counterparts 0.3.13 → 0.3.15
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 +264 -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 +48 -0
- package/src/adapters/claude-code/NOTES.md +148 -0
- package/src/adapters/claude-code/bin/hook.mjs +4 -2
- package/src/adapters/claude-code/bin/hook.ts +61 -7
- package/src/adapters/claude-code/bin/nightly.ts +5 -1
- package/src/adapters/claude-code/bin/runner.ts +11 -3
- package/src/adapters/claude-code/claim.ts +319 -0
- package/src/adapters/claude-code/doctor.ts +170 -16
- package/src/adapters/claude-code/embed-client.ts +3 -0
- package/src/adapters/cli/CONTRACT.md +5 -0
- package/src/adapters/cli/NOTES.md +25 -0
- package/src/adapters/cli/bin/counterparts.mjs +4 -2
- package/src/adapters/cli/bin/counterparts.ts +49 -3
- package/src/adapters/cli/commands.ts +169 -32
- package/src/adapters/cli/desktop.ts +112 -7
- package/src/adapters/cli/help.ts +10 -0
- package/src/adapters/cli/index.ts +1 -0
- package/src/adapters/cli/install.ts +94 -14
- package/src/adapters/cli/self-page.ts +5 -8
- package/src/adapters/cli/settle.ts +39 -2
- package/src/adapters/cli/wire.ts +18 -1
- package/src/adapters/config.ts +29 -1
- package/src/adapters/dashboard/NOTES.md +33 -0
- package/src/adapters/dashboard/bin/dashboard.mjs +4 -2
- package/src/adapters/dashboard/bin/dashboard.ts +11 -3
- package/src/adapters/dashboard/index.ts +14 -0
- package/src/adapters/dashboard/registries.ts +3 -0
- package/src/adapters/dashboard/source.ts +0 -8
- package/src/adapters/dashboard/web/fired.ts +8 -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/flow/sections/fired.js +1 -1
- package/src/adapters/dashboard/web/pages/health/sections/cycle.js +7 -10
- package/src/adapters/dashboard/web/pages/memories/memories.css +3 -0
- package/src/adapters/dashboard/web/pages/memories/row.js +5 -2
- package/src/adapters/dashboard/web/pages/memories/sections/hold.js +2 -1
- package/src/adapters/dashboard/web/pages/memories/sections/search.js +19 -3
- package/src/adapters/dashboard/web/server.ts +16 -4
- package/src/adapters/dashboard/web/shared/dates.js +6 -16
- package/src/adapters/dashboard/web/shared/memory-modal.js +21 -8
- package/src/adapters/dashboard/web/views/health.ts +19 -5
- package/src/adapters/dashboard/web/views/mechanism-panel.ts +8 -5
- package/src/adapters/dashboard/web/views/memories.ts +26 -7
- package/src/adapters/dashboard/web/views/memory-words.ts +16 -0
- package/src/adapters/dashboard/web/views/memory.ts +51 -2
- package/src/adapters/dashboard/web/views/mind.ts +38 -6
- package/src/adapters/empty-bunfig.toml +5 -0
- package/src/adapters/fired.ts +16 -2
- package/src/adapters/host-wiring.ts +112 -17
- package/src/adapters/log/index.ts +2 -2
- package/src/adapters/mcp/CONTRACT.md +17 -2
- package/src/adapters/mcp/INTERFACE-GAPS.md +15 -1
- package/src/adapters/mcp/NOTES.md +269 -0
- package/src/adapters/mcp/bin/serve.mjs +4 -2
- package/src/adapters/mcp/bin/serve.ts +17 -6
- package/src/adapters/mcp/facts.ts +72 -4
- package/src/adapters/mcp/meaning.ts +218 -15
- package/src/adapters/mcp/server.ts +21 -6
- package/src/adapters/mcp/tools.ts +86 -61
- package/src/adapters/plugin-run.sh +413 -34
- package/src/adapters/plugin.ts +141 -17
- package/src/adapters/runtime.ts +192 -17
- package/src/adapters/sessions.ts +2 -2
- package/src/core/associate/NOTES.md +10 -0
- package/src/core/bridge.ts +1 -1
- package/src/core/briefing.ts +20 -3
- package/src/core/contradictions.ts +56 -20
- package/src/core/counterpart.ts +72 -23
- package/src/core/dream/CONTRACT.md +6 -14
- package/src/core/dream/INTERFACE-GAPS.md +3 -2
- package/src/core/dream/NOTES.md +10 -0
- package/src/core/dream/index.ts +11 -53
- package/src/core/dream/reflect.ts +11 -2
- package/src/core/embed/static.ts +5 -1
- package/src/core/encode/INTERFACE-GAPS.md +2 -1
- package/src/core/encode/NOTES.md +12 -0
- package/src/core/encode/chunk.ts +6 -30
- package/src/core/encode/index.ts +0 -1
- package/src/core/encode/types.ts +1 -13
- package/src/core/handoff/INTERFACE-GAPS.md +1 -1
- package/src/core/handoff/index.ts +2 -1
- package/src/core/handoff/last-here.ts +18 -2
- package/src/core/physics/CONTRACT.md +6 -0
- package/src/core/physics/NOTES.md +33 -2
- package/src/core/physics/index.ts +22 -7
- package/src/core/prospective/CONTRACT.md +3 -1
- package/src/core/prospective/NOTES.md +15 -0
- package/src/core/recall/activate.ts +1 -1
- package/src/core/recall/time-ask.ts +173 -19
- package/src/core/self/CONTRACT.md +56 -19
- package/src/core/self/NOTES.md +172 -0
- package/src/core/self/behind.ts +6 -3
- package/src/core/self/briefing.ts +384 -28
- package/src/core/self/index.ts +105 -44
- package/src/core/self/page.ts +12 -85
- package/src/core/self/tunables.ts +16 -19
- package/src/core/self/writer.ts +31 -4
- package/src/core/sleep/NOTES.md +32 -0
- package/src/core/store/NOTES.md +21 -2
- package/src/core/store/index.ts +2 -1
- package/src/core/time.ts +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,269 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.15 — 2026-10-10
|
|
4
|
+
|
|
5
|
+
The self page is never cut in the wake. A page may now be at most 6,078 bytes, which the
|
|
6
|
+
wake prints whole at its default 9,000-byte ceiling; a longer one is refused and written
|
|
7
|
+
again shorter. A page written before this that is longer still prints whole, borrowing the
|
|
8
|
+
room held for "Work here", and doctor's Self page line is amber until the next revision
|
|
9
|
+
comes in under the limit. With the plugin and the npm install both connected, each event
|
|
10
|
+
runs once. `counterparts connect`, and `install` at a terminal, now rewrite Claude
|
|
11
|
+
Desktop's entry too, and doctor's Runtime line reads it. **If you connected Claude Desktop,
|
|
12
|
+
quit it and run `counterparts connect` once after upgrading**; until then doctor's Runtime
|
|
13
|
+
line is amber. Claude Code's hooks and server registration are the same as 0.3.14's, so
|
|
14
|
+
with Claude Code alone there is nothing to run (coming from 0.3.13 or earlier, run
|
|
15
|
+
`connect` once, as 0.3.14 said). The Claude Code plugin brings the sidebar mod (v0.1).
|
|
16
|
+
**No change to the store's format (still v12)**: the hooks keep their claims in a small
|
|
17
|
+
file of their own, `sessions/claims/hook-claims.sqlite`, which 0.3.14 leaves alone. Going
|
|
18
|
+
back to 0.3.14 is the order in QUICKSTART's "Going back to an earlier version":
|
|
19
|
+
`counterparts disconnect` while 0.3.15 is still installed, then the 0.3.14 reinstall, then
|
|
20
|
+
`counterparts connect`. The hook and server commands are the same in both versions, and
|
|
21
|
+
Claude Desktop's rewritten entry runs on 0.3.14 as it is.
|
|
22
|
+
|
|
23
|
+
The self page in the wake (#358).
|
|
24
|
+
|
|
25
|
+
- **The self page is never cut in the wake.** The page may now be at most 6,078 bytes,
|
|
26
|
+
which is exactly what the wake prints whole at the default 9,000-byte ceiling, even on
|
|
27
|
+
a day the wake also holds room for handoffs and "Work here" lines. Before, a page could
|
|
28
|
+
be written up to 16,384 bytes and the wake showed only its first 6,078 to 6,144, cut
|
|
29
|
+
with a marker. A longer page is refused, never cut: the self_page tool, the console and
|
|
30
|
+
the nightly reflection say the limit and how many bytes to take out, and the writer
|
|
31
|
+
says it shorter. The limit is in bytes, so accented letters, dashes and CJK count for
|
|
32
|
+
more than one. A page written before this that is over the limit still prints whole
|
|
33
|
+
when it fits with the room held for "Work here" lent to it (at 9,000, a page of about
|
|
34
|
+
7,200 bytes fits even on the tightest day), and doctor's Self page line goes amber until the next revision comes in under
|
|
35
|
+
the limit. Only a page that doesn't fit even then, or a ceiling set below what the page
|
|
36
|
+
needs, gets one line instead, pointing to the self_page tool or `counterparts
|
|
37
|
+
self-page` — never part of the page. If the nightly writer's page is refused as too
|
|
38
|
+
long and the run moves on without sending it again shorter, that night now reads as
|
|
39
|
+
failed, with the numbers, instead of "nothing to say". And "Still open" keeps its
|
|
40
|
+
"N more" count beside its first item when a long page leaves no other room for it.
|
|
41
|
+
|
|
42
|
+
Claude Desktop's entry, and the way back (#354, #356).
|
|
43
|
+
|
|
44
|
+
- **`counterparts connect` now fixes Claude Desktop's entry too.** 0.3.14 told Bun to
|
|
45
|
+
skip a project's `.env` and `bunfig.toml`, and `connect` rewrote the hooks and Claude
|
|
46
|
+
Code's server registration to match. It left alone the entry that
|
|
47
|
+
`install --host claude-desktop` puts in Claude Desktop's own config file. Now `connect`
|
|
48
|
+
rewrites that entry as well: only the command that starts the server changes, and the
|
|
49
|
+
store it names stays the same. Desktop rewrites that file while it's open, so with
|
|
50
|
+
Desktop running `connect` leaves the entry as it was and asks you to quit Desktop and
|
|
51
|
+
run `connect` again. Doctor's Runtime line now reads Desktop's entry too, and stays
|
|
52
|
+
amber until it's done.
|
|
53
|
+
- **`counterparts install` at a terminal fixes Claude Desktop's entry the same way.**
|
|
54
|
+
Running `install` again after an upgrade now rewrites Desktop's entry as `connect`
|
|
55
|
+
does: only the command changes, a backup is kept, and nothing is written while Desktop
|
|
56
|
+
is open. Its last line no longer promises a green doctor while Desktop's entry is left
|
|
57
|
+
as it was. The scripted install (`--no-connect`, or not at a terminal) still reads no
|
|
58
|
+
host file.
|
|
59
|
+
- **Going back to an earlier version is in the quickstart** ("Going back to an earlier
|
|
60
|
+
version"): `disconnect` first, then the reinstall, then `connect`, and
|
|
61
|
+
`install --host claude-desktop` again if you use Claude Desktop. Done in the other
|
|
62
|
+
order, every hook breaks and the older version's doctor still reads green.
|
|
63
|
+
|
|
64
|
+
One delivery per event when two wirings are live (#355, #359).
|
|
65
|
+
|
|
66
|
+
- **With the plugin and the npm install both connected, each event now runs once.**
|
|
67
|
+
The plugin is meant to step aside when the npm install's hooks are in your settings.
|
|
68
|
+
A plugin from before 0.3.14 didn't recognise the hook lines 0.3.14's `connect` writes,
|
|
69
|
+
so it didn't step aside, and every session got two wakes and two recall blocks per
|
|
70
|
+
prompt. The plugin now recognises our hook by the script it runs, whatever flags a
|
|
71
|
+
later version adds around it. As a backstop, each hook claims its event first: when
|
|
72
|
+
two Counterparts hooks fire for the same event, the first does the work (the wake,
|
|
73
|
+
the recall, the Stop's question, the capture, the background worker) and the other
|
|
74
|
+
exits without output. This works between any two versions from this one on. The
|
|
75
|
+
claims are kept in a small file of their own in the store's `sessions` folder, so
|
|
76
|
+
the background worker writing to the store doesn't hold a claim up. With one install
|
|
77
|
+
nothing changes; the claim adds two small writes per event, about a third of a
|
|
78
|
+
millisecond.
|
|
79
|
+
Doctor has a new amber line, "Installed twice", when a hook stepped aside this way in
|
|
80
|
+
the last week, and says how to keep just one install. No change to the store's format.
|
|
81
|
+
|
|
82
|
+
Recall (#356).
|
|
83
|
+
|
|
84
|
+
- **Facts recall reads "by 1/5" asked in late December as the coming January.** A date
|
|
85
|
+
with no year after "by", "until" or "before" now takes whichever year puts it nearest
|
|
86
|
+
today: "by 1/5" asked on 12-28 runs through next year's January 5, where it ran through
|
|
87
|
+
this year's and left out the year since. "Until Dec 30" asked on January 3 is still the
|
|
88
|
+
one four days back. Asked in early October, "by 1/5" and "finish by 1/2" now mean the
|
|
89
|
+
coming January too. "Since" and "after" still reach back to the last time the date came
|
|
90
|
+
round.
|
|
91
|
+
|
|
92
|
+
The plugin's sidebar (#342).
|
|
93
|
+
|
|
94
|
+
- **The sidebar mod (v0.1), inside the Claude Code plugin.** In Claude Code's fullscreen
|
|
95
|
+
layout, a pane beside the transcript shows the brain turning in braille, the twelve
|
|
96
|
+
mechanisms, search, and what this session kept and recalled (with the night's dreams and
|
|
97
|
+
fading, and other sessions folded into one line). It also has two switches,
|
|
98
|
+
"Counterparts memory · this folder" and "Claude Code's own memory". Pausing Counterparts
|
|
99
|
+
asks first; a folder paused for every session shows it in amber in the pane and says so
|
|
100
|
+
in the status line; a state the sidebar hasn't read yet never shows as on. `‹` makes it
|
|
101
|
+
quiet (narrow, nothing moving); its `✕` hides it to one status line; `/counterparts`
|
|
102
|
+
opens it anywhere. Beside an npm install, a plugin run from a folder
|
|
103
|
+
(`claude --plugin-dir`) now says that is expected, instead of suggesting
|
|
104
|
+
`counterparts disconnect`, and the plugin's `/counterparts:doctor` shows the npm
|
|
105
|
+
install's own doctor.
|
|
106
|
+
|
|
107
|
+
## 0.3.14 — 2026-10-09
|
|
108
|
+
|
|
109
|
+
The Claude Code plugin now runs on a Mac or Linux computer with neither Bun nor Node.js:
|
|
110
|
+
it downloads one prebuilt Counterparts program for that computer from this version's GitHub
|
|
111
|
+
release, checked against a sha256 the plugin carries. A project's `.env` and `bunfig.toml`
|
|
112
|
+
no longer reach into the hooks, the memory server or the `counterparts` command. **If you
|
|
113
|
+
installed through npm, run `counterparts connect` once after upgrading** to rewrite the
|
|
114
|
+
hooks and the server registration; until then doctor's Runtime line is amber. The wake keeps
|
|
115
|
+
the first "Still open" item beside a long self page and says when a reminder was due. Facts
|
|
116
|
+
recall names corrected memories with an id to open and reads amounts as amounts, meaning
|
|
117
|
+
recall says when the person asked about has no card, and the dashboard dates everything in
|
|
118
|
+
the configured zone. **No change to the store's format (still v12).** Going back to 0.3.13
|
|
119
|
+
takes three steps, in this order: `counterparts disconnect` while 0.3.14 is still installed,
|
|
120
|
+
then the 0.3.13 reinstall, then `counterparts connect`. 0.3.14's hook and server commands
|
|
121
|
+
name a file 0.3.13 doesn't ship, and 0.3.13's `connect` doesn't recognise them, so it would
|
|
122
|
+
add its own beside them.
|
|
123
|
+
|
|
124
|
+
A project's `.env` and `bunfig.toml` stay out (#349).
|
|
125
|
+
|
|
126
|
+
- **A project's `.env` and `bunfig.toml` no longer reach into Counterparts.** Bun reads
|
|
127
|
+
both from the folder it starts in, and Claude Code starts the hooks and the memory
|
|
128
|
+
server in your project. So a project whose `.env` set `COUNTERPARTS_DATA_DIR` or
|
|
129
|
+
`COUNTERPARTS_CONFIG` could send the plugin's server, an npm install's hooks or the
|
|
130
|
+
`counterparts` command to a different store, and a `bunfig.toml` with a `preload`
|
|
131
|
+
ran its own code inside them. Every place Counterparts starts Bun now passes
|
|
132
|
+
`--no-env-file` and `--config=` pointing at an empty bunfig in the package: the hook
|
|
133
|
+
and server commands `install` and `connect` write, the plugin's launcher, the
|
|
134
|
+
installed commands, and the workers and nightly run it starts itself. Node reads
|
|
135
|
+
neither on its own. **If you installed through npm, run `counterparts connect`
|
|
136
|
+
once** to rewrite your hooks and server registration. Until you do, doctor's Runtime
|
|
137
|
+
line is amber and says so. Plugin users get the change when the plugin updates.
|
|
138
|
+
|
|
139
|
+
The plugin on a computer with no Bun or Node (#351).
|
|
140
|
+
|
|
141
|
+
- **The plugin works on a Mac or Linux computer with no Bun or Node.js.** Until now it
|
|
142
|
+
gave up there. Now it downloads one prebuilt Counterparts program for that computer
|
|
143
|
+
(55–75 MB, over HTTPS, from this repository's GitHub releases), checks it against a
|
|
144
|
+
sha256 that ships inside the plugin, keeps it in the plugin's data folder, and runs
|
|
145
|
+
that. It re-checks the kept program too: the whole file each time the memory server
|
|
146
|
+
starts, and a quick stamp of it at every hook; one that changed is deleted and fetched
|
|
147
|
+
again. Windows isn't offered a program yet; there, the plugin still says to install
|
|
148
|
+
Bun or Node. The first session says it's getting ready and that memory starts in the
|
|
149
|
+
next one. A failed download says so once and tries again later; nothing unchecked is
|
|
150
|
+
ever run. `COUNTERPARTS_BINARY_DOWNLOAD=off` forbids the download. The program is the
|
|
151
|
+
whole of Counterparts, with the model and the dashboard packed in. It starts a little
|
|
152
|
+
faster than `bun` (a prompt's hook takes about 86 ms vs. about 102 ms). It won't wire
|
|
153
|
+
Claude Code or Claude Desktop itself: `counterparts connect` from it says to use the
|
|
154
|
+
npm install for that. How it is built and released: `docs/single-binary.md`.
|
|
155
|
+
|
|
156
|
+
The wake (#350).
|
|
157
|
+
|
|
158
|
+
- **"Still open" lists its first item beside a long self page, and never prints a heading
|
|
159
|
+
over a count.** With a long page, the Yesterday line and the Arriving lines taking the
|
|
160
|
+
room, a 9,000-byte wake could print "Still open:" with only "(20 more still open; recall
|
|
161
|
+
ids …)" under it. The self page is still never cut for this: it prints whole up to its
|
|
162
|
+
cap, as before. Instead "Still open" keeps its first item and its count, and the room
|
|
163
|
+
comes, in order, from the "Work here" lines (fewer of them that morning), Arriving past
|
|
164
|
+
its first line, and the Yesterday line's titles (fewer named, the rest counted). A lane
|
|
165
|
+
that still has room for nothing says so in one line: "Still open: 20 — no room to list
|
|
166
|
+
them in this wake; recall ids …".
|
|
167
|
+
- **An Arriving reminder past its date says it was due.** A one-off reminder stays under
|
|
168
|
+
"Arriving:" for a week after its date, and the wake written the evening before is read
|
|
169
|
+
the next morning, so "(due 2026-10-08)" was read on the 9th as if still to come. The
|
|
170
|
+
line now reads "(was due yesterday, 2026-10-08)" the morning after and "(was due
|
|
171
|
+
2026-10-05)" later. A reminder due on the day it was noted now reads "due 2026-10-08"
|
|
172
|
+
rather than the date alone.
|
|
173
|
+
- **A plain reminder said on its day leaves "Arriving:" at the next turn.** When the
|
|
174
|
+
day's wake was written before the reminder was said (a session running past midnight),
|
|
175
|
+
it stayed under "Arriving:" all day and into the next morning.
|
|
176
|
+
|
|
177
|
+
Recall (#345, #347, #348, #352).
|
|
178
|
+
|
|
179
|
+
- **Facts recall no longer reads an amount as a date, or "since 10/25" as an empty
|
|
180
|
+
window.** "7-8 hours", "3/4 cup", "5-10%" and "$5-10" were read as dates (July 8, March
|
|
181
|
+
4, May 10) and filtered the answer to them; they are amounts now, and a date later in
|
|
182
|
+
the question is still read. "Cut it by 1/2" or "reduced to 1/3" is a fraction, not a
|
|
183
|
+
deadline of January 2; "finish by 1/2" still is one. And "since 10/25" or "after 10/25"
|
|
184
|
+
asked before the 25th of this month means last year's 10/25, where it gave nothing (or
|
|
185
|
+
only what is still to come). "Before", "until" and "by" a coming day keep this year's.
|
|
186
|
+
"2-3 weeks ago" and "3 or 4 days ago" cover both ends, where only the far one was read,
|
|
187
|
+
and a zero-padded "09-28" stays a date whatever word follows it.
|
|
188
|
+
Questions with no time in them answer exactly as before.
|
|
189
|
+
- **Facts recall reads "by 12/20" asked in October as this year's December 20th.** A
|
|
190
|
+
date with no year under "by", "until", "up to" or "before", in a month that has not
|
|
191
|
+
begun yet, was read as last year's: "what's due by 12/20" asked on 10-09 kept only what
|
|
192
|
+
happened through 2025-12-20 and hid the ten months since. It is now this year's
|
|
193
|
+
whenever that is the nearer of the two, so those months are no longer cut off.
|
|
194
|
+
"Until Dec 30" asked on January 3rd is still the one four days back, and "since" and
|
|
195
|
+
"after" still reach back to last year's date as before.
|
|
196
|
+
- **Facts recall now names corrected memories, so they can be opened.** A memory
|
|
197
|
+
settled as corrected (it was wrong) is never offered as a fact. Facts answers used to
|
|
198
|
+
say only "1 corrected version hidden" under the memory that corrected it, with no way
|
|
199
|
+
to reach it, even when the question named it. If the correction itself pointed at the
|
|
200
|
+
wrong memory, a true memory became unreachable. Each one now gets a line under the
|
|
201
|
+
memory that corrected it, marked as wrong, with its id:
|
|
202
|
+
`corrected (was wrong): "…" (learned 09-10), corrected 09-11 · mem_…`. Opening that id
|
|
203
|
+
with `recall` shows the whole memory and which memory corrected it. Up to three are
|
|
204
|
+
named, the ones the question's words reach first, and any more are counted. The
|
|
205
|
+
dashboard's Ask shows them the same way, with links. Answers that have no corrected
|
|
206
|
+
versions are unchanged.
|
|
207
|
+
- **Meaning recall says when the person you asked about has no card.** "What has Han
|
|
208
|
+
been to Mike?" on a store where only Mike has a card used to come back as Mike's story
|
|
209
|
+
with no word about Han. Now the answer opens with "No card for Han yet; here is what
|
|
210
|
+
mentions Han", follows the memories that name Han, and lists Mike's card as one to ask
|
|
211
|
+
about. If nothing mentions Han, it says that instead. The name leads only when every
|
|
212
|
+
card the question names is mentioned in passing ("been to Mike", "since Driftwood").
|
|
213
|
+
When a card is asked about or named plainly ("how have Han and Oskar been?", "what did
|
|
214
|
+
Oskar say about Han?"), the answer follows that card as before and opens by saying Han
|
|
215
|
+
has none. The dashboard's Ask shows the same first line.
|
|
216
|
+
A question that names no card at all ("what has Han been up to?") is answered as
|
|
217
|
+
before, by its words and meaning. A first name of a card's longer name ("Marguerite"
|
|
218
|
+
for Marguerite Solberg), an acronym ("API", "Q3") and a question typed in Title Case
|
|
219
|
+
are never taken for a name with no card.
|
|
220
|
+
|
|
221
|
+
The dashboard, doctor and the tool descriptions (#343, #346, #347, #352).
|
|
222
|
+
|
|
223
|
+
- **The dashboard no longer says a repeating reminder is about to be put away.** A memory
|
|
224
|
+
whose date still repeats is kept for its next time however faint it has grown, so the
|
|
225
|
+
memories list no longer marks it "fading" and its card names no day it would be put
|
|
226
|
+
away. The row says how often it comes round instead ("repeats every May 14"), and the
|
|
227
|
+
card says "It comes round every May 14, so I'll keep it while it does." A protected
|
|
228
|
+
memory's card no longer names such a day either, since the nightly cleanup never lets
|
|
229
|
+
one go: it says "It's protected, so I'll keep it even if nobody uses it."
|
|
230
|
+
- **The dashboard dates everything in the zone the hooks use.** With a `timeZone` in the
|
|
231
|
+
configuration that differs from the computer's, the dashboard used the computer's zone
|
|
232
|
+
and the browser's own, so one page could show two days for one moment: a memory's
|
|
233
|
+
"recorded" chip on one, its "Written" line on the next. The dashboard now reads the
|
|
234
|
+
configuration's `timeZone` (the named one, else the one beside the store), every view
|
|
235
|
+
dates in it, and the card's "Written" day and the Health cycle line come from the
|
|
236
|
+
server already dated. The card's details row names that zone ("Sep 28th, 2026, 11:47
|
|
237
|
+
MDT") instead of printing UTC, and the Flow page's fired footer names it instead of a
|
|
238
|
+
stale "(UTC)". Without a `timeZone` set, nothing changes.
|
|
239
|
+
- **Doctor's prune line no longer reads BLOCKED over protected memories it was keeping
|
|
240
|
+
anyway.** The nightly cleanup counted every protected memory (the self page is one) as
|
|
241
|
+
a refusal every night, even when it was nowhere near being let go, and did the same for
|
|
242
|
+
a memory in the middle of being corrected. It now counts `protected` and
|
|
243
|
+
`in-live-revision-chain` only where that is what kept the memory, as it already did for
|
|
244
|
+
`recurring`. Nothing is cleaned up differently.
|
|
245
|
+
- **Doctor counts held corrections.** When a new memory says it changes or corrects one
|
|
246
|
+
that doesn't look related, the old one is left alone and the hold is recorded (0.3.13).
|
|
247
|
+
Doctor's Contradictions line now says how many were held in the last 7 lived days and
|
|
248
|
+
how many were settled by hand since ("2 corrections held because they didn't look
|
|
249
|
+
related to the memory they named, 1 settled by hand since; if the other was meant,
|
|
250
|
+
settle it with counterparts settle, which lists it"). It stays green. `counterparts
|
|
251
|
+
settle` lists the ones still held, each with the command that settles it.
|
|
252
|
+
- **Three more reads keep the newest rows.** Past the number of rows each reads,
|
|
253
|
+
`counterparts settle` (and doctor's held-corrections count) took the newest held
|
|
254
|
+
corrections for never settled, and the self tab's page history left its newest
|
|
255
|
+
versions and days undated. They read the newest now. Below those limits nothing
|
|
256
|
+
changes.
|
|
257
|
+
- **Tool descriptions put how to call each tool first.** Claude Code shows the model only
|
|
258
|
+
the first 2,048 characters of a tool's description when the tool is loaded up front:
|
|
259
|
+
with tool search off, behind a custom base URL or proxy, or on a model without tool
|
|
260
|
+
search. Seven of the nine descriptions are longer than that. Each tool's purpose, when
|
|
261
|
+
to call it and every "Do NOT" were already inside that first part. The cut fell in
|
|
262
|
+
the list of guarantees, so `note`, `recall`, `session_end` and `reflect` now lead
|
|
263
|
+
that list with the claims about how to call them: which fields are fields, that a
|
|
264
|
+
question needs a mode, that an empty `memories` is an answer. No wording changed, and
|
|
265
|
+
nothing behaves differently.
|
|
266
|
+
|
|
3
267
|
## 0.3.13 — 2026-10-09
|
|
4
268
|
|
|
5
269
|
A dated memory can now repeat (daily, weekly, monthly or yearly), and a reminder that
|
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
|
@@ -595,6 +595,54 @@ row, saying which source answered, existed until the keys were removed — §1a.
|
|
|
595
595
|
back immediately. Doctor prints these steps as the remedy on any Snapshot
|
|
596
596
|
finding that is not green.
|
|
597
597
|
|
|
598
|
+
26. **[M] ONE DELIVERY PER EVENT, HOWEVER MANY WIRINGS FIRE IT (2026-10-09).**
|
|
599
|
+
Claude Code runs every hook registered for an event — settings and plugins
|
|
600
|
+
alike — at once, with the same input. Two wirings of Counterparts in one host
|
|
601
|
+
(the npm install's hooks and the plugin's; two settings files naming two
|
|
602
|
+
builds) would otherwise give every session two wakes, two recall blocks per
|
|
603
|
+
prompt, two Stop asks, two boundaries and two background workers. Seen live on
|
|
604
|
+
2026-10-09. Two layers:
|
|
605
|
+
|
|
606
|
+
- **The plugin stands down** (`adapters/plugin.ts#hookGate`): a plugin hook
|
|
607
|
+
that finds a LIVE hook of ours in user, project or local settings exits at
|
|
608
|
+
once and says so at SessionStart. "Ours" is read by the SCRIPT
|
|
609
|
+
(`host-wiring.ts#readOurHook`): a runtime given `adapters/claude-code/bin/hook.ts`
|
|
610
|
+
or its `.mjs` shim, `counterparts-hook`, or `<binary> hook`, whatever one-token
|
|
611
|
+
flags come before or after `run`, and nothing with a shell operator in it.
|
|
612
|
+
So a plugin reads what a newer `connect` writes. (The plugin's server stands
|
|
613
|
+
down the same way, by the registration's NAME.) `connect`'s own rewrite keeps
|
|
614
|
+
the strict reading (`isOurHookCommand`): it rewrites only what it can fully
|
|
615
|
+
parse. A writer that adds a flag writes it as ONE token, or older readers
|
|
616
|
+
take its value for the script.
|
|
617
|
+
- **The claim is the backstop** (`claim.ts`), for whatever the stand-down
|
|
618
|
+
misses: after the store opens and before anything else, each hook process
|
|
619
|
+
claims its event in one `BEGIN IMMEDIATE` read-and-write of the one row
|
|
620
|
+
of its own small database, `sessions/claims/hook-claims.sqlite` (host
|
|
621
|
+
state, not memory; never backed up), keyed by the session id, the event, the
|
|
622
|
+
host's `prompt_id` and the event's own fields (the prompt text's hash,
|
|
623
|
+
`source`, `stop_hook_active` and the last assistant message's hash, `reason`,
|
|
624
|
+
`trigger`). A process is the holder's TWIN when its key matches and it
|
|
625
|
+
STARTED (`performance.timeOrigin`) before the holder finished — the winner
|
|
626
|
+
stamps its claim when it exits, and a holder that never stamps holds for
|
|
627
|
+
`CLAIM_WINDOW_MS` (15 s) at most. The twin exits 0 with nothing on stdout —
|
|
628
|
+
no wake, recall, ask, boundary or worker — writes one
|
|
629
|
+
`adapter.hook.claim.lost` row, and leaves one stderr line. All five events
|
|
630
|
+
are claimed. A matching key from a process that started after the holder
|
|
631
|
+
finished is a separate event (a host with no `prompt_id` sending the same
|
|
632
|
+
words twice) and delivers. **Fail-open:** no session id, an observer, or a
|
|
633
|
+
claims file that will not take the write, and the process delivers, so one
|
|
634
|
+
wiring behaves exactly as before (two small writes: about 0.3 ms measured in
|
|
635
|
+
process, within noise end to end). The claims are in their own file, not
|
|
636
|
+
the store's `meta`, so a claim waits only on another claim: the store's
|
|
637
|
+
writers (the worker the last Stop started, the MCP server, the CLI) never
|
|
638
|
+
hold it up, and a store somebody holds costs it nothing. Each of the two
|
|
639
|
+
writes waits at most `CLAIM_WAIT_MS` (500 ms). A claim that could not be
|
|
640
|
+
written is in the hook's `process.end` log line; it is said on stderr too
|
|
641
|
+
only when it is a fault (the file cannot be made or written), not when
|
|
642
|
+
another claim held the file. Doctor's `Installed twice` line (amber)
|
|
643
|
+
reads the week's `claim.lost` rows. The transcript's size is not in the key:
|
|
644
|
+
the host may write between the twins starting.
|
|
645
|
+
|
|
598
646
|
### The nightly run, and the page writer inside it (2026-09-28 — working defaults, held lightly)
|
|
599
647
|
|
|
600
648
|
**[M] Once per local calendar day, the first session's line starts the nightly run.** On the
|
|
@@ -2079,3 +2079,151 @@ INTERFACE-GAPS §15.
|
|
|
2079
2079
|
page writer's `calendarDaysSince` subtracts two such instants, which is date arithmetic
|
|
2080
2080
|
and zone-free, and `futureNamesIn` compares snapshot folder names, which are UTC by
|
|
2081
2081
|
design (`snapshots.ts`).
|
|
2082
|
+
|
|
2083
|
+
## 2026-10-09 — two wirings, one delivery: the stand-down reads the script, and a claim backs it
|
|
2084
|
+
|
|
2085
|
+
- **What happened.** On the owner's machine 0.3.14's `connect` rewrote the npm hooks to
|
|
2086
|
+
`"<bun>" --no-env-file "--config=<…>" run "<…/hook.ts>"`. The plugin beside it was built
|
|
2087
|
+
before those flags, its `parseScriptInvocation` returned null, and its hooks did not stand
|
|
2088
|
+
down. Every session got two wakes and two recall blocks per prompt. A read-only look at
|
|
2089
|
+
the store that night (the coordinator's) found most writes already idempotent (the capture
|
|
2090
|
+
cursor gave the second Stop nothing new; session records are a file per id; `gate_session`
|
|
2091
|
+
has a primary key; `wakeChecked` stopped a second delivered row). What still doubled:
|
|
2092
|
+
`adapter.wake.injected`, `adapter.boundary` (two `boundaries.jsonl` lines per boundary),
|
|
2093
|
+
`recall.decision`, `adapter.recall`, `adapter.ask`, `recall.credit`,
|
|
2094
|
+
`adapter.semantic.lag`, and the worker: `sleep.cycle`, `sweep.gate` and
|
|
2095
|
+
`adapter.embed.backfill` ran about twice, and the two builds' workers rewrote the wake
|
|
2096
|
+
bundle back and forth six times.
|
|
2097
|
+
- **Layer 1: read the script, not the flags** (`host-wiring.ts#readOurHook`). Used by the
|
|
2098
|
+
plugin's stand-down (`npmWiring`, `hookCommandLive`) and by doctor's Runtime row.
|
|
2099
|
+
`isOurHookCommand` stays strict, for `connect`'s rewrite only.
|
|
2100
|
+
- **Layer 2: the claim** (`claim.ts`, CONTRACT §5 G26). It sits before `adapter.hook`, so a
|
|
2101
|
+
twin writes none of the rows above and spawns no worker. No worker lock was added:
|
|
2102
|
+
this file's "No lock between two workers, on purpose" still stands, and with one hook
|
|
2103
|
+
process per event there is one worker per boundary again. Two builds' workers can still
|
|
2104
|
+
meet across DIFFERENT events (one wins a Stop, the other the next one) while two builds
|
|
2105
|
+
are wired; doctor's `Installed twice` line is what says to keep one.
|
|
2106
|
+
- **Twins, not a clock.** The first cut called an identical key inside 15 s a duplicate.
|
|
2107
|
+
Seven tests failed at once, all of them firing the same payload twice in a row (no
|
|
2108
|
+
`prompt_id`): a host without `prompt_id` sending the same words twice would have lost the
|
|
2109
|
+
second. The rule became "same key AND started before the holder finished". The winner
|
|
2110
|
+
stamps its claim as it exits; `performance.timeOrigin` is the process's start (Bun: 3–4
|
|
2111
|
+
ms after the spawn, measured). The suite then passed unchanged.
|
|
2112
|
+
- **Cost, measured on an M3 Pro beside a running benchmark.** Claim plus finish in process:
|
|
2113
|
+
median 0.24 ms, p95 0.29 ms over 300 events, with the row at its 64-entry bound. The
|
|
2114
|
+
UserPromptSubmit hook end to end, this branch against master alternating, 30 each:
|
|
2115
|
+
median 100.9 ms against 99.4 ms, minimum 95.1 against 95.3. Within noise.
|
|
2116
|
+
- **Not measured here:** that a Stop twin exiting 0 beside a winner exiting with the ask
|
|
2117
|
+
leaves Claude Code's merge blocking the stop (it should, since any blocking hook blocks),
|
|
2118
|
+
and that `prompt_id` is present at UserPromptSubmit itself (the schema says "absent until
|
|
2119
|
+
the first user input of the process lifetime"; the key also carries the prompt's hash, so
|
|
2120
|
+
either way works).
|
|
2121
|
+
|
|
2122
|
+
## 2026-10-09 — review of #355: what was checked, and three changes
|
|
2123
|
+
|
|
2124
|
+
- **False suppression, through the real hook entry** (`test/hook-claim.test.ts`, "separate
|
|
2125
|
+
events are never taken for twins"). Fired AT ONCE, none lost a claim: the same prompt and
|
|
2126
|
+
even the same `prompt_id` in two sessions (the key is per session); the same words typed
|
|
2127
|
+
twice in one session under two `prompt_id`s; SessionStart `startup`, `clear` and `resume`
|
|
2128
|
+
for one session id; a Stop and its re-fire (`stop_hook_active` false and true, same last
|
|
2129
|
+
words). One AFTER another with an identical key, all delivered: two auto-compactions under
|
|
2130
|
+
one `prompt_id`, a session resumed twice, two Stops with the same last words and no
|
|
2131
|
+
`prompt_id`. That second group passes only because the winner stamps its finish (checked:
|
|
2132
|
+
with `finishClaim` taken out, it fails). What remains: a holder KILLED before its stamp
|
|
2133
|
+
(the host's timeout, a hard kill) holds its key for up to 15 s, so in that window a
|
|
2134
|
+
same-key event with no `prompt_id` (a session resumed twice in a row after a killed
|
|
2135
|
+
SessionStart) would be silenced once. Not a path a host produces in practice; left as is.
|
|
2136
|
+
- **The race.** The claim is one `BEGIN IMMEDIATE` read-modify-write (`Store#updateMeta`),
|
|
2137
|
+
so two writers serialise and the second reads the first's claim. Proved two ways: two
|
|
2138
|
+
processes released at the same instant for 50 rounds, every round exactly one winner (in
|
|
2139
|
+
the suite; run 5 times, 250 races, no double win); and 50 pairs of real hook processes
|
|
2140
|
+
(SessionStart, UserPromptSubmit and Stop in turn) fired together over one store: 50 of 50
|
|
2141
|
+
had exactly one twin stand down, no twin printed anything, every SessionStart winner
|
|
2142
|
+
printed its wake, nothing delivered unclaimed. One thing the 50 rounds showed about the
|
|
2143
|
+
rule rather than the lock: a winner that finishes in the very millisecond its twin
|
|
2144
|
+
started reads as "finished before the twin started" (`started < ended` against a
|
|
2145
|
+
millisecond clock). A real hook runs for tens of milliseconds, so this is not a case a
|
|
2146
|
+
host produces; the race test starts each round's process a millisecond before it claims.
|
|
2147
|
+
- **CHANGED: the claim waits 500 ms on a lock, not 5 s** (`CLAIM_WAIT_MS`,
|
|
2148
|
+
`Store#updateMeta`'s new `waitMs`, put back afterwards as `db.ts#foldWal` does). With a
|
|
2149
|
+
write lock held on the store for 30 s, a UserPromptSubmit took 11 s on master and 16 s on
|
|
2150
|
+
the branch: the claim waited the full `BUSY_TIMEOUT_MS`, failed, and delivered (fail-open
|
|
2151
|
+
held; "never cost the turn" didn't). With the bound, 12 s. A twin outwaits its holder's
|
|
2152
|
+
sub-millisecond claim many times over in 500 ms; a store held longer than that makes both
|
|
2153
|
+
twins deliver, the nuisance direction. `finishClaim` has the same bound.
|
|
2154
|
+
- **CHANGED: `readOurHook` anchors our entry at `adapters/claude-code/bin/hook.(ts|mjs)`.**
|
|
2155
|
+
It accepts any runtime before the script (`tsx`, `deno run -A`, `node`), so a bare
|
|
2156
|
+
`claude-code/bin/hook.ts` suffix matched another tool's Claude Code hook at a lookalike
|
|
2157
|
+
path, and a match is what stands the plugin down (no memory at all, if that tool's line
|
|
2158
|
+
is the only one). Our entry has lived under `adapters/` since it was written (2026-08-25).
|
|
2159
|
+
The strict `isOurHookCommand` (connect's rewrite) is unchanged.
|
|
2160
|
+
- **The Stop ask beside a silent twin.** Our ask is not a block: it is exit 0 with
|
|
2161
|
+
`hookSpecificOutput.additionalContext` on Stop, which the reference calls "Non-error
|
|
2162
|
+
feedback for Claude. The conversation continues so Claude can act on it" and says "keeps
|
|
2163
|
+
the conversation going through the same loop protections as `decision: "block"`"
|
|
2164
|
+
(https://code.claude.com/docs/en/hooks, Stop decision control). How several hooks
|
|
2165
|
+
combine, from the guide (https://code.claude.com/docs/en/hooks-guide, "Combine results
|
|
2166
|
+
from multiple hooks", read 2026-10-09): "When multiple hooks match the same event, every
|
|
2167
|
+
hook's command runs to completion before Claude Code merges the results", and "Text from
|
|
2168
|
+
`additionalContext` is kept from every hook and passed to Claude together"; its worked
|
|
2169
|
+
example's logging hook "exits 0, which reports no decision". So a twin that exits 0 with
|
|
2170
|
+
nothing on stdout adds nothing and takes nothing away: the winner's ask stands. The docs
|
|
2171
|
+
state precedence explicitly only for PreToolUse and PreModelSwitch; for Stop this is read
|
|
2172
|
+
from the general merge rule, not quoted, and still not watched on a real host. The same
|
|
2173
|
+
page explains why the twins exist at all: "If you define the same handler in more than one
|
|
2174
|
+
settings file, it runs once. A plugin's or skill's copy of the same handler stays
|
|
2175
|
+
separate."
|
|
2176
|
+
- **`prompt_id` at UserPromptSubmit.** The reference's common-fields table: "UUID identifying
|
|
2177
|
+
the user prompt currently being processed … Absent until the first user input". At
|
|
2178
|
+
UserPromptSubmit that prompt is the one being processed, so it should be present; not
|
|
2179
|
+
watched on a real host. The key carries the prompt's hash either way.
|
|
2180
|
+
|
|
2181
|
+
## 2026-10-10 — the claim moves to its own file: the worker held the store past its wait
|
|
2182
|
+
|
|
2183
|
+
- **What CI hit.** The first full-suite run on master (a78e1dae, ubuntu, Pacific/Kiritimati)
|
|
2184
|
+
failed two tests that had passed on the PR: one wiring's UserPromptSubmit, and the npm
|
|
2185
|
+
hook's SessionEnd in `plugin.test.ts`, each printed `delivered unclaimed: database is
|
|
2186
|
+
locked`. Fail-open held (both delivered), but the claim was lost and a line printed, on a
|
|
2187
|
+
path every event of every user runs.
|
|
2188
|
+
- **Who held the lock.** The detached worker the previous Stop (or SessionEnd) started. A
|
|
2189
|
+
watcher polling `BEGIN IMMEDIATE` on the store while the test's sequence ran showed the
|
|
2190
|
+
long holds start only after the first Stop and go on after the last hook exits. The
|
|
2191
|
+
worker reaches the store one bun start-up after its hook exits, which is just when the
|
|
2192
|
+
next hook, started at that exit, reaches it too. Unloaded the holds are a few ms; in a
|
|
2193
|
+
2-CPU Linux container with busy loops beside it they were 300 to 600 ms each, past the
|
|
2194
|
+
claim's 500 ms. The hook's other writes wait the store's 5 s and went through; the claim
|
|
2195
|
+
was the one write that gave up.
|
|
2196
|
+
- **Root cause, and the change.** The claim shared the store's one write lock with every
|
|
2197
|
+
writer the store has, and only it waited 500 ms. A twin needs to wait only on its
|
|
2198
|
+
holder's claim, well under a millisecond of work. So the row moved to its own small
|
|
2199
|
+
database, `sessions/claims/hook-claims.sqlite` (LAYOUT's `sessions` entry is where host
|
|
2200
|
+
state of this kind goes; not backed up), which only claims write. In a directory of its
|
|
2201
|
+
own because `pruneSessions` removes any file directly in `sessions/` untouched for 7
|
|
2202
|
+
days, and in WAL a commit touches the log, not the database file, so the file itself
|
|
2203
|
+
could look a week old in use; the prune skips directories, as it does `log/`. The claim logic is unchanged;
|
|
2204
|
+
`Store#updateMeta`'s `waitMs` (added for the claim in the review of #355) is gone again,
|
|
2205
|
+
with no caller left. WAL with `synchronous = NORMAL`: nothing in the file outlives the
|
|
2206
|
+
15 s window, so a commit a power cut takes back costs nothing, and WAL never corrupts
|
|
2207
|
+
under NORMAL. The two writes of an event, median, in a 2-CPU Linux container: 3-4 ms with
|
|
2208
|
+
the rollback journal and FULL, about 1 ms with WAL and FULL, 0.13-0.23 ms with WAL and
|
|
2209
|
+
NORMAL. Claim plus finish through `claimDelivery`: 0.32 ms, against 0.8-1.2 ms for the
|
|
2210
|
+
old row in `meta`.
|
|
2211
|
+
- **Proved.** A stand-in worker holding the store's write lock 700 ms at a time (300 ms
|
|
2212
|
+
gaps) beside the one-wiring sequence (6 hooks, twice each): master delivered unclaimed 4
|
|
2213
|
+
times of 12, this branch 0, with the same hook times (the hook waits for the lock either
|
|
2214
|
+
way, at its first store write). The two failing tests, 4 copies each in parallel with 6
|
|
2215
|
+
busy loops in a 2-CPU container: master failed 3 runs of 48, this branch 0 of 64. In
|
|
2216
|
+
the suite: "a store somebody holds does not hold the claim" (the claim is made inside a
|
|
2217
|
+
second connection's write transaction on the store) and the old held-lock test, now
|
|
2218
|
+
holding the claims file itself.
|
|
2219
|
+
- **stderr.** A claim that could not be written goes into the hook's `process.end` line
|
|
2220
|
+
(`unclaimed`, `busy`). It is said on stderr only when it is a fault (the claims file
|
|
2221
|
+
cannot be made, opened or written), where someone chasing two wakes would look; not when
|
|
2222
|
+
another claim held the file past 500 ms, which passes and, with one wiring, lost nothing.
|
|
2223
|
+
- **Why one wiring still claims.** It cannot know it has no twin: the claim is the backstop
|
|
2224
|
+
for the reading of the host's wiring being wrong, so it cannot be skipped on that
|
|
2225
|
+
reading. What one wiring pays is two writes of about 0.15 ms each on a file nothing else
|
|
2226
|
+
writes.
|
|
2227
|
+
- **Left as is.** A twin's `adapter.hook.claim.lost` row still goes to the store, with the
|
|
2228
|
+
store's 5 s wait. It is written only when two wirings are live, after the twin has
|
|
2229
|
+
decided to stand down, and it is the record doctor reads.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
|
-
':' //; if command -v bun >/dev/null 2>&1; then exec bun "$0" "$@"; elif command -v node >/dev/null 2>&1; then exec node "$0" "$@"; else echo "counterparts: needs Bun 1.3+ or Node 22.15+ on PATH" >&2; exit 127; fi
|
|
2
|
+
':' //; s="$0"; n=0; while [ -h "$s" ] && [ $n -lt 32 ]; do n=$((n+1)); l="$(readlink "$s")"; case "$l" in /*) s="$l" ;; *) s="${s%/*}/$l" ;; esac; done; c="${s%/*}/../../empty-bunfig.toml"; [ -f "$c" ] || c=/dev/null; if command -v bun >/dev/null 2>&1; then exec bun --no-env-file "--config=$c" "$0" "$@"; elif command -v node >/dev/null 2>&1; then exec node "$0" "$@"; else echo "counterparts: needs Bun 1.3+ or Node 22.15+ on PATH" >&2; exit 127; fi
|
|
3
3
|
// A shell script and an ES module at once: the line above is a no-op string to
|
|
4
|
-
// JavaScript and, to sh, the runtime choice (Bun if it is on PATH, else Node
|
|
4
|
+
// JavaScript and, to sh, the runtime choice (Bun if it is on PATH, else Node;
|
|
5
|
+
// Bun with --no-env-file and --config=<empty-bunfig.toml>, found through any
|
|
6
|
+
// bin symlink, so a project's .env and bunfig.toml stay out: adapters/runtime.ts).
|
|
5
7
|
// See `adapters/launch.mjs`.
|
|
6
8
|
import { launch } from "../../launch.mjs";
|
|
7
9
|
|