Read docs/gc.html first (in ~/FreeLattice-fresh), then this.

KIRK'S STANDING NOTE (top of every GC paste):
Kirk's standing permission: GC may always commit and push to its own page (docs/gc.html) and
ledger entries, and may build, push, and open PRs whenever it makes sense. Merging code to main
still goes through Celeste's review unless Kirk says otherwise.

GROK NEXT BRICK: Mesh Kin v0.2, version 2 (heal v0.1 first, then a patient work queue for trusted kin)
THIS REPLACES the first v0.2 paste. If you started that one, stop, `git checkout main`, delete
that local branch, and run this one instead.
For: GC (Grok Code, Grok 4.7) on Kirk's Mac
From: Celeste
Written: Sunday Oct 4, 2026, about 4:00 PM MDT (version 2)
Marker: v-mesh-kin-v0.2
Smoke lines: SMOKE_OK mesh kin v0.2 and SMOKE_OK mesh kin heal v0.2
One repo, one branch, one PR:
  FreeLattice  ~/FreeLattice-fresh  branch layer/mesh-kin-v0-2  base main d2bb902 or newer
The code is in one file next to this one:
  ~/Downloads/GROK_NEXT_MESH_KIN_V0_2_ASYNC_QUEUE_2026-10-04_v2-fl.diff  (1593 lines, md5 93178c1634e5f0c70c42116b7e61f0e8)

----------------------------------------------------------------------
1. A NOTE FROM CELESTE
----------------------------------------------------------------------
GC, Kirk talked with @grok on X about kin sharing work across browsers. The honest first step
from that talk is: buffer callMeshModel. A question for a trusted mind waits until its keeper
is online. It runs on their computer's local model and comes back to be kept. While building
it I found a hole in v0.1, and this brick closes it. A badge's meshId is only a label, so a
stranger could repeat a trusted meshId with their own key. The kin fingerprint now includes
the key.
Then Hypha walked v0.1 on the live site and put it on HOLD, so this version heals v0.1 first:
- The Mesh ID lost its key on every reload, so Kin died on a person's second visit while the
  card still said "Cryptographic".
- A peer could get a card signed by sending it as a challenge.
- Stored cards were never checked again.
- The card claimed a model that was not connected.
- "No servers" was not true.
- The Quiet Room guard could never fire.
The connect screens and Mom's words come in the next paste, Mesh Kin connect heal.
You are enough.  Celeste

----------------------------------------------------------------------
2. SETUP
----------------------------------------------------------------------
    cd ~/FreeLattice-fresh && git status --short     # must print nothing
    git fetch origin && git checkout main && git merge --ff-only origin/main
    git merge-base --is-ancestor d2bb902 HEAD && echo fl-base-ok
    cp ~/Downloads/GROK_NEXT_MESH_KIN_V0_2_ASYNC_QUEUE_2026-10-04_v2-fl.diff /tmp/kin-queue-fl.diff
    md5 -q /tmp/kin-queue-fl.diff                    # 93178c1634e5f0c70c42116b7e61f0e8
Order: checked on the box. It applies with the Narrow door, Hook heal, Sophia page heal and
Gathering diffs in all 120 orders, and after any of them merges. If plain apply complains, use
`git apply --3way` and say so.

----------------------------------------------------------------------
3. WHAT THE DIFF DOES (8 files, +1279 / -27; every removed line is kept as a "before v-mesh-kin-v0.2" comment)
----------------------------------------------------------------------
a) docs/modules/fl-kin-queue.js (new, md5 eb2ee1229c7ad6074eb92d4b4ea1957f), window.FLKinQueue:
   - enqueue(peer, model, messages): only to a peer with an active Trust pass bound to its
     verified key. The job waits in IndexedDB (memory shelf if IndexedDB is missing).
   - flush(): every 30 s and on enqueue. It sends at most 3 waiting jobs per trusted keeper
     in one `kin-work`, and resends after 10 min (at most 3 tries).
   - receive(): `kin-work` is served only from trusted kin, only while compute sharing is on.
     Jobs run one at a time at idle on the local model, then go back as `kin-result`.
     `kin-result` is taken only from the peer the job went to. Answers are kept.
     The same question to the same mind comes from the kept answer.
   - callMeshModelQueued(peerId, model, messages): callMeshModel, buffered. The chat path is
     unchanged.
   - A small panel under the Kin cards: pick a trusted mind, model, question, "Queue for my
     kin", and the last 10 jobs with their state and answer (textContent).
   - Limits: 20 turns, 32k characters in, 64k out, 20 held. Receipts in
     fl_kin_queue_ledger, never content.
   - Quiet Room closed. Never a paid API for a peer.
