counterparts 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +142 -0
- package/docs/module-map.md +4 -1
- package/package.json +1 -1
- package/src/adapters/claude-code/CONTRACT.md +73 -52
- package/src/adapters/claude-code/INTERFACE-GAPS.md +8 -3
- package/src/adapters/claude-code/NOTES.md +119 -0
- package/src/adapters/claude-code/bin/hook.ts +95 -33
- package/src/adapters/claude-code/bin/nightly.ts +21 -2
- package/src/adapters/claude-code/bin/runner.ts +55 -44
- package/src/adapters/claude-code/child.ts +203 -0
- package/src/adapters/claude-code/config.ts +66 -69
- package/src/adapters/claude-code/doctor.ts +249 -68
- package/src/adapters/claude-code/envelope.ts +38 -0
- package/src/adapters/claude-code/hooks.ts +206 -42
- package/src/adapters/claude-code/index.ts +7 -20
- package/src/adapters/claude-code/night-run.ts +19 -8
- package/src/adapters/cli/CONTRACT.md +9 -0
- package/src/adapters/cli/commands.ts +282 -4
- package/src/adapters/cli/coverage.ts +100 -0
- package/src/adapters/cli/dream-core.ts +11 -0
- package/src/adapters/cli/help.ts +6 -0
- package/src/adapters/cli/mechanisms.ts +23 -6
- package/src/adapters/cli/self-page.ts +4 -4
- package/src/adapters/cli/settle.ts +63 -0
- package/src/adapters/dashboard/registries.ts +29 -1
- package/src/adapters/dashboard/web/README.md +41 -11
- package/src/adapters/dashboard/web/flow.ts +12 -0
- package/src/adapters/dashboard/web/lanes.ts +11 -0
- package/src/adapters/dashboard/web/mechanisms/dreaming/panel.js +2 -1
- package/src/adapters/dashboard/web/mechanisms/emotional/panel.js +2 -2
- package/src/adapters/dashboard/web/mechanisms/episodic-semantic/panel.js +2 -1
- package/src/adapters/dashboard/web/mechanisms/index.js +2 -0
- package/src/adapters/dashboard/web/mechanisms/interference/index.js +8 -4
- package/src/adapters/dashboard/web/mechanisms/interference/panel.js +13 -0
- package/src/adapters/dashboard/web/mechanisms/prospective/panel.js +2 -1
- package/src/adapters/dashboard/web/narrate.ts +62 -4
- package/src/adapters/dashboard/web/pages/health/sections/cycle.js +2 -4
- package/src/adapters/dashboard/web/pages/memories/index.js +6 -1
- package/src/adapters/dashboard/web/pages/memories/memories.css +43 -26
- package/src/adapters/dashboard/web/pages/memories/row.js +52 -15
- package/src/adapters/dashboard/web/pages/memories/sections/hold.js +112 -24
- package/src/adapters/dashboard/web/pages/memories/sections/list.js +3 -3
- package/src/adapters/dashboard/web/pages/memories/sections/search.js +75 -15
- package/src/adapters/dashboard/web/pages/memories/state.js +3 -2
- package/src/adapters/dashboard/web/pages/self/sections/dreams.js +2 -2
- package/src/adapters/dashboard/web/pages/self/sections/journal.js +7 -11
- package/src/adapters/dashboard/web/pages/self/sections/page.js +47 -17
- package/src/adapters/dashboard/web/pages/self/sections/wake.js +16 -5
- package/src/adapters/dashboard/web/shared/dates.js +55 -0
- package/src/adapters/dashboard/web/shared/memory-marks.css +1 -0
- package/src/adapters/dashboard/web/shared/memory-marks.js +23 -12
- package/src/adapters/dashboard/web/shared/memory-modal.js +15 -11
- package/src/adapters/dashboard/web/shared/widgets/feel-radar.js +8 -5
- package/src/adapters/dashboard/web/views/mechanism-panel.ts +39 -0
- package/src/adapters/dashboard/web/views/mechanisms.ts +9 -1
- package/src/adapters/dashboard/web/views/mind.ts +57 -17
- package/src/adapters/dashboard/web/views/search.ts +170 -58
- package/src/adapters/fired.ts +28 -0
- package/src/adapters/log/CONTRACT.md +70 -0
- package/src/adapters/log/INTERFACE-GAPS.md +15 -0
- package/src/adapters/log/NOTES.md +49 -0
- package/src/adapters/log/index.ts +420 -0
- package/src/adapters/mcp/CONTRACT.md +11 -0
- package/src/adapters/mcp/INTERFACE-GAPS.md +8 -0
- package/src/adapters/mcp/NOTES.md +34 -0
- package/src/adapters/mcp/bin/serve.ts +23 -1
- package/src/adapters/mcp/deliberate.ts +39 -2
- package/src/adapters/mcp/index.ts +5 -2
- package/src/adapters/mcp/server.ts +181 -43
- package/src/adapters/mcp/tools.ts +78 -11
- package/src/adapters/mcp/write-up.ts +5 -9
- package/src/adapters/mechanism-evidence.ts +28 -9
- package/src/adapters/sessions.ts +158 -172
- package/src/core/contradictions.ts +607 -0
- package/src/core/counterpart.ts +273 -26
- package/src/core/coverage/CONTRACT.md +77 -0
- package/src/core/coverage/INTERFACE-GAPS.md +46 -0
- package/src/core/coverage/NOTES.md +100 -0
- package/src/core/coverage/index.ts +660 -0
- package/src/core/coverage/tunables.ts +29 -0
- package/src/core/dream/CONTRACT.md +14 -8
- package/src/core/dream/INTERFACE-GAPS.md +6 -0
- package/src/core/dream/NOTES.md +27 -0
- package/src/core/dream/index.ts +90 -29
- package/src/core/dream/mind.ts +14 -13
- package/src/core/dream/reflect.ts +29 -0
- package/src/core/dream/tunables.ts +3 -0
- package/src/core/handoff/CONTRACT.md +8 -2
- package/src/core/handoff/NOTES.md +2 -0
- package/src/core/handoff/index.ts +100 -14
- package/src/core/physics/CONTRACT.md +23 -1
- package/src/core/physics/NOTES.md +10 -0
- package/src/core/physics/index.ts +78 -1
- package/src/core/prospective/CONTRACT.md +4 -1
- package/src/core/prospective/NOTES.md +16 -1
- package/src/core/prospective/index.ts +21 -2
- package/src/core/recall/CONTRACT.md +10 -0
- package/src/core/recall/INTERFACE-GAPS.md +7 -0
- package/src/core/recall/NOTES.md +11 -0
- package/src/core/recall/index.ts +20 -1
- package/src/core/recall/render.ts +15 -3
- package/src/core/recall/standing.ts +124 -0
- package/src/core/remember/CONTRACT.md +8 -8
- package/src/core/remember/NOTES.md +41 -0
- package/src/core/remember/index.ts +2 -5
- package/src/core/remember/owes.ts +80 -217
- package/src/core/remember/proposals.ts +31 -2
- package/src/core/revision.ts +60 -3
- package/src/core/schemas/CONTRACT.md +6 -3
- package/src/core/schemas/NOTES.md +15 -0
- package/src/core/self/CONTRACT.md +28 -13
- package/src/core/self/NOTES.md +86 -0
- package/src/core/self/behind.ts +89 -0
- package/src/core/self/briefing.ts +136 -5
- package/src/core/self/episodes.ts +43 -48
- package/src/core/self/identity.ts +42 -6
- package/src/core/self/index.ts +20 -2
- package/src/core/self/writer.ts +26 -26
- package/src/core/store/CONTRACT.md +12 -0
- package/src/core/store/NOTES.md +52 -0
- package/src/core/store/errors.ts +6 -0
- package/src/core/store/index.ts +339 -0
- package/src/core/store/operational.ts +248 -3
- package/src/core/store/owner-op-seam.ts +65 -1
- package/src/core/time.ts +60 -3
- package/src/core/types.ts +25 -0
- package/src/adapters/claude-code/page-writer.ts +0 -516
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,147 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.8 — 2026-09-30
|
|
4
|
+
|
|
5
|
+
When two memories disagree, Claude can now say how: the fact changed, the old one was
|
|
6
|
+
wrong, or it's still open, with a trail and an undo. What hasn't been written up is
|
|
7
|
+
counted in one place, and a debt lapses after a few days of use instead of waiting
|
|
8
|
+
forever. The wake keeps up with the day, a process log records what the hooks, the
|
|
9
|
+
worker, the nightly run and the memory server did, and the dashboard takes the 09-30
|
|
10
|
+
feedback. **The store's format changes (v9 → v10).**
|
|
11
|
+
|
|
12
|
+
**The format change, and why every session must be closed.** The first Claude Code
|
|
13
|
+
session after installing copies the store (as every upgrade since 0.3.1 has) and
|
|
14
|
+
upgrades it: two new tables for contradictions and their trail, and one new column on
|
|
15
|
+
every memory (`fade`, 1 unless a memory was settled as changed). Every contradiction a
|
|
16
|
+
dream flagged and nobody settled is carried onto the new table, with its "already
|
|
17
|
+
raised" mark. Nothing else changes, and all memories come through. Until that first
|
|
18
|
+
session, `counterparts doctor` and the dashboard can't read the store yet (a v9 store is
|
|
19
|
+
older than they read) and say so; the next session's hook does the upgrade. **Close
|
|
20
|
+
every Claude Code session before installing.** A v10 store can't be opened by 0.3.7:
|
|
21
|
+
anything of 0.3.7's that opens it afterwards refuses at once (`SCHEMA_AHEAD`), and its
|
|
22
|
+
hooks stand down. But a session that was already open when you installed keeps its own
|
|
23
|
+
memory server, still running 0.3.7's code with the store already open, and that open was
|
|
24
|
+
the one place the check ran. Its memory tools re-read the format on every call and
|
|
25
|
+
refuse ("Counterparts was updated and this server is still running the old version, so
|
|
26
|
+
this tool did nothing. Run /mcp and Reconnect to load it."), so in a session opened
|
|
27
|
+
before the install, don't rely on the memory tools: quit it and start a new one, or run
|
|
28
|
+
`/mcp` → Reconnect. The hooks are fresh processes at every event, so they run the new
|
|
29
|
+
code at once and are fine. To go back to 0.3.7 you reinstall it and put back the copy
|
|
30
|
+
the upgrade took; anything remembered since is lost.
|
|
31
|
+
|
|
32
|
+
Contradictions.
|
|
33
|
+
|
|
34
|
+
- **Three ways a disagreement is settled, each with its own outcome.** When Claude
|
|
35
|
+
writes a memory that `updates` an older one, it says `how` (`changed` is the default):
|
|
36
|
+
- **changed** — true then, not now. The older memory takes one strength cut (half) and
|
|
37
|
+
stays recallable, labelled `Earlier (now [id])`. A later use resets its fading as
|
|
38
|
+
always but doesn't lift the cut.
|
|
39
|
+
- **corrected** — the older one was wrong. It is put away (archived): it leaves recall
|
|
40
|
+
and stays readable by its own id, `Corrected by [id]`. Nothing is deleted.
|
|
41
|
+
- **open** — both stand, and recall shows each with `(disagrees with [id])`.
|
|
42
|
+
- Beliefs, the core, current-state and protected memories keep their own paths; a `how`
|
|
43
|
+
sent at one of those is not applied, and the answer says which path ran.
|
|
44
|
+
- **Claude notices at write time.** A `note` or `session_end` memory comes back with up to
|
|
45
|
+
three of its nearest live memories and one line inviting a settle, if one of them
|
|
46
|
+
disagrees. No model call.
|
|
47
|
+
- **Settling a pair that already exists**, from anywhere: `note` with `settle` (no new
|
|
48
|
+
memory needed), the dream's new `settle` action (a reason is required), the
|
|
49
|
+
reflection's `settle` phase (only on memories it was shown), and yours:
|
|
50
|
+
**`counterparts settle`** lists what's unsettled and what was settled lately, settles
|
|
51
|
+
one (`--pair … --holds … --how … --why "…"`), or undoes one (`--undo`). Settling an
|
|
52
|
+
existing pair rewrites no memory.
|
|
53
|
+
- **Every settle and every undo leaves a trail row**: who (a session, a dream, the
|
|
54
|
+
reflection, you), how, why, which memories, and when. An undo puts back exactly what
|
|
55
|
+
the settle did: the strength, the archive, the flags it closed. Removing the memory
|
|
56
|
+
that settled a pair puts the other one back.
|
|
57
|
+
- **Unsettled pairs are labelled.** The older memory of a pair nobody has settled reads
|
|
58
|
+
`Unsettled — may be out of date, see [id]`, in recall and in the wake's lanes. Dream
|
|
59
|
+
flags are raised once awake, as before, now naming the pair and the `note` settle.
|
|
60
|
+
- **A replaced memory is readable by its own id**, with `replaced by [id]`; `counterparts
|
|
61
|
+
ask` prints a memory's standing above its words.
|
|
62
|
+
- Doctor has a **Contradictions** line (the last 7 days: flagged, settled by kind and by
|
|
63
|
+
whom, undone, still open or unsettled) and an **Upgrade to v10** line.
|
|
64
|
+
`counterparts mechanisms` counts reconsolidation as built and interference as partly
|
|
65
|
+
built.
|
|
66
|
+
|
|
67
|
+
What is written up, and what is owed.
|
|
68
|
+
|
|
69
|
+
- **One place says what hasn't been written up yet.** A piece of conversation counts as
|
|
70
|
+
written up only when something claims it: a memory from it, a write-up answered
|
|
71
|
+
"nothing new" (`memories: []`), or a chapter. A handoff alone doesn't. Each claim is
|
|
72
|
+
for the project it was made in.
|
|
73
|
+
- **One rule for what a session owes**: at least 3 unwritten pieces spanning 15 minutes
|
|
74
|
+
or more, in a session that has ended or captured nothing since the date changed. It
|
|
75
|
+
replaces the old asked/answered rule and the 12-hour silence window. Short sessions
|
|
76
|
+
(1–2 pieces, or 3 or more inside 15 minutes) owe nothing. A small debt (under 6 pieces)
|
|
77
|
+
gets the same pointer with one more sentence: "It was a short session: one line is
|
|
78
|
+
enough, or memories: [] if nothing in it is worth keeping." The next session's pointer
|
|
79
|
+
and caps are unchanged: two pointers a day across the store, this project only.
|
|
80
|
+
- **A debt lapses instead of waiting forever.** An owed stretch has two more days of use
|
|
81
|
+
(days with a turn end) after the day of its latest piece; at the first turn end of the
|
|
82
|
+
third, it lapses. Nothing is deleted: the session stops owing, and its text goes on the
|
|
83
|
+
ordinary 7-day retention. On a store with old unwritten stretches, the first pass
|
|
84
|
+
lapses them, one record each.
|
|
85
|
+
- **The in-session ask has a third reason**: three pieces not yet written up, half an
|
|
86
|
+
hour after the later of the first of them and the last ask (`due-unwritten`). The
|
|
87
|
+
day's cap on asks is unchanged, and an unanswered ask isn't repeated without new
|
|
88
|
+
pieces.
|
|
89
|
+
- **The handoff pointer says how current it is**: `Where I left off in this directory
|
|
90
|
+
(written 09-29 12:47): …`, and when work here ran after it, `(written 09-29 12:47; work
|
|
91
|
+
here 13:02–15:41 since, not yet written up)` or `…, written up since`. The excerpt is
|
|
92
|
+
the first real sentence, without a leading list marker.
|
|
93
|
+
- **`counterparts coverage [--date YYYY-MM-DD]`** says, in plain words, what was written
|
|
94
|
+
up and what is not yet, for a day. Doctor's **Crash write-up** line is now **Write-ups**:
|
|
95
|
+
yesterday's state, amber when a stretch the pointer can offer is still owed from
|
|
96
|
+
yesterday or earlier, small debts it never offers named apart as "left to lapse", and
|
|
97
|
+
the week's lapses. The 3-day wait is gone.
|
|
98
|
+
|
|
99
|
+
The wake.
|
|
100
|
+
|
|
101
|
+
- **The wake keeps up with the day.** It used to be written once, at the day's first
|
|
102
|
+
turn end, so a self page written later, a write-up that landed, or the nightly run's
|
|
103
|
+
page reached no session until the next day. Now each of those marks the wake behind,
|
|
104
|
+
and the next turn end re-renders it; the nightly run re-renders it when it finishes.
|
|
105
|
+
Re-renders on the same day are stable: the same Nearby memories, the identity lane
|
|
106
|
+
rotating once a day.
|
|
107
|
+
- **The wake says what it trimmed.** A lane that lost memories to its cap or to the size
|
|
108
|
+
budget gets one quiet line, like `(3 more still open; recall ids: mem_…, mem_…, mem_…)`,
|
|
109
|
+
up to five ids that recall reads whole. Most wakes will carry a "(N more nearby…)"
|
|
110
|
+
line.
|
|
111
|
+
- **A plain reminder, once told, leaves "Arriving"** for the rest of its grace week.
|
|
112
|
+
Recall still finds it.
|
|
113
|
+
- **One size budget per hook message** (10,000 bytes; 9,500 for the JSON form). When a
|
|
114
|
+
session start or a prompt is crowded, parts give way in a stated order and wait for a
|
|
115
|
+
later turn; nothing is cut, and nothing is marked told that wasn't shown. The
|
|
116
|
+
first-launch question is now measured against this budget, so it can fit beside a full
|
|
117
|
+
wake.
|
|
118
|
+
|
|
119
|
+
The log.
|
|
120
|
+
|
|
121
|
+
- **A process log**: one line per event from the hooks, the turn-end worker, the nightly
|
|
122
|
+
run and the memory server, in `sessions/log/<date>.log` inside the store (kept 7
|
|
123
|
+
days). Ids, counts and codes, no conversation text. **`counterparts log [--date
|
|
124
|
+
YYYY-MM-DD]`** prints a day, oldest first. Doctor has a green **Log** line (where it
|
|
125
|
+
is, how many days it holds, today's failures).
|
|
126
|
+
- Two failures now leave a durable record: capture failing to write, and a write-up
|
|
127
|
+
failing.
|
|
128
|
+
|
|
129
|
+
Cleanup.
|
|
130
|
+
|
|
131
|
+
- **The page writer's host mode is removed** (the windowless `claude -p` the worker
|
|
132
|
+
started for the self page alone, off by default since the nightly run). A config that
|
|
133
|
+
still says `pageWriter.mode: "host"` loads, reads as `session`, and doctor's "Old
|
|
134
|
+
settings" line names what it ignores.
|
|
135
|
+
|
|
136
|
+
The dashboard.
|
|
137
|
+
|
|
138
|
+
- **Dates** in one style ("Sep 30th", with the year when it isn't this year). **Self**:
|
|
139
|
+
the day-by-day note reads as a sentence, and Arriving items are titles that open the
|
|
140
|
+
memory. **Memories**: a "by word | by meaning" switch beside the search box, matched
|
|
141
|
+
words highlighted, close matches for typos, readable line lengths, and a row no longer
|
|
142
|
+
repeats its own date. **Feelings**: "disgust" reads "dislike". **How well I remember**:
|
|
143
|
+
one square per memory, scaling as memories grow.
|
|
144
|
+
|
|
3
145
|
## 0.3.7 — 2026-09-29
|
|
4
146
|
|
|
5
147
|
Dreaming asks where you can see it, and "on its own" now means a separate background
|
package/docs/module-map.md
CHANGED
|
@@ -15,16 +15,18 @@ code and the `NOTES.md` / `INTERFACE-GAPS.md` next to it.*
|
|
|
15
15
|
| `encode/` | attention + amygdala tagging | What gets in: gates (secrets, precision), salience tagged at write time, novelty as prediction error. |
|
|
16
16
|
| `remember/` | hippocampal encoding | The authorship contract: the experiencer's end-of-session dump (content, salience tags, `updates:` marks), in-the-moment jots, crash-fallback ingestion. |
|
|
17
17
|
| `store/` | the substrate | Two boxes since the floor (schema v6, 2026-09-20): one small canonical transactional SQLite (`counterparts.sqlite` — the memories' words, their archived versions, and every structured field), one rebuildable cache (embeddings/FTS, never backed up). The third box — one markdown file per memory — is gone. Markdown is an export (`render.ts`), plus a derived, write-only file copy of the journal under `journal/` — classified in the layout, deliberately NOT in the backup set, regenerated from its rows if deleted. |
|
|
18
|
-
| `recall/` | retrieval + priming | Cues → activation → surfacing gate → bounded injection; footnote tier; reinforcement on real use. |
|
|
18
|
+
| `recall/` | retrieval + priming | Cues → activation → surfacing gate → bounded injection; footnote tier; reinforcement on real use. Since 2026-09-29 a memory's standing in a contradiction is a label in front of it (earlier, unsettled, corrected) or after it (disagrees with). |
|
|
19
19
|
| `embed/` | — (a gist, not a reading) | Text in, vector out, on this machine, for nothing: the static embedding table (`static.ts`, potion-base-8M) that gives recall's semantic channel a source with no key. Zero code dependencies; its weights ship as the data-only package `counterparts-model-potion`, the one runtime dependency. The only embedder since 2026-09-24, when the paid Voyage seat was removed. **Added 2026-09-23 (roadmap C1).** |
|
|
20
20
|
| `associate/` | Hebbian linking | Co-activation strengthens links; spreading activation at recall. **RESOLVED (owner, 2026-08-25): stays a module** — edge-level arithmetic keeps `physics/` one page; Hebbian plasticity/contiguity is its own mechanism in the field guide. |
|
|
21
21
|
| `schemas/` | semantic memory | Entities and beliefs; birth by mention, death by decay; strength-weighted revision with row history. |
|
|
22
22
|
| `self/` | autobiographical self | Identity documents, episodes, the wake briefing (v0's briefing, grown up). Governed: frozen self-reinforcement rules. |
|
|
23
23
|
| `prospective/` | prospective memory | Future intentions, cued by time or context; fire / suppress / reference telemetry. |
|
|
24
24
|
| `handoff/` | working context for a place | The per-directory handoff: where the work here stands, written as a field on the end-of-session ask, shown as a two-line pointer at the next wake in that directory, expiring in lived days. **Never a memory** — out of recall, out of credit, out of consolidation, out of identity. **Added 2026-09-20 (E1, spec §6.4 / §15 item 6).** |
|
|
25
|
+
| `coverage/` | rehearsal debt | What is not written up yet, read in one place: per session, the unwritten stretch since its last claim in `coverage.jsonl`. The pacer's third ask (pieces and time), the one rule for what a session owes (retention, the next-session write-up), lapse after two days of use, the handoff pointer's "how current", and one row per stretch per state. Changes nothing about how pieces are claimed. **Added 2026-09-30.** |
|
|
25
26
|
| `sleep/` | systems consolidation | Pure math on a cycle: decay tick (active-day clock), floor-pruning (real forgetting), the core's two lanes (at most three a night), re-render of the wake briefing. Zero standing model calls. |
|
|
26
27
|
| `dream/` | sleep replay + REM | Dreaming: once a day, if the owner says yes, a background agent (the same model) replays what was lived since the last dream beside what it resembles — merges, links, replays, a pattern, a flagged contradiction, a softened feeling, a core nomination — each recorded for undo, with a dream journal kept apart from lived memory. The module holds the bookkeeping and the rules; the dreamer is the model. **Added 2026-09-26.** Since 2026-09-27 it also holds REFLECTION (`reflect.ts`), the waking self: usually right after a dream, lived, with its own record — an entry, the self page rewritten from the core, a morning share, feelings recorded later, and what a memory is about. |
|
|
27
28
|
| `fit/` | working memory's pointers | Fitting what a mechanism has into the room it has: a line for everything, the whole text for the most important, ids and a named lookup for the rest, a count of what waits. Plus `lineOf`, `derivedFrom`, parts, and the lookup ledger that measures whether receivers use the lookup. First users: the dream and the reflection. **Added 2026-09-28 (build B).** |
|
|
29
|
+
| *(`contradictions.ts`)* | reconsolidation + interference | Two memories that disagree: flagged (a dream, today), noticed at write time (the nearest few live memories come back with a stored one), and SETTLED — `changed` (both true at their time: one strength cut, labelled earlier), `corrected` (archived, readable by id), or `open` (both kept, shown together) — by a new memory's `updates` + `how`, a `note` settle, a dream or reflection with a plain reason, or the owner's `counterparts settle`. Every settle is on a trail (who, how, why, when) and can be undone. A file beside `revision.ts`, whose ordinary-memory arm it is; its tables are the store's (schema v10), its labels recall's (`recall/standing.ts`). **Added 2026-09-29.** |
|
|
28
30
|
| *(`time.ts`)* | — (a clock, not a memory) | The one module that converts: a moment (UTC ms from `store.now()`) to a person's local date or clock line, "today" in a zone, and calendar dates as said (day, month, year, range). A file, not a module; a test keeps hand-built dates out of `src/`. **Added 2026-09-25 (`docs/time.md`).** |
|
|
29
31
|
| *(`feelings-wheel.ts`)* | — (a vocabulary) | The feelings wheel as a typed list: six cores, the middle and outer rings, valence, and the key scheme (`<core>.<word>` only for a word printed under two cores). Read by `store/` to validate the `feelings` table. **Added 2026-09-25.** |
|
|
30
32
|
| *(observer)* | — (instrument stance) | **RESOLVED (owner, 2026-08-25): a MODE, not a module** — one predicate threaded through the core API, checked at the store seam. Spec moved to `docs/observer-mode.md`. |
|
|
@@ -44,6 +46,7 @@ input — does `encode` shrink to gates-and-tagging inside `remember`'s pipeline
|
|
|
44
46
|
| `sessions.ts` | Not an adapter — a leaf both may import: the live-session registry a host's hooks write (`<dataDir>/sessions/`) and its tools read, so a tool launched without a session can bind to one that is real, live and in its project. Adapters stay leaves; this is the sibling they share instead of importing each other. **Added 2026-09-04**, because this host's MCP servers are launched from a static config and cannot be told which session they serve. |
|
|
45
47
|
| `expansions.ts` | The same shape, for the other direction: the handle-resolution log the MCP `recall` tool writes (`<dataDir>/sessions/expansions.jsonl` — a per-store SALTED hash of the handle (G58), the id it reached or `null` for a refusal, a timestamp, the project) and the boundary's credit pass reads, so an expansion by TITLE credits the memory it actually reached, and a refusal shadows it. **Added 2026-09-15** (LAUNCH-STATUS G50): `recall/reference.ts` credits literal `mem_…` addresses and resolves nothing, so until this the most deliberate act a session had — naming a memory and reading it — earned no credit at all. |
|
|
46
48
|
| `scopes.ts` | The third shared leaf: the per-directory scope registry (`scopes.json` BESIDE the config, never inside the store, because the hook decides `off` before anything opens) — `on` / `observer` / `off` / `paused`, longest prefix wins, absent-or-unreadable meaning `unset` meaning on. Written by the `counterparts scope` console and the MCP `scope` tool, read by every hook. **Added 2026-09-15** (PR #92, G19): the hooks are registered globally, so until this the only way to say *not here* was a second config file and two environment variables. |
|
|
49
|
+
| `log/` | A shared leaf with its own CONTRACT: the process log — one line per allowlisted event (failures, stand-downs, turn ends, write-ups, the night, the wake) from the hook, the worker, the nightly run and the MCP server, to `<dataDir>/sessions/log/<date>.log`, ids and codes only, kept 7 days. Read by `counterparts log` and one doctor line. **Added 2026-09-30**: none of the four processes wired its `onEvent`, so ~270 event names died with their process. |
|
|
47
50
|
|
|
48
51
|
## Tools (`tools/`)
|
|
49
52
|
|
package/package.json
CHANGED
|
@@ -594,31 +594,23 @@ The MCP server labels a `self_page` write `by: "writer"` when the write NAMES a
|
|
|
594
594
|
that holds that open claim (`self/writer.ts#nightClaimFor`) — not the session the server is
|
|
595
595
|
bound to, so the owner's own page edit in the run's session stays an ordinary amendment;
|
|
596
596
|
and when the run moves past the writer without a write, its next phase answers the night
|
|
597
|
-
`nothing-to-say`. The
|
|
598
|
-
|
|
599
|
-
**
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
as a pinned DATE (`COUNTERPARTS_PAGE_WRITER`), because a windowless child's session id is
|
|
609
|
-
minted by the host after the launcher is gone. **The child's stdout is never parsed into a
|
|
610
|
-
verdict**: what the run did is read from the page's version chain and from the row the tool
|
|
611
|
-
left, and the exit code decides only between "nothing to say" and "could not run". The
|
|
612
|
-
child is told nothing on its prompts (`HookInput.pageWriter`): no dream line, no reminders.
|
|
597
|
+
`nothing-to-say`. The retired ask's registry mark is still read. The wake's `injection`, `bytes` and `sentinel` are untouched by any of it.
|
|
598
|
+
|
|
599
|
+
**Host mode is removed (2026-09-29).** The windowless `claude -p` the boundary's worker
|
|
600
|
+
started for the writer alone (`pageWriter.mode: host`, off by default since the nightly run)
|
|
601
|
+
is gone, with its `COUNTERPARTS_PAGE_WRITER` environment pin, `HookInput.pageWriter` and the
|
|
602
|
+
worker's fifth step. A configuration that still names it loads: `pageWriter.mode: "host"`,
|
|
603
|
+
`pageWriter.timeoutMs` and `pageWriter.command` are ignored and named on doctor's "Old
|
|
604
|
+
settings" line, and the mode reads as `session`. A stored row written with `mode: "host"`
|
|
605
|
+
stays as written and reads as `session`. What the headless nightly run shared with it —
|
|
606
|
+
the pure plan / starter shape, the prompt on STDIN, the SIGTERM → SIGKILL → stop-waiting
|
|
607
|
+
watchdog — is `child.ts` now, unchanged.
|
|
613
608
|
|
|
614
609
|
(Retired with the SessionStart ask, 2026-09-28: the measured-not-predicted sizing against the
|
|
615
610
|
host's ceiling, the durable `skipped` deferral rows, and the first-launch question's
|
|
616
611
|
once-per-night patience. `skipped` rows written before still read as they always did.)
|
|
617
612
|
|
|
618
|
-
**[M]
|
|
619
|
-
the same `finally` as the snapshot, so a day whose sweep broke is still a day that gets
|
|
620
|
-
written about; it never throws; and a failure never fails a wake, a boundary or a session.
|
|
621
|
-
Doctor's `Page writer` line is GREEN when it has never run on a store with no yesterday,
|
|
613
|
+
**[M] Doctor's line.** The `Page writer` line is GREEN when it has never run on a store with no yesterday,
|
|
622
614
|
GREEN on a night that had nothing to say, GREEN when it is off (a deliberate choice; this
|
|
623
615
|
page used to say amber while a page stands, which the code has not done since the S2 review
|
|
624
616
|
— the words follow the code as of 2026-09-28), AMBER on a failure, a refusal, an unreadable
|
|
@@ -626,19 +618,6 @@ page used to say amber while a page stands, which the code has not done since th
|
|
|
626
618
|
without it, and never RED. A night owed because no run started (fewer than three new
|
|
627
619
|
memories, dreaming off or declined) is green: the writer runs inside the nightly run now.
|
|
628
620
|
|
|
629
|
-
**[M] The child gets the day on STDIN and a stance this package chose.** The instruction is
|
|
630
|
-
not in `argv`, where `ps` shows it to every process on the machine, and
|
|
631
|
-
`COUNTERPARTS_OBSERVER` is deleted from the child's environment beside the two session
|
|
632
|
-
variables: a shell that exported it would hand the child an observer store whose
|
|
633
|
-
`self_page` refuses, and the night would then read `nothing-to-say` — fail-closed, but a
|
|
634
|
-
silently wrong answer. A child that ignores SIGTERM is escalated to SIGKILL on its process
|
|
635
|
-
group and then given up on, so the worker cannot be held past its own watchdog.
|
|
636
|
-
|
|
637
|
-
**UNVERIFIED, and named rather than claimed:** no build has started a real `claude -p`.
|
|
638
|
-
Everything above about host mode is proved against a stub executable. What a real machine
|
|
639
|
-
has to answer is keychain access from a background process (`claude setup-token` is the
|
|
640
|
-
documented route, spec §16), which is why `session` is the default.
|
|
641
|
-
|
|
642
621
|
### The headless nightly run (2026-09-29 — working defaults, held lightly)
|
|
643
622
|
|
|
644
623
|
**[M] With the setting `auto` the hook starts the nightly run itself; nothing in the working
|
|
@@ -668,7 +647,7 @@ deny beats the user's own allow rules; `ToolSearch` stays, for hosts that defer
|
|
|
668
647
|
install registers it (`nightMcpConfig`); `--max-turns` (`NIGHT_MAX_TURNS` 60,
|
|
669
648
|
`dreaming.maxTurns`); `--model` only when `dreaming.model` is set. It starts in a NEUTRAL
|
|
670
649
|
directory — the store's own — so no project's CLAUDE.md, hooks or MCP servers load. The
|
|
671
|
-
parent's stance,
|
|
650
|
+
parent's stance, `CLAUDE_PROJECT_DIR` and `CLAUDECODE` variables are removed;
|
|
672
651
|
this package's values are written last.
|
|
673
652
|
|
|
674
653
|
**[M] Session binding: the run is attributed to the session that started it.** The launch
|
|
@@ -700,24 +679,48 @@ meaning changed, so a store with `auto` written explicitly is reset on the first
|
|
|
700
679
|
this version, recorded (`dream.ask`, `by: upgrade`), and the owner is told once in the
|
|
701
680
|
terminal; "dream on your own" sets it again. Any setting chosen on this version is kept.
|
|
702
681
|
|
|
682
|
+
### One size budget per hook envelope (2026-09-29 — a working default)
|
|
683
|
+
|
|
684
|
+
**[M] Everything one SessionStart or one UserPromptSubmit prints is measured against one
|
|
685
|
+
budget**, the host's cap (`TUNABLES.HOST_OUTPUT_CHARS`, 10,000, counted in bytes; the JSON
|
|
686
|
+
form `ENVELOPE_CHARS`, 9,500), and a crowded envelope gives way in a stated order, first to
|
|
687
|
+
last. Each part that gives way is DEFERRED, never cut, and never spent on a line the session
|
|
688
|
+
did not get.
|
|
689
|
+
- **SessionStart:** the owner's notices (dropped before the JSON envelope passes 9,500) →
|
|
690
|
+
the write-up pointer → the first-launch question (measured against this budget, no
|
|
691
|
+
longer the reported injection budget) → plain reminders due today (they wait for the
|
|
692
|
+
first prompt, unclaimed) → the wake, which is never cut at delivery: it was composed to
|
|
693
|
+
its own budget at the boundary, trimming hints → craft → threads → horizon → identity.
|
|
694
|
+
A reminder reaches the person only in the JSON form, so when one is due and it fits
|
|
695
|
+
beside the wake in that form, the two asks are measured against THAT form (escaped,
|
|
696
|
+
under 9,500) and it is they that give way (review of #285, S2). A wake too full for the
|
|
697
|
+
reminder even alone sends the reminder to the first prompt and the asks use the plain
|
|
698
|
+
room. What gave way is recorded where it happened: each ask's deferral, and the
|
|
699
|
+
delivery for reminders, the dream offer and the update notice
|
|
700
|
+
(`adapter.envelope.gave-way`).
|
|
701
|
+
- **UserPromptSubmit:** the update notice → the turn's recall, sized to what the lines
|
|
702
|
+
below leave (`hooks.ts#recallRoom`, measured in the envelope's own form — every part
|
|
703
|
+
but recall's own escaping, which is a named reserve), trimming itself to that → the dream's lines (a
|
|
704
|
+
hand-back, a carried share, a raise line, the day's offer), reserved because they are
|
|
705
|
+
claimed when composed → plain reminders and the clock line, last.
|
|
706
|
+
- **The plain-stdout fallback is checked:** past the cap, `bin/hook.ts#hostDelivery` says
|
|
707
|
+
so (`overCap`) and the hook records `adapter.envelope.overcap` and prints it on stderr.
|
|
708
|
+
It is a tripwire, not a cut — by then the asks are marked; the budget above is what
|
|
709
|
+
keeps it from firing. On a normal day nothing here changes what is printed.
|
|
710
|
+
|
|
703
711
|
### The next-session write-up (C2, 2026-09-23 — true for now)
|
|
704
712
|
|
|
705
713
|
**[M] A session that ended owing a write-up is written up by the next session that starts
|
|
706
|
-
in its project.** "Owes" is
|
|
714
|
+
in its project.** "Owes" is `core/coverage/`'s rule since 2026-09-30 (read through `remember/owes.ts#planRetention`; before it, B3's predicate `owesWriteUp`, read across
|
|
707
715
|
every scope through `adapters/sessions.ts#writeUpPlan`, the retention pass's own sources),
|
|
708
|
-
narrowed by one shared eligibility (`sessions.ts#waitingForWriteUp`) that the
|
|
709
|
-
door and doctor all read:
|
|
710
|
-
- **
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
terminal nobody has closed (MAJOR 3). **Known, and accepted as the default:** words it
|
|
717
|
-
captured AFTER that answer, at a later Stop that asked nothing, wait with it — invisible
|
|
718
|
-
to the pointer and to doctor's count — until the registry forgets the record, up to a
|
|
719
|
-
week after its last write; then it is pointed at and the fetch carries them
|
|
720
|
-
(INTERFACE-GAPS §17);
|
|
716
|
+
narrowed by one shared eligibility (`sessions.ts#waitingForWriteUp`, `pointable`) that the
|
|
717
|
+
pointer, the door and doctor all read:
|
|
718
|
+
- **not at work** replaced "ended" on 2026-09-30: a session owes once it has ended (a
|
|
719
|
+
registry end or a `session-end` boundary) OR has captured nothing since the date changed.
|
|
720
|
+
There is no silence window any more (the 12-hour `WRITE_UP_SILENCE_MS` and the
|
|
721
|
+
open-and-answered exception of PR #192's MAJOR 3 are gone with the asked / answered
|
|
722
|
+
predicate they guarded): a session open overnight owes the next date, and one at work
|
|
723
|
+
today is `live-session` to the door;
|
|
721
724
|
- with the API sweep on, a crashed session whose words the sweep will still read is the
|
|
722
725
|
sweep's (`sweepOwns`); one whose only words left are in quarantine is not (MAJOR 5);
|
|
723
726
|
- **in its project** means the session holds words filed under this project's scope. A
|
|
@@ -727,6 +730,23 @@ door and doctor all read:
|
|
|
727
730
|
Sessions never pointed at go first, then the least recently pointed at or fetched, oldest
|
|
728
731
|
first among equals, so one session nobody writes up cannot stand in front of the rest.
|
|
729
732
|
|
|
733
|
+
**[M] A short session owes a SHORT write-up (2026-09-29, a working default).** A session
|
|
734
|
+
under the first-ask threshold — never asked — that left text, was not written up and gave
|
|
735
|
+
no answer owed a one-line write-up (#285's `owesShortWriteUp`; since 2026-09-30 a small owed stretch, `coverage/`'s `small`). Same pointer,
|
|
736
|
+
same door, one plain sentence more (`WRITE_UP_SHORT_LINE`: one line is enough, or
|
|
737
|
+
`memories: []`). Full write-ups first, STORE-WIDE (review of #285, S1): a short one is
|
|
738
|
+
offered only when no full debt anywhere in the store is waiting and not yet pointed at
|
|
739
|
+
today, because the day's allowance is one count for the store. It is offered only for a
|
|
740
|
+
session the host's registry knows (one our hooks saw start), so the unbound MCP server's
|
|
741
|
+
shared `mcp` id is passed by, and only for a person's interactive conversation: a session
|
|
742
|
+
whose host entrypoint (`CLAUDE_CODE_ENTRYPOINT`, kept on the registry record) says
|
|
743
|
+
`claude -p`, the Agent SDK, `mcp` or a GitHub action owes no short write-up (N2). It is
|
|
744
|
+
not a retention debt (text ages out with its week; a written-up one keeps it up to 7 days
|
|
745
|
+
after the write-up, like a full debt) and not in doctor's awaiting count. The headless
|
|
746
|
+
nightly run's child and an observer capture nothing, so they owe nothing. When a pointer
|
|
747
|
+
defers for room, its record names what else rode beside the wake, and doctor's advice
|
|
748
|
+
names that rather than the wake's budget (M3).
|
|
749
|
+
|
|
730
750
|
**[M] SessionStart carries a POINTER, not the words** (owner's choice of 2026-09-23,
|
|
731
751
|
INTERFACE-GAPS §15 option (b)). In `HookResult.ask`, after whichever other ask took the
|
|
732
752
|
field, it says how many sessions here are waiting, the oldest one's date, size and "part k
|
|
@@ -735,7 +755,7 @@ of N", and the call that fetches it, naming the ended session once and this sess
|
|
|
735
755
|
MCP door (`mcp/CONTRACT` guarantee 16), at most `WRITE_UP_PART_BYTES` (~24 KB) per
|
|
736
756
|
session, because an MCP result is not under the host's 10,000-character cap on a hook's
|
|
737
757
|
output and the wake is. The pointer is measured against that cap as PLAIN stdout
|
|
738
|
-
(`
|
|
758
|
+
(`HOST_OUTPUT_CHARS` = 10,000; bytes ≥ characters): with no owner notice
|
|
739
759
|
`bin/hook.ts#hostDelivery` prints plain text, and with one it drops the notice before it
|
|
740
760
|
lets the JSON envelope pass `ENVELOPE_MAX_CHARS`. It is NOT held to the reported budget,
|
|
741
761
|
which is what the wake is composed to; a 9,038-byte wake leaves room (tested with host
|
|
@@ -761,13 +781,14 @@ the sweep no interpreter; its gate row says `not-opted-in` and `runner.done` say
|
|
|
761
781
|
next-session`. A crashed session is pointed at like any other. An old `crashWriteUp` value
|
|
762
782
|
is ignored and named in `retired`.
|
|
763
783
|
|
|
764
|
-
**[M] Doctor: `Crash write-up`, and the `Sweep` line.** `Crash write-up`: `next session`
|
|
784
|
+
**[M] Doctor: `Write-ups` (was `Crash write-up`, same key), and the `Sweep` line.** Since 2026-09-30 `Write-ups` reads the coverage ledger — yesterday's state, amber on a stretch owed from yesterday or earlier, the week's lapses (`core/coverage/NOTES.md` §8). Before it, `Crash write-up`: `next session`
|
|
765
785
|
green; amber when a session is finished in one project and waiting on words it left in
|
|
766
786
|
another, naming that project (re-review m-C); amber when the newest pointer outcome is a
|
|
767
787
|
DEFERRAL and sessions are waiting — saying the wake was too full, by how many bytes, and to lower
|
|
768
788
|
`injectionBudgetBytes` by that much (never "open a session", which would defer again);
|
|
769
|
-
|
|
770
|
-
|
|
789
|
+
and (until 2026-09-30, when the `Write-ups` rule above replaced it) amber when a session had
|
|
790
|
+
waited past a 3-day `WRITE_UP_WAIT_DAYS`. Counted with the pointer's own eligibility: a small
|
|
791
|
+
debt the pointer never offers (not a person's session) is named apart, as left to lapse. Never red; not in the session-start reading. `Sweep`: `not-opted-in` —
|
|
771
792
|
and an older build's `no-credential` — is green `next session`.
|
|
772
793
|
|
|
773
794
|
## 6. Scars honored
|
|
@@ -606,9 +606,14 @@ That is a different mechanism, not a wider parameter, and it is not built.
|
|
|
606
606
|
fourth severity is the honest shape, and it touches the report, the JSON, the
|
|
607
607
|
dashboard and every caller that partitions on three.
|
|
608
608
|
|
|
609
|
-
## 12. Nobody has run a windowless host session, and this adapter cannot prove one from inside the suite (2026-09-20, S2)
|
|
609
|
+
## 12. Nobody has run a windowless host session, and this adapter cannot prove one from inside the suite (2026-09-20, S2) — CLOSED 2026-09-29: host mode removed
|
|
610
610
|
|
|
611
|
-
|
|
611
|
+
**Closed by removal.** The page writer's host mode was removed on 2026-09-29 (the nightly
|
|
612
|
+
run carries the writer). The questions below now belong to the headless nightly run, which
|
|
613
|
+
starts a windowless `claude -p` of its own (`night-run.ts`, the "Unproven until a real run"
|
|
614
|
+
list in NOTES 2026-09-29); they are kept as they were written.
|
|
615
|
+
|
|
616
|
+
Host mode was the owner's pick for the nightly page writer, and every part of it that is
|
|
612
617
|
this package's — the plan, the argument and environment shape, the watchdog, the claim, how
|
|
613
618
|
the outcome is read back — is under test against a stub executable. Three things are not,
|
|
614
619
|
and cannot be without a real machine and a real login:
|
|
@@ -638,7 +643,7 @@ known to work.
|
|
|
638
643
|
|
|
639
644
|
**Closed for the mechanism by #189 (roadmap B3, the owner's ruling of 2026-09-23).** The
|
|
640
645
|
writer's night is now decided on the machine's LOCAL calendar — `core/self/calendar.ts`
|
|
641
|
-
and `self/writer.ts#pageWriterNight`, one function shared by `Self`,
|
|
646
|
+
and `self/writer.ts#pageWriterNight`, one function shared by `Self`, the nightly run and
|
|
642
647
|
doctor's Page writer line — so from US Pacific the night rolls over at local midnight,
|
|
643
648
|
not at 5 p.m. East of UTC the night waits for its UTC date to close
|
|
644
649
|
(`pageWriterAbout`: `min(local yesterday, UTC yesterday)`), because of what remains below.
|
|
@@ -1730,3 +1730,122 @@ Working defaults, held lightly (dream NOTES has the why).
|
|
|
1730
1730
|
- **Still open:** the dashboard's vocabulary does not name `dream.night` or the two latch
|
|
1731
1731
|
events yet (every reader guards unknown names). The host-mode page writer's child has the
|
|
1732
1732
|
same exposure finding 3 describes and is not locked down here.
|
|
1733
|
+
|
|
1734
|
+
## 2026-09-29 — doctor's Contradictions and Upgrade to v10 lines
|
|
1735
|
+
|
|
1736
|
+
`contradictionFindings`: green, always printed — over the last 7 lived days, how many
|
|
1737
|
+
pairs a dream flagged, how many settled and how (changed, corrected, open) and by whom
|
|
1738
|
+
(sessions, dreams, reflections, the page writer, the owner), how many undone; standing
|
|
1739
|
+
now, how many open and how many unsettled with both memories live (pointing at
|
|
1740
|
+
`counterparts settle`). `upgradeV10Findings`: what the v10 carry found (flags, pairs,
|
|
1741
|
+
already raised, still standing); silent on a store born at v10. Both are read-only table
|
|
1742
|
+
and meta reads. The awake raise line (`dreams.raiseLines`) now names the pair's id and
|
|
1743
|
+
the `note` settle.
|
|
1744
|
+
|
|
1745
|
+
After the review of #284: the Contradictions line counts a pair recorded while pressure
|
|
1746
|
+
builds on a core memory (`source` pressure) as flagged, beside a dream's flags.
|
|
1747
|
+
|
|
1748
|
+
## 2026-09-29 — cleanup batch: host mode out, one envelope budget, short write-ups
|
|
1749
|
+
|
|
1750
|
+
Working defaults, held lightly.
|
|
1751
|
+
|
|
1752
|
+
- **Host mode removed.** `page-writer.ts` is gone; what the headless nightly run shared
|
|
1753
|
+
with it (the plan / starter shape, `startChild`, the kill and reap graces, the host
|
|
1754
|
+
command, the permission mode) moved unchanged to `child.ts`, with its own test
|
|
1755
|
+
(`test/child.test.ts`, the SIGTERM-ignoring stub included). Also gone: the worker's step
|
|
1756
|
+
5 and its `configPath` / `startPageWriter` inputs, `COUNTERPARTS_PAGE_WRITER` (the
|
|
1757
|
+
MCP door no longer reads it, the night child no longer scrubs it), `HookInput.pageWriter`,
|
|
1758
|
+
`PAGE_WRITER_MS`, and doctor's host-mode fix text. Old configurations load:
|
|
1759
|
+
`pageWriter.mode: "host"`, `pageWriter.timeoutMs` and `pageWriter.command` go to the
|
|
1760
|
+
old-settings line (`retired`), never also to the block's `ignored`, and the mode reads
|
|
1761
|
+
`session`. The dashboard's why-map still carries the `host-mode` / `not-host-mode`
|
|
1762
|
+
labels; nothing produces them now (a dashboard follow-up).
|
|
1763
|
+
- **One size budget per envelope.** The order, first to go → last: SessionStart —
|
|
1764
|
+
notices → write-up pointer → first-launch question → plain reminders (to the first
|
|
1765
|
+
prompt, unclaimed) → the wake (never cut here). UserPromptSubmit — update notice → the
|
|
1766
|
+
turn's recall (`recallRoom`: the configured budget, or less when the clock, plain lines,
|
|
1767
|
+
dream lines and person lines leave less; the JSON envelope's 9,500 when a person-facing
|
|
1768
|
+
line rides the prompt) → the dream's lines → plain reminders and the clock. The audit's
|
|
1769
|
+
"`nowLine` and plain reminders aren't reserved" was already untrue at SessionStart (`sent`
|
|
1770
|
+
counted them since #271); what changed there is that the first-launch question is now
|
|
1771
|
+
measured against the host's cap, like the pointer, instead of the reported injection
|
|
1772
|
+
budget — a second ceiling. The dream's lines are reserved, not shed, because they are
|
|
1773
|
+
claimed when composed (a hand-back, a carried share, a raise line); shedding them after
|
|
1774
|
+
the claim would lose them. `adapter.envelope.gave-way` names what gave way.
|
|
1775
|
+
- **The fallback is a tripwire.** `hostDelivery`'s plain form is now measured against
|
|
1776
|
+
`HOST_OUTPUT_CHARS`; past it the delivery carries `overCap`, the hook records
|
|
1777
|
+
`adapter.envelope.overcap` and prints it on stderr. It does not cut: by then the asks are
|
|
1778
|
+
marked, and the pure function cannot tell a wake from an ask. What can still reach it
|
|
1779
|
+
is a wake composed past the cap by a misconfigured budget.
|
|
1780
|
+
- **Short write-ups.** The pointer offers a session under the first-ask threshold a
|
|
1781
|
+
one-line write-up (`WRITE_UP_SHORT_LINE`). Order: a full debt not yet pointed at today,
|
|
1782
|
+
then short ones, then a full one already pointed at today — a plain "full before short"
|
|
1783
|
+
would let one unwritten full session hold every short one back for ever. A short debt is
|
|
1784
|
+
offered only for a session the registry knows, so the unbound MCP server's shared `mcp`
|
|
1785
|
+
id is passed by; it is not in doctor's awaiting count (it ages out in a week, and
|
|
1786
|
+
`WRITE_UP_WAIT_DAYS` is 3, so counting it would turn doctor amber for a debt that clears
|
|
1787
|
+
itself).
|
|
1788
|
+
- **Unproven:** how often short pointers fire on the owner's machine (every quick session,
|
|
1789
|
+
including any `claude` sessions other tools start in a project with hooks on, now owes
|
|
1790
|
+
one line); whether one-line answers are worth the pointer's room.
|
|
1791
|
+
|
|
1792
|
+
## 2026-09-29, later — the fix round after the review of #285
|
|
1793
|
+
|
|
1794
|
+
(`docs/adversarial-review-pr285-2026-09-29.md`; the probes are regression tests now.)
|
|
1795
|
+
|
|
1796
|
+
- **S1, the short write-up waits for the whole store.** The allowance is one count for the
|
|
1797
|
+
store, so a short debt is offered only when no full debt in ANY project is waiting and
|
|
1798
|
+
not yet pointed at today (`owedWriteUps`' `fullFirst`). Named cost: a full debt in a
|
|
1799
|
+
project nobody reopens holds every short one back; doctor turns amber on it after
|
|
1800
|
+
`WRITE_UP_WAIT_DAYS`, and the short ones age out with their week, as before.
|
|
1801
|
+
- **S2, the SessionStart order is real now.** A reminder reaches the person only in the
|
|
1802
|
+
JSON form, so when one is due and fits beside the wake in that form, the question and the
|
|
1803
|
+
pointer are measured against it (`EnvelopeRoom`, `envelope.ts` — the one envelope shape
|
|
1804
|
+
both `hooks.ts` and `bin/hook.ts` use). Measured: on a 9,000-byte wake of ordinary
|
|
1805
|
+
lines the JSON form of the wake and one reminder is already past 9,500, so on the
|
|
1806
|
+
owner's near-full wake a reminder cannot be shown at SessionStart whatever the asks do;
|
|
1807
|
+
it moves to the first prompt, which was already the behaviour, and the asks use the plain
|
|
1808
|
+
room. The ordering shows on a smaller wake (tested by walking wake sizes through the real
|
|
1809
|
+
`deliverTurn`). `adapter.envelope.gave-way` is now recorded where the giving way
|
|
1810
|
+
happens: each ask's deferral (`question`, `pointer`) and the delivery (`plain`, `dream`,
|
|
1811
|
+
`update-notice`, through the `noteGaveWay` door). The adapter no longer guesses it.
|
|
1812
|
+
- **M2, recall's room is measured.** In the JSON form, `recallRoom` measures the escaped
|
|
1813
|
+
envelope of the clock, the context and the person's lines, keys included. The one
|
|
1814
|
+
estimate left is recall's own escaping (`ENVELOPE_ESCAPE_RESERVE`, 200): its text does
|
|
1815
|
+
not exist when its budget is set, and composing twice would spend its fires twice. Plain
|
|
1816
|
+
stdout reserves nothing.
|
|
1817
|
+
- **M3, doctor names the cause.** A deferred pointer's record carries `beside` (the
|
|
1818
|
+
question, the reminders) and `limit`; doctor says "the wake and the first-launch question
|
|
1819
|
+
left …" and advises lowering `injectionBudgetBytes` only if it keeps happening.
|
|
1820
|
+
- **N2, entrypoints.** Read from the 2.1.285 host binary (strings, not docs): the host sets
|
|
1821
|
+
`CLAUDE_CODE_ENTRYPOINT` at startup — `cli` for a terminal session, `sdk-cli` when the
|
|
1822
|
+
start is non-interactive (`-p`/`--print`, `--init-only`, `--sdk-url`, or stdout not a
|
|
1823
|
+
TTY), `sdk-ts` / `sdk-py` from the Agent SDK, `mcp` for `claude mcp serve`,
|
|
1824
|
+
`claude-code-github-action` under `CLAUDE_CODE_ACTION`; an inherited `cli` becomes
|
|
1825
|
+
`sdk-cli` for a non-interactive start. This session's own Bash environment carries
|
|
1826
|
+
`CLAUDE_CODE_ENTRYPOINT=cli`, so the host exports it to children. What is NOT verified:
|
|
1827
|
+
a hook process's environment on a real `claude -p` run (running one here would fire the
|
|
1828
|
+
owner's live hooks). The hook records the value on the session's registry record; a
|
|
1829
|
+
short debt whose entrypoint is one of the five non-interactive names is not offered.
|
|
1830
|
+
Unknown or absent reads as a person's. A long `claude -p` session still owes a full
|
|
1831
|
+
write-up; only the short offer is skipped.
|
|
1832
|
+
- **N1** (the first-launch question can now fit beside a full wake): kept as built, on
|
|
1833
|
+
Mike's word — once per session in each unscoped directory until he answers there, the
|
|
1834
|
+
original G41 design.
|
|
1835
|
+
|
|
1836
|
+
## 2026-09-30 — the wake keeps up (self NOTES §30)
|
|
1837
|
+
|
|
1838
|
+
- **The worker** calls `Counterpart.refreshWake({ at: today })` after its cycle (step 3a in
|
|
1839
|
+
`bin/runner.ts`), in its own try: nothing marked, nothing rendered; a failure is a
|
|
1840
|
+
`runner.failed` row with `step: "wake"` and the mark stays. The re-fired Stop after a
|
|
1841
|
+
session answers the ask still spawns a worker (`stop()`: `askAtStop` is skipped, the
|
|
1842
|
+
spawn is not), which is what catches a write-up; tested.
|
|
1843
|
+
- **The nightly process** refreshes with `trigger: "run-end"` after the child returns,
|
|
1844
|
+
whatever the run's state, in the `finally` of the store read in `runNight`, before the
|
|
1845
|
+
run's row is written. `openNightCounterpart` already carried the host's budget; a config
|
|
1846
|
+
without one refuses the render, as `rebrief` does. The child is quiet, so no turn-end of
|
|
1847
|
+
its own follows the page it wrote — the run's end is the trigger that matters under
|
|
1848
|
+
`auto`, where the day's first worker renders before the writer writes (tested with a
|
|
1849
|
+
`start` that runs the worker first).
|
|
1850
|
+
- **Delivery.** The delivery check compares each session's wake with the sentinel recorded
|
|
1851
|
+
at ITS start, so a session that woke before a rebuild still reads `delivered` (tested).
|