counterparts 0.3.36 → 0.3.38

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 (136) hide show
  1. package/CHANGELOG.md +210 -0
  2. package/docs/QUICKSTART.md +12 -7
  3. package/docs/module-map.md +4 -2
  4. package/package.json +1 -1
  5. package/src/adapters/claude-code/CONTRACT.md +26 -4
  6. package/src/adapters/claude-code/NOTES.md +72 -0
  7. package/src/adapters/claude-code/bin/hook.ts +70 -6
  8. package/src/adapters/claude-code/bin/nightly.ts +2 -0
  9. package/src/adapters/claude-code/bin/runner.ts +2 -0
  10. package/src/adapters/claude-code/child-error.ts +211 -0
  11. package/src/adapters/claude-code/child.ts +29 -10
  12. package/src/adapters/claude-code/doctor-checkout.ts +4 -2
  13. package/src/adapters/claude-code/doctor-host.ts +31 -0
  14. package/src/adapters/claude-code/doctor-meaning.ts +200 -0
  15. package/src/adapters/claude-code/doctor-modes.ts +115 -0
  16. package/src/adapters/claude-code/doctor-open.ts +12 -2
  17. package/src/adapters/claude-code/doctor-self-page.ts +2 -0
  18. package/src/adapters/claude-code/doctor-write-ups.ts +84 -19
  19. package/src/adapters/claude-code/doctor.ts +74 -23
  20. package/src/adapters/claude-code/hooks.ts +99 -11
  21. package/src/adapters/claude-code/index.ts +15 -0
  22. package/src/adapters/claude-code/night-catch-up.ts +25 -5
  23. package/src/adapters/claude-code/night-run.ts +86 -11
  24. package/src/adapters/claude-code/stale-windows.ts +160 -0
  25. package/src/adapters/claude-code/standdown.ts +70 -3
  26. package/src/adapters/claude-code/vectors.ts +4 -1
  27. package/src/adapters/cli/INTERFACE-GAPS.md +14 -0
  28. package/src/adapters/cli/NOTES.md +25 -0
  29. package/src/adapters/cli/bin/counterparts.ts +4 -2
  30. package/src/adapters/cli/commands-dashboard.ts +8 -5
  31. package/src/adapters/cli/commands-install.ts +12 -14
  32. package/src/adapters/cli/commands.ts +4 -1
  33. package/src/adapters/cli/coverage.ts +28 -6
  34. package/src/adapters/cli/help.ts +6 -1
  35. package/src/adapters/cli/index.ts +2 -0
  36. package/src/adapters/cli/install.ts +24 -1
  37. package/src/adapters/cli/mechanisms.ts +31 -8
  38. package/src/adapters/cli/rollback.ts +3 -3
  39. package/src/adapters/cli/snapshot.ts +4 -4
  40. package/src/adapters/cli/uninstall.ts +16 -74
  41. package/src/adapters/cli/wire.ts +216 -28
  42. package/src/adapters/dashboard/bin/dashboard.ts +2 -0
  43. package/src/adapters/dashboard/registries.ts +1 -1
  44. package/src/adapters/dashboard/web/mechanisms/index.js +2 -0
  45. package/src/adapters/dashboard/web/mechanisms/schema/index.js +9 -6
  46. package/src/adapters/dashboard/web/mechanisms/schema/panel.js +14 -0
  47. package/src/adapters/dashboard/web/narrate.ts +10 -3
  48. package/src/adapters/dashboard/web/views/mechanism-panel.ts +44 -0
  49. package/src/adapters/dashboard/web/views/mechanisms.ts +13 -1
  50. package/src/adapters/fired.ts +29 -0
  51. package/src/adapters/host-wiring.ts +56 -1
  52. package/src/adapters/hosts.ts +51 -0
  53. package/src/adapters/lifecycle.ts +35 -4
  54. package/src/adapters/mcp/CONTRACT.md +26 -3
  55. package/src/adapters/mcp/INTERFACE-GAPS.md +11 -0
  56. package/src/adapters/mcp/NOTES.md +147 -0
  57. package/src/adapters/mcp/bin/serve.ts +53 -3
  58. package/src/adapters/mcp/chat-wake.ts +111 -0
  59. package/src/adapters/mcp/deliberate.ts +5 -2
  60. package/src/adapters/mcp/index.ts +3 -1
  61. package/src/adapters/mcp/nights.ts +434 -9
  62. package/src/adapters/mcp/protocol.ts +11 -2
  63. package/src/adapters/mcp/server-args.ts +6 -0
  64. package/src/adapters/mcp/server-options.ts +19 -2
  65. package/src/adapters/mcp/server-self-tools.ts +23 -8
  66. package/src/adapters/mcp/server-session-end.ts +5 -3
  67. package/src/adapters/mcp/server-words.ts +218 -4
  68. package/src/adapters/mcp/server.ts +565 -55
  69. package/src/adapters/mcp/tools.ts +234 -12
  70. package/src/adapters/mechanism-evidence.ts +90 -15
  71. package/src/adapters/owned-names.ts +105 -0
  72. package/src/adapters/plugin.ts +34 -7
  73. package/src/adapters/private-base.ts +175 -0
  74. package/src/adapters/private-umask.ts +71 -0
  75. package/src/adapters/remote/CONTRACT.md +75 -0
  76. package/src/adapters/remote/INTERFACE-GAPS.md +20 -0
  77. package/src/adapters/remote/NOTES.md +80 -0
  78. package/src/adapters/remote/bin/serve-http.ts +258 -0
  79. package/src/adapters/remote/call-log.ts +206 -0
  80. package/src/adapters/remote/http.ts +500 -0
  81. package/src/adapters/sessions.ts +93 -7
  82. package/src/adapters/snapshots.ts +3 -3
  83. package/src/adapters/spawn.ts +13 -6
  84. package/src/adapters/update-words.ts +210 -0
  85. package/src/core/counterpart-deposit.ts +35 -2
  86. package/src/core/counterpart-events.ts +15 -0
  87. package/src/core/counterpart-sweep.ts +14 -1
  88. package/src/core/counterpart-types.ts +7 -0
  89. package/src/core/counterpart.ts +443 -47
  90. package/src/core/coverage/CONTRACT.md +12 -5
  91. package/src/core/coverage/NOTES.md +40 -1
  92. package/src/core/coverage/index.ts +73 -14
  93. package/src/core/coverage/tunables.ts +15 -1
  94. package/src/core/dream/CONTRACT.md +47 -9
  95. package/src/core/dream/NOTES.md +115 -0
  96. package/src/core/dream/index.ts +54 -6
  97. package/src/core/dream/night-line.ts +279 -0
  98. package/src/core/dream/recalled.ts +90 -0
  99. package/src/core/dream/reflect.ts +156 -25
  100. package/src/core/dream/tunables.ts +61 -0
  101. package/src/core/handoff/CONTRACT.md +15 -4
  102. package/src/core/handoff/NOTES.md +52 -0
  103. package/src/core/handoff/index.ts +16 -8
  104. package/src/core/handoff/last-here.ts +81 -2
  105. package/src/core/mint.ts +8 -1
  106. package/src/core/onboarding.ts +35 -8
  107. package/src/core/recall/CONTRACT.md +25 -2
  108. package/src/core/recall/NOTES.md +41 -0
  109. package/src/core/recall/index.ts +94 -0
  110. package/src/core/recall/session.ts +8 -3
  111. package/src/core/recall/tunables.ts +57 -1
  112. package/src/core/reconsolidation.ts +2 -1
  113. package/src/core/remember/CONTRACT.md +2 -1
  114. package/src/core/remember/owes.ts +7 -1
  115. package/src/core/remember/proposals.ts +41 -1
  116. package/src/core/schemas/CONTRACT.md +4 -2
  117. package/src/core/self/INTERFACE-GAPS.md +49 -0
  118. package/src/core/self/NOTES.md +80 -0
  119. package/src/core/self/briefing-delivery.ts +253 -2
  120. package/src/core/self/briefing-room.ts +25 -3
  121. package/src/core/self/briefing.ts +168 -23
  122. package/src/core/self/identity.ts +54 -21
  123. package/src/core/self/index.ts +218 -21
  124. package/src/core/self/tunables.ts +19 -6
  125. package/src/core/self/work.ts +20 -0
  126. package/src/core/self/writer.ts +16 -2
  127. package/src/core/store/CONTRACT.md +28 -2
  128. package/src/core/store/NOTES.md +97 -2
  129. package/src/core/store/db.ts +24 -1
  130. package/src/core/store/index.ts +28 -2
  131. package/src/core/store/operational.ts +37 -1
  132. package/src/core/store/pre-migration.ts +6 -2
  133. package/src/core/store/private.ts +319 -0
  134. package/src/core/store/reads-memories.ts +4 -0
  135. package/src/core/store/shapes.ts +6 -0
  136. package/src/core/types.ts +28 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,215 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.38 — 2026-10-28
