counterparts 0.2.0 → 0.3.0
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/README.md +87 -367
- package/docs/QUICKSTART.md +83 -1584
- package/docs/README.md +86 -0
- package/docs/module-map.md +1 -0
- package/package.json +5 -2
- package/src/adapters/claude-code/CONTRACT.md +151 -18
- package/src/adapters/claude-code/INTERFACE-GAPS.md +138 -2
- package/src/adapters/claude-code/NOTES.md +452 -0
- package/src/adapters/claude-code/bin/hook.ts +221 -49
- package/src/adapters/claude-code/bin/runner.ts +220 -101
- package/src/adapters/claude-code/config.ts +202 -279
- package/src/adapters/claude-code/doctor.ts +713 -421
- package/src/adapters/claude-code/embed-client.ts +165 -557
- package/src/adapters/claude-code/hooks.ts +409 -116
- package/src/adapters/claude-code/index.ts +7 -59
- package/src/adapters/claude-code/page-writer.ts +24 -4
- package/src/adapters/claude-code/spawn.ts +6 -7
- package/src/adapters/claude-code/transcript.ts +204 -10
- package/src/adapters/claude-code/vectors.ts +108 -24
- package/src/adapters/cli/CONTRACT.md +123 -3
- package/src/adapters/cli/INTERFACE-GAPS.md +45 -2
- package/src/adapters/cli/NOTES.md +265 -1
- package/src/adapters/cli/bin/counterparts.ts +9 -9
- package/src/adapters/cli/commands.ts +494 -436
- package/src/adapters/cli/help.ts +22 -27
- package/src/adapters/cli/index.ts +0 -2
- package/src/adapters/cli/install.ts +102 -89
- package/src/adapters/cli/removal.ts +1 -1
- package/src/adapters/cli/report.ts +25 -2
- package/src/adapters/cli/uninstall.ts +182 -34
- package/src/adapters/cli/wire.ts +232 -35
- package/src/adapters/dashboard/INTERFACE-GAPS.md +14 -2
- package/src/adapters/dashboard/activity.ts +4 -1
- package/src/adapters/dashboard/bin/dashboard.ts +1 -1
- package/src/adapters/dashboard/registries.ts +16 -1
- package/src/adapters/dashboard/resolve.ts +4 -4
- package/src/adapters/dashboard/source.ts +8 -2
- package/src/adapters/dashboard/web/flow.ts +6 -0
- package/src/adapters/dashboard/web/narrate.ts +66 -14
- package/src/adapters/dashboard/web/reveal.ts +6 -6
- package/src/adapters/dashboard/web/views.ts +12 -4
- package/src/adapters/fired.ts +20 -5
- package/src/adapters/mcp/CONTRACT.md +73 -1
- package/src/adapters/mcp/INTERFACE-GAPS.md +51 -1
- package/src/adapters/mcp/NOTES.md +389 -0
- package/src/adapters/mcp/bin/serve.ts +24 -35
- package/src/adapters/mcp/deliberate.ts +22 -0
- package/src/adapters/mcp/index.ts +26 -2
- package/src/adapters/mcp/server.ts +425 -49
- package/src/adapters/mcp/tools.ts +32 -7
- package/src/adapters/mcp/write-up.ts +454 -0
- package/src/adapters/sessions.ts +1353 -0
- package/src/core/counterpart.ts +32 -8
- package/src/core/embed/CONTRACT.md +85 -0
- package/src/core/embed/NOTES.md +93 -0
- package/src/core/embed/static.ts +622 -0
- package/src/core/encode/INTERFACE-GAPS.md +17 -0
- package/src/core/encode/NOTES.md +78 -0
- package/src/core/encode/secrets.ts +309 -9
- package/src/core/handoff/INTERFACE-GAPS.md +13 -1
- package/src/core/recall/CONTRACT.md +15 -3
- package/src/core/recall/INTERFACE-GAPS.md +94 -0
- package/src/core/recall/NOTES.md +49 -0
- package/src/core/recall/activate.ts +37 -3
- package/src/core/recall/index.ts +22 -1
- package/src/core/recall/session.ts +32 -0
- package/src/core/recall/tunables.ts +99 -2
- package/src/core/remember/CONTRACT.md +51 -7
- package/src/core/remember/INTERFACE-GAPS.md +111 -1
- package/src/core/remember/NOTES.md +221 -1
- package/src/core/remember/index.ts +28 -0
- package/src/core/remember/owes.ts +532 -0
- package/src/core/remember/owner-strike-seam.ts +34 -2
- package/src/core/remember/proposals.ts +25 -6
- package/src/core/remember/retention.ts +154 -0
- package/src/core/remember/spans.ts +53 -12
- package/src/core/remember/tunables.ts +8 -0
- package/src/core/remember/write-up-seam.ts +104 -0
- package/src/core/self/CONTRACT.md +16 -13
- package/src/core/self/INTERFACE-GAPS.md +8 -1
- package/src/core/self/NOTES.md +123 -1
- package/src/core/self/calendar.ts +81 -0
- package/src/core/self/episodes.ts +158 -36
- package/src/core/self/identity.ts +2 -2
- package/src/core/self/index.ts +88 -20
- package/src/core/self/tunables.ts +18 -46
- package/src/core/self/writer.ts +58 -9
- package/src/core/store/CONTRACT.md +16 -1
- package/src/core/store/NOTES.md +293 -0
- package/src/core/store/cache.ts +585 -27
- package/src/core/store/db.ts +97 -0
- package/src/core/store/index.ts +570 -13
- package/tools/install-loop/run.sh +52 -71
- package/src/adapters/claude-code/credentials.ts +0 -199
- package/src/adapters/claude-code/interpret-client.ts +0 -395
- package/src/adapters/cli/keys.ts +0 -503
|
@@ -536,6 +536,14 @@ notices.
|
|
|
536
536
|
Amber on two comparisons — the day's cap refusing more asks than it raises, the fallback
|
|
537
537
|
out-writing the author — and never red: this is a balance, not a fault.
|
|
538
538
|
|
|
539
|
+
**Since 2026-09-24, green with counts.** The two ratios became plain counts in the detail —
|
|
540
|
+
a refused ask is not a lost session — and the "too new to grade" clamp went with them. The
|
|
541
|
+
one loss the line could name, a session owed a write-up past `WRITE_UP_WAIT_DAYS`, is the
|
|
542
|
+
`Crash write-up` line's amber; Authorship carries the same count as detail (or "unknown"
|
|
543
|
+
when it could not be read), so one loss shows as one amber line. The owed reading walks
|
|
544
|
+
every scope's words, so it is read once per doctor run, shared by both lines, and skipped
|
|
545
|
+
by the budgeted session-start reading.
|
|
546
|
+
|
|
539
547
|
## What an adversarial read of the scope registry found (2026-09-15, PR #92 review)
|
|
540
548
|
|
|
541
549
|
Five findings, and four of them are one mistake wearing different clothes: the
|
|
@@ -1053,3 +1061,447 @@ budget.
|
|
|
1053
1061
|
The `SessionStart` notice goes quiet with it, because a notice needs a red. That closes
|
|
1054
1062
|
finding 8 (the truncated fix sentence) sideways rather than by shortening it — the sentence
|
|
1055
1063
|
would still truncate on a store that HAS lost its key, which is worth fixing on its own.
|
|
1064
|
+
|
|
1065
|
+
## 2026-09-23 — the Stop ask: shorter, quieter, rarer (B1; findings #28 and #13)
|
|
1066
|
+
|
|
1067
|
+
The owner's four decisions, built as stated: the person reads one line and the model two;
|
|
1068
|
+
two emission shapes behind a switch; on the user side pacing counts only what the person
|
|
1069
|
+
typed (the assistant's replies pace as before); "nothing new" is an answer. Thresholds, the day cap and the one pacer are untouched (§13 G3: one ask,
|
|
1070
|
+
one pacer — nothing here adds a second).
|
|
1071
|
+
|
|
1072
|
+
### What the host writes user-role
|
|
1073
|
+
|
|
1074
|
+
Measured 2026-09-23 on Claude Code 2.1.28x, reading **shapes only** (keys, flags, the
|
|
1075
|
+
first few characters of host frames) across every transcript under `~/.claude/projects/`;
|
|
1076
|
+
no content was copied. `parseTranscript` reads only entries with a `message.role`.
|
|
1077
|
+
|
|
1078
|
+
| what | the entry's own metadata | text opens with | now |
|
|
1079
|
+
|---|---|---|---|
|
|
1080
|
+
| the person, typed or pasted | `origin.kind: "human"`, `promptSource` `typed` / `queued` / `suggestion_accepted` | anything | `conversation` |
|
|
1081
|
+
| a headless prompt | `promptSource: "sdk"`, no origin | anything | `conversation` (no metadata → text rule) |
|
|
1082
|
+
| a subagent's hand-back (254 seen) | `isMeta: true`, `origin.kind: "peer"` (`from`, `senderTaskId`, `body`, `handback`) | `Another Claude session sent a message:\n<agent-message from="…">\n[Subagent hand-back] …` | `injected` (was `conversation`) |
|
|
1083
|
+
| a task notification (266 seen) | `origin.kind: "task-notification"`, **no** `isMeta` | `<task-notification>` | `injected` (was `conversation`) |
|
|
1084
|
+
| a coordinator's message (review: 104 user entries, plus 42 queued) | `isMeta: true`, `origin.kind: "coordinator"` | various | `injected` (caught by `isMeta` and by the non-human kind) |
|
|
1085
|
+
| Stop hook feedback (179 seen) | `isMeta: true`, no origin | `Stop hook feedback:\n["<command>"]: …` | `ritual`, unchanged — refusals are checked before metadata |
|
|
1086
|
+
| `/context` output, local-command caveat, skill bodies, image captions, idle notice, scheduled prompts | `isMeta: true` (some with `turnCompanion`, `sourceToolUseID`, `promptSource: "system"`) | various | `injected` |
|
|
1087
|
+
| the compaction summary | `isCompactSummary: true`, `isVisibleInTranscriptOnly` | `This session is being continued…` | `injected` (was `conversation`) |
|
|
1088
|
+
| slash-command echo, `!`-command | no metadata | `<command-name>`, `<local-command-stdout>`, `<bash-input>`, `<bash-stdout>` | unchanged text rule; `<bash-stdout>`/`<bash-stderr>` now `injected` |
|
|
1089
|
+
| an interrupt | `interruptedMessageId`, no origin | `[Request interrupted by user]` | `injected` |
|
|
1090
|
+
| hook output (`UserPromptSubmit hook success`, `hook_additional_context`, `hook_system_message`) | `type: "attachment"`, **no role** | — | never a turn (unchanged) |
|
|
1091
|
+
| **a prompt typed while the model works** (review M3: 76 seen, 58 never written again) | `type: "attachment"`, `attachment.type: "queued_command"`, `commandMode: "prompt"`, `origin.kind: "human"` | — | **never a turn — the person's own words, missed.** Pre-existing; `INTERFACE-GAPS.md` §14 |
|
|
1092
|
+
| an API error written as the assistant | `isApiErrorMessage: true`, `model: "<synthetic>"` | `API Error: …` | `injected` (was `conversation`) |
|
|
1093
|
+
|
|
1094
|
+
So "UserPromptSubmit hook success" was never counted by this reader: it is how the host
|
|
1095
|
+
*renders* an attachment to the model, and attachments carry no role. The misreadings
|
|
1096
|
+
that paced the ask were the hand-back and the task notification. The rule
|
|
1097
|
+
(`transcript.ts#pieceOf`): foreign → ritual (master's `classifyBlock`, both roles,
|
|
1098
|
+
unchanged) → metadata → the new text markers → conversation.
|
|
1099
|
+
|
|
1100
|
+
- A block the person typed is `conversation` even if it contains a marker (a pasted
|
|
1101
|
+
`<system-reminder>` is still something they pasted).
|
|
1102
|
+
- The new markers (`<task-notification>`, `<agent-message>`, `<bash-stdout>`,
|
|
1103
|
+
`<bash-stderr>`, `<local-command-caveat>`, the hand-back and interrupt openers,
|
|
1104
|
+
`… hook success:` frames) are **anchored at the start of the block and apply only to a
|
|
1105
|
+
user-role entry with no metadata** — a person who mentions `<agent-message>` or their
|
|
1106
|
+
own `PreToolUse hook error` mid-sentence is still speaking (review m1). `hook error`
|
|
1107
|
+
frames are deliberately not markers, for that reason.
|
|
1108
|
+
- **The assistant's text is never reclassified by a marker** (review m2): a reply that
|
|
1109
|
+
explains `<task-notification>` or quotes the ask's opener stays `conversation` and earns
|
|
1110
|
+
recall credit exactly as on master. Only an entry the metadata says the host synthesised
|
|
1111
|
+
changes.
|
|
1112
|
+
- The own-ask rule (`OWN_ASK`) applies only when the metadata says the HOST wrote the
|
|
1113
|
+
line, never to an entry with none.
|
|
1114
|
+
- A line that is JSON but not an object (`null`, a number, an array) is counted as
|
|
1115
|
+
`corrupt` and skipped; before this it threw, which lost the boundary's capture (review
|
|
1116
|
+
m5, pre-existing on master).
|
|
1117
|
+
|
|
1118
|
+
**Changed the next day (2026-09-24):** the assistant's replies no longer count as turns —
|
|
1119
|
+
see "Pacing counts typed turns" below.
|
|
1120
|
+
|
|
1121
|
+
**A gap left open:** an `<agent-message>` hand-back gets no `attributePeers` rewrite, so
|
|
1122
|
+
capture keeps its wrapper verbatim, labelled only by `injected`. It is out of pacing
|
|
1123
|
+
either way; whether capture should label it the way a `<cross-session-message>` is
|
|
1124
|
+
labelled is a capture-quality question for another round.
|
|
1125
|
+
|
|
1126
|
+
### The Stop ask's shapes
|
|
1127
|
+
|
|
1128
|
+
**2026-09-24: ONE shape — `hookSpecificOutput.additionalContext` on Stop.**
|
|
1129
|
+
|
|
1130
|
+
The owner looked at B1's two shapes (below) on 0.3.0 in a real terminal. Default JSON:
|
|
1131
|
+
his one line showed (`Stop says: Counterparts: asking the assistant to write up this
|
|
1132
|
+
session's memories.`) AND the whole two-line ask showed as `Stop hook error: Counterparts,
|
|
1133
|
+
before this session closes: 1) …`. stderr: no friendly line, and `Stop hook error:
|
|
1134
|
+
["/…/bun" run "/…/hook.ts"]: Counterparts, before this session closes: 1) …`. Both read as
|
|
1135
|
+
an error. So the ask moved to the third route, and the switch and both earlier shapes went.
|
|
1136
|
+
|
|
1137
|
+
What the host's reference says (https://code.claude.com/docs/en/hooks, fetched 2026-09-24),
|
|
1138
|
+
verbatim:
|
|
1139
|
+
|
|
1140
|
+
- Stop decision control table: "`hookSpecificOutput.additionalContext` | Non-error feedback
|
|
1141
|
+
for Claude. The conversation continues so Claude can act on it, but unlike `decision:
|
|
1142
|
+
"block"` it is shown in the transcript as hook feedback rather than a hook error".
|
|
1143
|
+
- Below it: "Use `additionalContext` when the hook is working as designed and giving Claude
|
|
1144
|
+
guidance, such as "run the test suite before finishing". It keeps the conversation going
|
|
1145
|
+
through the same loop protections as `decision: "block"`, namely the `stop_hook_active`
|
|
1146
|
+
input and the 8-consecutive-continuation cap, but the transcript labels it `Stop hook
|
|
1147
|
+
feedback` and no hook error notification is shown", with the example
|
|
1148
|
+
`{"hookSpecificOutput": {"hookEventName": "Stop", "additionalContext": "Please run the
|
|
1149
|
+
test suite before finishing"}}` — no `decision` beside it. It stands alone.
|
|
1150
|
+
- "Add context for Claude", where the reminder lands per event: "Stop and SubagentStop: at
|
|
1151
|
+
the end of the turn. The conversation continues so Claude can act on the feedback."
|
|
1152
|
+
- The decision-control summary row: "Stop and SubagentStop also accept
|
|
1153
|
+
`hookSpecificOutput.additionalContext` for non-error feedback that continues the
|
|
1154
|
+
conversation".
|
|
1155
|
+
- `systemMessage` is a universal field ("Warning message shown to the user"); the Stop
|
|
1156
|
+
section names no discard of it, and "Each field the event supports is honored, including
|
|
1157
|
+
`permissionDecision`, `additionalContext`, `updatedInput`, and `systemMessage`". So the
|
|
1158
|
+
person's one line stays, beside the ask.
|
|
1159
|
+
|
|
1160
|
+
Read off the installed host bundle (Claude Code 2.1.281, strings only — not measured live,
|
|
1161
|
+
because a real Stop here would fire the owner's own hooks):
|
|
1162
|
+
|
|
1163
|
+
- The Stop runner files each hook's `additionalContexts` as an attachment
|
|
1164
|
+
`{type: "hook_additional_context", content: [...], hookName: "Stop", hookEvent: "Stop"}`
|
|
1165
|
+
and pushes it into the same list as blocking errors; a non-empty list returns
|
|
1166
|
+
`{blockingErrors: <that list>, preventContinuation: false}`, which is the loop's
|
|
1167
|
+
`stop_hook_blocking` continuation. So the model does get a turn.
|
|
1168
|
+
- The model reads it as an `isMeta` user message `Stop hook additional context: <ask>`,
|
|
1169
|
+
wrapped as a system reminder.
|
|
1170
|
+
- The terminal's stop-hook summary prints `Ran 1 stop hook` with sub-lines
|
|
1171
|
+
`Stop hook error: …` (red) for errors and `Stop hook feedback: …` (gold) for
|
|
1172
|
+
additionalContext. **So the person still sees the two-line ask** — as feedback, in the
|
|
1173
|
+
notice colour, not as an error — plus their own `systemMessage` line. Quieter, not
|
|
1174
|
+
hidden. Nothing in the docs hides the model's text from the person entirely.
|
|
1175
|
+
|
|
1176
|
+
**The transcript filter.** The attachment entry carries no role, so `parseTranscript`
|
|
1177
|
+
never reads it: the ask is not ingested, and it will not appear in the Stop boundary row's
|
|
1178
|
+
`excluded` count either (there is nothing to exclude). Should a build ever write the
|
|
1179
|
+
model-facing text as user text, `transcript.ts#OWN_ASK` accepts the ask's opener behind a
|
|
1180
|
+
`<system-reminder>`, behind any `<Event> hook <words>:` frame, or both, and calls it
|
|
1181
|
+
`ritual`; with no metadata at all, a FRAMED opener is ritual too (`OWN_ASK_FRAMED` — nobody
|
|
1182
|
+
types a reminder tag in front of their own words), while a bare opener stays the person's.
|
|
1183
|
+
`STOP_HOOK_FEEDBACK` stays: older transcripts carry the stderr shape.
|
|
1184
|
+
|
|
1185
|
+
**An old `stopAskShape`** (the owner's live configuration says `"stderr"`) is read, ignored,
|
|
1186
|
+
and named among the old settings: `loadConfig` puts it in `retired`, doctor prints it on
|
|
1187
|
+
the green "Old settings" line, and `install --force` drops it from the file it rewrites.
|
|
1188
|
+
It never makes a configuration unreadable.
|
|
1189
|
+
|
|
1190
|
+
Loop protection is exactly as before: the re-fire (`stop_hook_active: true`) and an empty
|
|
1191
|
+
ask print nothing; the pacer is unchanged.
|
|
1192
|
+
|
|
1193
|
+
**History — B1 (2026-09-23), the two shapes and the owner's one-turn look.**
|
|
1194
|
+
|
|
1195
|
+
What the host's reference says (https://code.claude.com/docs/en/hooks, read 2026-09-23):
|
|
1196
|
+
|
|
1197
|
+
- Stop `decision: "block"` + `reason`: `"block"` "prevents Claude from stopping";
|
|
1198
|
+
`reason` "Tells Claude why it should continue". And, for blocking decisions generally:
|
|
1199
|
+
"You see it as a warning in the transcript, and it stays in the conversation".
|
|
1200
|
+
- `systemMessage`: "Warning message shown to the user."
|
|
1201
|
+
- Exit 2: "A hook that blocks by exiting 2 routes the same way as `reason`: Claude receives
|
|
1202
|
+
the stderr message as the explanation for why it should continue."
|
|
1203
|
+
- A THIRD route exists and is **not built** (the decision was two shapes):
|
|
1204
|
+
`hookSpecificOutput.additionalContext` on Stop is "Non-error feedback for Claude … unlike
|
|
1205
|
+
`decision: "block"` it is shown in the transcript as hook feedback rather than a hook
|
|
1206
|
+
error", with the same loop protections. If both built shapes turn out loud, that is the
|
|
1207
|
+
one the docs call quiet.
|
|
1208
|
+
|
|
1209
|
+
So the JSON shape may show the person their one line AND the model's two lines as a
|
|
1210
|
+
warning. Nobody can tell from here — `claude -p` draws no banner — which is why the owner
|
|
1211
|
+
looks.
|
|
1212
|
+
|
|
1213
|
+
**How the JSON `reason` comes back into the transcript is unmeasured too.** The stderr
|
|
1214
|
+
shape's return is measured (`Stop hook feedback:\n["<command>"]: <ask>` on an `isMeta`
|
|
1215
|
+
entry, `ritual`). The docs say the two route "the same way", but if the JSON one were
|
|
1216
|
+
framed `Stop hook error: …` it would match a `HOST_FRAMES` opener and be `injected` —
|
|
1217
|
+
kept in capture, our own wording encoded as experience (G11). So any line the person did
|
|
1218
|
+
not type that opens with the ask's first words, bare or behind any `<Event> hook <word>:`
|
|
1219
|
+
frame, is `ritual` (`transcript.ts#OWN_ASK`). After the owner's look, a session can
|
|
1220
|
+
confirm it: the Stop boundary row's `excluded` count should include the returned ask.
|
|
1221
|
+
|
|
1222
|
+
**The default is the shape the docs predict is the louder one** (they name
|
|
1223
|
+
`additionalContext` as the route with "no hook error notification", implying `decision:
|
|
1224
|
+
"block"` has one). That is right for the look; if a release is cut before the owner has
|
|
1225
|
+
looked, npm users get it. Say so in the release notes, or cut after the look.
|
|
1226
|
+
|
|
1227
|
+
**The recipe (one turn each; after this round's restart):**
|
|
1228
|
+
|
|
1229
|
+
1. The switch is a top-level key in the `claude-code.json` the hooks read (the one
|
|
1230
|
+
`counterparts doctor` reports). **JSON is the default: add nothing.** Each hook
|
|
1231
|
+
re-reads the file, so a change applies at the next Stop with no restart.
|
|
1232
|
+
2. Start a fresh Claude Code session in any directory and send one prompt that earns
|
|
1233
|
+
the first ask in a single turn, e.g. *"Write a 5,000-word short story about a
|
|
1234
|
+
lighthouse keeper."* (The first ask fires at 6 typed turns or 24,000 bytes of text;
|
|
1235
|
+
a 5,000-word reply is about 28,000.)
|
|
1236
|
+
3. When the reply ends, look at the terminal under it. (The host does not promise the
|
|
1237
|
+
final reply is in the transcript file at Stop time on every version; if nothing
|
|
1238
|
+
shows after the story, send `thanks` and look under that reply instead.)
|
|
1239
|
+
**One line or two?** You should see
|
|
1240
|
+
`Counterparts: asking the assistant to write up this session's memories.` The question
|
|
1241
|
+
is whether a `Stop hook` warning/error line carrying the two-line ask
|
|
1242
|
+
(`Counterparts, before this session closes: 1) …`) shows as well.
|
|
1243
|
+
4. Then set `"stopAskShape": "stderr"` in the same file, open ANOTHER fresh session
|
|
1244
|
+
(the first ask fires once per session), same prompt. Expect `Stop hook error:` and the
|
|
1245
|
+
two-line ask — the person reads the model's text in this shape; it has one channel.
|
|
1246
|
+
5. Pick. Delete the key for JSON, or leave `"stderr"`. The other shape is removed next
|
|
1247
|
+
round. Answer each ask however you like — `memories: []` mints nothing.
|
|
1248
|
+
|
|
1249
|
+
`"stderr"` is recognised in any case and with surrounding spaces (`"STDERR"`,
|
|
1250
|
+
`"stderr "`) on purpose, because a person types it by hand. Anything else is the default,
|
|
1251
|
+
and no value makes the config unreadable: a typo in a display preference must not stand
|
|
1252
|
+
the adapter down. `counterparts doctor` does not yet say which shape is live (doctor.ts
|
|
1253
|
+
is another builder's this round) — the look at one Stop is the confirmation.
|
|
1254
|
+
|
|
1255
|
+
One behaviour differs between the shapes and is accepted: if closing the store throws
|
|
1256
|
+
AFTER the delivery is printed, the stderr shape exits 0 (master's rule, which drops the
|
|
1257
|
+
ask) while the JSON shape's printed decision still blocks. The pacer committed the ask
|
|
1258
|
+
before either, so the JSON behaviour is the more consistent one.
|
|
1259
|
+
|
|
1260
|
+
### "Nothing new" is an answer
|
|
1261
|
+
|
|
1262
|
+
`session_end` with `memories: []` returns `reason: "nothing-new"`, mints nothing, and
|
|
1263
|
+
writes `nothingNewAt` (epoch ms) on the session's registry record via
|
|
1264
|
+
`sessions.ts#markNothingNew` — the MCP server's first write to that registry, deliberately
|
|
1265
|
+
narrow: no phase, no clock moved, no record created. The result carries `recorded`, so a
|
|
1266
|
+
mark that could not be written is visible to the caller rather than only to the ring.
|
|
1267
|
+
|
|
1268
|
+
**Whatever happened to a handoff sent with it** (review M2): the handoff's own outcome
|
|
1269
|
+
rides beside the answer. `nothing-to-clear` (`handoff: ""` where no pointer stands — which
|
|
1270
|
+
the field's description invites exactly when the work is finished) is a no-op, not an
|
|
1271
|
+
error. Any other refusal (`too-large`, `not-text`, `no-scope`) sets `isError`, because
|
|
1272
|
+
something sent did not land and resending can fix it — but the reason stays
|
|
1273
|
+
`nothing-new` and the answer is recorded. Before the review, all three came back
|
|
1274
|
+
`memories-required`, naming a field the caller HAD sent: new-user finding #12's
|
|
1275
|
+
mechanism, reopened. A landed handoff with no memories is still `handoff-only`, and it is
|
|
1276
|
+
marked too — so `nothingNewAt` means "answered with no memories", handoff or not. A call
|
|
1277
|
+
that leaves `memories` out and lands no handoff is still `memories-required`. Not a
|
|
1278
|
+
durable event row: a new durable event name is a core change (`AdapterDurableEventName`).
|
|
1279
|
+
|
|
1280
|
+
It cannot cause an immediate re-ask, and nothing had to change for that:
|
|
1281
|
+
`self/index.ts#openChapter` commits `askedAtTurns`/`askedAtBytes` when the ask goes OUT,
|
|
1282
|
+
so the next Stop sees only the answer's own small reply against the 8 typed turns or
|
|
1283
|
+
24,000 bytes a re-ask needs. `test/stop-ask-quiet.test.ts` walks it: ask, `memories: []`, next
|
|
1284
|
+
Stop `paced`, and the hook's rewrite of the record at that Stop carries the mark forward.
|
|
1285
|
+
|
|
1286
|
+
For the owed-a-write-up predicate (roadmap B3/C2): a session has answered when it wrote
|
|
1287
|
+
memories or a chapter, or its registry record carries `nothingNewAt` later than its last
|
|
1288
|
+
`adapter.ask` row with `asked: true`.
|
|
1289
|
+
|
|
1290
|
+
### Where the moved field detail is actually read (review m3)
|
|
1291
|
+
|
|
1292
|
+
Claude Code serves each MCP tool description cut at 2,048 characters
|
|
1293
|
+
(code.claude.com/docs/en/mcp, "For MCP server authors"; raisable from 2.1.280 with
|
|
1294
|
+
`CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH`). `session_end`'s rendered description is about
|
|
1295
|
+
3,050, so part of it is never read. Of what the ask dropped: "`updates` is a FIELD"
|
|
1296
|
+
(starts at ~1,240) and "A salience you claim is a floor" (~1,690) are inside the cut; the
|
|
1297
|
+
handoff-is-not-a-memory claim (~2,080) and the empty-array claim (~2,730) are past it and
|
|
1298
|
+
**survive only in the input schema's per-field descriptions**, which are served whole:
|
|
1299
|
+
`memories` ("Send `[]` when nothing here is worth keeping"), `handoff` ("not a memory"),
|
|
1300
|
+
`salience` ("your claim is the only way what you lived outranks what a sweep noticed"),
|
|
1301
|
+
`updates` ("A field — never written into `content`"). That is acceptable — the model
|
|
1302
|
+
reads a field's description while filling that field — and the test asserts against what
|
|
1303
|
+
is served (the rendered text sliced at 2,048, and the schema), not the source.
|
|
1304
|
+
|
|
1305
|
+
### Deploy note: sessions resumed across this deploy (review m4)
|
|
1306
|
+
|
|
1307
|
+
*Built 2026-09-24 in the shape proposed below (`self/episodes.ts#rebasedWatermark`), when
|
|
1308
|
+
the counting rule changed again — see "Pacing counts typed turns".*
|
|
1309
|
+
|
|
1310
|
+
The pacer keeps a watermark (`askedAtTurns`/`askedAtBytes`) at the substance it saw when it
|
|
1311
|
+
last asked, and a re-ask needed `substance − watermark` ≥ 8 turns AND ≥ 8,000 bytes
|
|
1312
|
+
(`self/episodes.ts#askDue`, `max(0, …)`). A session whose last ask was committed under
|
|
1313
|
+
master's counting — hand-backs, notifications and compaction summaries included, often
|
|
1314
|
+
several KB each — and that is RESUMED on this build carries a watermark above anything the
|
|
1315
|
+
new counting reaches for a while, so it will not be re-asked until the person's text and
|
|
1316
|
+
the assistant's replies alone pass the old total. Worst for coordinator sessions with heavy
|
|
1317
|
+
hand-back traffic. New sessions are unaffected; the day cap and first ask are unaffected.
|
|
1318
|
+
|
|
1319
|
+
**Proposal for `self/episodes.ts`'s owner (not this builder's file):** in `openChapter`,
|
|
1320
|
+
when `substance.turns < state.askedAtTurns` or `substance.bytes < state.askedAtBytes` —
|
|
1321
|
+
which only a change in the counting rule or a rewritten transcript can produce — persist
|
|
1322
|
+
`askedAtTurns = min(askedAtTurns, substance.turns)` and
|
|
1323
|
+
`askedAtBytes = min(askedAtBytes, substance.bytes)` once, so the re-ask pair measures from
|
|
1324
|
+
now instead of waiting to overtake the old total.
|
|
1325
|
+
|
|
1326
|
+
### Pacing counts typed turns (2026-09-24)
|
|
1327
|
+
|
|
1328
|
+
`substanceOf` counts a **turn** only for a user-role `conversation` piece — what the person
|
|
1329
|
+
typed — and one per transcript entry (`TranscriptTurn.entry`), because a typed message with
|
|
1330
|
+
an image or several text blocks yields several pieces and the cursor needs them apart. The
|
|
1331
|
+
assistant's text counts toward **bytes** only, as does the person's. Host frames, hand-backs,
|
|
1332
|
+
notifications, hook feedback, cross-session messages and our own ask were already
|
|
1333
|
+
`injected`/`ritual` and stay out of both.
|
|
1334
|
+
|
|
1335
|
+
Why: the ask fired after the owner's second message in a session where the assistant had
|
|
1336
|
+
written 8 separate text blocks between tool calls. The thresholds moved with it (self NOTES
|
|
1337
|
+
§23): typed turns OR text, 12 asks a session a day.
|
|
1338
|
+
|
|
1339
|
+
What else reads the new meaning: `noteOrphanTail` (the same `askDue`, the same re-based
|
|
1340
|
+
watermark), the `adapter.ask` row's `turns` field — stamped `counting: "typed"` from now
|
|
1341
|
+
on — and `remember/owes.ts`'s "asked" test, which uses the same OR. It reads an unstamped
|
|
1342
|
+
row's turns as 0 (`sessions.ts#hostSessionEvidence`), because those counted both roles.
|
|
1343
|
+
When no evaluation covers the last capture it decides on bytes alone: the cursor counts
|
|
1344
|
+
every piece of both roles and is no measure of what the person typed.
|
|
1345
|
+
|
|
1346
|
+
**A transcript that will not read** (`bin/hook.ts#toHookInput` sets `turnsUnread`) is
|
|
1347
|
+
not an empty conversation: the Stop ask and the tail pass `rebase: false`, and the re-base
|
|
1348
|
+
itself fires only on the migration pattern (bytes caught up, turns below the watermark), so
|
|
1349
|
+
a failed read cannot zero a session's watermark and make the next Stop due.
|
|
1350
|
+
|
|
1351
|
+
### I40
|
|
1352
|
+
|
|
1353
|
+
The scope registry's SessionStart warning went to stderr, which at exit 0 reaches only
|
|
1354
|
+
the host's debug log. It now also rides the SessionStart `systemMessage`, fitted in
|
|
1355
|
+
PRIORITY order (`bin/hook.ts#hostDelivery` takes a list): the doctor notice first, because
|
|
1356
|
+
it has no other route to the owner; the registry line after it and only if the envelope
|
|
1357
|
+
still fits `ENVELOPE_MAX_CHARS`. The first cut joined them the other way round into one
|
|
1358
|
+
string, and the review measured the cost: at the 9,038-character wake the envelope's own
|
|
1359
|
+
comment records, a 173-character doctor notice fits alone and so does the registry line,
|
|
1360
|
+
but the two joined made a 9,616-character envelope, the whole notice was dropped, and the
|
|
1361
|
+
one line with nowhere else to go was lost (review M1). A line left out is reported as
|
|
1362
|
+
`dropped` (the `adapter.notice.dropped` ring event), and the registry line keeps its
|
|
1363
|
+
stderr copy for the log.
|
|
1364
|
+
|
|
1365
|
+
### Left for others
|
|
1366
|
+
|
|
1367
|
+
`tools/parallel/bin/daily.ts` feeds `stopAsk("<session>", 1)` to the parallel-run meter
|
|
1368
|
+
as v2's ritual probe, one line per probe. Both lines now carry the session id, so the
|
|
1369
|
+
meter would find no session-free line to recognise. The parallel run is retired; noted,
|
|
1370
|
+
not changed.
|
|
1371
|
+
|
|
1372
|
+
## The next-session write-up (C2, 2026-09-23)
|
|
1373
|
+
|
|
1374
|
+
What the build settled, beyond the CONTRACT section:
|
|
1375
|
+
|
|
1376
|
+
- **A pointer, because of the host cap** (owner's choice between INTERFACE-GAPS §15's two
|
|
1377
|
+
options). The first build carried the words beside the wake, sized to the room; on a
|
|
1378
|
+
mature store there was none. Now the hook points and the MCP door serves.
|
|
1379
|
+
- **The pointer is held to the host's plain-stdout cap, not the reported budget** — and
|
|
1380
|
+
names the ended id once (PR #192 review, MAJOR 1: the first pointer named it three times
|
|
1381
|
+
and, at 537 bytes with host ids, deferred beside the owner's own wake). With no notice
|
|
1382
|
+
the hook prints plain text, so the JSON escaping margin does not apply; with one,
|
|
1383
|
+
`hostDelivery` drops the notice before the envelope overflows.
|
|
1384
|
+
- **The part size is a constant** (`WRITE_UP_PART_BYTES`, 24 KB, in `sessions.ts` because
|
|
1385
|
+
both the hook and the door cut parts), kept per session and project in
|
|
1386
|
+
`adapter.writeup.progress` so a change to the constant cannot renumber a write-up in
|
|
1387
|
+
flight.
|
|
1388
|
+
- **Least recently pointed at first.** Oldest-first alone let one session nobody wrote up
|
|
1389
|
+
stand in front of every other session in the project for ever.
|
|
1390
|
+
- **The door requires the hook's pointer to fetch, and the fetch's mark to answer**
|
|
1391
|
+
(`writeUpPointer`, then `writeUpFor`), the `pageWriterFor` pattern twice over: a model
|
|
1392
|
+
cannot read an owed session it was not pointed at, nor close one it never read.
|
|
1393
|
+
- **"Ended" is the sweep's 12 hours, not the bind's 4** (MAJOR 3), and a registry-open
|
|
1394
|
+
session that answered its last ask is never pointed at: the review's repro was a
|
|
1395
|
+
terminal left open over a long lunch, written up by another session, then re-served in
|
|
1396
|
+
full when it resumed.
|
|
1397
|
+
- **A write-up claims no coverage of the writer's own words** (MAJOR 4; core's
|
|
1398
|
+
`SessionEndDepositContext.cover` seam, built for it) and marks the ENDED session's words here as
|
|
1399
|
+
kept when its last part here comes back — so a later reader of either session sees the
|
|
1400
|
+
truth.
|
|
1401
|
+
- **One project's words at a time** (MAJOR 6). The progress key is the ended session AND
|
|
1402
|
+
the project; a session with words in two projects is marked written up only when both
|
|
1403
|
+
shares have come back, because B3 reads a write-up mark for the whole session.
|
|
1404
|
+
- **A failed final mark is finished by the next fetch** (MAJOR 2), whoever makes it,
|
|
1405
|
+
depositing nothing — the first build let only the session that answered retry, so the
|
|
1406
|
+
session owed for ever. The retry keys on the progress record's `answer` (set only when
|
|
1407
|
+
the last part came back), never on a part count, and the pointer freezes the count once
|
|
1408
|
+
`answer` is set: the words by then read as kept, and their marks can lengthen the text
|
|
1409
|
+
past a part boundary (re-review m-B).
|
|
1410
|
+
- **Progress is pruned at the pointer** (re-review NIT): entries whose session the plan no
|
|
1411
|
+
longer holds as owing — marked by the API sweep, answered after a resume, a share left
|
|
1412
|
+
waiting when another project's mark landed — go before the next session is pointed.
|
|
1413
|
+
- **The kept mark reads `[already written up]`**, because since the `cover` seam it also
|
|
1414
|
+
lands on words an earlier NEXT-SESSION write-up covered, not only on the session's own
|
|
1415
|
+
answers.
|
|
1416
|
+
- **The host evidence moved** from `bin/runner.ts` to `adapters/sessions.ts`
|
|
1417
|
+
(`hostSessionEvidence`, `writeUpSources`), so the retention pass, the pointer, the door
|
|
1418
|
+
and the sweep's marks read one set of facts; the runner keeps `retentionHost` as an
|
|
1419
|
+
alias.
|
|
1420
|
+
- **The sweep's marks** (`bin/runner.ts#sweepAware`): the worker wraps the interpreter it
|
|
1421
|
+
hands the sweep. A written-up session's spans in a chunk of their own are retired with
|
|
1422
|
+
no call — which removes their words from the buffer when the sweep claims them rather
|
|
1423
|
+
than seven days after the mark, the same thing the sweep does to spans that were all
|
|
1424
|
+
authored. In a mixed chunk only the transcript tail of the prompt is re-rendered (core
|
|
1425
|
+
prefixes the wake and cards to it); if the tail is not where it should be the chunk goes
|
|
1426
|
+
through unchanged — a possible duplicate, never a loss. "Finished" is read off the
|
|
1427
|
+
buffer after the sweep: none of the session's words left live, claimed, or
|
|
1428
|
+
quarantined, in ANY project — a quarantined session is NOT marked (MAJOR 5), and nor is
|
|
1429
|
+
one with words still unread in another project (re-review MAJOR-A).
|
|
1430
|
+
- **Cost on the wake's path:** one `planRetention` pass per start whose allowance is not
|
|
1431
|
+
spent; measured and filed as a residual with its cheap fix (INTERFACE-GAPS §15).
|
|
1432
|
+
|
|
1433
|
+
## 2026-09-23 — doctor's keyless lines (roadmap C3)
|
|
1434
|
+
|
|
1435
|
+
- **An absent `embedder` block is the local table, ON** (coordinator's ruling,
|
|
1436
|
+
2026-09-23) — unless the credentials FILE holds a Voyage key, which keeps a 0.2.0 setup
|
|
1437
|
+
as it was. `config.ts#resolveEmbedder` / `withEmbedderDefault`, applied after the
|
|
1438
|
+
credentials load by `bin/hook.ts#hostConfig`, `bin/runner.ts#runnerConfig`,
|
|
1439
|
+
`mcp/bin/serve.ts#questionEmbedder` and the console; doctor re-resolves from its own
|
|
1440
|
+
`config` + `credentials`. `loadConfig` stays pure — it never sees the credentials file.
|
|
1441
|
+
- **Only the credentials file the configuration NAMES counts** (review of #195, MINOR 3).
|
|
1442
|
+
The console's `hostConfigFor` and `doctor` used to fall back to a sibling
|
|
1443
|
+
`credentials.env` for a hand-written config with no `credentialsFile`; the hooks, the
|
|
1444
|
+
worker and the server never read one (`config.ts`: "a file found by convention
|
|
1445
|
+
never"), so the two disagreed about "a Voyage key is saved". Doctor now grades what
|
|
1446
|
+
the hooks have. (`credentials set` still WRITES the sibling for such a config — a file
|
|
1447
|
+
no hook reads; pre-existing, noted, not changed.)
|
|
1448
|
+
- **`tools/parallel/preflight.ts:215` reads the raw `embedder` block** and so does not
|
|
1449
|
+
know the default (review of #195, NIT 10). The parallel-run meter is retired; left.
|
|
1450
|
+
- **The Claude Code line's fix with no `claude` on the PATH** (go-public Phase C walk):
|
|
1451
|
+
`connect` registers the memory tools by running `claude mcp add`, so "Run: counterparts
|
|
1452
|
+
connect" named the command that had just failed. The console now passes
|
|
1453
|
+
`HostReading.claudeOnPath` (a PATH walk, never a spawn) and the exact `claude mcp add …`
|
|
1454
|
+
line `connect` prints; with `claudeOnPath === false` the fix is that line. Null (no PATH
|
|
1455
|
+
to search) keeps `connect`.
|
|
1456
|
+
- **`Recall by meaning` speaks of the local table only.** `OFF` is now only for an
|
|
1457
|
+
explicit `{ "enabled": false }` (*switched off in the configuration…*) or a block-less
|
|
1458
|
+
configuration beside a saved Voyage key (*not switched on: a Voyage key is saved here
|
|
1459
|
+
and this configuration names no embedder…*); both say `Turn on: counterparts install
|
|
1460
|
+
--force --embedder` (`doctor.ts#EMBEDDER_ON_COMMAND`). No line for a knob that is off
|
|
1461
|
+
advises a Voyage key any more; a configuration that names
|
|
1462
|
+
Voyage keeps its old amber for a missing key (frozen, not extended). The static green
|
|
1463
|
+
line names where the weights came from in words (`the counterparts-model-potion
|
|
1464
|
+
package`, `COUNTERPARTS_STATIC_WEIGHTS_DIR`), and with no worker row yet it checks for
|
|
1465
|
+
the table FILE in what `resolveStaticWeights` found — a variable naming an empty folder
|
|
1466
|
+
was green until the first worker row said `NO_WEIGHTS`.
|
|
1467
|
+
- **`Raw transcripts`** (`retentionFindings`, remember INTERFACE-GAPS §11): the policy
|
|
1468
|
+
from `remember/`'s `RETENTION_MS` plus the configuration's `snapshots.keep`, then the
|
|
1469
|
+
newest `remember.prune` row in sessions. Amber for `failed > 0`, or a
|
|
1470
|
+
`STARTED`/`LATCH_HELD` row dated before today; green otherwise, including "not run yet".
|
|
1471
|
+
Folds into `Background` while green (not a headline key).
|
|
1472
|
+
- **The Config line names the unreadable key** (`DoctorInput.configUnreadableKeys`, from
|
|
1473
|
+
`LoadedConfig.unreadableKeys`; review of #190, MINOR 5): the console passes it; the hook
|
|
1474
|
+
passes nothing (it refuses a bad configuration before it gets here).
|
|
1475
|
+
- **`Sweep` and `Crash write-up` were not touched.** On a keyless store that has lived,
|
|
1476
|
+
the amber `Sweep … no-credential` and the `Crash write-up` line name the same command
|
|
1477
|
+
(#188's report); C2 (#192) owns both lines and folds them with its `not-opted-in`
|
|
1478
|
+
reason.
|
|
1479
|
+
|
|
1480
|
+
## Keyless (2026-09-24, owner's word)
|
|
1481
|
+
|
|
1482
|
+
- **Removed:** `interpret-client.ts` (the Anthropic write-up of crashed sessions),
|
|
1483
|
+
`credentials.ts` (the credentials file), the paid half of `embed-client.ts` (Voyage),
|
|
1484
|
+
the `crashWriteUp` / `models` / `credentialsFile` keys, `apiSweepOn`, the seat helpers,
|
|
1485
|
+
the `credential` capability row, `runner.ts#sweepAware`, and `sessions.ts#sweepOwns`
|
|
1486
|
+
with the `sweep` option it fed. Why: "no keys; nothing leaves your machine except
|
|
1487
|
+
through Claude Code", said without an asterisk. No migration: essentially no install
|
|
1488
|
+
had a key.
|
|
1489
|
+
- **Old configurations are read, not refused.** Each removed key lands in
|
|
1490
|
+
`AdapterConfig.retired` (a phrase for a person), and doctor prints them on one green
|
|
1491
|
+
`Old settings` line — the owner's live file carries `credentialsFile`, and a key he no
|
|
1492
|
+
longer needs must not cost a grade, let alone his memory. `embedder.kind: "voyage"` reads
|
|
1493
|
+
as the table; `crashWriteUp: "next-session"` is not worth a note.
|
|
1494
|
+
- **The page writer's command is not configurable** (a supply-chain scanner's "runs a
|
|
1495
|
+
command named by config"). The spawn is always `claude`; `pageWriter.command` is retired
|
|
1496
|
+
like the keys, and the tests reach the stub through `PageWriterPlanInput.command` /
|
|
1497
|
+
`runPageWriter({ command })`, which only code can pass. The child's inherited
|
|
1498
|
+
environment is unchanged (filtering it could break `claude`'s own auth).
|
|
1499
|
+
- **A store holding Voyage vectors** is HELD under the table, as before (cache v5 never
|
|
1500
|
+
drops paid rows at open); the one exit `heldExits` names now is the drop
|
|
1501
|
+
(`verify --rebuild --drop-vectors`), since the model that wrote them cannot be
|
|
1502
|
+
configured again. Nobody is known to have such a store.
|
|
1503
|
+
- **The backfill tells the table from an injected embedder by `kind`**, not by the
|
|
1504
|
+
removed `needsCredential`: the table's limit is `STATIC_BACKFILL_LIMIT` and its misses
|
|
1505
|
+
are the item's; anything else keeps the paid-shaped rules (limit 64, blame only an
|
|
1506
|
+
item the embedder named). Core's `no-credential` / `no-credentials` reasons are left in
|
|
1507
|
+
its vocabulary, because rows already written carry them.
|