counterparts 0.3.14 → 0.3.16
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.
- package/CHANGELOG.md +236 -0
- package/docs/QUICKSTART.md +22 -0
- package/docs/README.md +1 -0
- package/package.json +1 -1
- package/src/adapters/claude-code/CONTRACT.md +85 -6
- package/src/adapters/claude-code/INTERFACE-GAPS.md +9 -2
- package/src/adapters/claude-code/NOTES.md +376 -0
- package/src/adapters/claude-code/bin/hook.ts +258 -33
- package/src/adapters/claude-code/claim.ts +625 -0
- package/src/adapters/claude-code/doctor.ts +222 -23
- package/src/adapters/claude-code/envelope.ts +6 -15
- package/src/adapters/claude-code/hooks.ts +86 -76
- package/src/adapters/claude-code/index.ts +2 -2
- package/src/adapters/cli/CONTRACT.md +5 -0
- package/src/adapters/cli/NOTES.md +25 -0
- package/src/adapters/cli/bin/counterparts.ts +38 -0
- package/src/adapters/cli/commands.ts +147 -12
- package/src/adapters/cli/desktop.ts +112 -7
- package/src/adapters/cli/help.ts +10 -0
- package/src/adapters/cli/install.ts +77 -10
- package/src/adapters/cli/self-page.ts +32 -9
- package/src/adapters/cli/wire.ts +14 -1
- package/src/adapters/config.ts +24 -11
- package/src/adapters/dashboard/registries.ts +3 -0
- package/src/adapters/dashboard/web/flow.ts +1 -0
- package/src/adapters/dashboard/web/lanes.ts +1 -0
- package/src/adapters/dashboard/web/narrate.ts +11 -0
- package/src/adapters/dashboard/web/pages/health/sections/wake.js +9 -3
- package/src/adapters/dashboard/web/views/health.ts +15 -9
- package/src/adapters/dashboard/web/views/mind.ts +7 -0
- package/src/adapters/fired.ts +10 -0
- package/src/adapters/host-wiring.ts +108 -14
- package/src/adapters/hosts.ts +41 -10
- package/src/adapters/mcp/CONTRACT.md +4 -3
- package/src/adapters/mcp/NOTES.md +28 -2
- package/src/adapters/mcp/bin/serve.ts +17 -2
- package/src/adapters/mcp/index.ts +1 -0
- package/src/adapters/mcp/server.ts +124 -20
- package/src/adapters/mcp/tools.ts +12 -8
- package/src/adapters/plugin-run.sh +8 -1
- package/src/adapters/plugin.ts +239 -39
- package/src/adapters/scopes.ts +78 -0
- package/src/adapters/sessions.ts +8 -2
- package/src/core/briefing.ts +28 -6
- package/src/core/counterpart.ts +119 -15
- package/src/core/dream/index.ts +1 -1
- package/src/core/dream/reflect.ts +119 -10
- package/src/core/fit/index.ts +4 -0
- package/src/core/handoff/NOTES.md +22 -0
- package/src/core/handoff/index.ts +2 -1
- package/src/core/handoff/last-here.ts +21 -8
- package/src/core/prospective/CONTRACT.md +3 -1
- package/src/core/prospective/NOTES.md +19 -0
- package/src/core/prospective/index.ts +34 -4
- package/src/core/recall/time-ask.ts +37 -18
- package/src/core/self/CONTRACT.md +87 -32
- package/src/core/self/INTERFACE-GAPS.md +22 -0
- package/src/core/self/NOTES.md +290 -0
- package/src/core/self/briefing.ts +738 -129
- package/src/core/self/identity.ts +13 -1
- package/src/core/self/index.ts +451 -97
- package/src/core/self/page.ts +163 -85
- package/src/core/self/tunables.ts +24 -17
- package/src/core/self/writer.ts +34 -5
- package/src/core/store/NOTES.md +5 -2
- package/src/core/store/db.ts +26 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,241 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.16 — 2026-10-10
|
|
4
|
+
|
|
5
|
+
The self page is kept whole up to 16 KB, and when it doesn't fit, the wake steps down to
|
|
6
|
+
something whole instead of cutting it: the page, a short version written with it, an
|
|
7
|
+
outline, the headings, or one line saying where to read it. At the default 9,000-byte
|
|
8
|
+
ceiling the page's room is now 5,681 bytes (it was 6,078). Dated items come before the
|
|
9
|
+
wake's furniture: an "Arriving:" item or a plain reminder due today is listed before the
|
|
10
|
+
handoffs, "Last here" and "Work here" take their room, and doctor's Wake line turns amber
|
|
11
|
+
when one still goes unlisted. A paused folder says so in one line when a session starts.
|
|
12
|
+
Each field of a hook's output is now held to Claude Code's 10,000-character limit on its
|
|
13
|
+
own, so a red doctor notice shows beside a full wake. A damaged claims file mends itself,
|
|
14
|
+
a late twin of a session's first start stands down, and every `counterparts scope` command
|
|
15
|
+
Claude is shown names its folder. The plugin's first-run line is back, and its sidebar
|
|
16
|
+
lights every mechanism an event proves. **Nothing to run after upgrading from 0.3.15**:
|
|
17
|
+
the hooks, the memory server's registration and Claude Desktop's entry are the same as
|
|
18
|
+
0.3.15's (coming from 0.3.14 or earlier, see those versions' notes on `counterparts
|
|
19
|
+
connect`). **No change to the store's format (still v12)**: a page's short version is kept
|
|
20
|
+
in the page's own record, which 0.3.15 reads past. Going back to 0.3.15 is the order in
|
|
21
|
+
QUICKSTART's "Going back to an earlier version": `counterparts disconnect` while 0.3.16 is
|
|
22
|
+
still installed, then the 0.3.15 reinstall, then `counterparts connect`.
|
|
23
|
+
|
|
24
|
+
The self page in the wake (#363).
|
|
25
|
+
|
|
26
|
+
- **A long self page is kept, not refused, and the wake steps down to something whole.**
|
|
27
|
+
0.3.15 refused a page past 6,078 bytes. Now the page is kept whole up to 16,384 bytes,
|
|
28
|
+
and the wake shows the first of these that fits, each one whole: the page; a short
|
|
29
|
+
version its writer wrote with it; each section's heading and first sentence; the
|
|
30
|
+
headings alone; or one line saying where to read it. Each starts with a line giving the
|
|
31
|
+
page's size and the line it ends with — "if you don't see that line, it was cut off:
|
|
32
|
+
read it whole with the self_page tool or `counterparts self-page`" — and ends with that
|
|
33
|
+
line. The page's room at the default 9,000-byte ceiling is now 5,681 bytes (it was
|
|
34
|
+
6,078; the new top and end lines and the wake's opening line take the difference): a
|
|
35
|
+
page within it always shows whole, even on a day the wake also holds handoffs and
|
|
36
|
+
"Work here" lines, and a longer one still shows whole on most days, borrowing the room
|
|
37
|
+
held for "Work here". The nightly writer, the reflection and the self_page tool are told
|
|
38
|
+
to aim under it and, when a page runs past it, asked for a short version in the same
|
|
39
|
+
call (the tool's new `short`, the console's new `--short <file>`). A short version
|
|
40
|
+
belongs to the page it was written with — a page rewritten without one shows its
|
|
41
|
+
headings and first sentences, never an old short version — and crosses the same checks
|
|
42
|
+
as the page, a reflection's included (no confidential memory's words, no dream marks).
|
|
43
|
+
Adding a short version on its own never undoes a page written in between, and the
|
|
44
|
+
wake's own top and end lines are never stored as part of the page. Doctor's Self page
|
|
45
|
+
line says what the last wake showed: green for the page or its short version, amber
|
|
46
|
+
below, with what to do. Every wake's opening line now also says: if a note says this
|
|
47
|
+
was too large and saved to a file, read that file — which is what Claude Code does with
|
|
48
|
+
a hook's output past 10,000 characters (measured on 2.1.296: the model then sees only
|
|
49
|
+
the first 2,000 characters and is not told to look). Past 16,384 bytes a page is
|
|
50
|
+
refused, never cut. Below a ceiling of about 530 bytes the wake is now larger than its
|
|
51
|
+
ceiling, because of those fixed lines; the default is 9,000.
|
|
52
|
+
|
|
53
|
+
Dated items first in the wake (#367).
|
|
54
|
+
|
|
55
|
+
- **Dated items come before the wake's furniture.** A wake could say "Arriving: 1 — no
|
|
56
|
+
room to list them in this wake" while it still printed yesterday's chapter titles and
|
|
57
|
+
four handoffs: the room held for the handoffs and "Last here" was never offered to the
|
|
58
|
+
rest of the wake. Now the wake follows one declared order of what gives way: when an
|
|
59
|
+
"Arriving:" item has no room, "Work here" shows fewer lines first, then the Yesterday
|
|
60
|
+
line swaps titles for chapter ids one at a time, then "Last here" is dropped and fewer
|
|
61
|
+
handoffs are shown in full, the others named by id while there is room for them. The
|
|
62
|
+
newest handoff's own room goes only to a plain reminder due that day; no other line
|
|
63
|
+
can take it. Only then does a dated item go unlisted. An arriving item past the two
|
|
64
|
+
the wake lists is no longer left out silently: the lane's "N more arriving" line names
|
|
65
|
+
it by id, and when even that line has no room, doctor counts it as unlisted. "Still
|
|
66
|
+
open" keeps its first item before Arriving's second line, as before, but now after
|
|
67
|
+
those same lanes give way. A plain reminder due the day the wake is read comes first
|
|
68
|
+
in "Arriving:" (and in the two the wake is offered), and it outranks the self page
|
|
69
|
+
borrowing past its room: the page steps down to its short version or outline rather
|
|
70
|
+
than leave it out. The page within its own room still comes first. Beside a page that
|
|
71
|
+
borrowed, the Yesterday line was sometimes dropped whole; it now keeps its ids. If a
|
|
72
|
+
dated item still goes unlisted, doctor's Wake line says so in amber, with what to do.
|
|
73
|
+
|
|
74
|
+
Paused folders and the scope commands (#362, #366).
|
|
75
|
+
|
|
76
|
+
- **A paused folder now says so when a session starts.** With memory paused in a folder
|
|
77
|
+
(`counterparts scope . --pause`, or the sidebar's switch), a new, resumed, cleared or
|
|
78
|
+
compacted session there shows one line naming the paused folder and the command that
|
|
79
|
+
turns it back on, which works from any terminal. If the pause is on a parent folder, the
|
|
80
|
+
line names that folder and the command resumes it there. Claude gets a matching line so
|
|
81
|
+
it doesn't act as if it remembers.
|
|
82
|
+
Nothing else changes: no memories are loaded or recorded, nothing is written, other
|
|
83
|
+
hooks stay silent, and a folder turned `off` stays completely silent.
|
|
84
|
+
- **Every `counterparts scope` command Claude is shown now names the folder.** In a
|
|
85
|
+
folder that is off or paused, the memory tools' refusal used to tell Claude to run
|
|
86
|
+
`counterparts scope . --resume`, and the question a new folder gets in its first session
|
|
87
|
+
said `counterparts scope . --on`. The `.` meant wherever the command was run, and from a
|
|
88
|
+
subfolder `--resume` refuses. Now the command names the folder, and when the setting
|
|
89
|
+
belongs to a parent folder it names that one ("paused for ~/work, which includes this
|
|
90
|
+
directory"). Under the plugin it uses the plugin's own launcher, and with a
|
|
91
|
+
configuration other than the default it adds `--config`, as the paused notice does.
|
|
92
|
+
|
|
93
|
+
The hooks: each output field, the claims file, late twins (#366).
|
|
94
|
+
|
|
95
|
+
- **A red doctor notice now shows beside a full wake.** Measured on Claude Code 2.1.296:
|
|
96
|
+
the 10,000-character limit applies to each field of a hook's output, not to the output
|
|
97
|
+
as a whole. Counterparts held the whole output to 9,500 characters, so on a morning with
|
|
98
|
+
a full wake the doctor's notice was left out, and plain reminders, the dream question and
|
|
99
|
+
the update notice waited for a later turn. Now each field is held to the limit on its
|
|
100
|
+
own: they show beside a full wake or a full recall, and wait only when Claude's own text
|
|
101
|
+
would pass the limit.
|
|
102
|
+
- **A damaged claims file repairs itself.** If `sessions/claims/hook-claims.sqlite`
|
|
103
|
+
can't be read as a database, the next hook moves it aside (one copy is kept) and makes a
|
|
104
|
+
new one, and the event is still delivered. Before, every event printed an error and the
|
|
105
|
+
guard against double delivery stayed off until someone deleted the file. Doctor's new
|
|
106
|
+
amber "Hook claims" line says when it happened, for a week. The claims folder and file
|
|
107
|
+
are now private to you (0700 and 0600), like the log, and the log says why a claim
|
|
108
|
+
could not be made instead of giving only the length of the message.
|
|
109
|
+
- **With two installs live, a session's first start runs once even on a busy machine.**
|
|
110
|
+
The 0.3.15 release check found one double wake under load: the second hook started 45
|
|
111
|
+
ms after the first had finished, so its claim read it as a new event. A session's first
|
|
112
|
+
start, and a prompt Claude Code gives an id, are sent only once, so a second copy within
|
|
113
|
+
15 seconds now always steps aside. Doctor's "Installed twice" line no longer says
|
|
114
|
+
nothing was delivered twice; its fix also names `~/.claude/settings.json`.
|
|
115
|
+
A correction to the 0.3.15 notes, which said the claim "works between any two
|
|
116
|
+
versions": the plugin stepping aside is the main guard, and the claim is a backstop. It
|
|
117
|
+
catches a second hook that runs at the same time; for a resumed or compacted session, a
|
|
118
|
+
Stop, or a prompt without an id, one that starts after the first has finished can
|
|
119
|
+
still deliver again on a busy machine.
|
|
120
|
+
|
|
121
|
+
The plugin (#360, #365).
|
|
122
|
+
|
|
123
|
+
- **The sidebar lights every mechanism an event proves.** Each event is one row and lights
|
|
124
|
+
every mechanism it proves: a turn where a matching mood brought a memory closer lights
|
|
125
|
+
Emotion beside Retrieval, and a dream that wrote a gist and merged near-copies lights
|
|
126
|
+
Gist, Interference and Consolidation beside Dreaming.
|
|
127
|
+
- **A new plugin user is told their memory was set up, again.** In 0.3.15, the
|
|
128
|
+
sidebar's hooks module makes Claude Code start the plugin's SessionStart hook later,
|
|
129
|
+
after the plugin's server has already made the new memory, so the first session
|
|
130
|
+
didn't show "Counterparts: first run — a new memory was set up". Now whichever of the
|
|
131
|
+
two makes the memory leaves a note, and the first session start shows the line once,
|
|
132
|
+
never again after. Beside a live npm install the plugin still stands down and says
|
|
133
|
+
nothing about a first run. Nothing else changes.
|
|
134
|
+
|
|
135
|
+
## 0.3.15 — 2026-10-10
|
|
136
|
+
|
|
137
|
+
The self page is never cut in the wake. A page may now be at most 6,078 bytes, which the
|
|
138
|
+
wake prints whole at its default 9,000-byte ceiling; a longer one is refused and written
|
|
139
|
+
again shorter. A page written before this that is longer still prints whole, borrowing the
|
|
140
|
+
room held for "Work here", and doctor's Self page line is amber until the next revision
|
|
141
|
+
comes in under the limit. With the plugin and the npm install both connected, each event
|
|
142
|
+
runs once. `counterparts connect`, and `install` at a terminal, now rewrite Claude
|
|
143
|
+
Desktop's entry too, and doctor's Runtime line reads it. **If you connected Claude Desktop,
|
|
144
|
+
quit it and run `counterparts connect` once after upgrading**; until then doctor's Runtime
|
|
145
|
+
line is amber. Claude Code's hooks and server registration are the same as 0.3.14's, so
|
|
146
|
+
with Claude Code alone there is nothing to run (coming from 0.3.13 or earlier, run
|
|
147
|
+
`connect` once, as 0.3.14 said). The Claude Code plugin brings the sidebar mod (v0.1).
|
|
148
|
+
**No change to the store's format (still v12)**: the hooks keep their claims in a small
|
|
149
|
+
file of their own, `sessions/claims/hook-claims.sqlite`, which 0.3.14 leaves alone. Going
|
|
150
|
+
back to 0.3.14 is the order in QUICKSTART's "Going back to an earlier version":
|
|
151
|
+
`counterparts disconnect` while 0.3.15 is still installed, then the 0.3.14 reinstall, then
|
|
152
|
+
`counterparts connect`. The hook and server commands are the same in both versions, and
|
|
153
|
+
Claude Desktop's rewritten entry runs on 0.3.14 as it is.
|
|
154
|
+
|
|
155
|
+
The self page in the wake (#358).
|
|
156
|
+
|
|
157
|
+
- **The self page is never cut in the wake.** The page may now be at most 6,078 bytes,
|
|
158
|
+
which is exactly what the wake prints whole at the default 9,000-byte ceiling, even on
|
|
159
|
+
a day the wake also holds room for handoffs and "Work here" lines. Before, a page could
|
|
160
|
+
be written up to 16,384 bytes and the wake showed only its first 6,078 to 6,144, cut
|
|
161
|
+
with a marker. A longer page is refused, never cut: the self_page tool, the console and
|
|
162
|
+
the nightly reflection say the limit and how many bytes to take out, and the writer
|
|
163
|
+
says it shorter. The limit is in bytes, so accented letters, dashes and CJK count for
|
|
164
|
+
more than one. A page written before this that is over the limit still prints whole
|
|
165
|
+
when it fits with the room held for "Work here" lent to it (at 9,000, a page of about
|
|
166
|
+
7,200 bytes fits even on the tightest day), and doctor's Self page line goes amber until the next revision comes in under
|
|
167
|
+
the limit. Only a page that doesn't fit even then, or a ceiling set below what the page
|
|
168
|
+
needs, gets one line instead, pointing to the self_page tool or `counterparts
|
|
169
|
+
self-page` — never part of the page. If the nightly writer's page is refused as too
|
|
170
|
+
long and the run moves on without sending it again shorter, that night now reads as
|
|
171
|
+
failed, with the numbers, instead of "nothing to say". And "Still open" keeps its
|
|
172
|
+
"N more" count beside its first item when a long page leaves no other room for it.
|
|
173
|
+
|
|
174
|
+
Claude Desktop's entry, and the way back (#354, #356).
|
|
175
|
+
|
|
176
|
+
- **`counterparts connect` now fixes Claude Desktop's entry too.** 0.3.14 told Bun to
|
|
177
|
+
skip a project's `.env` and `bunfig.toml`, and `connect` rewrote the hooks and Claude
|
|
178
|
+
Code's server registration to match. It left alone the entry that
|
|
179
|
+
`install --host claude-desktop` puts in Claude Desktop's own config file. Now `connect`
|
|
180
|
+
rewrites that entry as well: only the command that starts the server changes, and the
|
|
181
|
+
store it names stays the same. Desktop rewrites that file while it's open, so with
|
|
182
|
+
Desktop running `connect` leaves the entry as it was and asks you to quit Desktop and
|
|
183
|
+
run `connect` again. Doctor's Runtime line now reads Desktop's entry too, and stays
|
|
184
|
+
amber until it's done.
|
|
185
|
+
- **`counterparts install` at a terminal fixes Claude Desktop's entry the same way.**
|
|
186
|
+
Running `install` again after an upgrade now rewrites Desktop's entry as `connect`
|
|
187
|
+
does: only the command changes, a backup is kept, and nothing is written while Desktop
|
|
188
|
+
is open. Its last line no longer promises a green doctor while Desktop's entry is left
|
|
189
|
+
as it was. The scripted install (`--no-connect`, or not at a terminal) still reads no
|
|
190
|
+
host file.
|
|
191
|
+
- **Going back to an earlier version is in the quickstart** ("Going back to an earlier
|
|
192
|
+
version"): `disconnect` first, then the reinstall, then `connect`, and
|
|
193
|
+
`install --host claude-desktop` again if you use Claude Desktop. Done in the other
|
|
194
|
+
order, every hook breaks and the older version's doctor still reads green.
|
|
195
|
+
|
|
196
|
+
One delivery per event when two wirings are live (#355, #359).
|
|
197
|
+
|
|
198
|
+
- **With the plugin and the npm install both connected, each event now runs once.**
|
|
199
|
+
The plugin is meant to step aside when the npm install's hooks are in your settings.
|
|
200
|
+
A plugin from before 0.3.14 didn't recognise the hook lines 0.3.14's `connect` writes,
|
|
201
|
+
so it didn't step aside, and every session got two wakes and two recall blocks per
|
|
202
|
+
prompt. The plugin now recognises our hook by the script it runs, whatever flags a
|
|
203
|
+
later version adds around it. As a backstop, each hook claims its event first: when
|
|
204
|
+
two Counterparts hooks fire for the same event, the first does the work (the wake,
|
|
205
|
+
the recall, the Stop's question, the capture, the background worker) and the other
|
|
206
|
+
exits without output. This works between any two versions from this one on. The
|
|
207
|
+
claims are kept in a small file of their own in the store's `sessions` folder, so
|
|
208
|
+
the background worker writing to the store doesn't hold a claim up. With one install
|
|
209
|
+
nothing changes; the claim adds two small writes per event, about a third of a
|
|
210
|
+
millisecond.
|
|
211
|
+
Doctor has a new amber line, "Installed twice", when a hook stepped aside this way in
|
|
212
|
+
the last week, and says how to keep just one install. No change to the store's format.
|
|
213
|
+
|
|
214
|
+
Recall (#356).
|
|
215
|
+
|
|
216
|
+
- **Facts recall reads "by 1/5" asked in late December as the coming January.** A date
|
|
217
|
+
with no year after "by", "until" or "before" now takes whichever year puts it nearest
|
|
218
|
+
today: "by 1/5" asked on 12-28 runs through next year's January 5, where it ran through
|
|
219
|
+
this year's and left out the year since. "Until Dec 30" asked on January 3 is still the
|
|
220
|
+
one four days back. Asked in early October, "by 1/5" and "finish by 1/2" now mean the
|
|
221
|
+
coming January too. "Since" and "after" still reach back to the last time the date came
|
|
222
|
+
round.
|
|
223
|
+
|
|
224
|
+
The plugin's sidebar (#342).
|
|
225
|
+
|
|
226
|
+
- **The sidebar mod (v0.1), inside the Claude Code plugin.** In Claude Code's fullscreen
|
|
227
|
+
layout, a pane beside the transcript shows the brain turning in braille, the twelve
|
|
228
|
+
mechanisms, search, and what this session kept and recalled (with the night's dreams and
|
|
229
|
+
fading, and other sessions folded into one line). It also has two switches,
|
|
230
|
+
"Counterparts memory · this folder" and "Claude Code's own memory". Pausing Counterparts
|
|
231
|
+
asks first; a folder paused for every session shows it in amber in the pane and says so
|
|
232
|
+
in the status line; a state the sidebar hasn't read yet never shows as on. `‹` makes it
|
|
233
|
+
quiet (narrow, nothing moving); its `✕` hides it to one status line; `/counterparts`
|
|
234
|
+
opens it anywhere. Beside an npm install, a plugin run from a folder
|
|
235
|
+
(`claude --plugin-dir`) now says that is expected, instead of suggesting
|
|
236
|
+
`counterparts disconnect`, and the plugin's `/counterparts:doctor` shows the npm
|
|
237
|
+
install's own doctor.
|
|
238
|
+
|
|
3
239
|
## 0.3.14 — 2026-10-09
|
|
4
240
|
|
|
5
241
|
The Claude Code plugin now runs on a Mac or Linux computer with neither Bun nor Node.js:
|
package/docs/QUICKSTART.md
CHANGED
|
@@ -107,6 +107,18 @@ bun add -g counterparts@latest
|
|
|
107
107
|
Your memory isn't changed by an upgrade. Open sessions keep running the old version until
|
|
108
108
|
they restart.
|
|
109
109
|
|
|
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:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
counterparts connect
|
|
115
|
+
```
|
|
116
|
+
|
|
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
|
|
120
|
+
it's open, so `connect` leaves Desktop's entry alone while Desktop runs, and says so.
|
|
121
|
+
|
|
110
122
|
If you set it up before search by meaning was built in, it turns on by itself after the
|
|
111
123
|
upgrade. An older setup that used a Voyage or Anthropic key keeps working without it:
|
|
112
124
|
those settings are ignored now, and `counterparts doctor --all` lists them as old
|
|
@@ -118,6 +130,16 @@ kept):
|
|
|
118
130
|
counterparts install --force --embedder
|
|
119
131
|
```
|
|
120
132
|
|
|
133
|
+
### Going back to an earlier version
|
|
134
|
+
|
|
135
|
+
Go back in this order. The other order breaks every hook, and the older version's
|
|
136
|
+
`doctor` still reads green.
|
|
137
|
+
|
|
138
|
+
1. `counterparts disconnect`, while the newer version is still installed.
|
|
139
|
+
2. Install the older version, for example `bun add -g counterparts@0.3.13`.
|
|
140
|
+
3. `counterparts connect`.
|
|
141
|
+
4. If you connected Claude Desktop: quit it, then run `counterparts install --host claude-desktop`.
|
|
142
|
+
|
|
121
143
|
## Start over
|
|
122
144
|
|
|
123
145
|
To set your memory aside and start with a blank one, close every Claude Code session and
|
package/docs/README.md
CHANGED
|
@@ -21,6 +21,7 @@ has it; every other page is a working default or a record of what happened.
|
|
|
21
21
|
- [`IMPROVEMENTS.md`](IMPROVEMENTS.md) — things noticed while living on it, as opposed to
|
|
22
22
|
building it.
|
|
23
23
|
- [`new-user-findings.md`](new-user-findings.md) — what the first install from npm was like.
|
|
24
|
+
- [`RELEASING.md`](RELEASING.md) — how a release is cut, checked and published.
|
|
24
25
|
|
|
25
26
|
## Module documents (in `src/`)
|
|
26
27
|
|
package/package.json
CHANGED
|
@@ -393,7 +393,8 @@ row, saying which source answered, existed until the keys were removed — §1a.
|
|
|
393
393
|
G41–G43) is read at the ENTRY POINT, from the file `config-path.ts` resolved,
|
|
394
394
|
before a store is opened: an `off` or `paused` directory returns from
|
|
395
395
|
`bin/hook.ts#main` with byte-for-byte empty stdout, empty stderr, no session
|
|
396
|
-
record, no capture, no spawn and no store
|
|
396
|
+
record, no capture, no spawn and no store — except that a `paused` one's
|
|
397
|
+
SessionStart prints ONE notice (below). `guard()` carries the same predicate
|
|
397
398
|
at the seam so a caller who builds an adapter directly inherits it, but the
|
|
398
399
|
guarantee itself is the absence of construction, and the install loop proves it
|
|
399
400
|
on a real process against a real clean-room install.
|
|
@@ -420,6 +421,22 @@ row, saying which source answered, existed until the keys were removed — §1a.
|
|
|
420
421
|
prints it. An `off` is not an instrument standing down; it is the owner saying
|
|
421
422
|
this directory is not part of the memory.
|
|
422
423
|
|
|
424
|
+
**A `paused` directory says so once, at SessionStart (rulings brief #19,
|
|
425
|
+
2026-10-10 — a working default).** A pause is meant to end, and a silent one was
|
|
426
|
+
missed: on 2026-10-09 three sessions ran without memory for ten minutes before
|
|
427
|
+
anyone noticed. So SessionStart, on every source (startup, resume, clear,
|
|
428
|
+
compact), prints one envelope from the registry already read: a `systemMessage`
|
|
429
|
+
for the person — the folder is paused and the command that resumes it — and an
|
|
430
|
+
`additionalContext` line for the model, so it does not act as if it remembers
|
|
431
|
+
(`bin/hook.ts#pausedNotice`). The folder whose entry paused it is NAMED, and the
|
|
432
|
+
command names it — never `.`, which is wherever the person types it — because
|
|
433
|
+
`--resume` refuses a directory that only inherits a pause. It
|
|
434
|
+
writes nothing anywhere — not the store, not a session record, not the per-event
|
|
435
|
+
claim, which comes after this return — so beside the npm install it is the
|
|
436
|
+
plugin's gate, not the claim, that keeps it to one line. Every other event, `off`
|
|
437
|
+
on every event, a session whose own folder is `off` (resuming the paused one
|
|
438
|
+
would turn nothing back on), and the headless nightly run stay silent.
|
|
439
|
+
|
|
423
440
|
**The guarantee is the HOOKS', and only the hooks'.** The MCP server still opens
|
|
424
441
|
a store when the host launches it in an `off` directory (`mcp/bin/serve.ts`): it
|
|
425
442
|
refuses every tool but `scope` with `scope-off`, per call, before any session bind
|
|
@@ -459,7 +476,7 @@ row, saying which source answered, existed until the keys were removed — §1a.
|
|
|
459
476
|
22. **[M] TURNING A DIRECTORY BACK ON NEVER REACHES BACK.** A session that lived
|
|
460
477
|
under `off` or `paused` left no session record and no span cursor, because the
|
|
461
478
|
hook process returned before anything was constructed (G19). Flip the registry
|
|
462
|
-
to `on` mid-session — `counterparts scope
|
|
479
|
+
to `on` mid-session — `counterparts scope <folder> --resume`, or the `scope` tool, which
|
|
463
480
|
is deliberately the one tool that answers in an off directory — and the next
|
|
464
481
|
boundary would otherwise slice the transcript from cursor 0 and deposit the whole
|
|
465
482
|
off conversation. It does not: a boundary that finds NO session record and a
|
|
@@ -595,6 +612,67 @@ row, saying which source answered, existed until the keys were removed — §1a.
|
|
|
595
612
|
back immediately. Doctor prints these steps as the remedy on any Snapshot
|
|
596
613
|
finding that is not green.
|
|
597
614
|
|
|
615
|
+
26. **[M] ONE DELIVERY PER EVENT, HOWEVER MANY WIRINGS FIRE IT (2026-10-09).**
|
|
616
|
+
Claude Code runs every hook registered for an event — settings and plugins
|
|
617
|
+
alike — at once, with the same input. Two wirings of Counterparts in one host
|
|
618
|
+
(the npm install's hooks and the plugin's; two settings files naming two
|
|
619
|
+
builds) would otherwise give every session two wakes, two recall blocks per
|
|
620
|
+
prompt, two Stop asks, two boundaries and two background workers. Seen live on
|
|
621
|
+
2026-10-09. Two layers:
|
|
622
|
+
|
|
623
|
+
- **The plugin stands down** (`adapters/plugin.ts#hookGate`): a plugin hook
|
|
624
|
+
that finds a LIVE hook of ours in user, project or local settings exits at
|
|
625
|
+
once and says so at SessionStart. "Ours" is read by the SCRIPT
|
|
626
|
+
(`host-wiring.ts#readOurHook`): a runtime given `adapters/claude-code/bin/hook.ts`
|
|
627
|
+
or its `.mjs` shim, `counterparts-hook`, or `<binary> hook`, whatever one-token
|
|
628
|
+
flags come before or after `run`, and nothing with a shell operator in it.
|
|
629
|
+
So a plugin reads what a newer `connect` writes. (The plugin's server stands
|
|
630
|
+
down the same way, by the registration's NAME.) `connect`'s own rewrite keeps
|
|
631
|
+
the strict reading (`isOurHookCommand`): it rewrites only what it can fully
|
|
632
|
+
parse. A writer that adds a flag writes it as ONE token, or older readers
|
|
633
|
+
take its value for the script.
|
|
634
|
+
- **The claim is the backstop** (`claim.ts`), for whatever the stand-down
|
|
635
|
+
misses: after the store opens and before anything else, each hook process
|
|
636
|
+
claims its event in one `BEGIN IMMEDIATE` read-and-write of the one row
|
|
637
|
+
of its own small database, `sessions/claims/hook-claims.sqlite` (host
|
|
638
|
+
state, not memory; never backed up), keyed by the session id, the event, the
|
|
639
|
+
host's `prompt_id` and the event's own fields (the prompt text's hash,
|
|
640
|
+
`source`, `stop_hook_active` and the last assistant message's hash, `reason`,
|
|
641
|
+
`trigger`). A process is the holder's TWIN when its key matches and it
|
|
642
|
+
STARTED (`performance.timeOrigin`) before the holder finished — the winner
|
|
643
|
+
stamps its claim when it exits, and a holder that never stamps holds for
|
|
644
|
+
`CLAIM_WINDOW_MS` (15 s) at most. The twin exits 0 with nothing on stdout —
|
|
645
|
+
no wake, recall, ask, boundary or worker — writes one
|
|
646
|
+
`adapter.hook.claim.lost` row, and leaves one stderr line. All five events
|
|
647
|
+
are claimed. A matching key from a process that started after the holder
|
|
648
|
+
finished is a separate event (a host with no `prompt_id` sending the same
|
|
649
|
+
words twice) and delivers — EXCEPT for an event the host sends once per key
|
|
650
|
+
(`firesOnce`: a SessionStart whose `source` opens a session id — `startup`,
|
|
651
|
+
`clear`, `fork` — and a prompt with its `prompt_id`), where any same-key
|
|
652
|
+
process inside the window is the twin however late its runtime came up
|
|
653
|
+
(2026-10-10: the 0.3.15 release check measured a twin starting 45 ms after
|
|
654
|
+
the winner finished, under load, and two wakes). For the events that can
|
|
655
|
+
legitimately repeat, a twin that starts that late still delivers: the
|
|
656
|
+
stand-down above is the main guard, and the claim a backstop that stops
|
|
657
|
+
the twins it sees. **Fail-open:** no session id, an observer, or a
|
|
658
|
+
claims file that will not take the write, and the process delivers, so one
|
|
659
|
+
wiring behaves exactly as before (two small writes: about 0.3 ms measured in
|
|
660
|
+
process, within noise end to end). A claims file that is not a database
|
|
661
|
+
is set aside with its `-wal`/`-shm` as `hook-claims.unreadable-<ms>.sqlite`
|
|
662
|
+
(one copy kept) and made again, once, and the event is claimed on the new
|
|
663
|
+
file; doctor's `Hook claims` line (amber, a week) reads the copy. The
|
|
664
|
+
directory is 0700 and the file 0600. The claims are in their own file, not
|
|
665
|
+
the store's `meta`, so a claim waits only on another claim: the store's
|
|
666
|
+
writers (the worker the last Stop started, the MCP server, the CLI) never
|
|
667
|
+
hold it up, and a store somebody holds costs it nothing. Each of the two
|
|
668
|
+
writes waits at most `CLAIM_WAIT_MS` (500 ms). A claim that could not be
|
|
669
|
+
written is in the hook's `process.end` log line, as its error's code; it is
|
|
670
|
+
said on stderr too only when it is a fault (the file cannot be made or
|
|
671
|
+
written), not when another claim held the file. Doctor's `Installed twice`
|
|
672
|
+
line (amber) reads the week's `claim.lost` rows, and says only what they
|
|
673
|
+
show. The transcript's size is not in the key: the host may write between
|
|
674
|
+
the twins starting.
|
|
675
|
+
|
|
598
676
|
### The nightly run, and the page writer inside it (2026-09-28 — working defaults, held lightly)
|
|
599
677
|
|
|
600
678
|
**[M] Once per local calendar day, the first session's line starts the nightly run.** On the
|
|
@@ -773,11 +851,12 @@ terminal; "dream on your own" sets it again. Any setting chosen on this version
|
|
|
773
851
|
### One size budget per hook envelope (2026-09-29 — a working default)
|
|
774
852
|
|
|
775
853
|
**[M] Everything one SessionStart or one UserPromptSubmit prints is measured against one
|
|
776
|
-
budget**, the host's cap (`TUNABLES.HOST_OUTPUT_CHARS`, 10,000, counted in bytes; the JSON
|
|
777
|
-
form
|
|
854
|
+
budget**, the host's cap (`TUNABLES.HOST_OUTPUT_CHARS`, 10,000, counted in bytes; in the JSON
|
|
855
|
+
form each field is held to it on its own, as the host measures it — 2026-10-10, it was 9,500
|
|
856
|
+
characters of whole envelope before), and a crowded envelope gives way in a stated order, first to
|
|
778
857
|
last. Each part that gives way is DEFERRED, never cut, and never spent on a line the session
|
|
779
858
|
did not get.
|
|
780
|
-
- **SessionStart:** the owner's notices (dropped
|
|
859
|
+
- **SessionStart:** the owner's notices (dropped when a field of the JSON form would pass the cap) →
|
|
781
860
|
the write-up pointer → the first-launch question (measured against this budget, no
|
|
782
861
|
longer the reported injection budget) → plain reminders due today (they wait for the
|
|
783
862
|
first prompt, unclaimed) → the wake, which is never cut at delivery: it was composed to
|
|
@@ -852,7 +931,7 @@ session, because an MCP result is not under the host's 10,000-character cap on a
|
|
|
852
931
|
output and the wake is. The pointer is measured against that cap as PLAIN stdout
|
|
853
932
|
(`HOST_OUTPUT_CHARS` = 10,000; bytes ≥ characters): with no owner notice
|
|
854
933
|
`bin/hook.ts#hostDelivery` prints plain text, and with one it drops the notice before it
|
|
855
|
-
lets the JSON
|
|
934
|
+
lets either field of the JSON form pass the cap (`fieldsFit`). It is NOT held to the reported budget,
|
|
856
935
|
which is what the wake is composed to; a 9,038-byte wake leaves room (tested with host
|
|
857
936
|
ids). Past the cap it DEFERS, claims nothing, and records the deferral DURABLY
|
|
858
937
|
(`sessions.ts#WRITE_UP_POINTER_KEY`, one meta row: outcome, need, room), which doctor
|
|
@@ -615,7 +615,12 @@ That is a different mechanism, not a wider parameter, and it is not built.
|
|
|
615
615
|
not the wake's — neither was taken here. *(The record half CLOSED 2026-10-02 by
|
|
616
616
|
#318 (`8916e8c`), noted 2026-10-09: `adapter.notice.dropped` is a durable row,
|
|
617
617
|
one per hook, part and session a lived day, and doctor's Wake line reads it. The
|
|
618
|
-
terminal still says nothing on the day it happens.)*
|
|
618
|
+
terminal still says nothing on the day it happens.)* *(The terminal half CLOSED for
|
|
619
|
+
every wake within the cap, 2026-10-10: measured on Claude Code 2.1.296, the host caps
|
|
620
|
+
each field of the JSON form on its own and an over-long envelope parses, so the
|
|
621
|
+
9,500-character envelope rule is gone and the notice rides whenever the wake and the
|
|
622
|
+
notice each fit (`bin/hook.ts#fieldsFit`). It is dropped now only beside a wake that is
|
|
623
|
+
itself past the cap, which the host previews anyway.)*
|
|
619
624
|
7. **Three findings cannot say "I do not know" — they say green.** `Severity` is
|
|
620
625
|
red / amber / green, so the unknown-newest-row reading (`undetermined`) is
|
|
621
626
|
reported as GREEN with a sentence that explains it is not a grade. Right for
|
|
@@ -768,7 +773,9 @@ on the owner's store it defers every morning by the same arithmetic.
|
|
|
768
773
|
can push the envelope past `ENVELOPE_MAX_CHARS` and the doctor notice is the part dropped
|
|
769
774
|
(the wake wins, as always; `adapter.notice.dropped` records it). At a full 9 KB wake the
|
|
770
775
|
notice is dropped with or without it. Bounded: at most two starts a day carry a pointer,
|
|
771
|
-
and the notice returns at the next start.
|
|
776
|
+
and the notice returns at the next start. *(CLOSED 2026-10-10: the notice is its own field
|
|
777
|
+
of the JSON form, measured as the host measures it, so the pointer no longer costs it; the
|
|
778
|
+
pointer and the question are measured against the model's field alone.)*
|
|
772
779
|
|
|
773
780
|
**Residual cost (PR #192 review, n1):** the eligibility plan (`writeUpPlan`) runs at EVERY
|
|
774
781
|
session start whose allowance is not spent — and when nothing is owed, the allowance is
|