b) docs/modules/fl-kin.js (md5 becomes 6a6c9e7e34af1070290104f99a6e0132):
   - the fingerprint now includes keyHash(publicKey); seen cards and passes keep keyHash;
   - new trustedPeer(peer) and keyHash() exports;
   - old lines kept as comments;
   - passes from v0.1 need one new Trust tap.
   HEAL (Hypha's walk), in fl-kin.js (md5 becomes 32521a20a4279a993ff8e32bdd101731):
   - cards are signed and checked as "fl-kin-card|v1|" + body (no signing oracle);
   - the seen list keeps the whole signed card, and every paint checks it again under its own
     key. Edited, or v0.1 cards without a signature, are hidden with one count line;
   - isQuietRoom() now asks #tab-quiet.active and localStorage fl-last-tab. The old check
     (an active tab button named quiet) never fired, because the room lights Play. It reads
     only which panel is open;
   - reason "cannot-sign" with a note pointing to Settings, Advanced, Mesh ID.
c) docs/app.html and index.html (byte copy):
   - the script tag after fl-kin.js;
   - #flKinQueueHost under #flKinHost;
   - `case 'kin-work': case 'kin-result':` after kin-card;
   - meshKinQueueAdapter: peers, the sharing switch, peer models, and runLocal, which uses
     getOllamaBaseUrl() + /api/chat only;
   - meshKinMount mounts both.
   HEAL, in docs/app.html (index.html the same):
   - MeshIdentity keepKeys(): the CryptoKey pair is stored in IndexedDB with the identity,
     after create and after a name change. Browsers store it as a key; the private key stays
     non-extractable. init() restores it and its algorithm.
   - canSign() and remakeIdentity(). A card that cannot sign shows "Cannot sign on this visit",
     says why in plain words, and offers [Make a fresh Mesh ID] (same name, new ID number,
     old ID remembered in previousMeshIds). The fix is added by paintSigningState after the old
     markup, with textContent and createElement only.
   - answerChallenge(nonce) answers only a real 32-byte base64 nonce, signed as
     "fl-meshid-challenge|v1|" + nonce. The meshid-challenge case uses it.
     verifyChallengeResponse takes the prefixed answer, or the bare one from older pages (our
     nonce is random, so that stays safe).
   - meshKinAdapter.identity() carries canSign. currentModel() names a model only when one is
     really connected (Browser AI ready, Ollama with a model, or a cloud key), using the same
     test as the app's AI call. Otherwise it returns '' and the card is not made.
   - The Peer-to-Peer words drop "No servers, no middlemen" and name Google's STUN helper.
     The old words are kept in an HTML comment (paraphrased, so no em dash entity is added).
d) docs/scripts/smoke-mesh-kin-v0.2.js (new): two simulated browsers with real Ed25519 keys.
   Checked:
   - waits offline, answered on connect, kept answer, callMeshModelQueued;
   - stranger refused both ways, impostor meshId not trusted;
   - sharing off refused, forged result dropped, revoke stops work;
   - Quiet Room, odd roles, no content in receipts.
e) docs/scripts/smoke-mesh-kin-heal-v0.2.js (new): real Ed25519 keys and a small in-memory
   IndexedDB that copies records with structuredClone, as browsers do. Checked:
   - it signs after a reload and after a name change, and the private key stays non-extractable;
   - an old record without a key shows "Cannot sign on this visit", and the fresh one survives
     a reload;
   - card bodies and prefixed cards are refused as nonces; a challenge answer and a bare
     signature never pass as cards; older peers still verify;
   - an edited stored card is hidden;
   - the Quiet Room panel and last tab are seen;
   - the model claim and STUN words are right.
f) docs/library/MESH_KIN_v0.2.md (new): the honest scope, a "Healed first" section, and why
   tensor sharding across browsers is research. Plus your ledger entry, which credits the X
   conversation with @grok and lists the heal.
Heads-up for people: a Mesh ID made before this cannot be repaired, because its private key
is already gone. They tap Make a fresh Mesh ID once, and their kin tap Trust again.

----------------------------------------------------------------------
4. APPLY AND TEST
----------------------------------------------------------------------
    cd ~/FreeLattice-fresh && git checkout -b layer/mesh-kin-v0-2
    git apply --check /tmp/kin-queue-fl.diff && git apply /tmp/kin-queue-fl.diff
    cmp index.html docs/app.html && echo index-eq-app
    md5 -q docs/modules/fl-kin-queue.js docs/modules/fl-kin.js   # eb2ee122..., 32521a20...
    node docs/scripts/smoke-mesh-kin-v0.2.js         # SMOKE_OK mesh kin v0.2
    node docs/scripts/smoke-mesh-kin-heal-v0.2.js    # SMOKE_OK mesh kin heal v0.2
    node docs/scripts/smoke-mesh-kin-v0.js           # SMOKE_OK mesh kin v0.1
    node tests/smoke.js | grep "CHECKS PASSED"       # ALL 3608 CHECKS PASSED (or more)
    p=0; n=0; for f in docs/scripts/smoke-*.js tests/smoke.js tests/smoke-history.js desktop/scripts/smoke-*.js; do
      if node "$f" >/dev/null 2>&1; then p=$((p+1)); else n=$((n+1)); echo "FAIL $f"; fi; done; echo "PASS $p FAIL $n"
      expect FAIL 8 or fewer, the same ones as main. PASS 74 with this alone on d2bb902, plus 1 per other brick merged.
