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,240 @@
|
|
|
1
|
+
# `adapters/mcp/` — CONTRACT
|
|
2
|
+
|
|
3
|
+
## 1. Purpose
|
|
4
|
+
|
|
5
|
+
The deliberate tools — note, recall, status — plus the two return channels the Stop ask
|
|
6
|
+
needs (`session_end` for memories, `chapter` for the episode), exposed over MCP to any host
|
|
7
|
+
that speaks it.
|
|
8
|
+
|
|
9
|
+
## 2. Brain analog
|
|
10
|
+
|
|
11
|
+
Effortful, voluntary retrieval and rehearsal, as distinct from the ambient reminding that
|
|
12
|
+
`recall/` provides. **Named deviation** (constitution line 8): deliberate remembering is
|
|
13
|
+
**the exception, not the interface**. A tool the model must remember to call cannot be
|
|
14
|
+
load-bearing, and this adapter is designed on the assumption that it will be used rarely.
|
|
15
|
+
|
|
16
|
+
## 3. Keeps
|
|
17
|
+
|
|
18
|
+
- **An explicit "remember this" channel exists, and is never the interface.** [v1]
|
|
19
|
+
decisions-triage 07-23, constitution line 8.
|
|
20
|
+
- **One tool, not two.** [v1] test-triage `mcp.test.ts` — a real design decision, kept.
|
|
21
|
+
- **Deliberate recall is a deeper effort with different thresholds**, adds a **labeled**
|
|
22
|
+
lower-confidence tier, and returns footnote-tier items as bodies. [v1] behavioral-spec
|
|
23
|
+
§9.1 G2.
|
|
24
|
+
- **One argument, two paths**: a handle expands *that* memory exactly; a question runs a
|
|
25
|
+
query. Expansion must never degrade into fuzzy search. [v1] §9.1 G1.
|
|
26
|
+
- **Exposure is not recording; retrieval is.** A SEARCH strengthens nothing — `build()` is
|
|
27
|
+
pure, and nothing on that path calls `resolveUse` or `coactivate`, so a memory that was
|
|
28
|
+
merely ranked and listed is no stronger for it. EXPANDING one in full, by id or by title
|
|
29
|
+
handle, is USING it, and the owner's credit ruling of 2026-09-14 credits it at the
|
|
30
|
+
session boundary, once per lived day, in the other adapter. So the handle path leaves one
|
|
31
|
+
HOST-STATE line (`adapters/expansions.ts`: a salted hash of the handle, the id it reached
|
|
32
|
+
or `null`, a timestamp, the project) so that boundary can tell which memory a TITLE
|
|
33
|
+
reached. No tool here writes a memory and none touches physics.
|
|
34
|
+
**Named deviation** (2026-09-15/16, G50 + G58): the rule this replaces was "[v1] §9.1 G4 —
|
|
35
|
+
ranking is not recording, deliberate recall trains nothing", an ABSOLUTE written against
|
|
36
|
+
the wake/footnote rich-get-richer problem. That is an EXPOSURE problem, and the absolute
|
|
37
|
+
over-reached past it: the brain's rule — the testing effect, spacing — is that RETRIEVAL
|
|
38
|
+
strengthens, and a memory read in full was retrieved. Corrected by owner ruling
|
|
39
|
+
2026-09-16: "Exposure never strengthens. Retrieval always does." `core/recall/CONTRACT.md`
|
|
40
|
+
still carries the absolute in §3 and §5 guarantee 8; correcting it is the open half.
|
|
41
|
+
- **A candidate count must not become an undercount** — a top-K tuned for surfacing is
|
|
42
|
+
wrong for an aggregation question. [v1] §9.1 G3.
|
|
43
|
+
- **Confidentiality is enforced at the boundary of the ask**; withholding is *stated* for a
|
|
44
|
+
direct lookup and silent in a list. [v1] §9.1 G5.
|
|
45
|
+
- **A census surface exists and includes what was removed** — counts and dates, never
|
|
46
|
+
bodies or hashes. [v1] §9.1 G6, scar §2.20.
|
|
47
|
+
- **Observer stands down over the wire.** [v1] test-triage `mcp.test.ts`, scar E7.
|
|
48
|
+
|
|
49
|
+
## 4. Drops / simplifies
|
|
50
|
+
|
|
51
|
+
- **The v1 self-store tool is superseded by experiencer authorship** — self-writing became
|
|
52
|
+
the primary path (owner decision, settled). This adapter therefore exposes **no tool that
|
|
53
|
+
writes an identity element**: what enters the identity band is decided by promotion and
|
|
54
|
+
reinforcement at the boundary, by construction, not through a tool description. The plain
|
|
55
|
+
note survives as the named exception it always was.
|
|
56
|
+
*Amended 2026-09-18 (owner rulings 8 and 9, `docs/plan-parallel-rebuild-2026-09-18.md`
|
|
57
|
+
§2), and the amendment is narrower than it looks: `self_page` writes the PAGE — the prose
|
|
58
|
+
the wake now opens with, one row with versions — and touches the identity band not at all.
|
|
59
|
+
It cannot promote a memory, protect one, or move a strength. The doctrine the drop
|
|
60
|
+
protected is "identity strength comes from lived salience", and that is exactly what still
|
|
61
|
+
decides what the page has to work with. Written down is not the same as earned.
|
|
62
|
+
Nor can it UNWRITE the page: clearing and restoring are the owner's console alone, because
|
|
63
|
+
a session that could erase the self between two turns would be a different kind of tool.*
|
|
64
|
+
- **`protected.add` as a callable operation is dropped** with the second-signature queue.
|
|
65
|
+
**PROPOSED** — owner call at check-in; see `schemas/CONTRACT.md` §4 for the evidence and
|
|
66
|
+
counter-argument.
|
|
67
|
+
- **No tool writes an entity, a belief, or a revision.** Entities are born by mention and
|
|
68
|
+
die by decay; revision is `updates:` plus arithmetic (owner decisions, settled). The
|
|
69
|
+
vocabulary this adapter exposes is deliberately three verbs wide, plus the return
|
|
70
|
+
channels — a return channel is not a fourth verb, it is the other end of an ask the
|
|
71
|
+
system already makes.
|
|
72
|
+
- **`chapter` is NOT the self-store tool coming back** (added 2026-09-04). The dropped v1
|
|
73
|
+
tool wrote identity prose directly. This one appends to the session's own journal, and
|
|
74
|
+
what it writes becomes memory only through `ingestEpisode`'s ordinary gated path at the
|
|
75
|
+
boundary — a self-kind memory like any other. It exists because the ask has said "add
|
|
76
|
+
chapter N to this session's episode" since the ritual shipped while nothing on this host
|
|
77
|
+
could accept one: zero episode files, eleven chapters written as `note`s titled
|
|
78
|
+
"chapter N". *If a doctrine names the only legitimate inputs, those inputs must be
|
|
79
|
+
reachable by construction* — the sentence that justified the ask now justifies its door.
|
|
80
|
+
|
|
81
|
+
## 5. Contract
|
|
82
|
+
|
|
83
|
+
**Inputs** — MCP tool calls:
|
|
84
|
+
`note(text[, salience, relevance, emotional, predictive, kind, title, updates])`,
|
|
85
|
+
`recall(handle | question)`, `status()`, `session_end(session, memories[], handoff?)` whose
|
|
86
|
+
entries take the same optional dimensions — `handoff` (2026-09-20, E1) is a FIELD on the
|
|
87
|
+
call and never one of the entries: it is this directory's working context, filed by
|
|
88
|
+
`core/handoff/`, never a memory, and it is written before the `memories` check so a dump
|
|
89
|
+
with a malformed array does not also lose it. Three answers, and only the first is silence:
|
|
90
|
+
ABSENT leaves what stands; PRESENT AND BLANK retires this directory's pointer; anything
|
|
91
|
+
that is not text is a named, durable refusal. The no-scope rule (an empty scope, or one
|
|
92
|
+
that is the store's own directory) is asked here because this side has the canonicaliser,
|
|
93
|
+
and the durable row is written by `core/handoff/`, which owns that guarantee —
|
|
94
|
+
`chapter(session, text[, title])`; the session's observer
|
|
95
|
+
role; the launch's session, scope and data dir when the host can supply them.
|
|
96
|
+
**Outputs** — a stored memory (note), ranked memories with a confidence label (recall), a
|
|
97
|
+
census (status), an appended chapter with the episode's id and the chapter number the store
|
|
98
|
+
actually wrote (chapter), the written self page or the version a write to it produced
|
|
99
|
+
(`self_page`, 2026-09-18); telemetry by reference.
|
|
100
|
+
|
|
101
|
+
**Guarantees** — **[M]** mechanized, **[A]** advisory:
|
|
102
|
+
|
|
103
|
+
1. **[M] `note` traverses the same write seam as every other entrance** — the gate battery
|
|
104
|
+
included (scar §2.7).
|
|
105
|
+
2. **[M] Every privilege the tool description states is mechanized.** v1's note claimed a
|
|
106
|
+
high-salience floor **in its prompt only**, with no engine backstop — the single place a
|
|
107
|
+
stated guarantee had no enforcement (§4.1 known gap). Here the claimed salience is a
|
|
108
|
+
floor clamped in `physics/` §5.2, or the description does not claim it.
|
|
109
|
+
The same guarantee now covers **silence**: an entry that claims no salience gets the
|
|
110
|
+
authored channel's default floor at the mint seam rather than a zero (measured
|
|
111
|
+
2026-09-04: 48 authored rows, all dimensions zero, most unclaimed — the deliberate
|
|
112
|
+
channel's own deposits were the weakest things in the store). The ask never told the
|
|
113
|
+
model to set salience, so silence is the common case, and a mechanism that only works
|
|
114
|
+
when the model remembers to speak is the same class of gap this guarantee exists for.
|
|
115
|
+
An author's own **dimensions** (relevance, emotional, predictive) may be given per note
|
|
116
|
+
and per session-end entry; they reach the row exactly as written, an out-of-range one is
|
|
117
|
+
refused by name rather than clamped or dropped, and `novelty` remains unclaimable —
|
|
118
|
+
prediction error is measured, never asserted.
|
|
119
|
+
3. **[M] Every tool carries an admission test and at least one named negative example** in
|
|
120
|
+
its description, plus an engine-side check wherever the rule is safety-relevant
|
|
121
|
+
(scar §2.16 — v1's `thread.open` shipped with no criteria and produced 33 opens and zero
|
|
122
|
+
closes in 13 days).
|
|
123
|
+
4. **[M] `recall` and `status` write nothing and train nothing**, asserted by a test that
|
|
124
|
+
runs both against a populated store and checks canonical state is byte-identical.
|
|
125
|
+
5. **[M] Under observer, every tool stands down over the wire and says so** (scars E7,
|
|
126
|
+
§2.4).
|
|
127
|
+
6. **[M] Confidential material is returned only in the owner's own session.**
|
|
128
|
+
7. **[M] The census names what was removed** — counts, kinds, dates; never bodies, never
|
|
129
|
+
hashes.
|
|
130
|
+
8. **[A] Wire-protocol framing is host trivia** and may change without touching a core
|
|
131
|
+
contract.
|
|
132
|
+
9. **[M] The core imports nothing from this directory.**
|
|
133
|
+
10. **[M] A session is bound ONCE, and a lazy bind is corroborated by host state the
|
|
134
|
+
model cannot write.** A server launched with `--session` is bound to it and consults
|
|
135
|
+
nothing else — that path is unchanged and preferred. A server launched without one
|
|
136
|
+
binds to the FIRST `session` argument that (a) names an id `adapters/sessions.ts`'s
|
|
137
|
+
registry holds, (b) is live there — not ended, last boundary inside
|
|
138
|
+
`SESSION_TTL_MS` — and (c) carries the same scope as this server. The bind lasts the
|
|
139
|
+
process's lifetime; a second, different id is refused. A claim with no id, an
|
|
140
|
+
unknown id, a dead id or a foreign scope is refused with WHICH of the four it was,
|
|
141
|
+
because a model that cannot tell "unknown id" from "wrong project" cannot act on
|
|
142
|
+
either.
|
|
143
|
+
11. **[M] The scope is the one the HOST names, never silently the store — and it is the
|
|
144
|
+
same string the hooks file that session under.** In order: `--scope` /
|
|
145
|
+
`COUNTERPARTS_SCOPE`, then `CLAUDE_PROJECT_DIR`, then `process.cwd()`. The middle one
|
|
146
|
+
is what makes the two adapters agree without either telling the other: this host
|
|
147
|
+
documents it as the project root where the session started, exports it to stdio MCP
|
|
148
|
+
servers and to hook processes alike, and keeps it put when the agent enters a
|
|
149
|
+
worktree — while the server's own working directory is documented nowhere and was
|
|
150
|
+
only ever measured (`lsof` on four running servers, 2026-09-04). The store's dir
|
|
151
|
+
survives as the answer when the host names no directory at all, and which default won
|
|
152
|
+
is stated in a startup event (`mcp.scope`).
|
|
153
|
+
|
|
154
|
+
The scope is CANONICAL (`sessions.ts#canonicalScope`), because it is not only
|
|
155
|
+
compared — it is the KEY. Span streams, cursors and coverage files are named from a
|
|
156
|
+
hash of this exact string (`remember/spans.ts#keyFor`), so a deposit whose scope says
|
|
157
|
+
`/tmp/x` would claim coverage in a different directory from spans captured under
|
|
158
|
+
`/private/tmp/x`. The bind already canonicalised; the filing does now too.
|
|
159
|
+
12. **[M] `updates` is a FIELD on `note` and on a `session_end` entry**, resolved through
|
|
160
|
+
the same `remember/updates.ts` path every deposit uses, with the RESOLVED id written
|
|
161
|
+
to `doc.meta["updates"]` by `mint.ts`. An unresolvable declaration lands unlinked; it
|
|
162
|
+
is never a refusal.
|
|
163
|
+
|
|
164
|
+
13. **[M] `chapter` binds by exactly the same rules as `session_end`**, through the one
|
|
165
|
+
`requireBoundSession` path, and every refusal names `chapter` rather than the tool the
|
|
166
|
+
check was written for. **The chapter number it returns is the STORE's** — one past what
|
|
167
|
+
was written, never one past what was asked — and a second call with no new ask in
|
|
168
|
+
between continues the chapter it is part of rather than opening another, because
|
|
169
|
+
appending in the moment is the doctrine's headline case (`self/` §13 G2). The journal
|
|
170
|
+
is a gated entrance like every other: the gate's text, possibly redacted, is what
|
|
171
|
+
lands.
|
|
172
|
+
|
|
173
|
+
### The residual risk of the lazy bind, named
|
|
174
|
+
|
|
175
|
+
**Two live sessions in the same directory are told apart only by the id the ask names.**
|
|
176
|
+
Scope narrows a claim to one project; it cannot narrow it to one session, because both
|
|
177
|
+
sessions' records carry the same scope and both are live. That is why the id is REQUIRED
|
|
178
|
+
rather than inferred: there is no "the obvious live session here" to fall back on, and a
|
|
179
|
+
server that guessed would let session B's model write into session A's day — the exact
|
|
180
|
+
privilege guarantee 10 exists to withhold. What the mechanism buys is that the id cannot
|
|
181
|
+
be *invented*: it must already be in host state the hooks wrote, live, and in this
|
|
182
|
+
project. The model can only name a session it was told about, and on this host it is
|
|
183
|
+
told about exactly one — its own, in its own Stop ask.
|
|
184
|
+
|
|
185
|
+
Two smaller residuals, recorded rather than fixed:
|
|
186
|
+
|
|
187
|
+
- **A session started from a linked checkout — CLOSED 2026-09-17.** If SessionStart
|
|
188
|
+
fired from a linked working copy while the MCP server's cwd was the parent project, the
|
|
189
|
+
two scopes differed and the bind was refused. Both sides now resolve the directory the
|
|
190
|
+
host names for the session — `CLAUDE_PROJECT_DIR`, which the host exports to hooks and
|
|
191
|
+
to stdio MCP servers alike and does not move when the agent enters a worktree
|
|
192
|
+
(`server.ts#hostScope`, `claude-code/bin/hook.ts#sessionScope`) — so they agree by
|
|
193
|
+
construction rather than by both happening to read the same working directory. What
|
|
194
|
+
remains is the honest residual: a host that exports no such variable leaves the two
|
|
195
|
+
sides back on their own working directories, where they agreed by measurement and not
|
|
196
|
+
by rule.
|
|
197
|
+
- **The data dir has to agree.** The registry lives under it, and the two sides resolve
|
|
198
|
+
it independently — the hooks from `claude-code.json`, the server from `--dir` /
|
|
199
|
+
`COUNTERPARTS_DATA_DIR` / the default. A host that sets one and not the other gets
|
|
200
|
+
`session-unknown` on every claim, which is at least a refusal that names itself.
|
|
201
|
+
|
|
202
|
+
## 6. Scars honored
|
|
203
|
+
|
|
204
|
+
**E7** (stand-down over the wire) · **§2.4** (a stood-down tool is distinguishable from a
|
|
205
|
+
broken one) · **§2.6** (mechanize invariants; instruct only preferences — guarantee 2 is
|
|
206
|
+
this scar's direct descendant) · **§2.7** (the note traverses the one write chokepoint) ·
|
|
207
|
+
**§2.16** (every model-facing operation carries an admission test and a negative example) ·
|
|
208
|
+
**§2.20** (the census is content-by-reference).
|
|
209
|
+
|
|
210
|
+
## 7. Open questions
|
|
211
|
+
|
|
212
|
+
1. **Does `note` still need to exist** once the experiencer writes at every session end?
|
|
213
|
+
Its job is the in-the-moment mark, which the jot channel also serves. Two doors to the
|
|
214
|
+
same room is how v1 ended up with a self-store nobody called.
|
|
215
|
+
2. **What does `status` show?** v1's answer grew into a dashboard. The useful minimum is
|
|
216
|
+
probably the symmetry counters (created versus exited per kind, up-moves versus
|
|
217
|
+
down-moves) — the numbers that made v1's pathologies visible — not a store census.
|
|
218
|
+
3. **Should `recall` expose the confidence label as a tier name or a number?** v1 labeled
|
|
219
|
+
the fallback tier and left the rest implicit.
|
|
220
|
+
4. **NAMED GAP: the stated-emotion gate cannot supply the `emotional` dimension.**
|
|
221
|
+
The obvious brain-faithful move — affect at encoding stamping a memory vivid — is not
|
|
222
|
+
available here, for two separate reasons, and neither was papered over. (a)
|
|
223
|
+
`encode/emotion.ts#gateEmotion` returns a `DurableFeeling` of `{type, subject}`: a
|
|
224
|
+
feeling that SURVIVED, with no magnitude anywhere on it, so there is no number to feed
|
|
225
|
+
`emotional` without inventing one — and inventing one is retro-typing emotion, which
|
|
226
|
+
§3 forbids. (b) These tool schemas expose no `feeling` field at all, so on the MCP
|
|
227
|
+
door the gate has nothing to fire on in the first place. Closing this means deciding
|
|
228
|
+
what a feeling's magnitude IS (a fired-cue count? a stated intensity the author
|
|
229
|
+
supplies alongside the type?) — a design question, not a wiring one. Until then the
|
|
230
|
+
author's own `emotional` score is the only route, which is why it is now exposed.
|
|
231
|
+
5. **Is four hours the right TTL?** CAL. Every Stop refreshes the clock and the ask is
|
|
232
|
+
delivered AT a Stop, so the window only ever bounds the gap between an ask and its
|
|
233
|
+
answer: four hours is far past any plausible think-time and comfortably inside a day,
|
|
234
|
+
so last night's session cannot be claimed into today's memory. The number to watch is
|
|
235
|
+
`session-not-live` refusals — more than a rare one means the window is wrong.
|
|
236
|
+
6. **Should `note` take a session claim too?** Today it deposits under the bound session
|
|
237
|
+
when there is one and under the literal `"mcp"` when there is not. Letting it BIND
|
|
238
|
+
would give an in-the-moment jot the power to claim a day, which is more privilege
|
|
239
|
+
than the tool needs; leaving it means an unbound server's notes still carry no
|
|
240
|
+
session. Neither is obviously right yet.
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# `adapters/mcp/` — INTERFACE-GAPS
|
|
2
|
+
|
|
3
|
+
*What this adapter needed from a module it may not edit, and what building it
|
|
4
|
+
found. Filed rather than hacked around; each entry says what exists today, what
|
|
5
|
+
the honest fix is, and where the proof lives. Written 2026-08-25 alongside
|
|
6
|
+
`test/mcp.test.ts`.*
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 1. `recall/` has no deliberate mode — the tiering lives here
|
|
11
|
+
|
|
12
|
+
**What exists.** `Recall.build()` is the pure half of the ambient path and is
|
|
13
|
+
public precisely so it can be reused ("a private half is a promise, not a seam",
|
|
14
|
+
`recall/index.ts`). It returns every candidate's verdict, so the information a
|
|
15
|
+
deeper look needs is all there.
|
|
16
|
+
|
|
17
|
+
**What is missing.** There is no `Recall.deliberate()`, and no per-call tunable
|
|
18
|
+
override — `RecallTunables` is fixed per instance. So "deliberate recall is a
|
|
19
|
+
deeper effort with different thresholds" (CONTRACT §3, [v1] §9.1 G2) is
|
|
20
|
+
implemented in `deliberate.ts` by RE-TIERING build's verdicts rather than by
|
|
21
|
+
running the gate at a different bar: soft verdicts (`below-bar`,
|
|
22
|
+
`below-strong-floor`, `capped`, `dedup-suppressed`, `cue-only-temporal`,
|
|
23
|
+
`cold-start-undiscriminating`) are
|
|
24
|
+
admitted at a labeled `dim` tier; hard gates (`dark-uncued`, `below-floor`,
|
|
25
|
+
`cue-fraction`) are not.
|
|
26
|
+
|
|
27
|
+
**Why that is defensible, not just convenient.** The hard/soft split is already
|
|
28
|
+
`recall/`'s own vocabulary, and re-tiering cannot admit anything the activation
|
|
29
|
+
pass did not score — which is the property that keeps expansion from degrading
|
|
30
|
+
into search. What it CANNOT do is change the candidate SET: a lower bar with the
|
|
31
|
+
same `MAX_CANDIDATES` is a lower bar over the same shortlist.
|
|
32
|
+
|
|
33
|
+
**The honest fix.** `Recall.build(turn, { tunables })` — a per-call override so a
|
|
34
|
+
deliberate ask can raise `MAX_CANDIDATES` and lower `FLOOR_GLOBAL_UNITS` on its own
|
|
35
|
+
terms. One optional argument, no new module.
|
|
36
|
+
|
|
37
|
+
## 2. Confidentiality is a prose-`meta` convention with one reader
|
|
38
|
+
|
|
39
|
+
`isConfidential(doc)` reads `meta.confidential` / `meta.confidentiality` and is
|
|
40
|
+
exported from `recall/activate.ts`. Nothing WRITES those fields: no tool, no
|
|
41
|
+
gate, no boundary sets them, so today a memory becomes confidential only if
|
|
42
|
+
something outside this package puts the key in the prose. The withholding
|
|
43
|
+
machinery is real and tested on both paths (stated for a lookup, silent in a
|
|
44
|
+
list) — the classifier is missing. Owner call: is confidentiality declared by
|
|
45
|
+
the experiencer at deposit, inferred by a gate, or set only by the owner from
|
|
46
|
+
the console? Until it is decided, the guarantee is enforceable but unreachable.
|
|
47
|
+
|
|
48
|
+
## 3. The entrance table (claude-code/INTERFACE-GAPS §4), extended
|
|
49
|
+
|
|
50
|
+
`claude-code/INTERFACE-GAPS.md` §4 asks the next adapter to extend the
|
|
51
|
+
gate-coverage enumeration. Both new entrances go through `Counterpart`, so they
|
|
52
|
+
inherit the wiring rather than adding to it:
|
|
53
|
+
|
|
54
|
+
| entrance | gate | wired at |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| `note` tool | `bridge.batteryGate()` (per proposal) | `Counterpart.submitJot` → `deposit()` |
|
|
57
|
+
| `session_end` tool | `bridge.batteryGate()` (per proposal) | `Counterpart.submitSessionEnd` → `deposit()` |
|
|
58
|
+
| `session_end`'s `handoff` field | `episodeGate()` at the seam (2026-09-20, E1) | `Counterpart.writeHandoff` → `Handoffs.write` |
|
|
59
|
+
| `chapter` tool | `episodeGate()` at the seam, then `self/`'s own on the same text | `Counterpart.appendEpisode` → `Self.appendChapter` |
|
|
60
|
+
| `recall` tool | n/a — reads only, asserted byte-identical | `test/mcp.test.ts` |
|
|
61
|
+
| `status` tool | n/a — reads only, asserted byte-identical | `test/mcp.test.ts` |
|
|
62
|
+
|
|
63
|
+
**Nothing new is unguarded.** The proof is the same shape as the claude-code
|
|
64
|
+
totality test: a credential submitted through `note` is redacted, and one that is
|
|
65
|
+
nothing but a credential is refused as `empty-after-redaction`. The journal is on
|
|
66
|
+
the table for the reason the caller-universality test found it in the first place:
|
|
67
|
+
a chapter is canonical prose, so it is an ingestion entrance, and a credential
|
|
68
|
+
written into one landed durably before that gate existed.
|
|
69
|
+
|
|
70
|
+
## 4. `note`'s span linkage depends on a hash the buffer returns positionally
|
|
71
|
+
|
|
72
|
+
`Counterpart.captureJot` returns a `CaptureResult`, and the jot's own span is
|
|
73
|
+
`result.spans[0]`. `submitJot({ ownSpanHash })` then withholds it from the sweep.
|
|
74
|
+
That linkage is load-bearing — without it a deliberate note costs two memories,
|
|
75
|
+
one from the tool and one from the crash fallback re-reading the jot — and it is
|
|
76
|
+
expressed as "index zero of an array". `SpanBuffer.jot` could return the span (or
|
|
77
|
+
its hash) as a named field instead. Proof it works today:
|
|
78
|
+
`test/mcp.test.ts` — "the note's own words ride the buffer as a span the deposit
|
|
79
|
+
claims".
|
|
80
|
+
|
|
81
|
+
## 5. `status` reports a census, and CONTRACT §7 OQ2 wanted counters
|
|
82
|
+
|
|
83
|
+
OQ2: "what does `status` show? The useful minimum is probably the symmetry
|
|
84
|
+
counters — created versus exited per kind — not a store census." Shipped: BOTH.
|
|
85
|
+
The census is small and the counters ride inside it as `symmetry`. If the census
|
|
86
|
+
half turns out to be noise in real use, deleting it is a two-line change and the
|
|
87
|
+
counters stay. Recorded so the choice is visible rather than assumed settled.
|
|
88
|
+
|
|
89
|
+
## 6. Deliberate recall has no session of its own — NARROWED, not closed
|
|
90
|
+
|
|
91
|
+
`build()` needs a `sessionId` and uses it to load per-session gate state (for
|
|
92
|
+
dedup). A server launched without a session uses the literal `"mcp"`, which means
|
|
93
|
+
two unbound servers share one gate-state row. It affects the `dedup-suppressed`
|
|
94
|
+
verdict only — and deliberate recall admits that verdict anyway — so the blast
|
|
95
|
+
radius is nil today. It would stop being nil the moment anything else keys off
|
|
96
|
+
that row.
|
|
97
|
+
|
|
98
|
+
**What the lazy bind changed (2026-09-04).** `this.session` is now a getter over
|
|
99
|
+
launch state *plus* the bind, so the moment a `session_end` claim is corroborated
|
|
100
|
+
against `adapters/sessions.ts`'s registry, `recall` and `note` on that server stop
|
|
101
|
+
using `"mcp"` and use the real session id. On this host that happens at the first
|
|
102
|
+
end-of-session dump — so the shared row is now the state of a server *before* its
|
|
103
|
+
first dump, rather than for its whole life.
|
|
104
|
+
|
|
105
|
+
**What is still open, and it is the same gap.** A server that never receives a
|
|
106
|
+
dump never binds, so its recalls still share `"mcp"`. Nothing keys off that row
|
|
107
|
+
but dedup, so the blast radius is unchanged; the honest fix is also unchanged —
|
|
108
|
+
`recall` has no session of its own and is borrowing one, and a per-call gate-state
|
|
109
|
+
key (or an explicitly session-free deliberate mode) is what would end the
|
|
110
|
+
borrowing rather than narrowing it.
|
|
111
|
+
|
|
112
|
+
## 7. `openServer` has no embedder socket — a memory noted through the tool gets no vector
|
|
113
|
+
|
|
114
|
+
The launch adapter now builds a Voyage client (`adapters/claude-code/embed-client.ts`)
|
|
115
|
+
and passes both halves — the sync `Embedder` the store indexes with, and the live
|
|
116
|
+
one the novelty seam uses — into `Counterpart.open`. `openServer` does not, and
|
|
117
|
+
deliberately: it takes `OpenServerOptions`, not an `AdapterConfig`, so it has no
|
|
118
|
+
egress knob and no seat to read, and importing the claude-code client here would
|
|
119
|
+
point one adapter at another (CONTRACT §5 G1 in spirit — adapters are leaves).
|
|
120
|
+
|
|
121
|
+
**What it costs today.** A memory deposited through `note` is stored, indexed
|
|
122
|
+
lexically, and left without a vector: `novelty` is null with reason
|
|
123
|
+
`no-chunk-vector`, and box 3 holds no row for it until something rebuilds the
|
|
124
|
+
cache with an embedder wired. The recall gate's semantic channel cannot see it.
|
|
125
|
+
|
|
126
|
+
**The honest fix,** whichever the owner prefers:
|
|
127
|
+
|
|
128
|
+
1. `OpenServerOptions` gains `embed?: Embedder` and `vectors?: LiveVectors` —
|
|
129
|
+
both CORE types, no cross-adapter import — and whoever launches the server
|
|
130
|
+
(`bin/serve.ts`, or a host that already built one) passes them in. Two lines
|
|
131
|
+
here, and the decision about egress stays with the caller who holds the
|
|
132
|
+
configuration.
|
|
133
|
+
2. Or the embedder moves out of `adapters/claude-code/` into a place both
|
|
134
|
+
adapters may import, at which point the egress knob needs a home that is not
|
|
135
|
+
one host's config file.
|
|
136
|
+
|
|
137
|
+
Filed rather than built: a socket wired to nothing that ever fills it is the
|
|
138
|
+
"starved front door" shape this repo keeps finding, and the choice between (1)
|
|
139
|
+
and (2) is the owner's, not this build's.
|
|
140
|
+
|
|
141
|
+
## 8. The session id has to travel through the MODEL, and that is the host's shape
|
|
142
|
+
|
|
143
|
+
**What exists.** `session_end` and `chapter` are bound to one session — the same bind,
|
|
144
|
+
one code path — and `bin/serve.ts` accepts `--session` / `COUNTERPARTS_SESSION` so a
|
|
145
|
+
host can say which at launch.
|
|
146
|
+
|
|
147
|
+
**What is missing.** This host cannot. Claude Code registers MCP servers from a
|
|
148
|
+
static configuration — command, args, env — with no per-session substitution, and
|
|
149
|
+
`lsof` on four running servers (2026-09-04) shows the only per-session fact the
|
|
150
|
+
process carries is its working directory, which identifies the PROJECT and not the
|
|
151
|
+
session. So the id can only reach the server through the one channel that is
|
|
152
|
+
per-session by construction: the model, carrying what the hook's ask told it.
|
|
153
|
+
|
|
154
|
+
**Why that is a real seam and not a hole.** The model supplies the id; it does not
|
|
155
|
+
supply the AUTHORITY. `adapters/sessions.ts`'s registry is written only by hooks,
|
|
156
|
+
under the data dir, and a claim is honored only if the registry already holds that
|
|
157
|
+
id, live, in this server's scope. The model can therefore name a session it was
|
|
158
|
+
told about and nothing else — and on this host it is told about exactly one.
|
|
159
|
+
|
|
160
|
+
**The honest fix, if the host ever offers one.** A per-session environment
|
|
161
|
+
variable, or an MCP launch the host parameterizes per session, would restore the
|
|
162
|
+
`--session` path and make the registry unnecessary for binding. The registry would
|
|
163
|
+
still earn its place as the liveness fact (`session-not-live`), which no launch
|
|
164
|
+
argument can carry.
|
|
165
|
+
|
|
166
|
+
## 9. An expansion BY TITLE earned no credit — CLOSED 2026-09-15 (LAUNCH-STATUS G50)
|
|
167
|
+
|
|
168
|
+
**The gap.** `recall/reference.ts` decides which memories a session actually USED, and
|
|
169
|
+
its expansion door reads the recall tool call's own input — where it credits literal
|
|
170
|
+
`mem_…` addresses and *resolves nothing*, on purpose: "this module resolves nothing
|
|
171
|
+
fuzzily, and the tool's own answer was already exact or not-found." But `tools.ts`
|
|
172
|
+
documents `handle` as "a memory id or exact handle" and `deliberate.ts#expandHandle`
|
|
173
|
+
answers an exact TITLE with the whole body. So a session that named a memory and read it
|
|
174
|
+
— the most deliberate thing this surface offers — left a boundary row reading
|
|
175
|
+
`expanded: 0, unresolvedHandles: 1` and credited nothing. Under-credit, and silent.
|
|
176
|
+
|
|
177
|
+
**Closed on the tool side, where the resolution happened.** `server.ts#noteHandleResolution`
|
|
178
|
+
writes `<salted hash of the handle> → <resolved id>` to `adapters/expansions.ts`'s log, and
|
|
179
|
+
`claude-code/hooks.ts#creditAtBoundary` translates the transcript's own handle with it
|
|
180
|
+
before `creditReferences` sees the slice. `reference.ts` is unchanged and still resolves
|
|
181
|
+
nothing; it is simply handed the address the tool reached.
|
|
182
|
+
|
|
183
|
+
**Why a log and not a per-session field.** There is no "expanded ids" state the credit
|
|
184
|
+
pass reads — expansions come from the TRANSCRIPT, sliced by the same turn cursor capture
|
|
185
|
+
uses. Keeping that is what keeps the fix narrow: the transcript decides which handles and
|
|
186
|
+
when, the log only says what each resolved to. A per-session list would fail twice over —
|
|
187
|
+
this server is usually unbound (§6, §8) and has no session id to key by, and a flat list
|
|
188
|
+
cannot be positioned against the turn cursor, so one expansion would be re-credited at
|
|
189
|
+
every later boundary.
|
|
190
|
+
|
|
191
|
+
**What is recorded, and why the refusals are recorded too.** Every handle-path outcome
|
|
192
|
+
leaves a line: an expansion leaves the id it reached, and `handle-unknown`,
|
|
193
|
+
`handle-ambiguous` and `handle-confidential-withheld` each leave `null` — a SHADOW, which
|
|
194
|
+
translates nothing and, being the newest answer, overrides an earlier resolution of the
|
|
195
|
+
same handle in the same project.
|
|
196
|
+
|
|
197
|
+
The shadow is §5 G6, not tidiness. The log is keyed by the HANDLE, because resolution is
|
|
198
|
+
deterministic — one store, one exact-title match. A REFUSAL is not: the owner's own
|
|
199
|
+
session resolves a confidential title and a stranger's session asking the same title is
|
|
200
|
+
told nothing. Recording only the expansions leaves the stranger's boundary translating its
|
|
201
|
+
handle through the owner's entry and crediting a memory it was never shown — and the first
|
|
202
|
+
draft of this fix did exactly that, until a test was written against it. Same shape for a
|
|
203
|
+
title that has since gone ambiguous or been renamed away.
|
|
204
|
+
|
|
205
|
+
**"Credit is not widened" was the claim after that fix, and it was still wrong** (review,
|
|
206
|
+
2026-09-15). A shadow only exists where an ANSWER was given, and three askings get no
|
|
207
|
+
answer at all:
|
|
208
|
+
|
|
209
|
+
1. the tool call never reached `expandHandle` — the server was down, or threw before the
|
|
210
|
+
resolver ran. Nothing is refused, so nothing is recorded;
|
|
211
|
+
2. the call was `recall { handle, question }`, refused by the dispatcher as
|
|
212
|
+
`both-arguments` on path `none`, before the handle path exists;
|
|
213
|
+
3. the call WAS refused `handle-confidential-withheld`, and the shadow could not be
|
|
214
|
+
written — a read-only log, a full disk. `recordHandleResolution` returns false, because
|
|
215
|
+
it may not throw at a tool.
|
|
216
|
+
|
|
217
|
+
Each still leaves the title in the transcript, so each still reaches a boundary looking for
|
|
218
|
+
a translation, and finds the only line in the log — the owner's. Recording the session id
|
|
219
|
+
instead would not help: `recallTool` runs under `this.session ?? "mcp"` and the bind only
|
|
220
|
+
happens on `note` / `chapter` / `session_end`, so the usual recall call has no session to
|
|
221
|
+
record.
|
|
222
|
+
|
|
223
|
+
**Two filters, and what is left after them.** Every line already carried the `scope` the
|
|
224
|
+
resolving server was serving, so `readHandleResolutions` now DROPS any record whose
|
|
225
|
+
canonical scope is not the asking boundary's (`sessions.ts#canonicalScope`, the same
|
|
226
|
+
comparison `requireBoundSession` already trusts; a line with no scope is dropped too). That
|
|
227
|
+
covers all three routes at once, and it retires the opposite race the previous draft
|
|
228
|
+
accepted — the stranger's shadow carries the stranger's scope and never reaches the owner's
|
|
229
|
+
boundary.
|
|
230
|
+
|
|
231
|
+
The second filter is temporal, because a project is a PLACE and not a conversation: one
|
|
232
|
+
directory's table holds Monday's session and Tuesday's. `creditAtBoundary` reads the asking
|
|
233
|
+
session's `startedAt` from the live-session registry and translates only records stamped at
|
|
234
|
+
or after it, so last week's resolution of a title cannot answer today's typed guess.
|
|
235
|
+
|
|
236
|
+
The RESIDUAL, stated rather than hidden: two sessions running CONCURRENTLY in the same
|
|
237
|
+
project directory share one table, so within the overlap a call that never reached
|
|
238
|
+
`expandHandle` can still be translated through a resolution the other one made. And a
|
|
239
|
+
session whose first hook event is the Stop itself has no registry record when the credit
|
|
240
|
+
pass runs (`claim()` precedes `noteSession("boundary")`), so it gets no floor at all.
|
|
241
|
+
|
|
242
|
+
**The row says why, not just how many.** `readHandleResolutions` returns
|
|
243
|
+
`{ map, ok, reason }` the way `claude-code/transcript.ts#readTranscript` does, and the
|
|
244
|
+
`recall.credit` row carries the reason as `expansionsRead` — `ok`, `absent`, `unreadable`,
|
|
245
|
+
`corrupt`, or `not-read` when the slice had nothing to translate and the file was never
|
|
246
|
+
opened. `resolvedHandles: 0` on its own could not tell a dead table from an idle one, which
|
|
247
|
+
is the failure shape I32 is named for.
|
|
248
|
+
|
|
249
|
+
Proof: `test/lifecycle.test.ts` "the handle door (G50)" — the positive, the unknown handle,
|
|
250
|
+
the ambiguous handle, and the confidential shadow — "the handle door, across projects
|
|
251
|
+
(G50 review)" for the three shadowless routes and the retired race, and "the handle door,
|
|
252
|
+
before this session started (G50 review)" for the floor, plus `test/sessions.test.ts` "the
|
|
253
|
+
handle-resolution log" for the file's own rules.
|
|
254
|
+
|
|
255
|
+
**What the tool DESCRIPTION still owes, and it is an owner call.** `tools.ts`'s `recall`
|
|
256
|
+
privilege still reads "It writes nothing and trains nothing: ranking is not recording, so
|
|
257
|
+
nothing you look at here gets stronger for having been looked at." The first half stays
|
|
258
|
+
true — `build()` is pure, no `resolveUse`, no `coactivate`, and the one write is host
|
|
259
|
+
state. The last clause has been false since the credit seam landed (#99, 2026-09-14): a
|
|
260
|
+
memory the session EXPANDS is credited at the boundary, by id then and by handle now. It is
|
|
261
|
+
left alone here on purpose, because correcting it is not a wording change: telling the
|
|
262
|
+
model that expanding strengthens a memory hands it a lever on the reinforcement signal it
|
|
263
|
+
is being measured by, and whether the description says so is the owner's ruling, not this
|
|
264
|
+
branch's. `CONTRACT.md` §3 now carries the accurate sentence for readers of this repo.
|
|
265
|
+
|
|
266
|
+
**What it still owes.** The `ids` path is untouched: a literal id that has been SUPERSEDED
|
|
267
|
+
still credits nothing, because `Store.resolve` follows the forwarding address inside
|
|
268
|
+
`expandHandle` while `reference.ts` sees only the id the model typed, and the boundary
|
|
269
|
+
then refuses the archived row. It is the same gap one level down and out of G50's scope;
|
|
270
|
+
`expandIds` already pairs `perId` with `memories`, so recording per-id resolutions there is
|
|
271
|
+
a small, separate change when someone wants it.
|