From abf79c14cce18b4650e13f3926898ff729282405 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Mon, 16 Nov 2026 02:03:28 -0500 Subject: [PATCH] Lock, not pin: the flag that keeps the model from rewriting a node The badge reads LOCKED, the status line and messages say lock and unlock, p's help says what it is and that it is not P, and the cascade says a locked node was flagged, not rewritten. Pin now means only a pane's pin. The stored flag and the op API keep the old name, pinned, so a live library keeps its locks. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab --- README.md | 8 +++++--- src/core/model.ts | 2 +- src/llm/tasks.ts | 6 +++--- src/ui/App.tsx | 2 +- src/ui/Node.tsx | 4 ++-- src/ui/keys.ts | 4 ++-- src/ui/store.ts | 11 ++++++----- tests/tasks.test.ts | 2 +- 8 files changed, 21 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 5c1eac0..0f1f48a 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,8 @@ Press `?` for every key. The short version: two gets an inline gloss, a sentence a margin note, several sentences an inset passage, a node child sections. - `c` edits, `r` renames, `a` adds, `D` deletes, `u` undoes (the last edit made in this tab, - wherever it was). On a node, `:` hands an instruction to the editor agent; `Esc` stops it. + wherever it was). `p` locks a node: the model never rewrites a locked node (your own edits lock + it). Locking is not pinning: a pin (`P`) keeps a pane open in the panes view. On a node, `:` hands an instruction to the editor agent; `Esc` stops it. - `g` opens history: commits, branches, conflicts. `f` shows only what touched the current document; `r` reverts the current document to a commit, leaving the rest of the library alone. - The library is the first page. `l` or `Enter` opens a document in place; `h` or `Esc` at its top @@ -196,8 +197,9 @@ What is sent where: writer: the keyboard, the editor agent and `POST /api/ops`. - **Staleness is computed, not stored.** Each node remembers a hash of the children and of the parent text it was last reconciled with; a mismatch makes it stale in that direction. A person's - edits pin a node: flagged when stale, never rewritten. The library and its documents are not - reconciled with each other. + edits lock a node: flagged when stale (LOCKED beside it), never rewritten. `p` locks or unlocks + one by hand; the flag keeps its old name, `pinned`, in the data and the op API, so existing + libraries keep their locks. The library and its documents are not reconciled with each other. - **Snapshots are patched, not rebuilt**: a change re-reads only the nodes it wrote, so an edit costs what it touches, whatever the size of the library. - **`src/core/repo.ts`** Every commit records the SHA-256 of the tree, so any checkout can be diff --git a/src/core/model.ts b/src/core/model.ts index e3adb16..490a98d 100644 --- a/src/core/model.ts +++ b/src/core/model.ts @@ -41,7 +41,7 @@ export interface NodeSnap { title: string; body: string; by: Actor; - /** Pinned nodes are flagged when stale but never rewritten by a model. Human edits pin. */ + /** Locked: flagged when stale but never rewritten by a model. Human edits lock. (Stored as `pinned`, its old name, so existing libraries keep their flags.) */ pinned: boolean; form?: Form; lens?: string; diff --git a/src/llm/tasks.ts b/src/llm/tasks.ts index f2e2e7d..c8fdd82 100644 --- a/src/llm/tasks.ts +++ b/src/llm/tasks.ts @@ -243,7 +243,7 @@ export async function reconcile(llm: LLM, doc: Doc, id: NodeId, onText: OnText = } export interface CascadeEvent { - kind: "decide" | "rewrite" | "keep" | "pinned" | "revise"; + kind: "decide" | "rewrite" | "keep" | "locked" | "revise"; node: NodeId; text: string; } @@ -278,7 +278,7 @@ export async function cascade( let i = 0; for (; i < levels; i++) { if (doc.snap().nodes[chain[i]]?.pinned) { - emit({ kind: "pinned", node: chain[i], text: "pinned: flagged, not rewritten" }); + emit({ kind: "locked", node: chain[i], text: "locked: flagged, not rewritten" }); break; } if (await regenUp(llm, doc, chain[i], noop, opts.signal, opts.hooks)) emit({ kind: "rewrite", node: chain[i], text: "re-summarised" }); @@ -297,7 +297,7 @@ export async function cascade( snap = doc.snap(); if (!snap.nodes[c] || !staleness(snap, c).down || !rendered(c)) continue; if (snap.nodes[c].pinned) { - emit({ kind: "pinned", node: c, text: "pinned: flagged, not rewritten" }); + emit({ kind: "locked", node: c, text: "locked: flagged, not rewritten" }); continue; } if (await regenDown(llm, doc, c, noop, opts.signal, opts.hooks)) { diff --git a/src/ui/App.tsx b/src/ui/App.tsx index c910d1e..8c77de1 100644 --- a/src/ui/App.tsx +++ b/src/ui/App.tsx @@ -391,7 +391,7 @@ function StatusLine() { : "Enter open/enter · e toggle · D delete note · w link it" : `e expand${store.generating ? "" : " (no model)"} · d define · y why · x example · c challenge · : ask · w link` : st.up || st.down - ? `stale · ${n.pinned ? "b accept · p unpin" : "R reconcile · b accept"}` + ? `stale · ${n.pinned ? "b accept · p unlock" : "R reconcile · b accept"}` : ""; return (