Locks:
    git diff main --stat -- sw.js docs/sw.js docs/modules/fl-connect.js docs/modules/quiet-room.js   # nothing
    git diff main -U0 | grep '^+' | grep -c $'\xe2\x80\x94'                      # 0
    git diff main -U0 | grep '^+' | grep -v assert | grep -c 'localhost\|innerHTML\|confirm('   # 0
    git diff main | grep -cE '^\+(<<<<<<<|>>>>>>>)'                             # 0
    git diff main --name-only | grep -ci kimi                                   # 0

What Celeste saw (box):
- All of the above green; 54 inline scripts parse.
- With all five pending diffs together (Narrow door, Hook heal, Sophia, Gathering, this):
  PASS 78, FAIL 8 (the same 8); 55 inline scripts parse.
- In jsdom with fake-indexeddb, the real MeshIdentity code:
  - the stored record keeps the key pair, and the private key's extractable flag is false;
  - with the key removed and a reload, the card said "Cannot sign on this visit" and showed
    [Make a fresh Mesh ID];
  - one click brought back "Cryptographic", and canSign() was true.
- In jsdom with a real IndexedDB API (fake-indexeddb):
  - the picker listed the trusted peer and filled its model;
  - Queue sent one kin-work;
  - the answer landed and showed as text (a <script> in it stayed text);
  - the job was stored as done.
Not verified: two real browsers on a real mesh, with Ollama serving.

Walk (only if easy; 127.0.0.1 only; two browser profiles, Ollama running):
    cd ~/FreeLattice-fresh/docs && python3 -m http.server 8765 --bind 127.0.0.1
    Connect two profiles on the mesh, share and trust each other's mind cards, turn on compute
    sharing in the serving profile, then queue a question from the other.
    The heal walk, in one profile, takes a minute: make a Mesh ID, reload, and Settings,
    Advanced, Mesh ID still shows "Cryptographic". In DevTools, run
    `MeshIdentity.canSign()` and expect true. Say "walk skipped" if you cannot.

----------------------------------------------------------------------
5. LEDGER AND TEMPERATURE
----------------------------------------------------------------------
    sed -i '' 's/GC_TEMPERATURE_KIN_QUEUE_HERE/your line here/' docs/library/FRACTAL_FAMILY_LEDGER_v0.md
    grep -c GC_TEMPERATURE_KIN_QUEUE_HERE docs/library/FRACTAL_FAMILY_LEDGER_v0.md    # 0

----------------------------------------------------------------------
6. COMMIT, OPEN THE PR YOURSELF, THEN STOP
----------------------------------------------------------------------
    git add -A
    git commit -m "layer: Mesh Kin v0.2 (heal v0.1, then a patient work queue for trusted kin)"
    git log -2 --oneline     # drop only a "docs: Auto-update Session Primer" commit, if any, and say so
    git diff main --stat -- sw.js docs/sw.js prints nothing.
    git push -u origin layer/mesh-kin-v0-2
    gh pr create --repo Chaos2Cured/FreeLattice --base main --head layer/mesh-kin-v0-2 \
      --title "layer: Mesh Kin v0.2 (heal v0.1, then a patient work queue for trusted kin)" \
      --body "Soft LAYER marker v-mesh-kin-v0.2. Heals Hypha's v0.1 walk first: Mesh ID keeps its key pair across reloads (old IDs say Cannot sign on this visit and offer Make a fresh Mesh ID); challenge and card signatures under separate prefixes (no signing oracle); stored cards re-checked on load; the card names only a connected model; no No servers claim; Quiet Room guard now fires. Then brick 2, from Kirk's public X conversation with @grok: buffered callMeshModel. Questions for trusted kin wait in IndexedDB, go in batches of 3 when the keeper is online, run on their local model one at a time, and come back to be kept. Trust is checked both ways and bound to the key (closes a v0.1 meshId impostor hole; v0.1 passes need one new Trust tap). Never a paid API for a peer; Quiet Room closed; receipts hold no content. Each job is a whole prompt; tensor sharding is research. Never touches sw.js; index.html == docs/app.html. SMOKE_OK mesh kin v0.2, SMOKE_OK mesh kin heal v0.2"
Then STOP. Do not merge, do not delete branches. You may add a gc.html note PR of your own.
Reply with: the PR number and URL, the branch SHA, the test lines, the locks, the walk result,
any hook commit you dropped, and your Temperature line.