4
+
5
+ Dreams can be found: ask about a dream, or about something only a dream held, and recall shows it labelled `[dream]`, told as dreamed and never as lived; `recall "last dream"` reads the newest one whole. An open item can say what would settle it ("settles when …"), and the night closes a few when that plainly happened. The wake says so when search by meaning is switched on but can't run, with the fix for how you installed, and an open window that meets a memory another window's newer Counterparts upgraded says whether to reload or update. A nightly run that fails now records what Claude Code said, so the next failure can be read. Short check-ins are written up by the next night, and "Last here" names the newest session. **Privacy:** your store is now readable by your account alone (folders 700, files 600, tightened the first time this version writes to it), and `counterparts connect` adds one `deniedMcpServers` entry to `~/.claude/settings.json` so Claude Code never loads Counterparts Online beside this install. **Run `counterparts connect` once after upgrading from npm** to add that entry: until then doctor's new Online line reads amber. No store-format change (store v15, cache v7). Going back to 0.3.37 needs no store restore: `counterparts disconnect`, 0.3.37's install, then `counterparts connect`. Restart the dashboard and every Claude Code session afterwards so the long-running memory server and dashboard load the new version.
6
+
7
+ - **Still open lists this folder's threads first.** A session's "Still open" leads with the
8
+ open threads written in its folder (and the folders joined to it as one project), then the
9
+ personal ones (about me, us or the owner) from anywhere. Another folder's work stays in that
10
+ folder, as "Work here" does, and the "N more open" line counts only what could show here.
11
+ The `still open` recall handle lists by the same rule. A thread with no folder recorded is
12
+ shown with the personal ones.
13
+ - **Short sessions are written up too.** A session that ends without leaving a record of its
14
+ own (no answer to the end-of-session ask, no chapter, no write-up) is now owed a write-up
15
+ whatever its size, so a quick check-in is remembered by the next night instead of being let
16
+ go. Notes saved in the moment still count as written, but they are not the session's record.
17
+ The 15-minute floor still applies to a closing line after a session's own record.
18
+ - **A night runs for check-ins.** When the dream has too little new to work on, each session
19
+ owed a write-up counts as one new memory, because the night writes it up first; with three,
20
+ the night runs whole instead of its catch-up alone — and dreams only if the catch-up did
21
+ write them up; when it could not, the night stays the catch-up alone.
22
+ - **"Last here" names the newest session.** When the folder's newest session wrote no chapter,
23
+ the wake's "Last here" names it, with its newest memory (or "not written up yet"), and the
24
+ older chapter after it, instead of the older chapter as if nothing had happened since.
25
+ - **"Last here" quotes the session's own words, and passes over runs nobody attended.** It no
26
+ longer quotes what the night filed under a session (a dream's gist or merge, a reflection's
27
+ entry) as if the session had said it: the quote is the session's own note, its write-up, or
28
+ "not written up yet". A `claude -p` or Agent SDK run is passed over for the person's own
29
+ session, and a session with no chapter now gets its room in the wake too.
30
+ - **Doctor no longer goes amber every morning for short check-ins.** Yesterday's sessions are
31
+ owed until that night's catch-up, which runs at the day's first prompt, so a doctor read before
32
+ it was amber every morning. Its Catch-up line is now amber only when a session is overdue: a
33
+ catch-up ran on a later day and left it owed, or two days of use passed with no catch-up since.
34
+ The sessions left to lapse are now named for what they are: short headless runs (`claude -p`,
35
+ the Agent SDK), and short sessions with no session record.
36
+ - **The memory server speaks MCP 2025-11-25 when a client asks for it.** claude.ai's connector and Claude
37
+ Desktop's chat ask for it, and now get it back instead of being answered in 2025-06-18. Nothing a
38
+ client sees changes beyond the version: that revision's additions are optional, and this server
39
+ uses none of them. A client asking for a version the server doesn't know still gets 2025-06-18.
40
+ - **Under Node, a deleted row's words no longer linger in the database file.** Node's built-in
41
+ SQLite leaves `secure_delete` off, so a deleted or rewritten row stayed in the file's free space
42
+ until the page was reused. The store now sets it to FAST on every open, as it already was under
43
+ Bun.
44
+ - **A nightly run that fails now says why.** When a background child of the nightly run exits
45
+ with an error, the run's record, `counterparts doctor` and `dream --show` carry one short
46
+ line of what Claude Code said (for example "Not logged in · Please run /login"), with
47
+ anything that looks like a key or token blanked out. Before, it said only "claude exited
48
+ with an error (exit 1)". A run that stopped because Claude Code was signed out, such as
49
+ after switching accounts mid-run, now says so plainly, and the next session offers to dream
50
+ there.
51
+ - **`counterparts connect` keeps Counterparts Online out of Claude Code.** Claude Code loads
52
+ your claude.ai connectors into every session, so with both this install and the hosted
53
+ connector you would get two memories over two stores. `connect` (and so `install`) now adds
54
+ one entry, `{ "serverUrl": "https://app.counterparts.ai/*" }`, to `deniedMcpServers` in
55
+ `~/.claude/settings.json`, with the same backup and leaving everything else as it is;
56
+ `disconnect` takes out exactly that entry. `doctor` has an Online line; an install from
57
+ before this version reads amber there until you run `counterparts connect` once.
58
+ - **Your memory is private to your account on this computer.** The store, its snapshots and
59
+ everything Counterparts writes under `~/.counterparts` are now readable by you alone
60
+ (folders 700, files 600; they were 755 and 644). An existing store is tightened the first
61
+ time this version writes to it; a drive that doesn't keep permissions (exFAT, some network
62
+ drives) is left as it is and still opens. `doctor` has a Privacy line that says when the
63
+ store is readable by other accounts, with the two commands that close it.
64
+ - **`backup --out` and `export` write private copies** (the database `600` in a `700`
65
+ folder) wherever you point them. A store you share with a group on purpose is made
66
+ private again the next time Counterparts writes to it; there is no switch for that yet.
67
+ - **A `snapshots.dir` you pointed somewhere of your own stays yours.** Only the snapshots in
68
+ it (the dated copies and the copies taken before an upgrade) are made private; the folder
69
+ itself is closed only when it holds nothing but snapshots, and never when it is your home
70
+ folder or above it. Everything else in it keeps its permissions.
71
+ - **`uninstall --delete-memories` now deletes a store `rollback` set aside, and says so.** A
72
+ `rollback-aside-…` folder beside your store is a whole earlier copy of your memory; it used
73
+ to be left behind. The plan names it as memory on its own line and counts it ("That is 2
74
+ memory stores: yours, and 1 …") before you type the confirmation.
75
+ - **`uninstall --delete-memories` never takes a `snapshots.dir` you chose.** A snapshots
76
+ folder your configuration points at, even one inside the same folder as the
77
+ configuration, is now listed under what is left alone instead of among what is deleted.
78
+ - **`doctor`'s Privacy line is right about setgid folders and the snapshot mirror.** A store
79
+ folder carrying a setgid or sticky bit (on Linux, a folder made inside a setgid one inherits
80
+ it) is never changed by a session, so the line now gives the one command to run by hand
81
+ (`chmod go-rwx …`, which keeps the bit) instead of saying the next session will do it. With a
82
+ `snapshots.mirror` configured, the line says the mirror is not checked.
83
+ - **Installing through a `~/.counterparts` link to a folder that is not there yet** now says so
84
+ and how to fix it (make the folder, or remove the link), instead of a bare `ENOENT`.
85
+ - **Dreams can be remembered by what they were about.** Asking about something a recent dream
86
+ was about ("keys", "locked doors") brings that dream up as one line after the answer, even
87
+ when the question never says "dream": one at most, and only when its meaning is close.
88
+ Asking about a dream ("did you dream about the greenhouse?") finds it by its words or
89
+ meaning, however old, and shows it first with a few lines of it. Either way it is labelled
90
+ `[dream]` with its date and id, and said to be dreamed, not lived, so it is told as a dream
91
+ and never as something that happened. "When did you last dream?" always names the newest
92
+ one, including one from earlier the same day.
93
+ - **Dreams fade unless they are talked about.** A recent dream comes up beside other
94
+ questions only for a day or so, unless it is read, asked about by what it was about, or
95
+ told; each day it is, it stays longer. It is never deleted: asking about dreams, "last
96
+ dream" and its id still find it.
97
+ - **Dreams follow the folder setting for where they ran.** A dream that ran in a folder set
98
+ off or paused is not shown in another folder's answers or as its "last dream". The rule
99
+ is about where the dream ran, not what it is about.
100
+ - **`recall "last dream"` reads the newest dream whole.** The handle `last dream` (or `last
101
+ night`, any case) returns the newest dream in full, its title, whole journal and what it did,
102
+ with the reflection after it and its share; nothing is credited or marked told. A dream's or
103
+ a reflection's id given alone as a handle reads whole too.
104
+ - **Dreaming off stops a dream on every host.** With dreaming set off, `dream` refuses to
105
+ launch, and refuses its writer and begin steps called without a launch, in Claude Code, the
106
+ Code tab and Desktop chat alike; a run already under way finishes. Desktop chat's dream and
107
+ reflect words say to follow the prompt in the chat itself, with no background agent.
108
+ - **Your counterpart tells you when search by meaning can't run.** When it's switched on but
109
+ its files didn't install or won't load, the session's wake carries one line for the assistant
110
+ to pass on: what's off, that memories are still found by their words, and the fix for how you
111
+ installed (for the plugin, `/plugin` → Installed → counterparts → Update now; for npm,
112
+ installing Counterparts again). If it keeps failing for another reason, it says so once a day
113
+ and points at doctor. Nothing is said when it's healthy or when you switched it off.
114
+ - **The fix for missing meaning files now works for npm installs.** Doctor and `install` used to
115
+ say `bun add -g counterparts-model-potion`, which Counterparts doesn't look for; they now say to
116
+ install Counterparts again (`npm install -g counterparts` under Node, `bun add -g counterparts`
117
+ under Bun).
118
+ - **An open item can say what would settle it.** Beside `unresolved: true`, `remember` and
119
+ `session_end` entries take an optional `settlesWhen`, a short phrase like "the landlord
120
+ replies". "Still open", in the wake and in `recall "still open"`, shows it after the
121
+ item ("… · settles when the landlord replies"; the wake cuts a long one at about
122
+ 80 characters). From the day after it was written, the nightly reflection is shown open items
123
+ that name one, and closes at most three a night when a memory plainly shows that thing
124
+ happened, with a why and the way back; when the memory it points to is missing, is the item
125
+ itself or is older than it, the morning share says so. Items without one behave exactly as
126
+ before. `status` counts open items that name one, that have only a date, and that have
127
+ neither.
128
+ - **An open window that meets a memory a newer Counterparts upgraded says what to do.** For the plugin, it used to say
129
+ "Run /mcp and Reconnect", which restarts the same old version. Now it says to run `/reload-plugins` (with `--force`
130
+ if it warns about the cache), or start a new session (first, in Claude Desktop's Code tab), when Claude Code already
131
+ has the newer version, and to update the plugin first when it doesn't. The npm install keeps "/mcp and Reconnect".
132
+ - **The hook in that window says the same, and tells the assistant too.** The red "memory is OFF … Run: counterparts
133
+ doctor" line now names the step for how you installed (plugin installs have no `counterparts` command; an npm
134
+ install is told to update itself), and the assistant gets a line so it doesn't act as if it remembers. Doctor's
135
+ Store open line gives the same step.
136
+ - **After an upgrade, the next session you start names the windows that still run the old version.** Once, with the
137
+ step for each (reload, or `/mcp` and Reconnect for npm); Claude Desktop's wake says it too.
138
+ - **"Counterparts was updated" names the right step for plugin users.** The once-a-session line after an update said
139
+ "Run /mcp and Reconnect" to everyone; a plugin window is now told to run `/reload-plugins` or start a new session.
140
+ - **The end-of-session ask invites a `settlesWhen` beside an open item.** When the assistant marks something still
141
+ open, the ask now suggests naming what would close it, if it can, so more open items reach the nightly check that
142
+ closes them.
143
+ - **An old window's "memory is OFF" line and doctor no longer say reload when a reload wouldn't help.** When the
144
+ plugin version Claude Code records is newer than the window but older than the version that upgraded the memory,
145
+ they now say to update first, as the memory tools already did.
146
+ - **Claude Desktop chat brings up the night's share.** A chat's wake never carried the
147
+ morning share a reflection left, so on a store used from Desktop chat alone it stayed
148
+ unsaid. The next chat's wake now carries it, once, right after its session line. Claude
149
+ Code's terminals wait for the reflecting session to end, as before.
150
+ - **"Today, elsewhere" dates an open folder by its open session.** A folder whose session from
151
+ yesterday ended this morning beside a new one read "open since" yesterday's start; it now
152
+ reads the open session's own start, and "quiet since" measures that session's silence.
153
+ - **The night no longer turns a missing record into "I didn't".** The dream and the page's
154
+ writers are told that finding no record of something is not a memory that it didn't happen,
155
+ so the page says it doesn't know instead. Guidance only: nothing checks a sentence.
156
+ - **`counterparts mechanisms` and the dashboard show Schemas as built.** The row said nothing
157
+ forms beliefs yet; it now counts the beliefs the nights formed, the ones adopted from a dream,
158
+ and the memories filed for and against them, and the dashboard's Schemas panel shows the
159
+ newest beliefs.
160
+
161
+ ## 0.3.37 — 2026-10-25
162
+
163
+ The wake says what the night did: a "Last night:" line under Yesterday, or, before the day's own nightly run, "The night of Oct 24: …" naming the latest night that finished. "Still open" counts what it leaves out calmly and points at `recall "still open"`, which lists every open item, and a terminal left open for hours reads "quiet since …" instead of "(live)". The Yesterday line can now open with day's end's own summary of yesterday, which in 0.3.36 never showed (a chapter's summary recorded no folder), also when yesterday's work spanned several folders. Ambient recall looks up memories by the meaning of what you just typed, not the exchange before it. **Privacy fixes:** a folder you have turned off no longer shows its chapter summaries ("Might be relevant") or its chapter titles (the Yesterday line) in another folder's session start, whichever way the wake arrives: built at session start, handed over as the last turn-end left it, or read back for a lost session. No store-format change (store v15, cache v7), no wiring change: `counterparts connect` is not needed after upgrading. Going back to 0.3.36 needs no store restore: `counterparts disconnect`, 0.3.36's install, then `counterparts connect`. Restart the dashboard and every Claude Code session afterwards so the long-running memory server and dashboard load the new version.
164
+
165
+ - **Recall's meaning lookup is about what you just asked.** Each turn now looks up memories by the meaning of
166
+ its own prompt, not the exchange before it, so a change of subject is followed at once rather than a turn
167
+ later. A store too large to look up in line on every turn still uses the previous exchange, as before.
168
+ Asking `recall` directly is unchanged. To go back: `recall.SEMANTIC_THIS_TURN` false.
169
+ - **Yesterday's line can open with day's end's summary again.** A chapter's summary memory was written with no
170
+ folder, so the privacy check behind "Yesterday, in day's end's words" refused every day with a chapter in it and
171
+ the summary never showed. A chapter's summary now records the folder its chapter was written in, and summaries
172
+ written before are read as written in their chapter's folder. Nothing in the store changes; the privacy check is
173
+ as strict as before.
174
+ - **The wake says what last night did.** A session start's wake has a "Last night:" line
175
+ under the Yesterday line: what the dream and the reflection did, by id and in a few
176
+ words ("dream drm_… made 11 links, 1 fold and 1 feeling; reflection rfl_… rewrote the
177
+ page"), or "a quiet night", or that the nightly run is under way; before the day's run it
178
+ names the latest night that finished (below). A store that has never had a night shows no line.
179
+ - **"Still open" counts the rest calmly.** The line under the open items reads "(96 more
180
+ open, kept quietly; recall "still open" lists them)" instead of a count of how many
181
+ were untouched for two weeks and five bare ids.
182
+ - **A terminal left open is quiet, not live.** "Today, elsewhere" (and "Here, also open")
183
+ says "open since 10-24 16:49, quiet since 07:12" for a session with no turn for two
184
+ hours, instead of "(live)".
185
+ - **A handoff's staleness reads in two parts.** "(1 day old, with a newer chapter here
186
+ since; release 0.3.34 then, 0.3.35 now)" where it said "1 day old; since then: a newer
187
+ chapter here; written on 0.3.34, 0.3.35 now".
188
+ - **Each turn's recall record says what kept memories from showing** (internal): near misses of the bar, habituation, full tiers, the byte budget and duplicates are counted beside the echo and project skips, along with whether a person started the turn. What shows is unchanged.
189
+ - **Yesterday's line can tell the whole day when you work in several folders.** Day's end's summary of
190
+ yesterday may now mention work from your other folders, the way "Today, elsewhere" already names their work.
191
+ Until now one cited piece of work from another folder kept the summary out, so for anyone who works in more
192
+ than one folder it almost never showed. A folder you have turned off or paused still keeps it out: if
193
+ yesterday touched one, the wake lists yesterday's chapters instead, as before.
194
+ - **A folder you have turned off no longer shows its chapter summaries under "Might be relevant"** in another
195
+ folder's session start. They were listed there before, whatever the folder's setting.
196
+ - **Recall can list what's still open.** `recall` with the handle "still open" lists every
197
+ open item the wake's "Still open" carries, in the wake's order, with ids, titles and how
198
+ long since each was touched, twenty to a page. Asking "what's still open?" or "open
199
+ threads" in facts mode gets the same list. The wake's count under "Still open" now points
200
+ at it: "(94 more open, kept quietly; recall "still open" lists them)".
201
+ - **The first wake of the day says what the last night did.** Before the day's nightly run,
202
+ the night line describes the latest night that finished, dated by the day it read ("The
203
+ night of Oct 24: dream drm_… made 11 links, 1 feeling and 1 fold; reflection rfl_…
204
+ rewrote the page."), instead of "Last night: none yet today". A night more than three
205
+ days back says so: "The night of Oct 19 was the last to run: …".
206
+ - **A folder you have turned off keeps its chapter summaries out of "Might be relevant" in other folders, also
207
+ when a session start hands over the wake as the last turn-end wrote it** (for example, in a second app with a
208
+ different size limit).
209
+ - **That wake's "Yesterday" line is the one this folder's own wake would carry**, so a turned-off folder's chapter
210
+ titles are no longer in it. The wake the crash fallback reads a lost session with leaves chapter summaries out
211
+ too.
212
+
3
213
  ## 0.3.36 — 2026-10-25
4
214
 
5
215
  A session opened mid-day now sees what this folder did earlier today (a "Today so far here" line), and the Yesterday line opens with day's end's own summary of yesterday when everything it rests on may be shown in this folder; on a tight day, "Still open" keeps its items before "Today so far" keeps its summaries. When you write the newer state of a recent memory without linking it, a turn that brings back both shows the newer one first and labels the older one "may be out of date". A word that brought a memory back, which the session then used, is wired to it, so next time the word alone can bring it back. The core is decided every night instead of every third (still at most three a night), and a belief you repeat awake counts as support for the one that already says it. A new way of deciding the core, by how much real use has backed a memory, runs **in shadow only**: it records each night what it would have let in or kept out, and nothing changes yet. **This release changes the store's format (v14 to v15, one new table), so after installing, quit the dashboard and every open Claude Code session, then start them again**: one left running from before the update keeps the old code against the upgraded store and stops working on it until it is restarted. The first open saves a copy of your store before upgrading it. **0.3.35 and older refuse the upgraded store**, so going back to 0.3.35 is `counterparts rollback` first, while 0.3.36 is still installed (it puts that pre-upgrade copy back; anything remembered since is set aside, not deleted), then 0.3.35's install and `counterparts connect` as it prints. Cache v7 unchanged; no wiring change, so `counterparts connect` is not needed after upgrading.
@@ -26,8 +26,9 @@ thing and is safe to run again. It asks two things, and you can skip either of t
26
26
 
27
27
  - **Your name**, so the memory knows what to call you.
28
28
  - **Whether to connect Claude Code.** This adds five hooks to `~/.claude/settings.json`
29
- (it keeps a backup first) and registers the memory tools. Hooks from other tools are
30
- left alone.
29
+ (it keeps a backup first), registers the memory tools, and adds one `deniedMcpServers`
30
+ entry so the Counterparts Online connector never loads into Claude Code as a second memory.
31
+ Hooks and settings from other tools are left alone.
31
32
 
32
33
  There are no API keys. Search by meaning is turned on for you and runs on your machine;
33
34
  nothing leaves it except through Claude Code itself.
@@ -107,16 +108,20 @@ bun add -g counterparts@latest
107
108
  Your memory isn't changed by an upgrade. Open sessions keep running the old version until
108
109
  they restart.
109
110
 
110
- Coming from 0.3.13 or earlier, or from 0.3.14 with Claude Desktop connected, run this
111
- once after upgrading. If you connected Claude Desktop, quit it first:
111
+ Coming from 0.3.37 or earlier, run this once after upgrading. If you connected Claude
112
+ Desktop, quit it first:
112
113
 
113
114
  ```
114
115
  counterparts connect
115
116
  ```
116
117
 
117
- It rewrites the hooks, the memory server's registration and Claude Desktop's entry so
118
- that Bun no longer reads a project's `.env` or `bunfig.toml` into them. Until then
119
- `counterparts doctor`'s Runtime line is amber. Desktop rewrites its own config file while
118
+ It adds one entry to `deniedMcpServers` in `~/.claude/settings.json`, so a claude.ai
119
+ connector to Counterparts Online is never loaded into Claude Code as a second memory
120
+ beside this one, leaving everything else in the file as it is. Until then `counterparts
121
+ doctor`'s Online line is amber. Coming from 0.3.13 or earlier, or from 0.3.14 with Claude
122
+ Desktop connected, it also rewrites the hooks, the memory server's registration and Claude
123
+ Desktop's entry so that Bun no longer reads a project's `.env` or `bunfig.toml` into them;
124
+ until then the Runtime line is amber too. Desktop rewrites its own config file while
120
125
  it's open, so `connect` leaves Desktop's entry alone while Desktop runs, and says so.
121
126
 
122
127
  If you set it up before search by meaning was built in, it turns on by itself after the
@@ -24,7 +24,7 @@ code and the `NOTES.md` / `INTERFACE-GAPS.md` next to it.*
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
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
- | `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. |
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 — never a memory row, but since 2026-10-27 (D1) recalled by what it was about, labelled `[dream]`; an ordinary question stops reaching it unless it is recalled or retold (`recalled.ts`). 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
29
  | *(`reconsolidation.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** as `contradictions.ts`; **renamed 2026-10-11** (Group 2: noticing and updating are one process; the tables keep their names). |
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`).** |
@@ -45,11 +45,13 @@ input — does `encode` shrink to gates-and-tagging inside `remember`'s pipeline
45
45
  | `mcp/` | Deliberate tools, ten: remember, 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**), and `meet`, the first meeting (**2026-10-11**, `core/onboarding.ts`). A result's words about the host come from `hosts.ts`. For a Claude Desktop client (by its name at `initialize`, **2026-09-30**) an eleventh, `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`. |
46
46
  | `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. |
47
47
  | `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).** |
48
+ | `remote/` | The memory server as a web connector (**2026-10-26**, the claude.ai trial): `http.ts` serves the same `McpServer` as MCP over HTTP (plain JSON, no SSE), bound to 127.0.0.1 and answering only under a per-run 192-bit secret path, one message at a time; `call-log.ts` keeps one id-only line per call; `bin/serve-http.ts` refuses a store or configuration nobody named and the owner's live stores. Its host is claude.ai's (`claude-ai:`), set at launch. No sign-in yet (its CONTRACT). |
48
49
  | `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`). |
49
50
  | `expansions.ts` | The same shape, for the other direction: the handle-resolution log the MCP `recall` tool writes (`<dataDir>/sessions/expansions.jsonl` — a per-store SALTED hash of the handle (G58), the id it reached or `null` for a refusal, a timestamp, the project) and the boundary's credit pass reads, so an expansion by TITLE credits the memory it actually reached, and a refusal shadows it. **Added 2026-09-15** (LAUNCH-STATUS G50): `recall/reference.ts` credits literal `mem_…` addresses and resolves nothing, so until this the most deliberate act a session had — naming a memory and reading it — earned no credit at all. |
50
51
  | `scopes.ts` | The third shared leaf: the per-directory scope registry (`scopes.json` BESIDE the config, never inside the store, because the hook decides `off` before anything opens) — `on` / `observer` / `off` / `paused`, longest prefix wins, absent-or-unreadable meaning `unset` meaning on. Written by the `counterparts scope` console and the MCP `scope` tool, read by every hook. **Added 2026-09-15** (PR #92, G19): the hooks are registered globally, so until this the only way to say *not here* was a second config file and two environment variables. |
51
52
  | `lifecycle.ts` | The host seam (**2026-09-30**): `HostLifecycle`, the interface a host adapter drives, and `Lifecycle`, its one implementation — what a session is to this memory whatever the host: the wake's composition and the registry's expectation of it, plain reminders, recall for a turn, the boundary (capture, the retroactive-capture seal, credit, the orphan tail), the ask's pacing (not its words), the next-session write-up pointer, every registry write, and the worker spawn with its counters. `claude-code/`'s `ClaudeCodeAdapter` extends it. Imports no adapter. |
52
- | `hosts.ts` | Which host a session lives in (`claude-code` is the default, and what a registry record with no `host` reads as) and the few sentences that depend on it — how to reconnect after an update, what switching the scope does — plus Claude Desktop's: the host name, its pseudo-scope `claude-desktop:` (a name, never resolved as a path), which MCP clients are Desktop, and the Code tab's scratch workspaces. **Added 2026-09-30.** |
53
+ | `hosts.ts` | Which host a session lives in (`claude-code` is the default, and what a registry record with no `host` reads as) and the few sentences that depend on it — how to reconnect after an update, what switching the scope does — plus Claude Desktop's: the host name, its pseudo-scope `claude-desktop:` (a name, never resolved as a path), which MCP clients are Desktop, and the Code tab's scratch workspaces. **Added 2026-09-30.** Since **2026-10-26** a second hookless chat host, claude.ai over the web (`claude-ai`, place `claude-ai:`), chosen by the launch and never by the client's name. |
54
+ | `update-words.ts` | How to get a newer Counterparts into a window, by install route: the plugin's update and the npm command (moved from `claude-code/doctor-meaning.ts`, which re-exports them), `/reload-plugins` and its limits, and what an older copy says when it meets a memory a newer one upgraded — reload when Claude Code records a newer plugin, update otherwise, Reconnect for an npm server. Shared by the MCP server's refusal, the hook's stand-down and doctor, which may not import each other. **Added 2026-10-27 (U1a).** |
53
55
  | `config.ts` | The host configuration's shape and reader (`AdapterConfig`, `loadConfig`, `TUNABLES`, capabilities) — read by the hooks, the worker, the console and the MCP server. Moved out of `claude-code/` on **2026-09-30**. |
54
56
  | `config-path.ts` | Where every entry point looks for that configuration: `--config`, else `COUNTERPARTS_CONFIG`, else `~/.counterparts/claude-code.json`; a named configuration that cannot be honoured refuses rather than falling back. |
55
57
  | `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. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "counterparts",
3
- "version": "0.3.36",
3
+ "version": "0.3.38",
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": {
@@ -830,9 +830,31 @@ children's output (the host's cut, below, is read from the host's own transcript
830
830
  finished) and the exit as its reason;
