counterparts 0.1.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/CONSTITUTION.md +68 -0
- package/LICENSE +21 -0
- package/README.md +348 -0
- package/docs/ELI5.md +84 -0
- package/docs/QUICKSTART.md +1258 -0
- package/docs/module-map.md +81 -0
- package/package.json +63 -0
- package/src/adapters/claude-code/CONTRACT.md +606 -0
- package/src/adapters/claude-code/INTERFACE-GAPS.md +655 -0
- package/src/adapters/claude-code/NOTES.md +1055 -0
- package/src/adapters/claude-code/bin/hook.ts +820 -0
- package/src/adapters/claude-code/bin/runner.ts +522 -0
- package/src/adapters/claude-code/config.ts +778 -0
- package/src/adapters/claude-code/credentials.ts +199 -0
- package/src/adapters/claude-code/doctor.ts +2557 -0
- package/src/adapters/claude-code/embed-client.ts +617 -0
- package/src/adapters/claude-code/hooks.ts +2240 -0
- package/src/adapters/claude-code/index.ts +224 -0
- package/src/adapters/claude-code/interpret-client.ts +395 -0
- package/src/adapters/claude-code/page-writer.ts +462 -0
- package/src/adapters/claude-code/primacy.ts +162 -0
- package/src/adapters/claude-code/spawn.ts +241 -0
- package/src/adapters/claude-code/standdown.ts +536 -0
- package/src/adapters/claude-code/transcript.ts +661 -0
- package/src/adapters/claude-code/vectors.ts +415 -0
- package/src/adapters/cli/CONTRACT.md +255 -0
- package/src/adapters/cli/INTERFACE-GAPS.md +350 -0
- package/src/adapters/cli/NOTES.md +936 -0
- package/src/adapters/cli/bin/counterparts.ts +74 -0
- package/src/adapters/cli/commands.ts +6095 -0
- package/src/adapters/cli/export.ts +766 -0
- package/src/adapters/cli/index.ts +103 -0
- package/src/adapters/cli/install.ts +670 -0
- package/src/adapters/cli/removal.ts +1186 -0
- package/src/adapters/cli/repair-dates.ts +659 -0
- package/src/adapters/cli/self-page.ts +229 -0
- package/src/adapters/cli/snapshot.ts +279 -0
- package/src/adapters/cli/start-fresh.ts +1228 -0
- package/src/adapters/config-path.ts +342 -0
- package/src/adapters/dashboard/CONTRACT.md +67 -0
- package/src/adapters/dashboard/INTERFACE-GAPS.md +139 -0
- package/src/adapters/dashboard/NOTES.md +474 -0
- package/src/adapters/dashboard/activity.ts +121 -0
- package/src/adapters/dashboard/ansi.ts +82 -0
- package/src/adapters/dashboard/bin/dashboard.ts +479 -0
- package/src/adapters/dashboard/browse.ts +298 -0
- package/src/adapters/dashboard/identity.ts +182 -0
- package/src/adapters/dashboard/index.ts +183 -0
- package/src/adapters/dashboard/layout.ts +149 -0
- package/src/adapters/dashboard/registries.ts +291 -0
- package/src/adapters/dashboard/resolve.ts +206 -0
- package/src/adapters/dashboard/source.ts +48 -0
- package/src/adapters/dashboard/status.ts +327 -0
- package/src/adapters/dashboard/stories.ts +194 -0
- package/src/adapters/dashboard/web/app.html +1731 -0
- package/src/adapters/dashboard/web/brain.html +463 -0
- package/src/adapters/dashboard/web/fired.ts +31 -0
- package/src/adapters/dashboard/web/flow.ts +457 -0
- package/src/adapters/dashboard/web/narrate.ts +1042 -0
- package/src/adapters/dashboard/web/reveal.ts +135 -0
- package/src/adapters/dashboard/web/server.ts +287 -0
- package/src/adapters/dashboard/web/views.ts +1744 -0
- package/src/adapters/expansions.ts +569 -0
- package/src/adapters/fired.ts +1580 -0
- package/src/adapters/mcp/CONTRACT.md +240 -0
- package/src/adapters/mcp/INTERFACE-GAPS.md +271 -0
- package/src/adapters/mcp/NOTES.md +205 -0
- package/src/adapters/mcp/bin/serve.ts +349 -0
- package/src/adapters/mcp/deliberate.ts +619 -0
- package/src/adapters/mcp/index.ts +101 -0
- package/src/adapters/mcp/protocol.ts +170 -0
- package/src/adapters/mcp/server.ts +1740 -0
- package/src/adapters/mcp/stdio.ts +56 -0
- package/src/adapters/mcp/tools.ts +779 -0
- package/src/adapters/scopes.ts +657 -0
- package/src/adapters/sessions.ts +402 -0
- package/src/adapters/snapshots.ts +1069 -0
- package/src/adapters/stance-env.ts +137 -0
- package/src/core/associate/CONTRACT.md +118 -0
- package/src/core/associate/INTERFACE-GAPS.md +173 -0
- package/src/core/associate/NOTES.md +194 -0
- package/src/core/associate/buffer.ts +66 -0
- package/src/core/associate/edges.ts +188 -0
- package/src/core/associate/index.ts +570 -0
- package/src/core/associate/pending.ts +383 -0
- package/src/core/associate/spread.ts +149 -0
- package/src/core/associate/tunables.ts +123 -0
- package/src/core/bridge.ts +272 -0
- package/src/core/briefing.ts +67 -0
- package/src/core/counterpart.ts +3855 -0
- package/src/core/encode/CONTRACT.md +151 -0
- package/src/core/encode/INTERFACE-GAPS.md +135 -0
- package/src/core/encode/NOTES.md +146 -0
- package/src/core/encode/aliases.ts +71 -0
- package/src/core/encode/battery.ts +284 -0
- package/src/core/encode/chunk.ts +265 -0
- package/src/core/encode/emotion.ts +119 -0
- package/src/core/encode/floor.ts +76 -0
- package/src/core/encode/index.ts +100 -0
- package/src/core/encode/precision.ts +162 -0
- package/src/core/encode/preselect.ts +269 -0
- package/src/core/encode/salience.ts +108 -0
- package/src/core/encode/secrets.ts +265 -0
- package/src/core/encode/tunables.ts +99 -0
- package/src/core/encode/types.ts +286 -0
- package/src/core/encode/words.ts +75 -0
- package/src/core/handoff/CONTRACT.md +199 -0
- package/src/core/handoff/INTERFACE-GAPS.md +166 -0
- package/src/core/handoff/NOTES.md +206 -0
- package/src/core/handoff/index.ts +957 -0
- package/src/core/mint.ts +279 -0
- package/src/core/observer.ts +28 -0
- package/src/core/physics/CONTRACT.md +341 -0
- package/src/core/physics/NOTES.md +155 -0
- package/src/core/physics/clock.ts +51 -0
- package/src/core/physics/index.ts +1054 -0
- package/src/core/prospective/CONTRACT.md +137 -0
- package/src/core/prospective/INTERFACE-GAPS.md +112 -0
- package/src/core/prospective/NOTES.md +160 -0
- package/src/core/prospective/derive.ts +188 -0
- package/src/core/prospective/index.ts +1030 -0
- package/src/core/prospective/tunables.ts +72 -0
- package/src/core/prospective/windows.ts +187 -0
- package/src/core/recall/CONTRACT.md +326 -0
- package/src/core/recall/INTERFACE-GAPS.md +163 -0
- package/src/core/recall/NOTES.md +472 -0
- package/src/core/recall/activate.ts +521 -0
- package/src/core/recall/cues.ts +275 -0
- package/src/core/recall/gate.ts +441 -0
- package/src/core/recall/index.ts +692 -0
- package/src/core/recall/probe.ts +239 -0
- package/src/core/recall/reference.ts +201 -0
- package/src/core/recall/render.ts +285 -0
- package/src/core/recall/session.ts +403 -0
- package/src/core/recall/tunables.ts +329 -0
- package/src/core/remember/CONTRACT.md +293 -0
- package/src/core/remember/INTERFACE-GAPS.md +189 -0
- package/src/core/remember/NOTES.md +373 -0
- package/src/core/remember/fallback.ts +452 -0
- package/src/core/remember/index.ts +103 -0
- package/src/core/remember/owner-strike-seam.ts +479 -0
- package/src/core/remember/proposals.ts +609 -0
- package/src/core/remember/spans.ts +1310 -0
- package/src/core/remember/tunables.ts +111 -0
- package/src/core/remember/updates.ts +198 -0
- package/src/core/retrieval.ts +96 -0
- package/src/core/revision.ts +441 -0
- package/src/core/schemas/CONTRACT.md +190 -0
- package/src/core/schemas/INTERFACE-GAPS.md +172 -0
- package/src/core/schemas/NOTES.md +260 -0
- package/src/core/schemas/aliases.ts +160 -0
- package/src/core/schemas/index.ts +1459 -0
- package/src/core/schemas/tunables.ts +44 -0
- package/src/core/schemas/types.ts +387 -0
- package/src/core/self/CONTRACT.md +459 -0
- package/src/core/self/INTERFACE-GAPS.md +284 -0
- package/src/core/self/NOTES.md +1057 -0
- package/src/core/self/briefing.ts +980 -0
- package/src/core/self/episodes.ts +483 -0
- package/src/core/self/freeze.ts +103 -0
- package/src/core/self/identity.ts +604 -0
- package/src/core/self/index.ts +2130 -0
- package/src/core/self/journal-file.ts +760 -0
- package/src/core/self/page.ts +404 -0
- package/src/core/self/tunables.ts +244 -0
- package/src/core/self/writer.ts +714 -0
- package/src/core/sleep/CONTRACT.md +298 -0
- package/src/core/sleep/INTERFACE-GAPS.md +262 -0
- package/src/core/sleep/NOTES.md +770 -0
- package/src/core/sleep/briefing.ts +86 -0
- package/src/core/sleep/consolidate.ts +241 -0
- package/src/core/sleep/cycle.ts +598 -0
- package/src/core/sleep/decay.ts +237 -0
- package/src/core/sleep/dedup.ts +373 -0
- package/src/core/sleep/index.ts +112 -0
- package/src/core/sleep/log.ts +116 -0
- package/src/core/sleep/markers.ts +164 -0
- package/src/core/sleep/prune.ts +170 -0
- package/src/core/sleep/strength-cache.ts +176 -0
- package/src/core/sleep/tunables.ts +135 -0
- package/src/core/sleep/types.ts +542 -0
- package/src/core/store/CONTRACT.md +446 -0
- package/src/core/store/NOTES.md +1068 -0
- package/src/core/store/cache.ts +709 -0
- package/src/core/store/db.ts +275 -0
- package/src/core/store/errors.ts +134 -0
- package/src/core/store/index.ts +2450 -0
- package/src/core/store/operational.ts +610 -0
- package/src/core/store/owner-op-seam.ts +428 -0
- package/src/core/store/paths.ts +494 -0
- package/src/core/store/prose.ts +165 -0
- package/src/core/store/render.ts +87 -0
- package/src/core/store/walk-seam.ts +78 -0
- package/src/core/types.ts +68 -0
- package/tools/install-loop/run.sh +1063 -0
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
# `adapters/claude-code/` — INTERFACE-GAPS
|
|
2
|
+
|
|
3
|
+
*Everything the composition root and this adapter needed from a module they may
|
|
4
|
+
not edit, plus three holes found by building them. Filed rather than hacked
|
|
5
|
+
around (the no-cross-edits rule); each entry says what exists today, what the
|
|
6
|
+
honest fix is, and where the proof lives.*
|
|
7
|
+
|
|
8
|
+
Written 2026-08-25, alongside `src/core/counterpart.ts`, `test/counterpart.test.ts`
|
|
9
|
+
and `test/claude-code.test.ts`.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. `remember/`'s `ProposalSource` has no member for a swept proposal
|
|
14
|
+
|
|
15
|
+
**What exists.** `ProposalSource = "session-end" | "jot"`. Both mean "the
|
|
16
|
+
experiencer wrote this". A crash-fallback sweep is neither, and
|
|
17
|
+
`Counterpart.applySweep` must build a `Proposal` to reach `mintProposal` — so it
|
|
18
|
+
sets `source: "session-end"` (`SWEPT_SOURCE`, named and commented at the top of
|
|
19
|
+
`counterpart.ts`) and carries the truth in `MintOptions.channel: "fallback"`.
|
|
20
|
+
|
|
21
|
+
**Why it is not urgent.** Nothing downstream reads `proposal.source`:
|
|
22
|
+
`mintProposal` reads content, kind, salience, updates, aliases, feeling, title
|
|
23
|
+
and day, and takes the authorship record from `channel`, which is engine-set and
|
|
24
|
+
unclaimable (SEAMS N). `test/seams.test.ts` already mints with
|
|
25
|
+
`channel: "fallback"` from a `source: "session-end"` proposal, so the composition
|
|
26
|
+
root is doing exactly what the seam suite does.
|
|
27
|
+
|
|
28
|
+
**The honest fix.** Add `"fallback"` to `ProposalSource` and let the fallback
|
|
29
|
+
path say what it is. One-line union change in `remember/proposals.ts`, plus the
|
|
30
|
+
places that switch on it (none today).
|
|
31
|
+
|
|
32
|
+
## 2. `Store.open({ dir })` does not run its own path guard — FOUND LIVE
|
|
33
|
+
|
|
34
|
+
**What happened.** `dataDir()` calls `assertSafeDataDir()`, so the
|
|
35
|
+
environment-resolved path is guarded. An EXPLICIT `dir` goes straight into the
|
|
36
|
+
constructor, which `mkdirSync`s `prose/`, `versions/`, `tmp/` and `cache/` before
|
|
37
|
+
anything checks it. Writing `test/counterpart.test.ts` created a directory under
|
|
38
|
+
`~/.bansai` — v1's live memory — proving the guard by violating it.
|
|
39
|
+
|
|
40
|
+
**What was done.** `Counterpart`'s constructor now calls
|
|
41
|
+
`assertSafeDataDir(opts.dir)` before anything opens, and
|
|
42
|
+
`test/counterpart.test.ts` — "an explicit data dir aimed at v1's live store is
|
|
43
|
+
refused BEFORE anything is created" — asserts the refusal AND that nothing was
|
|
44
|
+
created on the way to it.
|
|
45
|
+
|
|
46
|
+
**Why that is not enough.** The root is one entrance. `Store.open({ dir })` is
|
|
47
|
+
public and every adapter, tool and test can reach it directly. Scar §2.13 is
|
|
48
|
+
"path guards resolve before they compare, and no tool silently accepts a pointer
|
|
49
|
+
at real data" — the guard exists and resolves correctly; the gap is that the
|
|
50
|
+
entrance a caller actually uses does not consult it.
|
|
51
|
+
|
|
52
|
+
**The honest fix.** One line at the top of `Store`'s constructor:
|
|
53
|
+
`this.dir = assertSafeDataDir(opts.dir ?? dataDir())`. `assertSafeDataDir`
|
|
54
|
+
already resolves both sides before comparing, so `~/.bansai/../.bansai/x` is
|
|
55
|
+
caught too; the root's call then becomes redundant belt-and-braces rather than
|
|
56
|
+
the only belt.
|
|
57
|
+
|
|
58
|
+
**Residue.** The bug had already created what it describes: an empty v2-shaped
|
|
59
|
+
directory as a **new sibling** inside v1's store root. Nothing of v1's own data
|
|
60
|
+
was read, written or modified — every pre-existing entry was untouched — and the
|
|
61
|
+
session could not clean it up either, because the sandbox correctly refuses all
|
|
62
|
+
writes under a live store, deletions included. Removing a stray directory from a
|
|
63
|
+
live store is an operator action, not an agent one; that is the design, and the
|
|
64
|
+
guard above is what stops the next one being created.
|
|
65
|
+
|
|
66
|
+
## 3. `self.appendChapter` has no gate — FOUND BY THE CALLER-UNIVERSALITY TEST
|
|
67
|
+
|
|
68
|
+
**What happened.** `SelfOptions.gate` is consulted by `ingestEpisode` and by
|
|
69
|
+
nothing else. `appendChapter` writes the chapter straight into the episode's
|
|
70
|
+
canonical prose. So a credential written into a chapter landed in
|
|
71
|
+
`prose/episodes/*.md` and stayed there — while the memory minted from that same
|
|
72
|
+
episode was correctly redacted. Scar §2.7 is "a gate covers every ingestion path
|
|
73
|
+
**and every side-channel**", and the journal is the side channel.
|
|
74
|
+
|
|
75
|
+
**What was done.** `Counterpart.appendEpisode` routes the chapter through the
|
|
76
|
+
same `bridge.episodeGate()` and appends the GATE's text, refusing outright when
|
|
77
|
+
the battery refuses. Proof: `test/claude-code.test.ts` — "the entrances are
|
|
78
|
+
enumerated, and each one refuses or redacts a credential" walks all four
|
|
79
|
+
ingestion entrances and then asserts no canonical byte anywhere under `prose/`
|
|
80
|
+
holds the secret.
|
|
81
|
+
|
|
82
|
+
**The honest fix.** `self/` should consult its injected gate in `appendChapter`
|
|
83
|
+
the way it does in `ingestEpisode`, so the next caller inherits the rule instead
|
|
84
|
+
of having to remember it — the same reasoning that put the observer stand-down at
|
|
85
|
+
the store seam rather than at entry points.
|
|
86
|
+
|
|
87
|
+
## 4. SEAMS queued item 12 is now ANSWERABLE, and is answered here
|
|
88
|
+
|
|
89
|
+
**The item.** "Once entrances exist (adapters), enumerate every ingestion
|
|
90
|
+
entrance and prove the gate battery covers each (encode's caller-side half)."
|
|
91
|
+
|
|
92
|
+
**The entrances this build creates**, all four through `Counterpart`:
|
|
93
|
+
|
|
94
|
+
| entrance | gate | wired at |
|
|
95
|
+
|---|---|---|
|
|
96
|
+
| `submitSessionEnd` | `bridge.batteryGate()` (per proposal) | `counterpart.ts` `deposit()` |
|
|
97
|
+
| `submitJot` | `bridge.batteryGate()` (per proposal) | `counterpart.ts` `deposit()` |
|
|
98
|
+
| `appendEpisode` + `ingestEpisode` | `bridge.episodeGate()` | `counterpart.ts`, and `Self`'s `gate` option |
|
|
99
|
+
| `sweepFallback` → apply | `bridge.gateSweepChunk()` (CHUNK level) | `counterpart.ts` `applySweep()` |
|
|
100
|
+
|
|
101
|
+
**Not yet covered, and named so it is not mistaken for covered:** anything an
|
|
102
|
+
adapter other than this one adds. `mcp/`, `cli/` and `dashboard/` do not exist
|
|
103
|
+
yet; when they do, the table above is the thing to extend, and the totality test
|
|
104
|
+
in `test/claude-code.test.ts` is the shape to copy.
|
|
105
|
+
|
|
106
|
+
## 5. `kind` defaults in two places (SEAMS queued item 9, still open)
|
|
107
|
+
|
|
108
|
+
`remember/proposals.ts` defaults a kindless draft to `"fact"` for the authored
|
|
109
|
+
door. The fallback door reaches `encode/` through `gateSweepChunk`, which needs a
|
|
110
|
+
`kind` on every proposal, so `counterpart.ts` spells the same default
|
|
111
|
+
(`DEFAULT_KIND`). Two spellings of one rule. The fix queued item 9 already
|
|
112
|
+
names — move the default behind the gate verdict — closes both.
|
|
113
|
+
|
|
114
|
+
## 7. The Stop ask has no RETURN CHANNEL in this host's hooks
|
|
115
|
+
|
|
116
|
+
**What exists.** `stop()` raises `stopAsk(sessionId, chapter)` when `self/`'s pacer says a
|
|
117
|
+
chapter is due; the coverage read from `SpanBuffer.coverageReport` rides along as a
|
|
118
|
+
measurement of the unaskable tail rather than as a second condition. The entry script
|
|
119
|
+
prints it into the model's context.
|
|
120
|
+
`Counterpart.submitSessionEnd` is the entrance that turns a written dump into a
|
|
121
|
+
memory, and it is fully wired and tested.
|
|
122
|
+
|
|
123
|
+
**The gap.** A hook can only put text INTO the context; it cannot receive the
|
|
124
|
+
model's answer. So the ask goes out and the deposit has nowhere to come back
|
|
125
|
+
through — in this host, that channel is a TOOL, which is `mcp/CONTRACT.md`'s
|
|
126
|
+
job. Until the MCP adapter exists, the authored front door is reachable only by a
|
|
127
|
+
caller holding the `Counterpart` directly, and the crash fallback carries the
|
|
128
|
+
load the dump was meant to carry.
|
|
129
|
+
|
|
130
|
+
**Why the ask ships anyway.** Every session-ending path must raise an ask (spec
|
|
131
|
+
§2 G5/G11's mechanized half), and an ask that exists before its return channel is
|
|
132
|
+
the right order: the alternative is a channel nobody is ever invited to use. The
|
|
133
|
+
telemetry says which happened — `adapter.ask` records `uncovered` every time, so
|
|
134
|
+
the day the channel lands, the backlog it inherits is already a measured
|
|
135
|
+
number.
|
|
136
|
+
|
|
137
|
+
**CLOSED 2026-09-04, and what closing it cost.** The MCP adapter exists, so the
|
|
138
|
+
channel exists — but the first run measured it shut anyway: this host registers
|
|
139
|
+
MCP servers from a STATIC configuration (command, args, env), so the server never
|
|
140
|
+
receives `--session`, and `session_end` refused every dump with
|
|
141
|
+
`no-bound-session`. Zero episodes were written; the model fell back to `note` 34
|
|
142
|
+
times in one session.
|
|
143
|
+
|
|
144
|
+
The fix is a note the hooks leave where the tool can read it —
|
|
145
|
+
`adapters/sessions.ts`, `<dataDir>/sessions/<id>.json`, written at SessionStart,
|
|
146
|
+
refreshed at Stop, closed at SessionEnd — plus an ask that now NAMES the session
|
|
147
|
+
id, because on this host the id can only reach the server through the model. What
|
|
148
|
+
the hooks owe the seam is exactly three things and they are all here: the record,
|
|
149
|
+
its scope (the directory the session STARTED in — set at a start and never moved,
|
|
150
|
+
and from 2026-09-17 the SOURCE every later hook reads its own scope back from, so
|
|
151
|
+
a shell that walks into a worktree cannot file the session anywhere else), and the
|
|
152
|
+
id in the ask's text. Everything about what the server then does with a claim is
|
|
153
|
+
`mcp/CONTRACT.md` §5 G10 and its residual-risk note.
|
|
154
|
+
|
|
155
|
+
**THE SECOND HALF, closed 2026-09-04: the CHAPTER had no channel either.** The ask
|
|
156
|
+
said "add chapter N to this session's episode" from the day the ritual shipped, and
|
|
157
|
+
`Counterpart.appendEpisode` was wired, gated and tested — with no adapter calling it.
|
|
158
|
+
So the invitation named a door that did not exist: measured on the live host, zero
|
|
159
|
+
episode files, every `self.episode` meta row carrying a null `episodeId`, and eleven
|
|
160
|
+
chapters written as `note`s titled "chapter N" because a note was the only thing that
|
|
161
|
+
would take prose. `mcp`'s `chapter` tool is that door, binding through the same
|
|
162
|
+
`requireBoundSession` rules as `session_end`, and the number it returns is the store's,
|
|
163
|
+
never the ask's. The ask that names it is now ONE text on ONE pacer: the authorship half
|
|
164
|
+
and the chapter half fired at different Stops and drew about a dozen asks in a 13-turn
|
|
165
|
+
evening, which is exactly what spec §13 G3 forbids.
|
|
166
|
+
|
|
167
|
+
## 6. `sleep/`'s `SleepStore` and `Store` agree structurally, undocumented
|
|
168
|
+
|
|
169
|
+
`runCycle({ store })` accepts the real `Store` directly (this build passes it
|
|
170
|
+
without a wrapper); `test/seams.test.ts` wraps it in an explicit adapter object.
|
|
171
|
+
Both work, which means the structural compatibility is load-bearing and nothing
|
|
172
|
+
asserts it. A one-line `const _: SleepStore = store` type test in `sleep/`'s
|
|
173
|
+
suite would keep a future signature change from silently forcing every caller
|
|
174
|
+
into the wrapper.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Host-side gaps — this adapter's own open questions (CONTRACT §7)
|
|
179
|
+
|
|
180
|
+
1. **Is there a jot channel in this host?** `Counterpart.captureJot` and
|
|
181
|
+
`submitJot` exist and are tested; no hook calls them, because the host offers
|
|
182
|
+
no in-the-moment deposit surface this adapter can see. The MCP adapter is the
|
|
183
|
+
likely home (`mcp/CONTRACT.md`: note, recall, status). Cost to the turn:
|
|
184
|
+
unmeasured.
|
|
185
|
+
2. **The orphanable tail is measured, not bounded by anything host-specific.**
|
|
186
|
+
`noteOrphanTail` runs on `session-end` and `pre-compact`, and its bound is
|
|
187
|
+
`self/`'s re-ask thresholds — a memory number, not a host one. The host-local
|
|
188
|
+
number (how long after the last session-ending event a session can keep
|
|
189
|
+
living) is still unknown.
|
|
190
|
+
3. **Which host event means "crashed"? — CLOSED 2026-09-04.** None does, and the
|
|
191
|
+
answer is a definition rather than an event: a session is crashed when it
|
|
192
|
+
holds uncovered spans, recorded no `session-end` boundary, and has been silent
|
|
193
|
+
for `CRASH_STALE_MS` (`remember/spans.ts#crashedSessions`, CONTRACT §7.3). The
|
|
194
|
+
old eligibility rule — *any* boundary ∧ uncovered spans — made the sweep the
|
|
195
|
+
primary path in fact: it ran after every Stop, and on 2026-09-04 one evening's
|
|
196
|
+
sweeps billed 13 chunks and minted 61 memories beside 34 authored ones.
|
|
197
|
+
`pre-compact` is still wired and still captures; it is not by itself a crash.
|
|
198
|
+
4. **Long-call survival is asserted, not proven in this host (CONTRACT §5 G6).**
|
|
199
|
+
The call streams (scar E3) and `socketLifetimeMs` is a reported capability
|
|
200
|
+
with no reporter. The proof G6 asks for — one long call surviving this host's
|
|
201
|
+
ceilings, in this host — needs a live run with a real credential, which no
|
|
202
|
+
test here is entitled to make.
|
|
203
|
+
5. **`executionCeilingMs` has no consumer.** It is reported and checkable; no
|
|
204
|
+
code compares against it yet, because every foreground path is an appender and
|
|
205
|
+
the heavy work is already detached. When something in the foreground can grow,
|
|
206
|
+
this is the number it must be measured against.
|
|
207
|
+
6. **On first launch in a new directory, nobody is asked whether this should be
|
|
208
|
+
on. — CLOSED 2026-09-10 (G41).** The hooks are registered globally, so a
|
|
209
|
+
project directory that had never heard of Counterparts inherited capture,
|
|
210
|
+
deposit and the wake the first time a session opened in it.
|
|
211
|
+
|
|
212
|
+
The mechanism is the one this gap predicted: a written record plus an ask in
|
|
213
|
+
the first wake, not a prompt. `SessionStart` appends `SCOPE_ASK` — one short
|
|
214
|
+
block asking the model to ask the person, in plain words, and naming the
|
|
215
|
+
console line that records the answer — whenever the scope registry says
|
|
216
|
+
`unset`, at most once per session (`SessionRecord.askedScope`), and only when
|
|
217
|
+
it fits the ceiling the host reported. It rides `HookResult.ask` rather than
|
|
218
|
+
the injection, because the wake's sentinel states its own byte count and must
|
|
219
|
+
stay its last line (scar §2.3); when there is no room it defers with an event
|
|
220
|
+
and leaves the record unmarked, so the next session asks instead.
|
|
221
|
+
|
|
222
|
+
**What it does NOT close.** The default while unset is still ON, so the
|
|
223
|
+
session that raises the question is itself recorded. That is deliberate —
|
|
224
|
+
every directory the parallel run touches is unset, and defaulting to observer
|
|
225
|
+
would have muted the live run on the day it shipped — and it is the one
|
|
226
|
+
decision in this feature the owner was asked to confirm rather than told.
|
|
227
|
+
7. **Turning it OFF for one directory takes four moving parts. — CLOSED
|
|
228
|
+
2026-09-10 (G42).** It was a project `.claude/settings.json` with an `env`
|
|
229
|
+
block naming an observer configuration through `COUNTERPARTS_CONFIG` and
|
|
230
|
+
setting `COUNTERPARTS_OBSERVER=1` — verified that day to reach both the hooks
|
|
231
|
+
and this host's MCP servers, which was the part that was not obvious. It
|
|
232
|
+
worked; it was a JSON file, a second config file and two environment variables
|
|
233
|
+
to say "not here".
|
|
234
|
+
|
|
235
|
+
It is now one line: `counterparts scope . --off`, writing one entry in
|
|
236
|
+
`<config dir>/scopes.json` (`adapters/scopes.ts`). `off` is stronger than the
|
|
237
|
+
old mechanism as well as shorter — the old one was observer, which still
|
|
238
|
+
delivered the wake and recall; this one produces no output and writes nothing,
|
|
239
|
+
because the entry point refuses before a store is opened (CONTRACT §5 G19).
|
|
240
|
+
`--observer` is the same word for the old behaviour, and `--on` puts it back.
|
|
241
|
+
|
|
242
|
+
**The old mechanism is untouched and still governs.** The stance the
|
|
243
|
+
configuration and the environment produce is combined with the registry's by
|
|
244
|
+
`effectiveStance`, most restrictive wins — so the three private directories,
|
|
245
|
+
which have no registry entry, behave exactly as they did. (G39's complaint —
|
|
246
|
+
that the guard and `COUNTERPARTS_OBSERVER` accepted different value sets — was
|
|
247
|
+
closed separately, in `adapters/stance-env.ts`.)
|
|
248
|
+
|
|
249
|
+
8. **There is no pause/resume for a directory that is normally on. — CLOSED
|
|
250
|
+
2026-09-10 (G43).** `counterparts scope . --pause` is off-for-now and records
|
|
251
|
+
`resumeTo` — what the directory thought it was — so `--resume` puts back
|
|
252
|
+
`observer` where the directory was observer, and `on` where it was on or was
|
|
253
|
+
simply switched off. The directory never changes its mind about what it is;
|
|
254
|
+
the pause is the temporary version this gap asked for, and it is a command
|
|
255
|
+
rather than an edit. The MCP `scope` tool takes `pause` and `resume` too, so a
|
|
256
|
+
session can be paused from inside itself.
|
|
257
|
+
|
|
258
|
+
**Host fact, 2026-09-10:** three private project directories are running in
|
|
259
|
+
observer mode by the mechanism in item 7. Sessions there deliver wake and recall
|
|
260
|
+
and capture nothing, by configuration. A daily record that reads few turns from
|
|
261
|
+
those directories is reading the configuration working, not a fault. **They are
|
|
262
|
+
unchanged by the scope registry** — they hold no entry in it, and the combination
|
|
263
|
+
rule only ever adds restriction — so the migration to `counterparts scope
|
|
264
|
+
<path> --observer` is the owner's to make when they feel like it, not something
|
|
265
|
+
this change did to them.
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## 8. The embedder: what it closed, and the four things it deliberately did not
|
|
270
|
+
|
|
271
|
+
Written 2026-08-29 alongside `embed-client.ts` — the first embedder this package
|
|
272
|
+
has ever had. `Store.open({ embed })` held the socket from the day it was
|
|
273
|
+
written and nothing constructed one, so every memory in the store recorded
|
|
274
|
+
`novelty: null`, reason `no-chunk-vector` (replay review F4/F5).
|
|
275
|
+
|
|
276
|
+
**Closed.** A Voyage client on bare `fetch`, chunked with per-chunk failure
|
|
277
|
+
isolation (E1), credential from `VOYAGE_API_KEY` alone with a named pre-flight
|
|
278
|
+
refusal (§2.18), its own pinned seat with an expiring placeholder (§2.15), and
|
|
279
|
+
egress behind an explicit `embedder.enabled` knob that defaults OFF. Both
|
|
280
|
+
composition roots build it: `openAdapter` and `bin/runner.ts` — the second
|
|
281
|
+
matters more, because the sweep is where most memories are minted.
|
|
282
|
+
|
|
283
|
+
### 8a. `Embedder` was widened to `(text) => number[] | null` — a core edit
|
|
284
|
+
|
|
285
|
+
A production embedder is a network client behind a cache, and `put` /
|
|
286
|
+
`rebuildCache` are synchronous: a lookup that misses has nothing to return.
|
|
287
|
+
Throwing would fail a write over a rebuildable cache; returning `[]` would write
|
|
288
|
+
a dim-0 row that every cosine reads as 0.0 similarity. So a miss is `null` and is
|
|
289
|
+
counted as `unrecomputed` — the same shape `tools/replay/INTERFACE-GAPS §4` asks
|
|
290
|
+
for ("a cache miss must be a counted `not-exercised`"). Two call sites in
|
|
291
|
+
`store/index.ts` changed; every existing sync embedder still typechecks.
|
|
292
|
+
|
|
293
|
+
### 8b. The sweep door and `chunkVector` — CLOSED 2026-08-29 (the slices ruling)
|
|
294
|
+
|
|
295
|
+
The owner ruled, and the vector now reaches `encodeChunk`: `sweepFallback`
|
|
296
|
+
memoizes one chunk vector per content key (raw transcript crossing
|
|
297
|
+
`redactSecrets` before the embedder — the egress rule held on a pre-battery
|
|
298
|
+
surface) and both the prompt cards and the gate select against it. Swept
|
|
299
|
+
memories record real novelty whenever a vector source is wired; without one
|
|
300
|
+
the semantic channel reads `skipped` and the run is lexical-only, said out
|
|
301
|
+
loud. The warm call remains the box-3 half.
|
|
302
|
+
|
|
303
|
+
### 8c. The episode door is BLIND, and now says so instead of pretending
|
|
304
|
+
|
|
305
|
+
`EpisodeGate` is synchronous by type, so `episodeGate()` cannot pay for a live
|
|
306
|
+
embedding the way `batteryGate()` can (`GateFn` may return a promise, and
|
|
307
|
+
`submitProposal` awaits it). The first draft therefore gave it a cache-only
|
|
308
|
+
lookup — which was worse than nothing: `EpisodeGateVerdict` has **no field for a
|
|
309
|
+
novelty number**, so anything computed there fed a gate decision that never reads
|
|
310
|
+
it (`gateProposal` consults `input.novelty` only after its refusal branch has
|
|
311
|
+
returned) and was then dropped. A decorative wire, the same defect 8d describes,
|
|
312
|
+
caught in review before it shipped.
|
|
313
|
+
|
|
314
|
+
The parameter was REMOVED rather than kept with an apology in a comment.
|
|
315
|
+
`episodeGate()` takes no vector source, computes `computeNovelty(null, [])`, and
|
|
316
|
+
episodes record `novelty: null` with reason `no-chunk-vector` — which is exactly
|
|
317
|
+
what they did before this build and is now the honest statement of it.
|
|
318
|
+
|
|
319
|
+
**The honest fix, two halves, both outside this build:** `EpisodeGateVerdict`
|
|
320
|
+
needs somewhere to carry the number (8d's change, applied to the other verdict
|
|
321
|
+
type), and `self/` should consult its injected gate everywhere the way
|
|
322
|
+
`ingestEpisode` does (gap 3). Until both, the door is blind by construction.
|
|
323
|
+
|
|
324
|
+
### 8e. FOUND IN REVIEW: the authored door embedded RAW text — fixed by reordering
|
|
325
|
+
|
|
326
|
+
**What happened.** `batteryGate` embedded `input.content` — the author's draft —
|
|
327
|
+
and gated it afterwards. An adversarial review proved the leak through the real
|
|
328
|
+
`submitSessionEnd` path: a planted Google API key reached the recorded embedder
|
|
329
|
+
**verbatim** while the prose written to disk was correctly redacted. Egress
|
|
330
|
+
bypassed a gate the store did not.
|
|
331
|
+
|
|
332
|
+
Every existing secrets test passed the whole time, and that is the lesson worth
|
|
333
|
+
keeping: they all assert what is DURABLE (`prose/` holds no credential), and this
|
|
334
|
+
leak was on the wire. "A gate covers every ingestion path and every side channel"
|
|
335
|
+
(scar §2.7) had an unwritten clause — the side channel can also be an EXIT.
|
|
336
|
+
|
|
337
|
+
**The fix** is the ordering the sweep door already used
|
|
338
|
+
(`counterpart.applySweep` warms `result.accepted`, post-gate): gate first with
|
|
339
|
+
novelty not yet known, return immediately on a refusal (nothing refused is ever
|
|
340
|
+
embedded), embed the gate's text, then compute novelty and attach it. Safe
|
|
341
|
+
because the battery's accept/refuse never consults novelty — verified by reading
|
|
342
|
+
`battery.ts`, not assumed. The rejected shortcut was calling `redactSecrets`
|
|
343
|
+
before embedding: it would have stopped the credential and left 8f standing.
|
|
344
|
+
|
|
345
|
+
**The tripwire** is `test/claude-code.test.ts` — "the embedder is handed the
|
|
346
|
+
GATED text": it records what the embedder was actually handed and asserts
|
|
347
|
+
`[REDACTED:` present and the credential absent. Confirmed to FAIL on the pre-fix
|
|
348
|
+
tree (its failure message prints the raw key), which is the only reason to
|
|
349
|
+
believe it would catch a regression.
|
|
350
|
+
|
|
351
|
+
### 8f. FOUND IN REVIEW: a gate rewrite used to throw away the vector it paid for
|
|
352
|
+
|
|
353
|
+
The same ordering bug, wearing its other face. The cache keys on the text it was
|
|
354
|
+
asked for; `Store.indexOne` looks up `indexTextOf(title, body)` where `body` is
|
|
355
|
+
the GATE's output. Embedding the raw draft therefore cached under a key the store
|
|
356
|
+
never asks for, so every redaction, hedge or alias rewrite — 18.9% of chunks in
|
|
357
|
+
the replay corpus — silently cost the deposit its vector, leaving box 3 emptier
|
|
358
|
+
than the run's own telemetry implied.
|
|
359
|
+
|
|
360
|
+
Fixed by the same reorder: one string, embedded once, looked up by the same key.
|
|
361
|
+
Held by "a gate REWRITE keeps its vector", also confirmed failing pre-fix. The
|
|
362
|
+
comments at `counterpart.ts` (`LiveVectors`) and `store/index.ts`
|
|
363
|
+
(`indexTextOf`) asserted this property while it was false; both now name the
|
|
364
|
+
ordering that makes it true and what breaks if it is reversed.
|
|
365
|
+
|
|
366
|
+
### 8d. `GateVerdict` gained `novelty` — without it the wire was decorative
|
|
367
|
+
|
|
368
|
+
The battery computed novelty at the authored door and the verdict had nowhere to
|
|
369
|
+
put it, so `submitProposal` built the `Proposal` from the DRAFT's salience and
|
|
370
|
+
the number was discarded before `mintProposal` ever saw it. Three lines in
|
|
371
|
+
`remember/proposals.ts` (an optional field on the `ok` arm, and a merge into
|
|
372
|
+
`proposal.salience`) carry it to the mint. It is optional and null-able on
|
|
373
|
+
purpose: a gate with no vector source omits it, a gate that tried and could not
|
|
374
|
+
measure sends `null`, and those stay different records. `verdictFor` therefore
|
|
375
|
+
attaches NOTHING — it runs before any vector exists — and `batteryGate` attaches
|
|
376
|
+
the value after the gate has spoken, which is what keeps the omitted/null
|
|
377
|
+
distinction real rather than documented.
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## 9. The hooks and the MCP server can name different stores, and nothing notices — FOUND LIVE
|
|
382
|
+
|
|
383
|
+
*Written 2026-09-10, from the live host. LAUNCH-STATUS I31.*
|
|
384
|
+
|
|
385
|
+
**What happened.** This host registers MCP servers from a static configuration:
|
|
386
|
+
`~/.claude.json` carries the server's `env`, and the counterparts server is
|
|
387
|
+
launched with `COUNTERPARTS_DATA_DIR` naming the live store. The hooks do not
|
|
388
|
+
read that file at all — they take `dataDir` from
|
|
389
|
+
`~/.counterparts/claude-code.json`. From 2026-09-04 15:16 until 2026-09-10 08:15
|
|
390
|
+
those two named **different directories**: the config's `dataDir` had been
|
|
391
|
+
overwritten with a temp path (I29), while the server kept opening the live store.
|
|
392
|
+
|
|
393
|
+
**What it cost, and why it was invisible for six days.** Gap 7 above describes the
|
|
394
|
+
session record this adapter writes so the tool can find the session:
|
|
395
|
+
`<dataDir>/sessions/<id>.json`, written at SessionStart, refreshed at Stop. The
|
|
396
|
+
hook writes it into ITS store. `requireBoundSession` in
|
|
397
|
+
`src/adapters/mcp/server.ts` reads it back with `readSession(registryDir)` — the
|
|
398
|
+
SERVER's store. Split the two and the mechanism has a writer in one directory and
|
|
399
|
+
a reader in another, so **every `session_end` and every `chapter` call was refused
|
|
400
|
+
`session-unknown`** for the whole window. The authored front door that gap 7 was
|
|
401
|
+
written to open was shut again, by configuration rather than by design, and the
|
|
402
|
+
refusal names the session rather than the split, so the message told nobody what
|
|
403
|
+
was actually wrong.
|
|
404
|
+
|
|
405
|
+
Nothing leaked: the live store's `operational.sqlite` mtime stayed at 2026-09-05
|
|
406
|
+
and its last active date stayed 2026-09-04 through every daily record. The server
|
|
407
|
+
held the live store open and refused every write that reached it. The refusals are
|
|
408
|
+
the evidence.
|
|
409
|
+
|
|
410
|
+
**The honest fix, and it belongs to `mcp/`.** The server can see this at startup
|
|
411
|
+
and the operator cannot. When it resolves its registry dir, it should also resolve
|
|
412
|
+
the hooks' configured `dataDir` and **refuse to bind a session when the two
|
|
413
|
+
differ**, naming both paths — the same shape as `assertSafeDataDir`: resolve both
|
|
414
|
+
sides, compare, refuse before anything opens. The alternative sometimes proposed —
|
|
415
|
+
have the hook write the session record into both stores — makes the split legal
|
|
416
|
+
instead of loud, and a split store is never what anyone wanted.
|
|
417
|
+
|
|
418
|
+
**Why the #80 guard does not cover this.** `COUNTERPARTS_REQUIRE_EXPLICIT_DIR`
|
|
419
|
+
refuses a store nobody named. Both of these stores were named, confidently, by two
|
|
420
|
+
different files. A guard against silence does not catch two voices disagreeing;
|
|
421
|
+
that needs a comparison, which is what the fix above is.
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
## 10. `remember/` has no way to ADVANCE A CURSOR without depositing (#92 review, F1)
|
|
426
|
+
|
|
427
|
+
*Written 2026-09-15, from the scope-controls review.*
|
|
428
|
+
|
|
429
|
+
**The ask.** A boundary that discovers it joined the memory late — no session
|
|
430
|
+
record, cursor still 0, because this directory was `off` or `paused` when the
|
|
431
|
+
session started and has been turned back on since — must move the read cursor to
|
|
432
|
+
the end of the transcript it can see WITHOUT appending any of it
|
|
433
|
+
(`CONTRACT.md` §5 G22). `remember/` has no such method: `capture` is the only
|
|
434
|
+
thing that writes a cursor, and it writes one as part of depositing.
|
|
435
|
+
|
|
436
|
+
**What the adapter does instead, and why it is a workaround rather than a
|
|
437
|
+
design.** `hooks.ts#sealJoinedLate` calls `captureSpans` with `turns.length`
|
|
438
|
+
PLACEHOLDER turns whose `source` is `tool`. `enters()` refuses that source, so
|
|
439
|
+
`SpanBuffer.captureInner` takes its ALL_EXCLUDED arm — "nothing conversational
|
|
440
|
+
happened: still advance, or the same tool output is re-scanned forever" — which
|
|
441
|
+
advances the cursor to `turns.length` and appends nothing. It is correct and it
|
|
442
|
+
is tested, and it depends on an arm of a core function that exists for another
|
|
443
|
+
reason, through an argument that is a lie about what happened.
|
|
444
|
+
|
|
445
|
+
**What would say it instead:** `SpanBuffer.sealCursor(scope, session, turns)` —
|
|
446
|
+
one `mutate("capture", …)` around `writeCursor`, returning the same
|
|
447
|
+
`CaptureResult` shape with a `SEALED` reason, and `Counterpart.sealSpanCursor`
|
|
448
|
+
beside `captureSpans` to reach it. Roughly fifteen lines in
|
|
449
|
+
`core/remember/spans.ts` plus a name in `CaptureReason`. It is a CORE change and
|
|
450
|
+
the review that found the bug deliberately did not make one; the fix shipped
|
|
451
|
+
adapter-side and this is the entry that says what it is standing in for.
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
## 11. `self/` does not export what a sentinel LOOKS like (2026-09-17, S2)
|
|
456
|
+
|
|
457
|
+
*Written from the wake-delivery repair.*
|
|
458
|
+
|
|
459
|
+
**The ask.** `self/briefing.ts` composes both wake sentinels and holds the two
|
|
460
|
+
regexes that read them back — `OPEN_RE` and `SENTINEL_RE` — as module-private
|
|
461
|
+
constants. `readSentinel` is exported, but it answers only for a string that IS a
|
|
462
|
+
whole bundle: it takes the LAST LINE and requires the stated bytes to equal the
|
|
463
|
+
string's own. What arrives at the host is not that string. It is the injected
|
|
464
|
+
block (the wake plus, on a first launch, the scope question) or, on a day that
|
|
465
|
+
carried a notice, the JSON envelope the hook printed — so the sentinel has to be
|
|
466
|
+
recognised INSIDE a larger text, and its stated bytes cannot be checked against
|
|
467
|
+
that text's length.
|
|
468
|
+
|
|
469
|
+
**What the adapter does instead.** `transcript.ts` carries a second spelling of
|
|
470
|
+
both patterns — the literal prefix located with `indexOf`, then an anchored
|
|
471
|
+
pattern run on one bounded slice, so a match is the sentinel string byte for byte
|
|
472
|
+
and the scan stays linear over an arbitrary transcript. Two copies of one shape,
|
|
473
|
+
in two modules, which is exactly the arrangement `FOREIGN_MARKERS` exists as one
|
|
474
|
+
exported constant to avoid.
|
|
475
|
+
|
|
476
|
+
**What would say it instead:** export the two patterns from `self/`, or a
|
|
477
|
+
`findSentinels(text)` that answers `{ head, tail }` over an arbitrary string
|
|
478
|
+
beside today's whole-bundle `readSentinel`. A handful of lines, and a CORE
|
|
479
|
+
change — which is why the repair shipped adapter-side and this entry stands in
|
|
480
|
+
for it.
|
|
481
|
+
|
|
482
|
+
**A residual of the repair: the check identifies its own hook BY ITS COMMAND
|
|
483
|
+
LINE.** `COUNTERPARTS_HOOK_COMMAND` knows two spellings — the source path the
|
|
484
|
+
owner's host runs (what the 2026-09-17 measurement read off a live transcript)
|
|
485
|
+
and the `counterparts-hook` bin `package.json` installs. A third is possible and
|
|
486
|
+
unmeasured: a compiled binary under some other name, which the runtime question
|
|
487
|
+
in LAUNCH-STATUS may yet produce. The cost of missing it is a session that reads
|
|
488
|
+
`not-found` on a wake that actually arrived — visible rather than silent, and
|
|
489
|
+
one token to fix once the launch wiring is decided.
|
|
490
|
+
|
|
491
|
+
**The second half, still open: nothing checks that RECALL arrived.** A recall
|
|
492
|
+
block states its own sentinel at every `UserPromptSubmit`, and the line that used
|
|
493
|
+
to hold it was the same dead in-process `Map` the wake's expectation lived in, so
|
|
494
|
+
it never answered either. The wake's answer works because the bundle is delivered
|
|
495
|
+
ONCE per session and the host records it in an attachment at the head of the
|
|
496
|
+
file; a recall block is delivered every turn, and checking each one means a
|
|
497
|
+
per-turn expectation and a read positioned against the turn rather than the head.
|
|
498
|
+
That is a different mechanism, not a wider parameter, and it is not built.
|
|
499
|
+
|
|
500
|
+
---
|
|
501
|
+
|
|
502
|
+
## What the spawn-seam repair still owes (I32/I33, 2026-09-11)
|
|
503
|
+
|
|
504
|
+
1. **Nothing SAYS the worker has not run — CLOSED 2026-09-14.** `spawnRefusals()`
|
|
505
|
+
and the durable `adapter.spawn.refused` rows made the fact readable and no
|
|
506
|
+
surface read them, which is exactly the posture that let I32 run for a week.
|
|
507
|
+
Both surfaces now exist and share one library (`doctor.ts`), so they cannot
|
|
508
|
+
disagree: `ClaudeCodeAdapter#notice` puts the worst RED finding in the
|
|
509
|
+
owner's terminal at SessionStart as the hook's `systemMessage` (red only, no
|
|
510
|
+
nag; amber is the console's), and `counterparts doctor` prints the whole
|
|
511
|
+
reading read-only, exit 1 on any red. The counters are read by `doctor`'s
|
|
512
|
+
Spawn finding, which goes red at `TUNABLES.ESCALATE_AFTER` and names the
|
|
513
|
+
reason. See NOTES, "The warning reaches the terminal".
|
|
514
|
+
2. **No command restores a credential — CLOSED 2026-09-14.**
|
|
515
|
+
`counterparts credentials set <NAME>` writes one name into the file the
|
|
516
|
+
configuration names, at 0600, with the value from stdin or `--from-env <VAR>`
|
|
517
|
+
and never from argv, never echoed, never logged. It replaces that name's line
|
|
518
|
+
(the template's commented placeholder included) and keeps every other line and
|
|
519
|
+
comment; `credentials list` says which names the file holds. `install --force`
|
|
520
|
+
keeping a file that holds a key (§E) was the other half.
|
|
521
|
+
3. **The ask cap's day is UTC — LIVE AGAIN 2026-09-18.** This read MOOT from
|
|
522
|
+
2026-09-17, when the cap counted per SESSION for the session's whole life and
|
|
523
|
+
had no day at all. It counts per session PER CALENDAR DAY again, on
|
|
524
|
+
`Store#today` (UTC), so an owner at UTC−6 gets the day's allowance back at
|
|
525
|
+
18:00 local. `input.at` is still the host's UTC ISO date and still stamps
|
|
526
|
+
every `adapter.ask` row, because every other `date` field in the store is UTC
|
|
527
|
+
and two clocks in one store is a scar this repo already has a name for. The
|
|
528
|
+
fix, if the mid-evening reset is ever felt, is one per-owner zone read
|
|
529
|
+
wherever a day is decided — `self/INTERFACE-GAPS` carries the decision.
|
|
530
|
+
4. **The two poisoned titles are not repaired.** The embedder no longer chokes on
|
|
531
|
+
them and the backfill no longer stalls behind them, but the two memories on the
|
|
532
|
+
owner's store still hold a lone surrogate in their payload JSON,
|
|
533
|
+
and what gets embedded for them is the U+FFFD form. A versioned title repair
|
|
534
|
+
is a live-store write and the owner's wording (G46 item 5).
|
|
535
|
+
5. **The refusal counter never decays on its own.** It is cleared by a spawn that
|
|
536
|
+
starts, and by nothing else. A host that refuses once, is fixed by hand, and
|
|
537
|
+
never reaches another boundary keeps a stale count until it does. Acceptable
|
|
538
|
+
— the counter's only consumer is an escalation that a start disarms — but it
|
|
539
|
+
is not a time series, and nothing should read it as one.
|
|
540
|
+
6. **Overlapping runners contend for box 2.** I33 measured six workers at one
|
|
541
|
+
boundary against a 5 s `BUSY_TIMEOUT`. Every meta write this PR adds (the
|
|
542
|
+
refusal counters, the per-id embed failures) is wrapped so a lost lock costs
|
|
543
|
+
the counter and never the run — but the contention itself is unaddressed, and
|
|
544
|
+
a worker that skips its own increment is a counter that reads low. The
|
|
545
|
+
embed counters are at least down to ONE transaction per run
|
|
546
|
+
(`Store.setMetaMany`) rather than one per id; the spawn counter still takes
|
|
547
|
+
its own.
|
|
548
|
+
7. **The give-up gate is per FILL, not per id.** `embed.failed.<id>` may only
|
|
549
|
+
climb when the last fill blamed one input — a 400 the bisector narrowed to a
|
|
550
|
+
single item — which is what stops a 503 or a watchdog abort from retiring a
|
|
551
|
+
healthy window. But a `ChunkFailure` carries offsets into the embedder's own
|
|
552
|
+
deduped batch, which do not address the backfill's ids, so the test is "did
|
|
553
|
+
this fill see poison at all". A fill that mixed an isolated 400 with a 500
|
|
554
|
+
elsewhere therefore still charges the 500's victims. Closing it means carrying
|
|
555
|
+
the failing texts' hashes out of `EmbedderStats` — a new surface, and the
|
|
556
|
+
cache-key hygiene rules apply to it, so it was not taken here.
|
|
557
|
+
|
|
558
|
+
## What `doctor` and the checkout finding still owe (2026-09-14)
|
|
559
|
+
|
|
560
|
+
1. **`Store.eventLog` has no descending read**, so "the newest row of this name"
|
|
561
|
+
costs a ladder of lived-day windows instead of one query. Filed in full as
|
|
562
|
+
`cli/INTERFACE-GAPS` §10, where the console's other asks against `store/`
|
|
563
|
+
live; the workaround is exact, not approximate, and the cost is up to five
|
|
564
|
+
queries on a 150 ms hot path.
|
|
565
|
+
2. **`adapter.checkout` is a durable name in `core/counterpart.ts`.** The third
|
|
566
|
+
time the core has learned a string for an adapter's sake, and for the same
|
|
567
|
+
narrow reason the spawn names did: `dashboard/registries.ts` derives
|
|
568
|
+
`DurableEventName` from these literals, so a durable event named in the
|
|
569
|
+
adapter would fail the registry's totality silently. The core knows a string;
|
|
570
|
+
it knows nothing about git. If that derivation ever moves, this line and the
|
|
571
|
+
two above it should move with it.
|
|
572
|
+
3. **The checkout reading is a git subprocess on a foreground hook.** Bounded by
|
|
573
|
+
`CHECKOUT_BUDGET_MS` (1 s for the WHOLE reading, each call taking what is left
|
|
574
|
+
of it, never throwing, degrading to a neutral finding) and cheap in practice,
|
|
575
|
+
but it is still four to seven `git` invocations per session start, and it is
|
|
576
|
+
the only place this adapter shells out at all. The budget is the answer to the
|
|
577
|
+
review of #108, which measured 7.81 s against a sleeping git when each call
|
|
578
|
+
had its own 2 s ceiling and nothing bounded the set. If it ever shows up in a
|
|
579
|
+
session-start measurement again, the cheap fix is to read `.git/HEAD` and
|
|
580
|
+
`.git/refs/remotes/origin/master` directly and keep git for the ancestry test.
|
|
581
|
+
4. **It grades `origin/master` AS LAST FETCHED, and never fetches.** A tree
|
|
582
|
+
nobody has fetched in a week reads `master` while origin has moved on, which
|
|
583
|
+
is the exact failure the `behind` grade exists to catch — one layer earlier
|
|
584
|
+
than this reading can see. The honest fix is a fetch somebody else performs
|
|
585
|
+
(a cron, the merge itself), not a network call on the wake's path.
|
|
586
|
+
5. **The notice is red-only and says so, which means AMBER has exactly one
|
|
587
|
+
reader: the owner running `doctor`.** A store that sits amber for a month —
|
|
588
|
+
embedder off, vectors uncovered, a checkout quietly behind — tells nobody
|
|
589
|
+
until somebody asks. That is the deliberate trade (a notice people mute is
|
|
590
|
+
worth less than one they read), and it is a trade, not a property.
|
|
591
|
+
6. **The notice loses to the wake, and the owner is not told when it does.** The
|
|
592
|
+
host caps a hook's stdout at 10,000 characters, so over `ENVELOPE_MAX_CHARS`
|
|
593
|
+
the hook prints the plain wake and drops the notice — which means the red day
|
|
594
|
+
with the longest wake is the day the terminal is most likely to stay silent.
|
|
595
|
+
All that is left behind is an `adapter.notice.dropped` ring row, and a ring row
|
|
596
|
+
dies with the process. Closing it properly means either a durable row (a write
|
|
597
|
+
on the wake's path, which §5 G2 argues against) or a second channel that is
|
|
598
|
+
not the wake's — neither was taken here.
|
|
599
|
+
7. **Three findings cannot say "I do not know" — they say green.** `Severity` is
|
|
600
|
+
red / amber / green, so the unknown-newest-row reading (`undetermined`) is
|
|
601
|
+
reported as GREEN with a sentence that explains it is not a grade. Right for
|
|
602
|
+
the notice (unknown must not warn) and wrong for a reader counting greens. A
|
|
603
|
+
fourth severity is the honest shape, and it touches the report, the JSON, the
|
|
604
|
+
dashboard and every caller that partitions on three.
|
|
605
|
+
|
|
606
|
+
## 12. Nobody has run a windowless host session, and this adapter cannot prove one from inside the suite (2026-09-20, S2)
|
|
607
|
+
|
|
608
|
+
Host mode is the owner's pick for the nightly page writer, and every part of it that is
|
|
609
|
+
this package's — the plan, the argument and environment shape, the watchdog, the claim, how
|
|
610
|
+
the outcome is read back — is under test against a stub executable. Three things are not,
|
|
611
|
+
and cannot be without a real machine and a real login:
|
|
612
|
+
|
|
613
|
+
1. **Keychain access from a background process.** The child authenticates with the
|
|
614
|
+
subscription login, and the detached worker that starts it is not a terminal. The
|
|
615
|
+
documented route for unattended runs is `claude setup-token` (spec §16). Until somebody
|
|
616
|
+
runs it, `NO_CREDENTIAL`-shaped failures will surface as `failed(exit …)` on the run's
|
|
617
|
+
row, which is honest but not diagnostic.
|
|
618
|
+
2. **That SessionStart hooks actually fire inside `claude -p`.** The whole reason for host
|
|
619
|
+
mode is that they do — it is what makes the child a session of the self rather than a
|
|
620
|
+
stranger with a prompt. The docs say so; no probe here has watched it happen.
|
|
621
|
+
3. **That `--allowedTools` with one MCP tool name and `--permission-mode default` really
|
|
622
|
+
leaves the child with one tool.** The SPELLING is confirmed — this host lists its
|
|
623
|
+
counterparts tools as `mcp__counterparts__chapter`, `mcp__counterparts__session_end` and
|
|
624
|
+
so on, so `mcp__counterparts__self_page` follows the convention. What is unproved is the
|
|
625
|
+
flag pair's effect on a windowless run. A spelling or a flag the host does not honour
|
|
626
|
+
fails CLOSED (the tool prompts, nobody answers, the run ends with the page untouched and
|
|
627
|
+
a `nothing-to-say` row), which is the right direction but is indistinguishable from a
|
|
628
|
+
night that genuinely had nothing to say.
|
|
629
|
+
|
|
630
|
+
Filed here rather than guessed at: the exact steps the owner has to run by hand are in the
|
|
631
|
+
PR that landed this, and until one of those runs happens, `session` mode is the one that is
|
|
632
|
+
known to work.
|
|
633
|
+
|
|
634
|
+
## 13. The "nightly" writer is not nightly anywhere west of UTC (2026-09-20, S2 review)
|
|
635
|
+
|
|
636
|
+
`store.today()` is `new Date().toISOString().slice(0, 10)` — UTC, like every other date in
|
|
637
|
+
this store, by the decision `store/index.ts#dateOf` records. The page writer keys its night
|
|
638
|
+
off that date, so from US Pacific the day rolls over at 5 p.m. local: "yesterday" becomes
|
|
639
|
+
available, is claimed and is written **in the late afternoon**, and the window it covers is
|
|
640
|
+
5 p.m.-to-5 p.m. local rather than a person's day. The morning session finds the night
|
|
641
|
+
already claimed.
|
|
642
|
+
|
|
643
|
+
**Nothing here is being changed for it.** Two clocks in one store is a scar this repo
|
|
644
|
+
already has a name for, and `learned_on` — the field the writer selects the day by — is
|
|
645
|
+
stamped on the same calendar, so a locally-dated writer would read a UTC-dated day and get
|
|
646
|
+
a different set of memories than the one it named.
|
|
647
|
+
|
|
648
|
+
**What WAS changed is the words.** The block, the doctor line and the contracts say which
|
|
649
|
+
DATE a run is about and never "last night" or "this morning", because those were the only
|
|
650
|
+
part of it that was actually false.
|
|
651
|
+
|
|
652
|
+
The real fix, if the owner wants one, is the one `self/INTERFACE-GAPS` §9's neighbour asks
|
|
653
|
+
for: a per-owner zone read wherever a day is decided — one clock, moved once — and not a
|
|
654
|
+
second clock bolted onto this mechanism. Until then it belongs on the findings list for the
|
|
655
|
+
first blank-store trial, where it is a thing to notice rather than a thing to fix.
|