counterparts 0.3.15 → 0.3.17

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 (128) hide show
  1. package/CHANGELOG.md +411 -0
  2. package/docs/ELI5.md +1 -1
  3. package/docs/QUICKSTART.md +17 -1
  4. package/docs/module-map.md +2 -2
  5. package/package.json +1 -1
  6. package/src/adapters/claude-code/CONTRACT.md +64 -13
  7. package/src/adapters/claude-code/INTERFACE-GAPS.md +9 -2
  8. package/src/adapters/claude-code/NOTES.md +248 -0
  9. package/src/adapters/claude-code/bin/hook.ts +212 -34
  10. package/src/adapters/claude-code/bin/runner.ts +3 -3
  11. package/src/adapters/claude-code/claim.ts +449 -35
  12. package/src/adapters/claude-code/doctor.ts +323 -41
  13. package/src/adapters/claude-code/envelope.ts +6 -15
  14. package/src/adapters/claude-code/hooks.ts +119 -86
  15. package/src/adapters/claude-code/index.ts +2 -2
  16. package/src/adapters/claude-code/night-catch-up.ts +1 -1
  17. package/src/adapters/claude-code/night-run.ts +22 -1
  18. package/src/adapters/claude-code/standdown.ts +18 -1
  19. package/src/adapters/claude-code/transcript.ts +35 -5
  20. package/src/adapters/cli/CONTRACT.md +16 -0
  21. package/src/adapters/cli/commands.ts +551 -17
  22. package/src/adapters/cli/coverage.ts +1 -1
  23. package/src/adapters/cli/help.ts +6 -0
  24. package/src/adapters/cli/mechanisms.ts +4 -1
  25. package/src/adapters/cli/rollback.ts +816 -0
  26. package/src/adapters/cli/self-page.ts +30 -4
  27. package/src/adapters/config.ts +32 -11
  28. package/src/adapters/dashboard/CONTRACT.md +1 -1
  29. package/src/adapters/dashboard/registries.ts +1 -1
  30. package/src/adapters/dashboard/status.ts +16 -8
  31. package/src/adapters/dashboard/web/actions.ts +20 -2
  32. package/src/adapters/dashboard/web/flow.ts +1 -1
  33. package/src/adapters/dashboard/web/narrate.ts +2 -2
  34. package/src/adapters/dashboard/web/pages/flow/sections/symmetry.js +7 -4
  35. package/src/adapters/dashboard/web/pages/health/sections/wake.js +9 -3
  36. package/src/adapters/dashboard/web/pages/memories/index.js +9 -1
  37. package/src/adapters/dashboard/web/pages/memories/sections/search.js +7 -7
  38. package/src/adapters/dashboard/web/shared/memory-modal.js +61 -2
  39. package/src/adapters/dashboard/web/shared/modal.css +5 -0
  40. package/src/adapters/dashboard/web/views/health.ts +27 -18
  41. package/src/adapters/dashboard/web/views/mechanisms.ts +34 -4
  42. package/src/adapters/dashboard/web/views/memory.ts +12 -0
  43. package/src/adapters/fired.ts +1 -1
  44. package/src/adapters/hosts.ts +41 -10
  45. package/src/adapters/lifecycle.ts +113 -8
  46. package/src/adapters/mcp/CONTRACT.md +26 -4
  47. package/src/adapters/mcp/NOTES.md +54 -1
  48. package/src/adapters/mcp/bin/serve.ts +12 -1
  49. package/src/adapters/mcp/deliberate.ts +11 -13
  50. package/src/adapters/mcp/facts.ts +48 -49
  51. package/src/adapters/mcp/index.ts +2 -3
  52. package/src/adapters/mcp/meaning.ts +3 -3
  53. package/src/adapters/mcp/server.ts +353 -84
  54. package/src/adapters/mcp/tools.ts +190 -91
  55. package/src/adapters/mcp/write-up.ts +2 -2
  56. package/src/adapters/mechanism-evidence.ts +41 -2
  57. package/src/adapters/plugin.ts +146 -29
  58. package/src/adapters/scopes.ts +78 -0
  59. package/src/adapters/sessions.ts +59 -2
  60. package/src/core/associate/CONTRACT.md +7 -1
  61. package/src/core/briefing.ts +70 -24
  62. package/src/core/contradictions.ts +2 -2
  63. package/src/core/counterpart.ts +715 -51
  64. package/src/core/coverage/NOTES.md +15 -0
  65. package/src/core/coverage/index.ts +7 -3
  66. package/src/core/coverage/tunables.ts +18 -4
  67. package/src/core/dream/CONTRACT.md +17 -6
  68. package/src/core/dream/NOTES.md +53 -0
  69. package/src/core/dream/index.ts +100 -11
  70. package/src/core/dream/reflect.ts +173 -24
  71. package/src/core/fit/index.ts +11 -0
  72. package/src/core/handoff/CONTRACT.md +6 -0
  73. package/src/core/handoff/INTERFACE-GAPS.md +1 -1
  74. package/src/core/handoff/NOTES.md +28 -4
  75. package/src/core/handoff/index.ts +11 -8
  76. package/src/core/handoff/last-here.ts +231 -15
  77. package/src/core/mint.ts +22 -2
  78. package/src/core/physics/CONTRACT.md +127 -21
  79. package/src/core/physics/NOTES.md +115 -0
  80. package/src/core/physics/index.ts +560 -74
  81. package/src/core/prospective/CONTRACT.md +17 -9
  82. package/src/core/prospective/NOTES.md +34 -0
  83. package/src/core/prospective/derive.ts +15 -12
  84. package/src/core/prospective/index.ts +41 -5
  85. package/src/core/prospective/tunables.ts +11 -3
  86. package/src/core/recall/CONTRACT.md +25 -2
  87. package/src/core/recall/NOTES.md +79 -3
  88. package/src/core/recall/activate.ts +56 -8
  89. package/src/core/recall/index.ts +30 -5
  90. package/src/core/recall/mood.ts +2 -2
  91. package/src/core/recall/probe.ts +164 -2
  92. package/src/core/recall/reference.ts +10 -0
  93. package/src/core/recall/tunables.ts +17 -2
  94. package/src/core/remember/CONTRACT.md +2 -2
  95. package/src/core/remember/NOTES.md +10 -0
  96. package/src/core/self/CONTRACT.md +123 -50
  97. package/src/core/self/INTERFACE-GAPS.md +39 -0
  98. package/src/core/self/NOTES.md +297 -1
  99. package/src/core/self/behind.ts +9 -4
  100. package/src/core/self/briefing.ts +815 -164
  101. package/src/core/self/episodes.ts +12 -1
  102. package/src/core/self/identity.ts +67 -34
  103. package/src/core/self/index.ts +720 -111
  104. package/src/core/self/page.ts +157 -6
  105. package/src/core/self/tunables.ts +24 -14
  106. package/src/core/self/work.ts +5 -1
  107. package/src/core/self/writer.ts +13 -11
  108. package/src/core/sleep/CONTRACT.md +7 -1
  109. package/src/core/sleep/NOTES.md +58 -0
  110. package/src/core/sleep/consolidate.ts +53 -4
  111. package/src/core/sleep/cycle.ts +42 -10
  112. package/src/core/sleep/decay.ts +165 -5
  113. package/src/core/sleep/dedup.ts +3 -1
  114. package/src/core/sleep/prune.ts +36 -3
  115. package/src/core/sleep/strength-cache.ts +10 -0
  116. package/src/core/sleep/types.ts +107 -4
  117. package/src/core/sleep/upgrade.ts +9 -7
  118. package/src/core/store/CONTRACT.md +9 -0
  119. package/src/core/store/NOTES.md +106 -0
  120. package/src/core/store/cache.ts +127 -6
  121. package/src/core/store/db.ts +69 -3
  122. package/src/core/store/errors.ts +9 -0
  123. package/src/core/store/feelings.ts +13 -0
  124. package/src/core/store/index.ts +391 -28
  125. package/src/core/store/operational.ts +434 -10
  126. package/src/core/store/pre-migration.ts +3 -1
  127. package/src/core/store/rollback-hold.ts +127 -0
  128. package/src/core/types.ts +25 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,416 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.17 — 2026-10-11