831
831
  - `failed` or `timed-out`: nothing finished;
832
832
  - `could-not-start`: `no-claude`, `spawn-failed`, `quick-exit` (non-zero inside
833
- `NIGHT_QUICK_EXIT_MS` with nothing begun), `nothing-ran` (a clean exit that began no dream
833
+ `NIGHT_QUICK_EXIT_MS` of the failing child's own start, with nothing begun), `signed-out`
834
+ (2026-10-27: a failed child said the host had lost its sign-in — a 401, "not logged in",
835
+ an invalid key, an expired OAuth token), `nothing-ran` (a clean exit that began no dream
834
836
  and no reflection), `refused`, or `runner` (the detached process could not be started).
835
837
 
838
+ **[M] A failed child says why (2026-10-27, R4; `child-error.ts`).** For a child that exits
839
+ non-zero, one line of what the host said goes on the row's `detail` (`exit`, `quick-exit`,
840
+ `signed-out`, and `partial` by `exit`), on that child's line (`NightChildRun.detail`), on the
841
+ `dream.night` event (`detail`, `childDetails`), and on the write-up row (`detail`; the night
842
+ row's is `catch-up: <line>`). Where it comes from, when the child's output is kept: a result
843
+ that is the host's API error (`terminal_reason: "api_error"`, an `api_error_status`, or
844
+ `subtype: "success"` with `is_error`) gives its reason, status and text; any other error result
845
+ gives only its subtype and status, with the STDERR line beside them — its text may be the
846
+ model's. Else the STDERR line: the last that reads as an error (`error|denied|invalid|failed|
847
+ not logged`), else the last (every child pipes STDERR now; its last `STDERR_TAIL_BYTES` kept).
848
+ At most 300 characters, one line, ANSI and OSC sequences out, home paths as `~`, and scrubbed
849
+ by shape before it is stored or logged (`child-error.ts#scrubSecrets`): `Authorization` with
850
+ its scheme and value, all of a `Cookie:`, the word after `Bearer`, the value after a credential
851
+ label (`…token`, `…key`, `api key`, `secret`, `password`, `pw`, …) bare, JSON or quoted with `:`
852
+ or `=` — and with only a space when the value has a digit or is 16+ long — the prefixes `sk-`,
853
+ `ghp_`/`github_pat_`, `xox?-`, `AKIA`, and any run of 20+ key-ish characters with a digit in it
854
+ become `[redacted]`. `signed-out` is read only from the host's own words (an API-error result,
855
+ a 401 status, or the STDERR line), never a bare "401" or "OAuth", and only when the run began
856
+ nothing. No flag is added to the child, and nothing is retried.
857
+
836
858
  **[M] The child is locked down (owner decision B).** `--permission-mode default`;
