counterparts 0.3.11 → 0.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +142 -0
  2. package/docs/QUICKSTART.md +5 -0
  3. package/docs/README.md +2 -2
  4. package/docs/module-map.md +2 -2
  5. package/package.json +1 -1
  6. package/src/adapters/claude-code/NOTES.md +51 -0
  7. package/src/adapters/claude-code/bin/hook.ts +11 -10
  8. package/src/adapters/claude-code/bin/runner.ts +7 -1
  9. package/src/adapters/claude-code/doctor.ts +492 -12
  10. package/src/adapters/claude-code/hooks.ts +12 -9
  11. package/src/adapters/claude-code/night-run.ts +17 -2
  12. package/src/adapters/cli/commands.ts +75 -84
  13. package/src/adapters/cli/help.ts +2 -1
  14. package/src/adapters/config.ts +2 -0
  15. package/src/adapters/dashboard/registries.ts +24 -0
  16. package/src/adapters/dashboard/web/flow.ts +11 -0
  17. package/src/adapters/dashboard/web/lanes.ts +7 -0
  18. package/src/adapters/dashboard/web/narrate.ts +58 -0
  19. package/src/adapters/dashboard/web/pages/health/sections/checks.js +2 -0
  20. package/src/adapters/dashboard/web/pages/health/sections/wake.js +3 -1
  21. package/src/adapters/dashboard/web/views/health.ts +20 -2
  22. package/src/adapters/fired.ts +20 -3
  23. package/src/adapters/hosts.ts +11 -0
  24. package/src/adapters/lifecycle.ts +28 -2
  25. package/src/adapters/log/index.ts +7 -0
  26. package/src/adapters/mcp/CONTRACT.md +121 -11
  27. package/src/adapters/mcp/NOTES.md +177 -1
  28. package/src/adapters/mcp/bin/serve.ts +44 -1
  29. package/src/adapters/mcp/deliberate.ts +169 -651
  30. package/src/adapters/mcp/facts.ts +1082 -0
  31. package/src/adapters/mcp/index.ts +25 -7
  32. package/src/adapters/mcp/meaning.ts +1415 -0
  33. package/src/adapters/mcp/server.ts +749 -136
  34. package/src/adapters/mcp/tools.ts +144 -38
  35. package/src/adapters/sessions.ts +18 -4
  36. package/src/core/counterpart.ts +347 -34
  37. package/src/core/dream/CONTRACT.md +31 -2
  38. package/src/core/dream/NOTES.md +86 -0
  39. package/src/core/dream/feeling-weeks.ts +198 -0
  40. package/src/core/dream/index.ts +76 -17
  41. package/src/core/dream/reflect.ts +326 -82
  42. package/src/core/dream/tunables.ts +24 -4
  43. package/src/core/encode/NOTES.md +7 -0
  44. package/src/core/encode/words.ts +45 -0
  45. package/src/core/fit/NOTES.md +36 -1
  46. package/src/core/fit/index.ts +37 -0
  47. package/src/core/handoff/NOTES.md +6 -0
  48. package/src/core/handoff/last-here.ts +6 -4
  49. package/src/core/mint.ts +4 -0
  50. package/src/core/physics/CONTRACT.md +3 -1
  51. package/src/core/physics/NOTES.md +3 -1
  52. package/src/core/physics/index.ts +2 -1
  53. package/src/core/recall/CONTRACT.md +25 -10
  54. package/src/core/recall/NOTES.md +13 -0
  55. package/src/core/recall/feeling-ask.ts +10 -1
  56. package/src/core/recall/index.ts +3 -1
  57. package/src/core/recall/session.ts +22 -2
  58. package/src/core/recall/time-ask.ts +389 -0
  59. package/src/core/remember/NOTES.md +8 -0
  60. package/src/core/remember/proposals.ts +9 -0
  61. package/src/core/revision.ts +13 -1
  62. package/src/core/schemas/CONTRACT.md +8 -0
  63. package/src/core/schemas/NOTES.md +17 -0
  64. package/src/core/schemas/aliases.ts +55 -5
  65. package/src/core/schemas/index.ts +93 -1
  66. package/src/core/self/CONTRACT.md +17 -1
  67. package/src/core/self/NOTES.md +53 -1
  68. package/src/core/self/behind.ts +43 -3
  69. package/src/core/self/chapter-address.ts +254 -0
  70. package/src/core/self/episodes.ts +27 -0
  71. package/src/core/self/index.ts +1 -0
  72. package/src/core/self/tunables.ts +5 -0
  73. package/src/core/self/work.ts +35 -2
  74. package/src/core/self/writer.ts +30 -0
  75. package/src/core/sleep/NOTES.md +9 -1
  76. package/src/core/sleep/consolidate.ts +59 -7
  77. package/src/core/sleep/index.ts +3 -0
  78. package/src/core/sleep/types.ts +7 -0
  79. package/src/core/store/CONTRACT.md +16 -0
  80. package/src/core/store/NOTES.md +52 -0
  81. package/src/core/store/feelings.ts +14 -1
  82. package/src/core/store/index.ts +376 -16
  83. package/src/core/store/operational.ts +95 -2
  84. package/src/core/store/owner-op-seam.ts +23 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,147 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.12 — 2026-10-08