4
+
5
+ The plugin's sidebar shows what memory is doing in 35 columns: what came to mind for your
6
+ last message, what was quietly offered, what this session saved, which mechanisms fired
7
+ today, and last night's dream. Forgetting now changes what comes to mind: each memory fades
8
+ on its own curve, slower the more it mattered, was felt or was used, and one that falls
9
+ below reach stops coming up on its own, though asking still finds it, labelled faded. One
10
+ under the floor for 14 lived days is archived, never deleted. Memories written before this
11
+ version are read at the defaults for what they are about (`counterparts claims-era` turns
12
+ that off). Claude's in-the-moment tool is `remember` now (`note` still works), the wake is
13
+ put together when a session starts and names the other folders worked in today, and
14
+ `counterparts rollback` is the way back. **Nothing to run after upgrading from 0.3.16**:
15
+ the hooks, the memory server's registration and Claude Desktop's entry are the same as
16
+ 0.3.16's (coming from 0.3.14 or earlier, see those versions' notes on `counterparts
17
+ connect`). If your Claude Code settings allow `mcp__counterparts__note`, you'll be asked
18
+ once to allow `mcp__counterparts__remember`. **The store's format changes (v12 to v13, and
19
+ the search cache v5 to v6)**: the first open after the upgrade copies your memory to
20
+ `snapshots/…-pre-migration-v12-to-v13` and upgrades it. 0.3.16 refuses the upgraded store,
21
+ and a memory server still running 0.3.16 answers "Counterparts was updated" until it is
22
+ reconnected (`/mcp`) or restarted, so close your sessions, quit Claude Desktop and stop the
23
+ dashboard before installing. To go back to 0.3.16, run `counterparts rollback` while 0.3.17
24
+ is still installed, then QUICKSTART's "Going back to an earlier version": `counterparts
25
+ disconnect`, the 0.3.16 reinstall, then `counterparts connect`.
26
+
27
+ The sidebar mod, v0.2 (#375).
28
+
29
+ - **The sidebar shows what memory is doing, in 35 columns.** A small brain beside the
30
+ title (click COUNTERPARTS for the dashboard), the day, the count and a search box; then
31
+ **Memories**, what was said to Claude in full for your last message, and
32
+ **Subconscious**, the titles it was quietly given (`↗ opened` on one it looked up);
33
+ **Saved this session**, newest first; **Mechanisms today**, how many times each of the
34
+ twelve fired today, as bars (a click on one lists what its firings were about: the
35
+ memories that came to mind, what faded, what was merged, never bare counts); and **Last
36
+ Dream**, its first sentence (a click opens more of the dream). Each item takes up to
37
+ three lines, and when they don't all fit, fewer show. A click opens any item in place,
38
+ and again closes it; a long one shows 20 lines and ends with **more**, which opens that
39
+ memory on the dashboard (the dashboard now opens one memory by `#memories?id=`). Dates
40
+ in titles read short ("Oct 9"; today's are dropped). A click on a section's heading
41
+ gives it the room. Three rows of switches at the bottom: Counterparts in this folder
42
+ and Claude Code's own memory (each as safe as before: a pause still asks first, and an
43
+ unknown state is never shown as on), the view, and the brain. On a laptop screen the
44
+ sections fold to fit, each keeping its heading.
45
+ - **Closed, it says the newest thing in one line.** `/counterparts quiet` (or the pane's
46
+ ✕) shows it dim at the end of the line under the prompt, as in "remembered: …", "stored:
47
+ …" or "dreamed: …", always ending with "· /counterparts opens it". The amber status line
48
+ is gone except to warn that a folder is paused or off, and clearing it gives the row
49
+ back. `/counterparts brain turning|still|off` (or the footer) sets the brain: turning
50
+ sways gently, still lights only when something fires, off leaves it out. A view or brain
51
+ you set before carries over; v0.1's "full" opens the sidebar, its "quiet" and "hidden"
52
+ are quiet.
53
+ - **The dashboard counts each mechanism's firings today.** `/api/mechanisms` carries
54
+ `firedToday` on every mechanism: how many times it fired on today's date, counting
55
+ rows rather than amounts, and one dream once. With a dashboard from before this
56
+ release the sidebar counts them itself from the activity feed.
57
+
58
+ Forgetting (#372, #377, #379, #385, #386).
59
+
60
+ - **Forgetting now changes what comes to mind (store v13).** Each memory fades on its own
61
+ curve: steep at first and flat later, slower the more it mattered, the more it was felt,
62
+ used or came back. A routine note leaves the working layer in about two days; a felt
63
+ reading lasts months; a strong fact about a year. Under a line ("below reach") a memory
64
+ stops coming up on its own — in turns, as a pointer from a link, or in the wake's work
65
+ lines — but asking for it still finds it, labelled faded, and
66
+ using it, opening it or a dream replaying it brings it back. A memory that has sat under
67
+ the floor for 14 lived days (was 90) is archived — never deleted, still readable by id.
68
+ A reminder is held at full strength until its date and the week after, then fades on its own curve as if it had
69
+ never been held (so a routine one written weeks before its date is archived that night —
70
+ never deleted, still readable by id); a repeating date is held
71
+ around each time it comes round. Chapters, their copies and live handoffs are never let
72
+ go. A feeling now counts once for how high a memory stands and once for how slowly it
73
+ fades, and softens from the day it was recorded. The nightly pass reads only the
74
+ memories whose standing changes that day. The dashboard counts "below reach now" and
75
+ "exited" apart. Skills and places now count their salience as fully as any other memory
76
+ (they counted it at 0.4, which left a quiet skill out of reach from the day it was written).
77
+ The band-symmetry check now warns only when memories climb with nothing behind it; fading
78
+ down a band is the curve working. The store upgrades to v13 on the first open, after taking a copy; a
79
+ build from before refuses the upgraded store, and the copy is the way back. These are
80
+ lightly held decisions; they are listed in `docs/IMPROVEMENTS.md` under "Decisions to
81
+ review".
82
+ - **A dated memory goes back to fading normally once its day and the week after have
83
+ passed.** It is still held at full strength until then, and a repeating date is still held
84
+ around each time it comes round. After that it no longer fades faster: it reads as if it had
85
+ never been held, counted from when it was made or last used. So an old routine reminder
86
+ leaves at once, and one written weeks before its date is archived that same night — never
87
+ deleted, still readable by id. A strongly felt dated fact lasts as long as any memory like it.
88
+ - **Old claims are read as defaults (an era, not a rewrite).** Memories written before this
89
+ build reached the store, with a salience claim made under the old field text ("set it on
90
+ anything that should last"), are read by the forgetting curve at the default for what they
91
+ are about — a done work event 0.20, other work 0.25, the world 0.35, me 0.40 — when that is
92
+ lower, so the store starts to fade. No claim is rewritten. The core, memories about you or
93
+ about us, things marked as said by you (memories written since 10-08), protected memories
94
+ and dated ones still ahead or repeating keep their claim; older rulings of yours with no
95
+ such mark may fade. `counterparts claims-era` says whether it is on and how many memories it
96
+ affects; `--off` reads every claim as stored again, `--on` puts it back; doctor shows the
97
+ same in one line. The reading is what turns back: a memory let go at the floor while it
98
+ was on stays archived (readable by id). A lightly held decision, listed in
99
+ `docs/IMPROVEMENTS.md`.
100
+ - **Asking for facts shows faded memories in full, among the rest.** A match that has faded
101
+ (below reach) is ranked with the live ones by how well it matched, its words shown and
102
+ labelled faded, and the header counts them ("3 of them faded"). It was a title line after
103
+ the main results, which left counting questions one item short. Things that come up on
104
+ their own still leave faded memories out; being shown strengthens nothing, opening or
105
+ quoting one does. Meaning mode is unchanged.
106
+ - **Say which memories you drew on.** `session_end` and `chapter` take an optional `drewOn`
107
+ list: the ids of memories shown this session (a footnote, a recall result) that changed
108
+ what was done or said. Each gets half a use, so it holds longer: once a day per memory, at
109
+ most three per ask, and only ids this session was actually shown. An id it was not shown,
110
+ a superseded memory or one faded under a newer one is refused by name. Opening it later
111
+ the same day still lifts it to a full use. A wake line is still credited by opening it.
112
+ - **Each further use adds less.** What a memory gains from being used now levels off gently
113
+ instead of climbing in a straight line to a cap at five uses.
114
+ - **The doctor counts it.** The Credit line says how many `drewOn` credits landed over the
115
+ last week, beside the newest boundary's reading.
116
+
117
+ Writing memories (#369, #374, #383).
118
+
119
+ - **`note` is now `remember`, and memory is asked for by attention.** The tool Claude
120
+ writes a memory with in the moment is called `remember`. **The old name `note` still
121
+ works** for at least this release — a session that started before the upgrade keeps
122
+ calling `note` and is served exactly as `remember`; only `remember` is listed. Its words
123
+ changed with it: memory forms only from what Claude writes here and at the end-of-session
124
+ ask (nothing reads the transcript afterwards), so it asks Claude to write in the moment,
125
+ as things catch its attention — a line read and why it struck, something said about the
126
+ person or about Claude, news, a decision, a work event — one idea per call. The
127
+ end-of-session ask now asks for "what caught your attention since you last wrote, one idea
128
+ each — what you read, what they said, what happened" (474 characters at most), and no
129
+ longer says "nothing worth keeping is a real answer"; an empty list is still accepted, as
130
+ the `memories` field says. The salience field gives an anchored scale by attention (about
131
+ 0.1–0.2 a routine merge or status change; 0.4 or more a line that struck, or a reading
132
+ engaged with; the person's rulings, preferences and corrections high even about work), and
133
+ `relevance` now means how much it bears on the person, on Claude or on the two of them —
134
+ not only on the task. A dated decision, a kill or renew date and an outside deadline are
135
+ named as `eventDate`s. The CLI's `counterparts note` keeps its name.
136
+ - **Three things you may notice after upgrading.** If your Claude Code settings already allow
137
+ `mcp__counterparts__note`, you will be asked once to allow `mcp__counterparts__remember`.
138
+ A few strongly felt memories claimed at 0.42–0.50 now start episodic rather than semantic.
139
+ The text of a session that still owes a write-up is now kept up to 14 days of use plus the
140
+ ordinary 7 days, not 2.
141
+ - **An unclaimed memory starts by what it is about.** A memory written without a salience
142
+ used to start at 0.25 whatever it was. Now: 0.20 for a work event that is done, 0.25 for
143
+ other work and for an unmarked one, 0.35 for the world (readings, news), 0.40 for the
144
+ person, the two of you or Claude (or said by the person). All stay under the semantic
145
+ floor, and a strong feeling on a silent memory lifts it to at most 0.49: a default sets how
146
+ high a memory starts, never its band.
147
+ - **The core's fast lane can open again.** "Strongly felt" is read against the word's own
148
+ default: a feeling at 0.6, or one at 0.5 or more that is 0.1 above what its word is stored
149
+ at when nobody weighs it, now counts. Since the feelings wheel gave every word a default (all at or under 0.55),
150
+ nothing written without a number could reach the old 0.6 bar. A word nobody weighed
151
+ still never opens the lane on its own.
152
+ - **Mood no longer lifts memories in recall** (both weights 0, the code kept for a re-test):
153
+ memories it lifted were used less than others (1.3% against 2.4%). Recall also stops
154
+ reading recent feelings each turn while it is off.
155
+ - **What a session said and nobody wrote up stays owed for fourteen days of use**, not
156
+ three, so the nightly write-up (oldest first, four sessions a night) reaches it; past that
157
+ it is let go and said as lost. And a session at its ask limit for the day is still asked
158
+ when it holds an unwritten stretch that is due.
159
+ - **A memory written with `remember` (or its old name `note`) reaches the next session's
160
+ wake the same day.** Only write-ups, chapters and the self page used to bring the wake up
161
+ to date between days, so a note left Still open, Nearby and Arriving as they were for up
162
+ to a day, in every directory, a question it answered included. Now every memory that
163
+ lands, and every handoff written or retired, re-renders the wake at that turn's end, in
164
+ the background.
165
+ - **You can say what a memory is about.** `counterparts about <id>` prints its mark (me,
166
+ us, owner, work or world) and who set it; `counterparts about <id> owner --why "..."`
167
+ changes it as you, keeping the why, recorded the way a nightly reflection's re-mark is.
168
+ It works on an archived memory too, and an earlier version's id marks the current one.
169
+ The dashboard's memory card shows the mark and has a small picker that runs the same
170
+ command. A personal memory written in a project, left unmarked or marked work, counts as
171
+ that project's work and is shown only there; marking it owner or us shows it everywhere.
172
+ - **Claude can fix a mark in the moment.** `remember` takes `remark: {id, about, why}` for
173
+ a memory the session was shown, recorded as set by the counterpart itself. A dream's or a
174
+ reflection's words can only be moved toward work or world this way; you can mark them
175
+ anything.
176
+ - **A full night still offers the unmarked memories to be marked.** The nightly
177
+ reflection is offered up to five memories nobody has marked; on a busy night they were
178
+ squeezed out of its bundle entirely (10-10: none). They now keep a small room of their
179
+ own, a line each at least, and unmarked skills are offered too.
180
+
181
+ The wake, and other folders (#376, #380, #382, #387).
182
+
183
+ - **A session's wake is put together when the session starts.** "Still open", "Arriving:",
184
+ the Yesterday line and the self page are read at that moment, so the morning's first
185
+ sessions see yesterday's chapters and a question or reminder noted last night, not the
186
+ wake the evening's last turn left. "Nearby" and "Who I am" still come from the last turn's
187
+ end. Reads only, no model call: a few milliseconds.
188
+ - **"Today, elsewhere."** One line in the wake names the other folders worked in today:
189
+ when, whether a session there is still open, how many memories it wrote, and its chapter's
190
+ title when that chapter is about you or me (the "About me, from another directory" rule).
191
+ Never what was said there, a work memory's title, or a handoff. Folders whose scope is not
192
+ on are not named. It is at most 300 bytes (more folders become "+N more"), and it is
193
+ given room ahead of "Nearby", "Still open" past its first item, "Work here", the
194
+ Yesterday line's titles, "Last here" and the older handoffs, so it prints beside a long
195
+ page. The page, "Arriving:", "Still open"'s first item and a plain reminder due today
196
+ still come first, and on days no other folder was active the wake is unchanged.
197
+ - **"Since you started."** A session that is already open now hears what changed in other
198
+ folders while it worked: one line for the assistant, at a prompt, such as "Since you
199
+ started (10:40): ~/deadfront ended 11:05, 3 memories; ~/random open since 10:52, 2
200
+ memories." Only when something changed there (a session started or ended, a
201
+ chapter, new memories), never at the first prompt after the wake, and at most once an
202
+ hour. The same rules as "Today, elsewhere": counts, not what was said; a chapter's title
203
+ only when it is about you or me; folders whose scope is not on are not named. It takes
204
+ only the room recall left, and waits for the next prompt when there is none. Reads only,
205
+ no model call: about 5 ms on a prompt that checks, nothing in the hour after a line.
206
+ - **The Yesterday line keeps other folders' chapters to their folders.** At a session start
207
+ it names a chapter from another folder by title only when that chapter is about you or me
208
+ and that folder's scope is on, the rule "About me, from another directory" and "Today,
209
+ elsewhere" already keep. Other chapters join the line's count ("and 2 more"); when that is
210
+ all there was, the line says how many sessions wrote chapters in other folders. Chapters
211
+ written in this folder are named as before.
212
+
213
+ Going back (#384, #382).
214
+
215
+ - **`counterparts rollback` takes your memory back to before an upgrade.** When an upgrade
216
+ changed the store's format, the older version can't open it. This puts back the copy the
217
+ upgrade made first (the newest one, or `--to` names another), says how many memories would
218
+ be lost, and asks you to type a word. Nothing is deleted: the upgraded store and its cache
219
+ are set aside in a `rollback-aside-…` folder beside it. It refuses while a session, a
220
+ memory server or the dashboard has the store open, and says which. Until you install the
221
+ older version, the newer one leaves the store alone, and its sessions say why. `--undo`
222
+ puts the upgraded store back if nothing has written to the restored one, and
223
+ `--upgrade-again` lets this version upgrade it again from a fresh copy, so rolling back
224
+ twice on one day no longer reuses the first copy. `counterparts doctor` shows a Rollback
225
+ line while a rollback is in place. After a rollback, a later version leaves the store alone
226
+ too, until you run `counterparts rollback --upgrade-again` once on it.
227
+ - **A search cache from a newer build says so.** When only the search cache was written by a
228
+ newer Counterparts (after going back to an older version, say), the memory tools no longer
229
+ say "Counterparts was updated — run /mcp", which did not help. They say a newer build wrote
230
+ the search cache: if that build is installed, reconnect; if you went back to an older one,
231
+ delete `cache/cache.sqlite*` in the store (no memory is kept there; it is rebuilt) and then
232
+ reconnect. `counterparts doctor` says the same. A store from a newer build keeps its message.
233
+
234
+ At ten times today's size (#368, #373).
235
+
236
+ - **Recall counts the memories instead of listing them on every turn.** At ten times
237
+ today's size that list was about a sixth of a turn. A second speed-up, not looking up
238
+ words found in almost every memory, is built but off: it changed what recall showed on
239
+ small stores.
240
+ - **The sleep pass no longer reads forgotten memories to skip them.** The census, the
241
+ duplicate check and the fading pass ask the database for the rows they need instead of
242
+ reading every row, archived ones included. Their counts are unchanged.
243
+ - **The store reuses its prepared database statements.** It used to prepare each query
244
+ again on every read. A new day's sleep pass at ten times today's size went from about
245
+ 3.7 to 1.1 seconds.
246
+ - **A night's dream starts in about a second at ten times today's size, not half a
247
+ minute.** The cache keeps each memory's nearest memories from when it was written, so
248
+ the dream reads them instead of comparing every queued memory against every stored one.
249
+ A new memory's list is the older memories nearest it when it was written; one written
250
+ before the upgrade gets its list the first night it is dreamed. The cache's format goes
251
+ to v6 and fills itself in. An MCP server still running the previous build refuses its
252
+ tools until it is reconnected (`/mcp`), as after a store-format change.
253
+ - **New memories in a dream part Claude Code cut go back in the queue.** When the nightly
254
+ run's transcript shows a part of the dream was cut to a preview the run couldn't open
255
+ (and it wasn't fetched again whole), the new memories that part carried are dreamed on
256
+ another night instead of being marked as seen. Any the dream changed or looked up stay
257
+ done. The morning's line about the cut says how many went back.
258
+ - **A reader for which memories recall shows and the replies ignore.** `probeMemoryHits`
259
+ reads the ids the credit row already lists as shown and not used, and gives a hit rate
260
+ per memory and per lane (loud, footnote, pointer). It only measures. Nothing reads it
261
+ to change a memory's strength or how readily it comes to mind.
262
+
263
+ Fixes (#378, #382).
264
+
265
+ - **Two installs that meet a damaged claims file deliver the event once on Linux too.**
266
+ When one hook moved the damaged file aside, the other, still holding the old file, could
267
+ delete the new file's journal while the first hook was writing to it. That hook then
268
+ gave up on its claim, and the event went out twice (2 of 30 runs of the twins test under
269
+ load). Now a hook that finds its journal gone tries once more, and a claim that was
270
+ already saved when that happened counts as made.
271
+ - **Hook claims hold up in three more corners.** A claims file another hook holds is given up
272
+ on after one wait instead of three; a lock dated in the future after the clock steps back
273
+ is treated as a dead process's instead of waited on; and a hook whose own claim landed while
274
+ its write reported a failure delivers the event instead of standing down for itself.
275
+ - **A plugin's first run can't be held up from a shared /tmp.** Another user's directory at
276
+ the first-run lock's name made the first run wait 20 seconds and fail; it is passed over
277
+ now, and the install runs.
278
+ - **`counterparts self-page --write --short <file>` works.** The spaced form was refused;
279
+ only `--short=<file>` worked, though the help and the page's room note print the spaced
280
+ one. Both forms work now.
281
+
282
+ ## 0.3.16 — 2026-10-10
283
+
284
+ The self page is kept whole up to 16 KB, and when it doesn't fit, the wake steps down to
285
+ something whole instead of cutting it: the page, a short version written with it, an
286
+ outline, the headings, or one line saying where to read it. At the default 9,000-byte
287
+ ceiling the page's room is now 5,681 bytes (it was 6,078). Dated items come before the
288
+ wake's furniture: an "Arriving:" item or a plain reminder due today is listed before the
289
+ handoffs, "Last here" and "Work here" take their room, and doctor's Wake line turns amber
290
+ when one still goes unlisted. A paused folder says so in one line when a session starts.
291
+ Each field of a hook's output is now held to Claude Code's 10,000-character limit on its
292
+ own, so a red doctor notice shows beside a full wake. A damaged claims file mends itself,
293
+ a late twin of a session's first start stands down, and every `counterparts scope` command
294
+ Claude is shown names its folder. The plugin's first-run line is back, and its sidebar
295
+ lights every mechanism an event proves. **Nothing to run after upgrading from 0.3.15**:
296
+ the hooks, the memory server's registration and Claude Desktop's entry are the same as
297
+ 0.3.15's (coming from 0.3.14 or earlier, see those versions' notes on `counterparts
298
+ connect`). **No change to the store's format (still v12)**: a page's short version is kept
299
+ in the page's own record, which 0.3.15 reads past. Going back to 0.3.15 is the order in
300
+ QUICKSTART's "Going back to an earlier version": `counterparts disconnect` while 0.3.16 is
301
+ still installed, then the 0.3.15 reinstall, then `counterparts connect`.
302
+
303
+ The self page in the wake (#363).
304
+
305
+ - **A long self page is kept, not refused, and the wake steps down to something whole.**
306
+ 0.3.15 refused a page past 6,078 bytes. Now the page is kept whole up to 16,384 bytes,
307
+ and the wake shows the first of these that fits, each one whole: the page; a short
308
+ version its writer wrote with it; each section's heading and first sentence; the
309
+ headings alone; or one line saying where to read it. Each starts with a line giving the
310
+ page's size and the line it ends with — "if you don't see that line, it was cut off:
311
+ read it whole with the self_page tool or `counterparts self-page`" — and ends with that
312
+ line. The page's room at the default 9,000-byte ceiling is now 5,681 bytes (it was
313
+ 6,078; the new top and end lines and the wake's opening line take the difference): a
314
+ page within it always shows whole, even on a day the wake also holds handoffs and
315
+ "Work here" lines, and a longer one still shows whole on most days, borrowing the room
316
+ held for "Work here". The nightly writer, the reflection and the self_page tool are told
317
+ to aim under it and, when a page runs past it, asked for a short version in the same
318
+ call (the tool's new `short`, the console's new `--short <file>`). A short version
319
+ belongs to the page it was written with — a page rewritten without one shows its
320
+ headings and first sentences, never an old short version — and crosses the same checks
321
+ as the page, a reflection's included (no confidential memory's words, no dream marks).
322
+ Adding a short version on its own never undoes a page written in between, and the
323
+ wake's own top and end lines are never stored as part of the page. Doctor's Self page
324
+ line says what the last wake showed: green for the page or its short version, amber
325
+ below, with what to do. Every wake's opening line now also says: if a note says this
326
+ was too large and saved to a file, read that file — which is what Claude Code does with
327
+ a hook's output past 10,000 characters (measured on 2.1.296: the model then sees only
328
+ the first 2,000 characters and is not told to look). Past 16,384 bytes a page is
329
+ refused, never cut. Below a ceiling of about 530 bytes the wake is now larger than its
330
+ ceiling, because of those fixed lines; the default is 9,000.
331
+
332
+ Dated items first in the wake (#367).
333
+
334
+ - **Dated items come before the wake's furniture.** A wake could say "Arriving: 1 — no
335
+ room to list them in this wake" while it still printed yesterday's chapter titles and
336
+ four handoffs: the room held for the handoffs and "Last here" was never offered to the
337
+ rest of the wake. Now the wake follows one declared order of what gives way: when an
338
+ "Arriving:" item has no room, "Work here" shows fewer lines first, then the Yesterday
339
+ line swaps titles for chapter ids one at a time, then "Last here" is dropped and fewer
340
+ handoffs are shown in full, the others named by id while there is room for them. The
341
+ newest handoff's own room goes only to a plain reminder due that day; no other line
342
+ can take it. Only then does a dated item go unlisted. An arriving item past the two
343
+ the wake lists is no longer left out silently: the lane's "N more arriving" line names
344
+ it by id, and when even that line has no room, doctor counts it as unlisted. "Still
345
+ open" keeps its first item before Arriving's second line, as before, but now after
346
+ those same lanes give way. A plain reminder due the day the wake is read comes first
347
+ in "Arriving:" (and in the two the wake is offered), and it outranks the self page
348
+ borrowing past its room: the page steps down to its short version or outline rather
349
+ than leave it out. The page within its own room still comes first. Beside a page that
350
+ borrowed, the Yesterday line was sometimes dropped whole; it now keeps its ids. If a
351
+ dated item still goes unlisted, doctor's Wake line says so in amber, with what to do.
352
+
353
+ Paused folders and the scope commands (#362, #366).
354
+
355
+ - **A paused folder now says so when a session starts.** With memory paused in a folder
356
+ (`counterparts scope . --pause`, or the sidebar's switch), a new, resumed, cleared or
357
+ compacted session there shows one line naming the paused folder and the command that
358
+ turns it back on, which works from any terminal. If the pause is on a parent folder, the
359
+ line names that folder and the command resumes it there. Claude gets a matching line so
360
+ it doesn't act as if it remembers.
361
+ Nothing else changes: no memories are loaded or recorded, nothing is written, other
362
+ hooks stay silent, and a folder turned `off` stays completely silent.
363
+ - **Every `counterparts scope` command Claude is shown now names the folder.** In a
364
+ folder that is off or paused, the memory tools' refusal used to tell Claude to run
365
+ `counterparts scope . --resume`, and the question a new folder gets in its first session
366
+ said `counterparts scope . --on`. The `.` meant wherever the command was run, and from a
367
+ subfolder `--resume` refuses. Now the command names the folder, and when the setting
368
+ belongs to a parent folder it names that one ("paused for ~/work, which includes this
369
+ directory"). Under the plugin it uses the plugin's own launcher, and with a
370
+ configuration other than the default it adds `--config`, as the paused notice does.
371
+
372
+ The hooks: each output field, the claims file, late twins (#366).
373
+
374
+ - **A red doctor notice now shows beside a full wake.** Measured on Claude Code 2.1.296:
375
+ the 10,000-character limit applies to each field of a hook's output, not to the output
376
+ as a whole. Counterparts held the whole output to 9,500 characters, so on a morning with
377
+ a full wake the doctor's notice was left out, and plain reminders, the dream question and
378
+ the update notice waited for a later turn. Now each field is held to the limit on its
379
+ own: they show beside a full wake or a full recall, and wait only when Claude's own text
380
+ would pass the limit.
381
+ - **A damaged claims file repairs itself.** If `sessions/claims/hook-claims.sqlite`
382
+ can't be read as a database, the next hook moves it aside (one copy is kept) and makes a
383
+ new one, and the event is still delivered. Before, every event printed an error and the
384
+ guard against double delivery stayed off until someone deleted the file. Doctor's new
385
+ amber "Hook claims" line says when it happened, for a week. The claims folder and file
386
+ are now private to you (0700 and 0600), like the log, and the log says why a claim
387
+ could not be made instead of giving only the length of the message.
388
+ - **With two installs live, a session's first start runs once even on a busy machine.**
389
+ The 0.3.15 release check found one double wake under load: the second hook started 45
390
+ ms after the first had finished, so its claim read it as a new event. A session's first
391
+ start, and a prompt Claude Code gives an id, are sent only once, so a second copy within
392
+ 15 seconds now always steps aside. Doctor's "Installed twice" line no longer says
393
+ nothing was delivered twice; its fix also names `~/.claude/settings.json`.
394
+ A correction to the 0.3.15 notes, which said the claim "works between any two
395
+ versions": the plugin stepping aside is the main guard, and the claim is a backstop. It
396
+ catches a second hook that runs at the same time; for a resumed or compacted session, a
397
+ Stop, or a prompt without an id, one that starts after the first has finished can
398
+ still deliver again on a busy machine.
399
+
400
+ The plugin (#360, #365).
401
+
402
+ - **The sidebar lights every mechanism an event proves.** Each event is one row and lights
403
+ every mechanism it proves: a turn where a matching mood brought a memory closer lights
404
+ Emotion beside Retrieval, and a dream that wrote a gist and merged near-copies lights
405
+ Gist, Interference and Consolidation beside Dreaming.
406
+ - **A new plugin user is told their memory was set up, again.** In 0.3.15, the
407
+ sidebar's hooks module makes Claude Code start the plugin's SessionStart hook later,
408
+ after the plugin's server has already made the new memory, so the first session
409
+ didn't show "Counterparts: first run — a new memory was set up". Now whichever of the
410
+ two makes the memory leaves a note, and the first session start shows the line once,
411
+ never again after. Beside a live npm install the plugin still stands down and says
412
+ nothing about a first run. Nothing else changes.
413
+
3
414
  ## 0.3.15 — 2026-10-10
4
415
 
5
416
  The self page is never cut in the wake. A page may now be at most 6,078 bytes, which the
package/docs/ELI5.md CHANGED
@@ -52,7 +52,7 @@ never got to write.
52
52
  - **claude-code** — the hooks. Injects the wake at session start, runs recall on each
53
53
  prompt, captures each turn at Stop, asks for memories and the chapter, spawns the
54
54
  background worker.
55
- - **mcp** — the tools the AI calls on purpose: `note`, `recall`, `status`, `session_end`,
55
+ - **mcp** — the tools the AI calls on purpose: `remember` (was `note`), `recall`, `status`, `session_end`,
56
56
  and `chapter`.
57
57
  - **cli** — the owner's console. Status, backup, export, delete, and the one-off repairs.
58
58
  - **dashboard** — the owner's window into the brain. What it remembered, what faded,
@@ -132,7 +132,23 @@ counterparts install --force --embedder
132
132
 
133
133
  ### Going back to an earlier version
134
134
 
135
- Go back in this order. The other order breaks every hook, and the older version's
135
+ If the upgrade changed your memory's format, the older version won't open it until you
136
+ put the old one back. Close your Claude Code sessions, quit Claude Desktop and stop the
137
+ dashboard, then, while the newer version is still installed:
138
+
139
+ ```
140
+ counterparts rollback
141
+ ```
142
+
143
+ It puts back the copy the upgrade made first (they're kept 14 days), says how many
144
+ memories you would lose (everything remembered since the upgrade), and asks you to type a
145
+ word. Nothing is deleted: the upgraded memory is set aside next to it, in a
146
+ `rollback-aside-…` folder. Until you install the older version, the newer one leaves your
147
+ memory alone, and sessions on it say why. `counterparts rollback --undo` puts the
148
+ upgraded memory back if the older version hasn't used it yet;
149
+ `counterparts rollback --upgrade-again` lets the newer version upgrade it again.
150
+
151
+ Then go back in this order. The other order breaks every hook, and the older version's
136
152
  `doctor` still reads green.
137
153
 
138
154
  1. `counterparts disconnect`, while the newer version is still installed.
@@ -22,11 +22,11 @@ code and the `NOTES.md` / `INTERFACE-GAPS.md` next to it.*
22
22
  | `self/` | autobiographical self | Identity documents, episodes, the wake briefing (v0's briefing, grown up). Governed: frozen self-reinforcement rules. |
23
23
  | `prospective/` | prospective memory | Future intentions, cued by time or context; fire / suppress / reference telemetry. |
24
24
  | `handoff/` | working context for a place | The per-directory handoff: where the work here stands, written as a field on the end-of-session ask, shown as a two-line pointer at the next wake in that directory, expiring in lived days. **Never a memory** — out of recall, out of credit, out of consolidation, out of identity. **Added 2026-09-20 (E1, spec §6.4 / §15 item 6).** |
25
- | `coverage/` | rehearsal debt | What is not written up yet, read in one place: per session, the unwritten stretch since its last claim in `coverage.jsonl`. The pacer's third ask (pieces and time), the one rule for what a session owes (retention, the next-session write-up), lapse after two days of use, the handoff pointer's "how current", and one row per stretch per state. Changes nothing about how pieces are claimed. **Added 2026-09-30.** |
25
+ | `coverage/` | rehearsal debt | What is not written up yet, read in one place: per session, the unwritten stretch since its last claim in `coverage.jsonl`. The pacer's third ask (pieces and time), the one rule for what a session owes (retention, the next-session write-up), lapse after fourteen days of use (two until 2026-10-10), the handoff pointer's "how current", and one row per stretch per state. Changes nothing about how pieces are claimed. **Added 2026-09-30.** |
26
26
  | `sleep/` | systems consolidation | Pure math on a cycle: decay tick (active-day clock), floor-pruning (real forgetting), the core's two lanes (at most three a night), re-render of the wake briefing. Zero standing model calls. |
27
27
  | `dream/` | sleep replay + REM | Dreaming: once a day, if the owner says yes, a background agent (the same model) replays what was lived since the last dream beside what it resembles — merges, links, replays, a pattern, a flagged contradiction, a softened feeling, a core nomination — each recorded for undo, with a dream journal kept apart from lived memory. The module holds the bookkeeping and the rules; the dreamer is the model. **Added 2026-09-26.** Since 2026-09-27 it also holds REFLECTION (`reflect.ts`), the waking self: usually right after a dream, lived, with its own record — an entry, the self page rewritten from the core, a morning share, feelings recorded later, and what a memory is about. |
28
28
  | `fit/` | working memory's pointers | Fitting what a mechanism has into the room it has: a line for everything, the whole text for the most important, ids and a named lookup for the rest, a count of what waits. Plus `lineOf`, `derivedFrom`, parts, and the lookup ledger that measures whether receivers use the lookup. First users: the dream and the reflection. **Added 2026-09-28 (build B).** |
29
- | *(`contradictions.ts`)* | reconsolidation + interference | Two memories that disagree: flagged (a dream, today), noticed at write time (the nearest few live memories come back with a stored one), and SETTLED — `changed` (both true at their time: one strength cut, labelled earlier), `corrected` (archived, readable by id), or `open` (both kept, shown together) — by a new memory's `updates` + `how`, a `note` settle, a dream or reflection with a plain reason, or the owner's `counterparts settle`. Every settle is on a trail (who, how, why, when) and can be undone. A file beside `revision.ts`, whose ordinary-memory arm it is; its tables are the store's (schema v10), its labels recall's (`recall/standing.ts`). **Added 2026-09-29.** |
29
+ | *(`contradictions.ts`)* | reconsolidation + interference | Two memories that disagree: flagged (a dream, today), noticed at write time (the nearest few live memories come back with a stored one), and SETTLED — `changed` (both true at their time: one strength cut, labelled earlier), `corrected` (archived, readable by id), or `open` (both kept, shown together) — by a new memory's `updates` + `how`, a `remember` settle, a dream or reflection with a plain reason, or the owner's `counterparts settle`. Every settle is on a trail (who, how, why, when) and can be undone. A file beside `revision.ts`, whose ordinary-memory arm it is; its tables are the store's (schema v10), its labels recall's (`recall/standing.ts`). **Added 2026-09-29.** |
30
30
  | *(`time.ts`)* | — (a clock, not a memory) | The one module that converts: a moment (UTC ms from `store.now()`) to a person's local date or clock line, "today" in a zone, and calendar dates as said (day, month, year, range). A file, not a module; a test keeps hand-built dates out of `src/`. **Added 2026-09-25 (`docs/time.md`).** |
31
31
  | *(`feelings-wheel.ts`)* | — (a vocabulary) | The feelings wheel as a typed list: seven cores (happy, warm, calm, curious, sad, uneasy, angry), the groups and their words, default valence and intensity on every entry, blends, aliases, and the rule that re-filed the first wheel's feelings (v11). Read by `store/` to validate the `feelings` table. **Added 2026-09-25; v2 2026-09-30.** |
32
32
  | *(`leaving.ts`)* | — (a table) | What counts as having left: every `archived_reason` the code writes, filed `replaced` (a live row carries it — a revision, a merge, a rebuilt journal copy), `let-go` or `removed`. The `status` census and the dashboard's archive words both read it, so they agree. **Added 2026-09-30.** |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "counterparts",
3
- "version": "0.3.15",
3
+ "version": "0.3.17",
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": {
@@ -387,13 +387,34 @@ row, saying which source answered, existed until the keys were removed — §1a.
387
387
  already passed, because the published bundle is one per store and read in every
388
388
  directory. With no live handoff nothing is passed through and nothing is spliced.
389
389
 
390
+ **AND THE HOST'S SESSIONS (2026-10-10).** `composeWake` also hands the core the
391
+ registry's sessions (`WakeHere.sessions`: directory, start, last boundary, live or
392
+ ended — host state, no content) for the wake's "Today, elsewhere" line, which names
393
+ the other directories worked in today that the scope setting lets this one name
394
+ (`chapterExports`): times, counts of memories, and a chapter's title only on the
395
+ "About me, from another directory" line's gate. Never this directory, this session,
396
+ or the nightly run's (the store's own directory). The wake itself is ASSEMBLED at
397
+ delivery from reads (self CONTRACT §5 G1): no model, no network, no state written.
398
+
399
+ **AND, AT A PROMPT, WHAT CHANGED SINCE (2026-10-11).** A session already open
400
+ never reads a wake again, so `userPromptSubmit` may add one "Since you started"
401
+ line for the model (`Lifecycle#sinceLine` → `Counterpart#sinceElsewhere`): another
402
+ directory's session started or ended, a chapter, new memories, since this session
403
+ last heard. The same gate as "Today, elsewhere" (`elsewhereGate`, one code path)
404
+ and the same registry hand-over (`elsewhereHere`). At most once an hour, never at
405
+ the first prompt after a wake; the state is the session record's `sinceSeen`
406
+ (host state, no store change). It takes only what recall left of its budget and,
407
+ with no room, waits a prompt. Reads only; nothing under observer or for the
408
+ nightly run.
409
+
390
410
  19. **[M] A directory set `off` gets NO OUTPUT AND NO WRITE — because nothing is
391
411
  constructed.** The scope registry (`adapters/scopes.ts`,
392
412
  `<config dir>/scopes.json`, longest-prefix, added 2026-09-10 for owner asks
393
413
  G41–G43) is read at the ENTRY POINT, from the file `config-path.ts` resolved,
394
414
  before a store is opened: an `off` or `paused` directory returns from
395
415
  `bin/hook.ts#main` with byte-for-byte empty stdout, empty stderr, no session
396
- record, no capture, no spawn and no store. `guard()` carries the same predicate
416
+ record, no capture, no spawn and no store — except that a `paused` one's
417
+ SessionStart prints ONE notice (below). `guard()` carries the same predicate
397
418
  at the seam so a caller who builds an adapter directly inherits it, but the
398
419
  guarantee itself is the absence of construction, and the install loop proves it
399
420
  on a real process against a real clean-room install.
@@ -420,6 +441,22 @@ row, saying which source answered, existed until the keys were removed — §1a.
420
441
  prints it. An `off` is not an instrument standing down; it is the owner saying
421
442
  this directory is not part of the memory.
422
443
 
444
+ **A `paused` directory says so once, at SessionStart (rulings brief #19,
445
+ 2026-10-10 — a working default).** A pause is meant to end, and a silent one was
446
+ missed: on 2026-10-09 three sessions ran without memory for ten minutes before
447
+ anyone noticed. So SessionStart, on every source (startup, resume, clear,
448
+ compact), prints one envelope from the registry already read: a `systemMessage`
449
+ for the person — the folder is paused and the command that resumes it — and an
450
+ `additionalContext` line for the model, so it does not act as if it remembers
451
+ (`bin/hook.ts#pausedNotice`). The folder whose entry paused it is NAMED, and the
452
+ command names it — never `.`, which is wherever the person types it — because
453
+ `--resume` refuses a directory that only inherits a pause. It
454
+ writes nothing anywhere — not the store, not a session record, not the per-event
455
+ claim, which comes after this return — so beside the npm install it is the
456
+ plugin's gate, not the claim, that keeps it to one line. Every other event, `off`
457
+ on every event, a session whose own folder is `off` (resuming the paused one
458
+ would turn nothing back on), and the headless nightly run stay silent.
459
+
423
460
  **The guarantee is the HOOKS', and only the hooks'.** The MCP server still opens
424
461
  a store when the host launches it in an `off` directory (`mcp/bin/serve.ts`): it
425
462
  refuses every tool but `scope` with `scope-off`, per call, before any session bind
@@ -459,7 +496,7 @@ row, saying which source answered, existed until the keys were removed — §1a.
459
496
  22. **[M] TURNING A DIRECTORY BACK ON NEVER REACHES BACK.** A session that lived
460
497
  under `off` or `paused` left no session record and no span cursor, because the
461
498
  hook process returned before anything was constructed (G19). Flip the registry
462
- to `on` mid-session — `counterparts scope . --resume`, or the `scope` tool, which
499
+ to `on` mid-session — `counterparts scope <folder> --resume`, or the `scope` tool, which
463
500
  is deliberately the one tool that answers in an off directory — and the next
464
501
  boundary would otherwise slice the transcript from cursor 0 and deposit the whole
465
502
  off conversation. It does not: a boundary that finds NO session record and a
@@ -629,19 +666,32 @@ row, saying which source answered, existed until the keys were removed — §1a.
629
666
  `adapter.hook.claim.lost` row, and leaves one stderr line. All five events
630
667
  are claimed. A matching key from a process that started after the holder
631
668
  finished is a separate event (a host with no `prompt_id` sending the same
632
- words twice) and delivers. **Fail-open:** no session id, an observer, or a
669
+ words twice) and delivers — EXCEPT for an event the host sends once per key
670
+ (`firesOnce`: a SessionStart whose `source` opens a session id — `startup`,
671
+ `clear`, `fork` — and a prompt with its `prompt_id`), where any same-key
672
+ process inside the window is the twin however late its runtime came up
673
+ (2026-10-10: the 0.3.15 release check measured a twin starting 45 ms after
674
+ the winner finished, under load, and two wakes). For the events that can
675
+ legitimately repeat, a twin that starts that late still delivers: the
676
+ stand-down above is the main guard, and the claim a backstop that stops
677
+ the twins it sees. **Fail-open:** no session id, an observer, or a
633
678
  claims file that will not take the write, and the process delivers, so one
634
679
  wiring behaves exactly as before (two small writes: about 0.3 ms measured in
635
- process, within noise end to end). The claims are in their own file, not
680
+ process, within noise end to end). A claims file that is not a database
681
+ is set aside with its `-wal`/`-shm` as `hook-claims.unreadable-<ms>.sqlite`
682
+ (one copy kept) and made again, once, and the event is claimed on the new
683
+ file; doctor's `Hook claims` line (amber, a week) reads the copy. The
684
+ directory is 0700 and the file 0600. The claims are in their own file, not
636
685
  the store's `meta`, so a claim waits only on another claim: the store's
637
686
  writers (the worker the last Stop started, the MCP server, the CLI) never
638
687
  hold it up, and a store somebody holds costs it nothing. Each of the two
639
688
  writes waits at most `CLAIM_WAIT_MS` (500 ms). A claim that could not be
640
- written is in the hook's `process.end` log line; it is said on stderr too
641
- only when it is a fault (the file cannot be made or written), not when
642
- another claim held the file. Doctor's `Installed twice` line (amber)
643
- reads the week's `claim.lost` rows. The transcript's size is not in the key:
644
- the host may write between the twins starting.
689
+ written is in the hook's `process.end` log line, as its error's code; it is
690
+ said on stderr too only when it is a fault (the file cannot be made or
691
+ written), not when another claim held the file. Doctor's `Installed twice`
692
+ line (amber) reads the week's `claim.lost` rows, and says only what they
693
+ show. The transcript's size is not in the key: the host may write between
694
+ the twins starting.
645
695
 
646
696
  ### The nightly run, and the page writer inside it (2026-09-28 — working defaults, held lightly)
647
697
 
@@ -821,11 +871,12 @@ terminal; "dream on your own" sets it again. Any setting chosen on this version
821
871
  ### One size budget per hook envelope (2026-09-29 — a working default)
822
872
 
823
873
  **[M] Everything one SessionStart or one UserPromptSubmit prints is measured against one
824
- budget**, the host's cap (`TUNABLES.HOST_OUTPUT_CHARS`, 10,000, counted in bytes; the JSON
825
- form `ENVELOPE_CHARS`, 9,500), and a crowded envelope gives way in a stated order, first to
874
+ budget**, the host's cap (`TUNABLES.HOST_OUTPUT_CHARS`, 10,000, counted in bytes; in the JSON
875
+ form each field is held to it on its own, as the host measures it — 2026-10-10, it was 9,500
876
+ characters of whole envelope before), and a crowded envelope gives way in a stated order, first to
826
877
  last. Each part that gives way is DEFERRED, never cut, and never spent on a line the session
827
878
  did not get.
828
- - **SessionStart:** the owner's notices (dropped before the JSON envelope passes 9,500) →
879
+ - **SessionStart:** the owner's notices (dropped when a field of the JSON form would pass the cap) →
829
880
  the write-up pointer → the first-launch question (measured against this budget, no
830
881
  longer the reported injection budget) → plain reminders due today (they wait for the
831
882
  first prompt, unclaimed) → the wake, which is never cut at delivery: it was composed to
@@ -900,7 +951,7 @@ session, because an MCP result is not under the host's 10,000-character cap on a
900
951
  output and the wake is. The pointer is measured against that cap as PLAIN stdout
901
952
  (`HOST_OUTPUT_CHARS` = 10,000; bytes ≥ characters): with no owner notice
902
953
  `bin/hook.ts#hostDelivery` prints plain text, and with one it drops the notice before it
903
- lets the JSON envelope pass `ENVELOPE_MAX_CHARS`. It is NOT held to the reported budget,
954
+ lets either field of the JSON form pass the cap (`fieldsFit`). It is NOT held to the reported budget,
904
955
  which is what the wake is composed to; a 9,038-byte wake leaves room (tested with host
905
956
  ids). Past the cap it DEFERS, claims nothing, and records the deferral DURABLY
906
957
  (`sessions.ts#WRITE_UP_POINTER_KEY`, one meta row: outcome, need, room), which doctor