837
859
  `--allowedTools` exactly `mcp__counterparts__dream`, `…reflect`, `…self_page`, `…recall`;
838
860
  `--disallowedTools` the built-ins that run commands or code, read, search or write files,
@@ -1082,14 +1104,14 @@ the sweep no interpreter; its gate row says `not-opted-in` and `runner.done` say
1082
1104
  next-session`. A crashed session is pointed at like any other. An old `crashWriteUp` value
1083
1105
  is ignored and named in `retired`.
1084
1106
 
1085
- **[M] Doctor: `Catch-up` (was `Write-ups`, and before that `Crash write-up`; same key), and the `Sweep` line.** Since 2026-09-30 the line reads the coverage ledger — yesterday's state, amber on a stretch owed from yesterday or earlier, the week's lapses (`core/coverage/NOTES.md` §8). Before it, `Crash write-up`: `next session`
1107
+ **[M] Doctor: `Catch-up` (was `Write-ups`, and before that `Crash write-up`; same key), and the `Sweep` line.** Since 2026-09-30 the line reads the coverage ledger — yesterday's state, amber on an OVERDUE stretch (since S2c, 2026-10-26: a catch-up ran on a later date and left it owed, or two days of use with no catch-up since; until then any stretch from yesterday or earlier), the week's lapses (`core/coverage/NOTES.md` §8). Before it, `Crash write-up`: `next session`
1086
1108
  green; amber when a session is finished in one project and waiting on words it left in
1087
1109
  another, naming that project (re-review m-C); amber when the newest pointer outcome is a
1088
1110
  DEFERRAL and sessions are waiting — saying the wake was too full, by how many bytes, and to lower
1089
1111
  `injectionBudgetBytes` by that much (never "open a session", which would defer again);
1090
1112
  and (until 2026-09-30, when the `Write-ups` rule above replaced it) amber when a session had
1091
- waited past a 3-day `WRITE_UP_WAIT_DAYS`. Counted with the pointer's own eligibility: a small
1092
- debt the pointer never offers (not known as a person's session) is named apart, as left to lapse. Never red; not in the session-start reading. `Sweep`: `not-opted-in` —
1113
+ waited past a 3-day `WRITE_UP_WAIT_DAYS`. Counted with the pointer's own eligibility: a
1114
+ debt the pointer never offers (short, and headless or with no session record — counted by reason since S2c) is named apart, as left to lapse. Never red; not in the session-start reading. `Sweep`: `not-opted-in` —
1093
1115
  and an older build's `no-credential` — is green `next session`.
1094
1116
 
1095
1117
  ## 6. Scars honored
@@ -2707,3 +2707,75 @@ running both, found confusing. The npm install now leaves `npm-live.json` beside
2707
2707
  in a night child; the check above left them out), and whether `--system-prompt` changes
2708
2708
  what of the user's CLAUDE.md reaches the child. A model night after release, or the
2709
2709
  coordinator's `childUsage` per child, says.
2710
+
2711
+ ## 2026-10-27 — a failed night child says why (R4)
2712
+
2713
+ Night run nrn_8f332b7d176d (10-27, 2.1.311) ended "claude exited with an error (exit 1)":
2714
+ the catch-up did one batch in 55 s and exited 1; writer, dream and tags each exited 1 in
2715
+ ~3 s with 0 tokens. Nothing of what the host said was kept, so the cause was unrecoverable.
2716
+ It was a lost sign-in: the owner switched Claude Code accounts mid-run.
2717
+
2718
+ - **Measured on 2.1.311 with no sign-in** (an empty `CLAUDE_CONFIG_DIR`, so no hooks and no
2719
+ login): `claude -p` exits 1 and writes `Not logged in · Please run /login` to STDOUT — under
2720
+ `stream-json` an `init` line, a synthetic assistant message, and a `result` line with
2721
+ `is_error: true`, `subtype: "success"`, `terminal_reason: "api_error"`,
2722
+ `api_error_status: null` and all-zero usage (so the row reads 0 tokens rather than none).
2723
+ STDERR is empty. An unknown flag goes to STDERR (`error: unknown option '--x'`), STDOUT
2724
+ empty. So `subtype` is not the test of an error; `is_error` is.
2725
+ - **The catch-up child reads only its STDERR**: its output is text, not kept (it is prose),
2726
+ and the brief adds no flag. A sign-in lost during a write-up therefore leaves the write-up
2727
+ row's `detail` empty; the night's own row gets the line from the dream's child, which keeps
2728
+ its `stream-json`. If a write-up's reason is ever needed alone, keeping its text STDOUT's
2729
+ last line on a non-zero exit is the smallest step (open).
2730
+ - **Quick by the child's own time.** The run's quick-exit test counted from the run's start,
2731
+ catch-up included: a 55-second catch-up made three 3-second exits read `exit`, not
2732
+ `quick-exit` (the reflection, judged on the dream child's own time, was skipped as quick).
2733
+ It now uses the failing child's own `ms`.
2734
+ - **STDERR is piped for every child**, so the exit-then-grace end (once only for children
2735
+ whose STDOUT was kept) now holds for all: a helper holding the pipe cannot hold the run.
2736
+ - **Review of #656 narrowed both readings.** A result's text is read only when it is the
2737
+ host's API error. `max_turns` and `error_during_execution` results can carry the model's
2738
+ words (memory text), so for those only the subtype and status are kept. `signed-out` is
2739
+ read only from the host's own words: no bare "401" ("retry after 401 seconds") and no
2740
+ bare "OAuth" ("the OAuth flow"). It is also gated on nothing having begun, because
2741
+ `fellBack` asks on any `could-not-start`, and a dream that began is resumed instead. The
2742
+ scrub gained JSON, quoted and space-separated labels, Basic auth, whole cookies, `pw=`
2743
+ and the digitless prefixed keys (`ghp_`, `xox?-`, `AKIA`). STDERR prefers its last
2744
+ error-shaped line. OSC sequences are stripped, and home paths become `~`.
2745
+
2746
+ ## 2026-10-27 — the wake says so when search by meaning can't run (W1)
2747
+
2748
+ A plugin install ran for days with no meaning weights (`NO_WEIGHTS`): the plugin's dependency
2749
+ step had not run, nothing self-heals (Bun auto-install is off on purpose), and only doctor's
2750
+ amber line said so. Now `doctor-meaning.ts#wakeMeaningLine` gives the session-start wake one
2751
+ line for the model to tell its person, under the clock beside the Code tab's line (outside the
2752
+ wake block, so the sentinel's byte count is untouched). Desktop's `wake` carries the same line
2753
+ in its notice slot (`mcp/bin/serve.ts#desktopWakeNotice`).
2754
+
2755
+ - **Configured on and can't run, nothing else, and only to a person.** Off by choice, an
2756
+ observer, a resume's short wake, and any start `watchedAtStart` refuses (the headless night,
2757
+ `claude -p`/SDK, a compaction) say nothing; Desktop's `wake` with `night: true` neither.
2758
+ - **`missing`**: this process finds no whole table (both files). The hook's environment is the
2759
+ worker's, so this is the look the worker makes, and it fires before any boundary too (a fresh
2760
+ plugin install's first wake). A worker row that still says `NO_WEIGHTS`/`MISSING_FILE` while
2761
+ the table is whole now reads as restored: silent until the next row.
2762
+ - **`unloadable`**: the newest row's refusal is any other code; it stands until the next row.
2763
+ - **`stopped`**: `adapter.runner.failed` with `step: "vectors"` on two separate dates, with no
2764
+ backfill row since the earlier one. One failure is not enough (review of #664): the runner
2765
+ latches one row per step per date, and its `vectors` step covers the lagged cue as well as
2766
+ the backfill, so a single throw is one bad boundary. Said at most once a day
2767
+ (`adapter.meaning.stopped.told`, the date; an unattended start does not spend it).
2768
+ `missing`/`unloadable` are said every wake until fixed: the person is the fix.
2769
+ - **A backfill "stuck at 0" was dropped** (review of #664). The static table blames every miss on
2770
+ the memory (`vectors.ts`, `isStatic`) and sets it aside on its third (`EMBED_SKIP_AFTER`), so
2771
+ `remaining` falls — `test/wake-meaning-off.test.ts` runs three real backfills to show it. What
2772
+ can stay flat is the store refusing vectors (`refused:` codes; doctor's held / cache-ahead
2773
+ lines) or counter writes lost to a lock: neither is a person's fix, and both are doctor's.
2774
+ - **One route rule.** `byRoute`, `PLUGIN_UPDATE`, `PLUGIN_TABLE_UPDATE`, `npmTableCommand` and
2775
+ `tableOnDisk` moved here from `doctor.ts`; doctor's fix lines and `install`'s hint use them
2776
+ too. The npm route reinstalls Counterparts with the runtime it runs on (`npm install -g
2777
+ counterparts` under Node, `bun add -g counterparts` under Bun): the table is its own
2778
+ dependency, and a separate global `counterparts-model-potion` is not where
2779
+ `resolveStaticWeights` looks. The table is "found" only with both files, as the loader needs.
2780
+ `stopped` points at doctor (`/counterparts:doctor`, or `counterparts doctor` in a terminal).
2781
+ - **Not covered**: `held` and `cache-ahead` (the store withdrawing the channel) stay doctor's.
@@ -14,10 +14,10 @@
14
14
  */
15
15
  import { readFileSync } from "node:fs";
16
16
  import { homedir } from "node:os";
17
- import { resolve } from "node:path";
17
+ import { join, resolve } from "node:path";
18
18
  import { fileURLToPath } from "node:url";
19
19
 
20
- import { DATA_DIR_ENV, dataDir, describeGuardRefusal } from "../../../core/store/index.js";
20
+ import { DATABASE_FILE, DATA_DIR_ENV, dataDir, describeGuardRefusal, isStoreError } from "../../../core/store/index.js";
21
21
  import {
22
22
  defaultConfigPath,
23
23
  implicitConfigRefusal,
@@ -51,14 +51,20 @@ import { NIGHT_RUN_ENV } from "../night-run.js";
51
51
  import {
52
52
  CONFIG_REFUSED,
53
53
  CONFIG_UNREADABLE,
54
+ aheadWriter,
54
55
  classifyStandDown,
55
56
  decideSay,
57
+ newerStoreSay,
56
58
  readMark,
57
59
  writeMark,
58
60
  } from "../standdown.js";
61
+ import { CODE_TAB_ENTRYPOINT } from "../../hosts.js";
62
+ import { newerStoreWords } from "../../update-words.js";
59
63
  import type { SaysSoHook, StandDownFault } from "../standdown.js";
60
64
  import { readTranscript } from "../transcript.js";
61
65
  import { BINARY, entryScript, scriptArgs } from "../../runtime.js";
66
+ import { usePrivateUmask } from "../../private-umask.js";
67
+ import { tightenInstallBase } from "../../private-base.js";
62
68
  import type { Binary } from "../../runtime.js";
63
69
  import { noteNpmLive, npmWiringForGate } from "../../npm-live.js";
64
70
  import {
@@ -70,6 +76,7 @@ import {
70
76
  installRoute,
71
77
  markTwiceSaid,
72
78
  pluginOrigin,
79
+ recordedForThisCopy,
73
80
  runningAsPlugin,
74
81
  takeFirstRunNotice,
75
82
  twiceNoticePath,
@@ -566,8 +573,11 @@ interface Said {
566
573
  * ONE LINE ON STDERR ALWAYS — AND, WHEN THIS WAS A FAULT, ONE RED LINE WHERE
567
574
  * THE OWNER WILL SEE IT.
568
575
  *
569
- * Exit code is untouched (0, always) and nothing else is injected: no wake, no
570
- * context, just the `systemMessage` the host displays. WHAT to say and WHETHER
576
+ * Exit code is untouched (0, always) and no wake is injected: just the
577
+ * `systemMessage` the host displays — and, for the one fault that has a line
578
+ * for the model (`StandDownFault.say`: a memory a newer Counterparts upgraded),
579
+ * that line as `additionalContext`, so the model does not act as if it
580
+ * remembers. WHAT to say and WHETHER
571
581
  * to say it is `standdown.ts#decideSay`'s, which is the rule that tells a store
572
582
  * that will not open from a database that was merely busy; this function is the
573
583
  * process end of it — the two channels, the mark, and the ordering.
@@ -592,10 +602,61 @@ function standDown(
592
602
  // still one this session has met, and the count is what decides the next one.
593
603
  writeMark(dataDir, said.sessionId, decision.mark);
594
604
  if (decision.message === null) return;
595
- process.stdout.write(JSON.stringify({ systemMessage: decision.message }));
605
+ // A FAULT WITH A LINE FOR THE MODEL TOO (U1a: a memory a newer Counterparts
606
+ // upgraded) rides the envelope the paused notice does (`sayPaused`): the
607
+ // person's line as `systemMessage`, the model's as `additionalContext`.
608
+ process.stdout.write(
609
+ decision.model === null
610
+ ? JSON.stringify({ systemMessage: decision.message })
611
+ : hostDelivery(said.hook, { injection: decision.model, ask: null }, {}, [decision.message]).stdout,
612
+ );
596
613
  said.wroteStdout = true;
597
614
  }
598
615
 
616
+ /**
617
+ * THE STAND-DOWN'S WORDS FOR A STORE A NEWER COUNTERPARTS UPGRADED (U1a,
618
+ * 2026-10-27), or the fault unchanged. The step is this copy's route's
619
+ * (`update-words.ts#newerStoreWords`): a hook is the code installed at its own
620
+ * path, so on npm a store ahead of it means the install is the older one
621
+ * (update); on the plugin it is the folder Claude Code loaded for this window,
622
+ * and `installed_plugins.json` says whether `/reload-plugins` would load a
623
+ * newer one (reload) or not (update first). Read only when the fault is this
624
+ * one; never throws — a fact it cannot read gives the update words.
625
+ *
626
+ * THE WRITER TOO (F1, after the review of #666): reload only into a record at
627
+ * least as new as the version that upgraded the memory. The store refused to
628
+ * open, so its wake stamp is read from the database file on its own
629
+ * connection (`standdown.ts#aheadWriter`): the path the refusal named, else
630
+ * the configured store's (the cache's refusal names none). Read off the npm
631
+ * route only, as the server does — npm's step is the update either way.
632
+ */
633
+ function withNewerStoreWords(
634
+ fault: StandDownFault | null,
635
+ payload: Record<string, unknown>,
636
+ err: unknown,
637
+ storeDir: string | undefined,
638
+ ): StandDownFault | null {
639
+ if (fault === null || fault.code !== "SCHEMA_AHEAD") return fault;
640
+ try {
641
+ const route = installRoute(process.env);
642
+ const cwd = process.env["CLAUDE_PROJECT_DIR"] ?? eventDirectory(payload);
643
+ const loaded = installedVersion();
644
+ const named = isStoreError(err) ? err.detail["path"] : undefined;
645
+ const dbPath = typeof named === "string" ? named : storeDir === undefined ? null : join(storeDir, DATABASE_FILE);
646
+ const words = newerStoreWords({
647
+ route,
648
+ who: "hook",
649
+ loaded,
650
+ recorded: route === "npm" ? null : recordedForThisCopy({ home: homedir(), env: process.env, cwd }),
651
+ writer: route === "npm" ? null : aheadWriter(dbPath, loaded),
652
+ codeTab: (process.env["CLAUDE_CODE_ENTRYPOINT"] ?? "") === CODE_TAB_ENTRYPOINT,
653
+ });
654
+ return newerStoreSay(fault, words);
655
+ } catch {
656
+ return fault;
657
+ }
658
+ }
659
+
599
660
  /**
600
661
  * A configuration refusal as a REASON clause. `config-path.ts` writes its
601
662
  * sentences to stand alone on stderr, so each opens with `refused: ` — which
@@ -708,7 +769,7 @@ async function main(): Promise<void> {
708
769
  const remedy = `Set "dataDir" in ${choice.path}, or set ${DATA_DIR_ENV}.`;
709
770
  standDown(said, {
710
771
  line: describeGuardRefusal(err, remedy) ?? detail,
711
- fault: classifyStandDown(err),
772
+ fault: withNewerStoreWords(classifyStandDown(err), payload, err, said.dataDir),
712
773
  marker: true,
713
774
  });
714
775
  }
@@ -837,6 +898,8 @@ async function runHook(
837
898
  // From here the configuration was understood, so the store it names is the one
838
899
  // a stand-down may leave its once-per-session mark under.
839
900
  said.dataDir = loaded.dataDir;
901
+ // The install's base directory, private (R1, `private-base.ts`): once a session.
902
+ if (name === "session-start" && loaded.dataDir !== undefined) tightenInstallBase(choice.path, loaded.dataDir);
840
903
  // THE SESSION'S OWN DIRECTORY — the one everything this event captures will be
841
904
  // FILED under, whatever directory the agent's shell has wandered into. It is
842
905
  // resolved here rather than above because its first source is the session
@@ -1096,6 +1159,7 @@ export function isEntryPoint(argv1: string | undefined, url: string, binary: Bin
1096
1159
  /** Run the hook and exit — what this file does as a script, and what the
1097
1160
  * single binary's `hook` mode calls. */
1098
1161
  export function start(): void {
1162
+ usePrivateUmask();
1099
1163
  void main().then(
1100
1164
  () => process.exit(process.exitCode === 2 ? 2 : 0),
1101
1165
  (err: unknown) => {
@@ -13,6 +13,7 @@
13
13
  */
14
14
  import { implicitConfigRefusal, namedConfigRefusal, namedUnreadableRefusal } from "../../config-path.js";
15
15
  import { openLog } from "../../log/index.js";
16
+ import { usePrivateUmask } from "../../private-umask.js";
16
17
  import { nightChildrenWords } from "../../../core/dream/index.js";
17
18
 
18
19
  import { NIGHT_KIND_ENV, NIGHT_RUN_ENV, openNightCounterpart, readKind, runNight } from "../night-run.js";
@@ -90,6 +91,7 @@ function standDown(config: Parameters<typeof openNightCounterpart>[0], run: stri
90
91
  /** The nightly run, then exit — what this file does as a script, and what the
91
92
  * single binary's `nightly` mode calls. */
92
93
  export function start(): void {
94
+ usePrivateUmask();
93
95
  void main().then(
94
96
  () => process.exit(0),
95
97
  (err: unknown) => {
@@ -85,6 +85,7 @@ import type { Store } from "../../../core/store/index.js";
85
85
  import { hostSessionEvidence, installedVersion, writeUpSources } from "../../sessions.js";
86
86
  import { openLog } from "../../log/index.js";
87
87
  import { BINARY } from "../../runtime.js";
88
+ import { usePrivateUmask } from "../../private-umask.js";
88
89
  import type { Binary } from "../../runtime.js";
89
90
 
90
91
  import {
@@ -750,6 +751,7 @@ async function main(): Promise<void> {
750
751
  /** One worker run, then exit — what this file does as a script, and what the
751
752
  * single binary's `runner` mode calls. */
752
753
  export function start(): void {
754
+ usePrivateUmask();
753
755
  void main().then(
754
756
  () => process.exit(0),
755
757
  (err: unknown) => {