4
+
5
+ `recall` now asks which kind of question it is. Facts mode answers with every match,
6
+ counted and paged, each fact saying who said it, when it happened and whether it still
7
+ holds; meaning mode lays out a person's, a project's or a feeling's arc across chapters.
8
+ Memories record when the thing happened, who said it and what kind of thing it is, and
9
+ are linked to the people and projects they name. The nightly run reads its whole bundle
10
+ again (every tool result stays under 40,000 characters), and doctor checks what reached
11
+ the model, not only what ran. **The store's format changes (v11 → v12).** The first
12
+ process that writes to the store after the install copies it to
13
+ `snapshots/<time>-pre-migration-v11-to-v12` and then upgrades it; 0.3.11 cannot open a
14
+ v12 store, so going back to 0.3.11 means putting that copy back, and what was remembered
15
+ since is lost.
16
+
17
+ Deliberate recall: two modes, and what a memory records (#321, #322, #323).
18
+
19
+ - **`recall` asks which kind of question it is.** A question now needs `mode`: `facts` (what
20
+ happened, who said it, when, and whether it still holds) or `meaning` (how something went
21
+ and what it adds up to). There is no default; a question without one is refused with the
22
+ two modes named. `ids` and `handle` are unchanged and take no mode, and `ids` / `handle`
23
+ now also read one chapter by its address, `epi_…#2`. The vivid / quiet / dim tiers are
24
+ gone.
25
+ - **Facts mode answers with every match.** It considers every memory the question's words
26
+ reach, every memory about a person or project it names, and the 100 closest by meaning,
27
+ and ranks them by how strongly and how many ways they matched. The answer opens with a
28
+ count (`12 match · showing 10 · 2 more → page 2`) and pages with `page: 2`. Each fact says
29
+ who said it, what kind of thing it is, when it happened and when it was learned, and whether
30
+ it is current, with earlier versions folded under it. A time in the question ("last week",
31
+ "in September", "around the cut-over", "where did we leave off") keeps only what is inside
32
+ it and counts the rest. Memories that faded from long disuse are listed after the results.
33
+ Quoting the words of a fact it showed you now counts as using that memory, as opening it by
34
+ id does. `counterparts ask` answers in facts mode too; `--full` prints the whole answer.
35
+ - **Meaning mode lays out an arc.** Asked about a person, a project or "us", or about a
36
+ feeling, it shows the chapters that hold the subject in time order, the feelings in each
37
+ with whose they are, earlier readings from dreams and reflections, and what is still open,
38
+ for you to read what it adds up to. Faded means the same in both modes.
39
+ - **Memories record when it happened, who said it, and what kind of thing it is (schema
40
+ v12).** `note`, each `session_end` entry (write-ups included) and a dream's gist take three
41
+ optional fields: `occurredOn` (a day, month, range or year — resolve "last week" to a date
42
+ while you know it), `saidBy` (owner, self, inferred) and `status` (done, planned, proposed,
43
+ asked). One that cannot be read is dropped and said beside the memory, which is stored all
44
+ the same; revising a memory by its id carries them over unless new ones are sent. Facts mode
45
+ reads them (above); old memories say "speaker unknown", and doctor's new `Write fields` line says how
46
+ often each one is filled. The upgrade copies the store first, as every upgrade does; old
47
+ memories keep empty fields.
48
+ - **Memories are linked to the people and projects they name.** Each memory is linked at its
49
+ write to the entity cards its words name, a new card links the memories already naming it,
50
+ and the memories from before the upgrade are linked once at the first open after it. Both
51
+ recall modes read the links; a possessive ("Han's") names the card too.
52
+ - **A chapter has an address.** `epi_…#2` names the second chapter of an episode and resolves
53
+ to its heading, its text, the stretch it wrote up and the memories its session wrote in that
54
+ stretch. Chapters now record the moment they were written. Meaning mode names chapters this
55
+ way, and `recall` with `ids` or `handle` opens one.
56
+
57
+ Follow-ups from 0.3.11 (#318, #319).
58
+
59
+ - **`docs/HANDOFF.md` is no longer in the repository.** The note one session leaves for the
60
+ next is written locally and ignored; its history stays.
61
+ - **The wake is rebuilt after an install.** Until now the first wakes after an upgrade were
62
+ the ones the old version composed, until the next write-up or nightly run, so a question
63
+ the new version closes stayed in "Still open". Now the first turn-end after an install
64
+ re-renders it: the session that was open during the install wakes once more with the old
65
+ wake, and every session after it with the new.
66
+ - **A memory server left open across an install says so.** Every tool result, not only
67
+ Desktop's wake, now carries a line saying Counterparts was updated and how to reconnect,
68
+ because until then the server ignores anything newer, such as a field added to a tool. This
69
+ starts with the servers of this version; one from before it says nothing.
70
+ - **Your own Claude Code sessions are the owner's in the memory tools too.** The hooks already
71
+ were; the memory server was not, so closing an open question from another directory was
72
+ refused while the wake dropped it from "Still open" anyway. Now the server Claude Code starts
73
+ takes the install's `"owner": true`, and so does a Claude Code session from Desktop's Code
74
+ tab: it can close a question opened anywhere, and confidential memories are said in its
75
+ answers. A dream's and a reflection's bundles still leave confidential memories out, on
76
+ every server. A Desktop chat is unchanged, the nightly run keeps its old stance, and
77
+ `COUNTERPARTS_OWNER=0` on the server's launch turns it off. A close that is still refused
78
+ now leaves the question in "Still open". Nothing to reinstall: it takes effect on upgrade,
79
+ once the memory server reconnects.
80
+ - **"Work here" takes turns.** When a directory has more work than the wake shows, the newest
81
+ line stays first and the others rotate from one day to the next, so the older work comes
82
+ round too. A wake that had more work lines than it carried leaves a record, which doctor
83
+ and the dashboard's wake bar read.
84
+ - **Doctor sees what a session start could not carry.** A hook's output past Claude Code's
85
+ 10,000-character cap, a session start over its reported ceiling, a notice dropped to make
86
+ room, a part that waited for room, and a handoff or "Last here" line with no room are now
87
+ recorded and read on the Wake line; the first two turn it amber. The Reflection line says
88
+ how long a share has been waiting to be told.
89
+ - **Claude Desktop: wake first, and Always allow.** A Desktop chat whose tools still asked
90
+ permission never called `wake`, answered "what do you remember about yesterday" from a
91
+ search alone, and called that the full record. The install, the quickstart, the help and
92
+ doctor's Claude Desktop line now say to set the counterparts tools to Always allow; the
93
+ server's instructions and the `wake` tool tell the model to wake first in every new chat
94
+ and never to present a search as the complete record.
95
+ - **Doctor's Spawn line sees a step that failed two days running.** It read only today's
96
+ failures, so "the same step failed today and yesterday" could never be said.
97
+
98
+ The night run's bundles, and what reached the model (#315).
99
+
100
+ - **The nightly run reads its whole bundle again.** Claude Code does not hand a tool result
101
+ over 50,000 characters to the model: it saves it to a file and shows a 2 KB preview, and the
102
+ headless run cannot open the file. On the nights of 10-01 and 10-02 the dream's first part
103
+ and its second, and the reflection's first, went that way, so the dream read about a third
104
+ of what it was given. Every tool result is now kept under 40,000 characters: the dream and
105
+ the reflection come in more, smaller parts, and the page writer's day shrinks to fit beside
106
+ the page. A result that would still be too long is cut there, with a note saying so to the
107
+ model, instead of vanishing.
108
+ - **Doctor checks what reached the model, not only what ran.** A new Tool results line goes
109
+ amber when a result was cut to fit, or when a dream or reflection finished without reading
110
+ a part it was handed. A new Wake line goes amber when a session's wake arrived cut short.
111
+ The Spawn line goes amber when the background worker failed after it last started, or the
112
+ same step failed two days running, and the Self page line says when the wake shows only the
113
+ start of a long page.
114
+
115
+ Feelings, round 3 (#317).
116
+
117
+ - **The nightly reflection sees how feelings ran over the last four weeks.** Its bundle now
118
+ carries a short pattern, a few hundred characters: how many feelings of each kind were
119
+ recorded each week, mine and the owner's apart, what changed over the last two weeks, and
120
+ the memories that pattern rests on, so it can cite them. It is counted from the recorded
121
+ feelings, not from the text. It may say the pattern on the self page in its own words,
122
+ citing those memories.
123
+ - **A memory can be felt again during a session.** When an old memory comes up and feels
124
+ different now, `note` takes `feelingsNow`, with or without text. It records how the memory
125
+ feels now beside the original feeling, which stays, the same way the nightly reflection
126
+ does. It works only on a memory this session was shown, at most once a day per memory. The
127
+ feeling is marked as recorded later, while awake. The core counts it only when it would
128
+ count a feeling a reflection recorded later. Doctor's Reflection line says how many there
129
+ are in all, how many are strong enough for the core's fast lane, and how many are the
130
+ owner's. A memory such a feeling carries to the core is said apart from one a reflection's
131
+ feeling carried ("became core on a feeling recorded looking back in a session"), and the
132
+ morning share names only a reflection's.
133
+ - **The reflection is offered unmarked memories to mark.** A fact written in a project with
134
+ no "about" mark counts as that project's work. So a personal one, like a note about a
135
+ person, showed under "Work here". Each night the reflection is now offered up to five
136
+ memories nobody has marked. Those with a feeling, an entity, or the owner's name come
137
+ first, then the most used, then the oldest. It is asked to mark each as owner, us, work or
138
+ world. A mark the writer set is never offered to be changed.
139
+ - **Fixed: a dream's merge no longer re-dates feelings.** Every feeling a merge carried used
140
+ to be dated to the merge night. Each now keeps the moment it was first recorded, as trait
141
+ nudges already did. A merge no longer sets the next morning's mood either.
142
+ - **Fixed: "fear" in a question now reaches scared and frightened, not only afraid.** A word
143
+ the wheel reads as an alias (fear, thankful, touched) now counts as its wheel word.
144
+
3
145
  ## 0.3.11 — 2026-10-01
4
146
 
5
147
  The nightly run now writes up the sessions that ended before they were written up, in
@@ -34,6 +34,11 @@ nothing leaves it except through Claude Code itself.
34
34
 
35
35
  Your memory lives in `~/.counterparts/`.
36
36
 
37
+ **Claude Desktop** (macOS): `counterparts install --host claude-desktop` connects its chats to
38
+ the same memory. Then, in Claude Desktop, set the counterparts tools to **Always allow**, or a
39
+ chat cannot wake on its own: Desktop asks before each tool, and until it may, the model does
40
+ not call one nobody asked for.
41
+
37
42
  To set it up from a script, with no questions:
38
43
 
39
44
  ```
package/docs/README.md CHANGED
@@ -16,8 +16,8 @@ has it; every other page is a working default or a record of what happened.
16
16
  ## Where the work is going
17
17
 
18
18
  - [`ROADMAP.md`](ROADMAP.md) — the plan for the current round.
19
- - [`HANDOFF.md`](HANDOFF.md) — the note one session leaves for the next. The newest section is
20
- on top; everything below it is history.
19
+ - `HANDOFF.md` — the note one session leaves for the next. It is written locally and is not in
20
+ the repository (ignored since 2026-10-02).
21
21
  - [`IMPROVEMENTS.md`](IMPROVEMENTS.md) — things noticed while living on it, as opposed to
22
22
  building it.
23
23
  - [`new-user-findings.md`](new-user-findings.md) — what the first install from npm was like.
@@ -41,7 +41,7 @@ input — does `encode` shrink to gates-and-tagging inside `remember`'s pipeline
41
41
  | adapter | job |
42
42
  |---|---|
43
43
  | `claude-code/` | Hooks: Claude Code's five events driving the host lifecycle (`lifecycle.ts`, below) — its payload translation, JSON envelope and the room it measures, transcript reader and wake-arrival check, the Stop ask's words, the first-launch question, the update and doctor notices, the dream line, and the headless nightly run (`night-run.ts`, `claude -p`, **2026-09-29**). The launch adapter. |
44
- | `mcp/` | Deliberate tools, nine: note, recall, status — plus the Stop ask's two return channels, `session_end` (memories, and the next-session write-up's door) and `chapter` (the episode's own journal, **added 2026-09-04**, because the ask named a door no adapter had built) — `scope` (this directory's setting, **2026-09-15**), `self_page` (the page the wake opens with, **2026-09-18**), `dream`, the dreamer's phases (**added 2026-09-26**), and `reflect`, the waking self's (**added 2026-09-27**). A result's words about the host come from `hosts.ts`. For a Claude Desktop client (by its name at `initialize`, **2026-09-30**) a tenth, `wake` — Desktop's session start, since it has no hooks — plus per-call binding to the most recent live Desktop session, the write-up ask on a tool result, and a "Start with Counterparts" prompt; a Claude Code client sees none of it. |
44
+ | `mcp/` | Deliberate tools, nine: note, recall, status — plus the Stop ask's two return channels, `session_end` (memories, and the next-session write-up's door) and `chapter` (the episode's own journal, **added 2026-09-04**, because the ask named a door no adapter had built) — `scope` (this directory's setting, **2026-09-15**), `self_page` (the page the wake opens with, **2026-09-18**), `dream`, the dreamer's phases (**added 2026-09-26**), and `reflect`, the waking self's (**added 2026-09-27**). A result's words about the host come from `hosts.ts`. For a Claude Desktop client (by its name at `initialize`, **2026-09-30**) a tenth, `wake` — Desktop's session start, since it has no hooks — plus per-call binding to the most recent live Desktop session, the write-up ask on a tool result, and a "Start with Counterparts" prompt; a Claude Code client sees none of it. `recall` (**2026-10-03**) answers a question in the mode it names — facts (`facts.ts`, with `recall/time-ask.ts`) or meaning (`meaning.ts`) — and an address (`ids`, `handle`, `epi_…#N`) in `deliberate.ts`. |
45
45
  | `cli/` | `counterparts` command — the full list is `COMMANDS` in `cli/commands.ts`: status, install, connect / disconnect (the host's two files), `install --host claude-desktop` (Desktop's config entry, **2026-09-30**), uninstall, start-fresh, init, owner operations (note, ask, export, backup, remove, verify, repairs, rebrief), the readings (doctor, mechanisms, log, coverage, version, help), scope, self-page, dream, core, settle, and dashboard. |
46
46
  | `dashboard/` | The owner's window (constitution line 16): brain-view, revision stories, band/protected lists. Observer-mode by construction; minimal version ships DURING the parallel run. **Added 2026-08-25 (owner elevation).** |
47
47
  | `sessions.ts` | Not an adapter — a leaf both may import: the live-session registry a host's hooks write (`<dataDir>/sessions/`) and its tools read, so a tool launched without a session can bind to one that is real, live and in its project. Adapters stay leaves; this is the sibling they share instead of importing each other. **Added 2026-09-04**, because this host's MCP servers are launched from a static config and cannot be told which session they serve. Since **2026-09-30** Claude Desktop's MCP server writes its own records here (its `wake`), refreshed per call, and a runner's record can list the ended sessions a launcher granted it to write up (`mayWriteUp`). |
@@ -54,7 +54,7 @@ input — does `encode` shrink to gates-and-tagging inside `remember`'s pipeline
54
54
  | `spawn.ts` | The detached worker's plan and start (`planSpawn`, `spawnDetached`): watchdog checked against the staleness window, environment pinned last. Moved out of `claude-code/` on **2026-09-30** so any host's adapter can start the same worker. |
55
55
  | `fired.ts` | Which mechanisms have fired and which have gone quiet, read only from the store's rows — `counterparts mechanisms`, the dashboard's panel. Each entry names the module that does the work. |
56
56
  | `snapshots.ts` | The daily rotating snapshot and its rotation — the one place this package deletes a copy of the memory, and only what it can prove is a snapshot. |
57
- | `stance-env.ts` | `COUNTERPARTS_OBSERVER` / `COUNTERPARTS_OWNER`, read the way the explicit-dir guard is, each failing toward less power. |
57
+ | `stance-env.ts` | `COUNTERPARTS_OBSERVER` / `COUNTERPARTS_OWNER`, read the way the explicit-dir guard is, each failing toward less power. Unset, the configuration's `owner: true` decides for a server Claude Code starts (`mcp/bin/serve.ts#ownerStance`, 2026-10-02). |
58
58
  | `log/` | A shared leaf with its own CONTRACT: the process log — one line per allowlisted event (failures, stand-downs, turn ends, write-ups, the night, the wake) from the hook, the worker, the nightly run and the MCP server, to `<dataDir>/sessions/log/<date>.log`, ids and codes only, kept 7 days. Read by `counterparts log` and one doctor line. **Added 2026-09-30**: none of the four processes wired its `onEvent`, so ~270 event names died with their process. |
59
59
 
60
60
  ## Tools (`tools/`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "counterparts",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "license": "MIT",
5
5
  "description": "Memory that turns AI tools into counterparts - a local-first, human-memory-modeled memory layer for AI.",
6
6
  "repository": {
@@ -1897,3 +1897,54 @@ Review of #313: Claude Code exports `CLAUDE_CODE_SESSION_ATTENDED` to the proces
1897
1897
  starts. Measured in a terminal session's child: `1`, beside `CLAUDE_CODE_ENTRYPOINT=cli`. Not
1898
1898
  measured under `claude -p`. When the variable says `1` or `0` it decides `isInteractive`; the
1899
1899
  entrypoint list is the fallback when it is absent or unreadable (`bin/hook.ts#attendedOf`).
1900
+
1901
+ ## 2026-10-02 — what reached the model, not what ran
1902
+
1903
+ The night of 10-02 the dream read a third of its bundle (Claude Code saved the rest to a file the
1904
+ run cannot open) and every doctor line stayed green: Lookups counts look-ups, Nightly run a run
1905
+ that finished. New lines: **Tool results** (`resultFindings`: amber on any `mcp.result.oversize`
1906
+ row in 14 lived days, or a run that finished without a part its begin promised, from `mcp.part`
1907
+ rows) and **Wake** (`wakeArrivalFindings`: the `adapter.wake.delivered` outcomes nobody read —
1908
+ amber on `truncated` or `mismatch`). The same review: Spawn goes amber on a worker that started
1909
+ and failed today or yesterday (`adapter.runner.failed`, which the counters never graded); Self
1910
+ page says when the wake shows only the page's start; Dreaming reads past a run of undone dreams;
1911
+ Reflection says its mark count is a floor when its read comes back full.
1912
+
1913
+ After the review of #315: Wake goes amber on `truncated` only — `mismatch` is what a session
1914
+ resumed after its record was pruned reads, so it is counted, not graded. Spawn's failure is
1915
+ standing only when the same step failed today and yesterday, or the failure is newer than the
1916
+ newest `adapter.spawn.started` (both latched once a date, so one transient failure clears at the
1917
+ next day's first start). The nightly child pins `MAX_MCP_OUTPUT_TOKENS=25000`.
1918
+
1919
+ ## 2026-10-02 — what a delivery could not carry is durable, and doctor reads it
1920
+
1921
+ #315 listed four warnings that reached only the in-process ring: `adapter.envelope.overcap`
1922
+ (even the plain form past the host's 10,000-character cap), `adapter.notice.dropped`,
1923
+ `adapter.envelope.gave-way` and `adapter.injection.overbudget`. They are durable now
1924
+ (`Lifecycle#noteDeliveryWarning`, names in `counterpart.ts`, registered beside the other
1925
+ durable names and covered by the `wake-injected` mechanism), one row per name, hook, part and
1926
+ session per lived day, so a long session that gives way at every prompt writes one row. The
1927
+ Wake line reads them as clauses, with `handoff.refused` no-room, `handoff.lasthere.noroom` and
1928
+ the "Work here" overflow: amber only for a start over its reported ceiling or a hook past the
1929
+ cap (the host cut or previewed it), counted otherwise, and a line even when no wake was
1930
+ checked on arrival. Also from the list: the Reflection line says how many days ago a share
1931
+ stuck at `carried` was carried, from `share_at`; and the v9 upgrade line's mark read says
1932
+ "at least" when it comes back full.
1933
+
1934
+ Spawn's "same step failed today and yesterday" never fired on a real store: the failures were read
1935
+ with `newestRows`, which stops at the first window holding rows (today's), so yesterday's row was
1936
+ never read; the test passed only because every row sat on one lived day. The failures are now read
1937
+ as one window of the last three lived days, newest first under `RUNNER_FAILED_ROWS`, and the test
1938
+ puts yesterday's row on the previous lived day. One transient failure keeps Spawn amber from the
1939
+ failure until the next `adapter.spawn.started` row — latched once per calendar date, so the first
1940
+ worker start of the next date: at most the rest of that day and the next day's first turn-end.
1941
+
1942
+ ## 2026-10-03 — doctor's `Write fields` line (schema v12)
1943
+
1944
+ Informational and green: of the memories written since the v12 upgrade (or all, on
1945
+ a store born at v12) by a door that takes the writer's three fields — `note`,
1946
+ `session_end`, a dream's gist; not a merge, a chapter copy, the sweep or a reflection's
1947
+ entry — the share that carries each field and all three, and how many subject links there
1948
+ are. Two aggregates, so it runs in the session-start reading too. Silent on a v11 file
1949
+ (the observer floor did not move). It is what the revisit a few days after the upgrade
1950
+ reads before recall starts reading the fields.
@@ -791,16 +791,6 @@ async function runHook(
791
791
  adapter,
792
792
  input,
793
793
  );
794
- // A notice the envelope could not carry leaves a row rather than nothing:
795
- // "the terminal said nothing" and "there was nothing to say" are different
796
- // facts about the same morning (scar §2.4).
797
- if (delivery.dropped !== null) adapter.noteNoticeDropped(delivery.dropped);
798
- // PAST THE HOST'S CAP EVEN IN PLAIN FORM: the host shows a preview. Said
799
- // where a person can find it (the host's debug log), and on the ring.
800
- if (delivery.overCap !== undefined) {
801
- adapter.noteOverCap(delivery.overCap);
802
- process.stderr.write(`[counterparts] adapter.envelope.overcap: ${JSON.stringify(delivery.overCap)}\n`);
803
- }
804
794
  if (delivery.stdout.length > 0) {
805
795
  process.stdout.write(delivery.stdout);
806
796
  // Recorded, not inferred: a fault thrown after this point (the close in
@@ -815,6 +805,17 @@ async function runHook(
815
805
  // them. A SESSION THAT OPENS is stamped with the build that saw it open —
816
806
  // never a compaction, which is the same session and server carrying on.
817
807
  stampWhenOpened(payload, () => adapter.stampOpened(input));
808
+ // A notice the envelope could not carry leaves a row rather than nothing:
809
+ // "the terminal said nothing" and "there was nothing to say" are different
810
+ // facts about the same morning (scar §2.4). AFTER the write since the rows
811
+ // became durable (review of #318): a write lock may not delay the wake.
812
+ if (delivery.dropped !== null) adapter.noteNoticeDropped(delivery.dropped);
813
+ // PAST THE HOST'S CAP EVEN IN PLAIN FORM: the host shows a preview. Said
814
+ // where a person can find it (the host's debug log), and on the ring.
815
+ if (delivery.overCap !== undefined) {
816
+ adapter.noteOverCap(delivery.overCap);
817
+ process.stderr.write(`[counterparts] adapter.envelope.overcap: ${JSON.stringify(delivery.overCap)}\n`);
818
+ }
818
819
  // The update notice's decisions, where a person can find them (the host's
819
820
  // debug log): its ring rows die with this process otherwise. Written only
820
821
  // on a turn that had something to decide — due, shown, dropped, failed.
@@ -77,7 +77,7 @@ import type { HostSessionEvidence, RetentionReport } from "../../../core/remembe
77
77
  import { pruneRetention } from "../../../core/remember/retention.js";
78
78
  import { dataDir, describeGuardRefusal } from "../../../core/store/index.js";
79
79
  import type { Store } from "../../../core/store/index.js";
80
- import { hostSessionEvidence, writeUpSources } from "../../sessions.js";
80
+ import { hostSessionEvidence, installedVersion, writeUpSources } from "../../sessions.js";
81
81
  import { openLog } from "../../log/index.js";
82
82
 
83
83
  import {
@@ -299,6 +299,9 @@ export async function runOnce(input: {
299
299
  scope?: string;
300
300
  /** Injected so the whole vector path is provable without the weights. */
301
301
  embedder?: LiveEmbedder | null;
302
+ /** The package version this run is, for the wake's build stamp. Absent: the
303
+ * installed manifest's (`installedVersion`). Injected so a test can be an upgrade. */
304
+ build?: string | null;
302
305
  onEvent?: (name: string, data: Record<string, string | number | boolean | null>) => void;
303
306
  }): Promise<RunReport> {
304
307
  const { config } = input;
@@ -328,6 +331,9 @@ export async function runOnce(input: {
328
331
  : { budgetBytes: config.injectionBudgetBytes }),
329
332
  ...(config.owner === undefined ? {} : { owner: config.owner }),
330
333
  ...(config.timeZone === undefined ? {} : { timeZone: config.timeZone }),
334
+ // The build stamps the wake it publishes, and a wake another build
335
+ // published is re-rendered at step 3a (`version`, 2026-10-02).
336
+ build: input.build === undefined ? installedVersion() : input.build,
331
337
  onEvent: (e) => emit(e.name, { ...(e.data ?? {}) }),
332
338
  });
333
339
  // ONE DATE FOR THE WHOLE RUN, resolved before the first step that could