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,1057 @@
|
|
|
1
|
+
# `self/` — implementation notes
|
|
2
|
+
|
|
3
|
+
Where the contract was silent, ambiguous, or asked for machinery this build has not
|
|
4
|
+
earned yet. Each entry says what was decided and why, so the next session argues with a
|
|
5
|
+
recorded choice rather than re-deriving one.
|
|
6
|
+
|
|
7
|
+
## 1. Open question 1 answered: v0's sections, v1's data structures, one set of lanes
|
|
8
|
+
|
|
9
|
+
The contract asks whether the briefing keeps v0's four sections (Active Context / Core
|
|
10
|
+
Knowledge / Recent Patterns / Fading Context) or v1's lanes, and warns against accreting
|
|
11
|
+
both. Shipped: **behavioral-spec §1's composed order, minus the two riders the Rulings
|
|
12
|
+
drop with their subjects** — the second-signature reminder went with the `protected.add`
|
|
13
|
+
queue and the self-store pointer went with the self-store tool (module-map ruling 3).
|
|
14
|
+
|
|
15
|
+
header → context framing → identity → craft → threads → hints → horizon → sentinel
|
|
16
|
+
|
|
17
|
+
v0's vocabulary is honoured where it is still true (the lane HEADINGS are plain first
|
|
18
|
+
person: "Who I am:", "How I work:", "Still open:") and dropped where it named a structure
|
|
19
|
+
v2 does not have — "Fading Context" was a section for memories the ranker was about to
|
|
20
|
+
lose, and in v2 the thing that fades is simply not in the lane. One structure, one
|
|
21
|
+
ordering, no second surface to go stale.
|
|
22
|
+
|
|
23
|
+
The trim order is v1's verbatim and is NOT the reverse of the composed order:
|
|
24
|
+
`hints → craft → threads → horizon → identity`. Craft trims before threads deliberately
|
|
25
|
+
(so craft can never displace core, §1 G3), which means the composed order and the trim
|
|
26
|
+
order disagree about craft on purpose. That is policy, and it is why both lists are
|
|
27
|
+
exported constants with a test on each.
|
|
28
|
+
|
|
29
|
+
## 2. Protected elements ARE rendered into the briefing
|
|
30
|
+
|
|
31
|
+
§14.1 G2 says protected elements are never rendered *to the interpreter*, and scar §19
|
|
32
|
+
says why: they are never in the interpreter's schema slices, which is what makes them
|
|
33
|
+
"permanent AND unfalsifiable". That rule guards the FALSIFICATION path — what a model may
|
|
34
|
+
contradict — not the wake. Withholding a protected identity element from the briefing
|
|
35
|
+
would mean the most load-bearing statements are the ones the waking session never
|
|
36
|
+
inhabits, which inverts the point of protecting them, and constitution 16 plus scar
|
|
37
|
+
§2.19's "everything permanent is enumerable and inspectable on demand" point the same
|
|
38
|
+
direction.
|
|
39
|
+
|
|
40
|
+
So: protected elements rank and render like any other identity element, and
|
|
41
|
+
`enumerate()` lists identity and protected side by side so the owner can see which is
|
|
42
|
+
which. If encode-time preselection is ever built here (it is not; `encode/` owns it), the
|
|
43
|
+
no-render rule applies there and only there.
|
|
44
|
+
|
|
45
|
+
## 3. The freeze arms differ at exactly one line, and the counter is telemetry
|
|
46
|
+
|
|
47
|
+
`noteSelfConfirmation` resolves, reads kind, reads strength, decides, counts, and emits —
|
|
48
|
+
identically in both arms. The one difference is whether `store.reinforce` is called. That
|
|
49
|
+
is deliberate and is the contract's own sentence: *the event IS the measurement; the
|
|
50
|
+
movement is what is withheld*; a frozen rate measured on a different denominator would
|
|
51
|
+
not be comparable to the live one.
|
|
52
|
+
|
|
53
|
+
The durable counter (`self.claims.<kind>.<frozen|live>` in box 2) is a second measurement
|
|
54
|
+
on top of the event ring, because the ring is per-process and the interesting question is
|
|
55
|
+
a RATE over weeks. It is telemetry, not physics: moving the counter is not moving the
|
|
56
|
+
memory, and the test proves that by deep-equalling `physicsOf` across the walk.
|
|
57
|
+
|
|
58
|
+
**Softening does not flow through this seam.** The verdict says `live-softening` and
|
|
59
|
+
nothing is reinforced, because softening is a REVISION — `physics.applyChallenge`'s
|
|
60
|
+
pressure accumulator — and reinforcing on a softening occasion would be the ratchet
|
|
61
|
+
guarantee 6 exists to prevent. The freeze does not block it; this module simply does not
|
|
62
|
+
own it. Whoever wires the revision path must not route it through here.
|
|
63
|
+
|
|
64
|
+
## 4. `noteSelfConfirmation` is one seam, not two entry points
|
|
65
|
+
|
|
66
|
+
The contract names two frozen things: a fallback-authored *confirmation* against a self-
|
|
67
|
+
or skill-kind element, and a re-arriving identity *claim* (§14.2 G1–G2). They are the
|
|
68
|
+
same occasion at this seam: something arrived that would strengthen an existing element.
|
|
69
|
+
Splitting them would give the two halves separate denominators, which is precisely what
|
|
70
|
+
G4 forbids. If a future caller genuinely needs to distinguish them, the field to add is
|
|
71
|
+
on the occasion (`shape: "confirmation" | "claim"`), not a second method.
|
|
72
|
+
|
|
73
|
+
## 5. The byte fixed point is SOLVED, not iterated
|
|
74
|
+
|
|
75
|
+
The header and the sentinel each state the composed total, and stating it changes it. v1
|
|
76
|
+
(and `recall/render.ts` today) iterate a few passes and take what they get, which is
|
|
77
|
+
correct except exactly when the total crosses a power of ten — the moment the digit count
|
|
78
|
+
changes is the moment the two lines can disagree with reality, and a sentinel that is
|
|
79
|
+
wrong by two bytes is worse than no sentinel because it fails the check it exists to pass.
|
|
80
|
+
|
|
81
|
+
`fixedPointTotal(skeleton, occurrences)` solves for the digit width directly: the true
|
|
82
|
+
total for width `w` is `skeleton + occurrences × w`, and the fixed point is the first `w`
|
|
83
|
+
whose own digit count matches. The test sweeps a thousand consecutive skeleton sizes,
|
|
84
|
+
which crosses several powers of ten. If `recall/` ever wants it, the function is exported.
|
|
85
|
+
|
|
86
|
+
## 6. An under-floor budget publishes the FLOOR, deliberately unlike `recall/`
|
|
87
|
+
|
|
88
|
+
`recall/` goes quiet when even its smallest render does not fit: a quiet turn is a turn
|
|
89
|
+
with nothing to say. The wake cannot do that. A store with a full identity and a
|
|
90
|
+
misconfigured ceiling that injects nothing is v1's exact incident — "identity amnesia
|
|
91
|
+
disguised as a fresh install" (scar §2.3) — so `render()` returns the floor (header,
|
|
92
|
+
framing, sentinel, zero statements) with `overBudget: true`, `boundary()` publishes it
|
|
93
|
+
anyway, and `self.briefing.overbudget` fires as a tripwire. The host is wrong, and the
|
|
94
|
+
system says so out loud rather than going dark.
|
|
95
|
+
|
|
96
|
+
## 6a. Live append writes ONE heading per chapter
|
|
97
|
+
|
|
98
|
+
"When something significant happens later, append to it in the moment" (§13 G2) means the
|
|
99
|
+
common case is two or more appends inside one chapter — v1's ask fired once and missed the
|
|
100
|
+
moment that mattered by 82 seconds. So `appendChapter` emits the `## chapter N` heading
|
|
101
|
+
only when the chapter number advances past what the episode's own `meta.chapters` records;
|
|
102
|
+
a second append continues the prose it is already part of, and the revise reason changes
|
|
103
|
+
from `episode-chapter` to `episode-append` so the two are distinguishable in the version
|
|
104
|
+
history. `ChapterAppend.heading` reports which happened.
|
|
105
|
+
|
|
106
|
+
## 7. Deliberately NOT built (Amendment 15 — complexity is earned)
|
|
107
|
+
|
|
108
|
+
- **Recompression** (contract §3, §5 G9). The archive-first, re-judged-at-write-time,
|
|
109
|
+
protected-excluded machinery is real and earned — but it is machinery for a render that
|
|
110
|
+
does not yet overflow at the boundary in v2, and its whole subject (the identity
|
|
111
|
+
*index*) is dropped. When a real store's briefing cannot fit a real host's ceiling
|
|
112
|
+
without losing identity statements, recompression ships **with that measurement**, and
|
|
113
|
+
the durable "author's verbatim marks" go in at the same time (they are durable state no
|
|
114
|
+
model-facing path may set or clear, which is a store-column conversation, not a here
|
|
115
|
+
conversation).
|
|
116
|
+
- **The `unresolved` lifecycle.** The threads lane reads a flag; nothing here opens or
|
|
117
|
+
closes a thread. That belongs to whoever mints and revises memories.
|
|
118
|
+
- **Chapter-level handles minting.** `handles` are accepted and stored on the ingested
|
|
119
|
+
memory's `meta`; the rarity-weighted name channel that makes them retrievable is
|
|
120
|
+
`recall/`'s and `schemas/`' (INTERFACE-GAPS #2 in `recall/`).
|
|
121
|
+
- **A dashboard view.** `enumerate()`, `schemaBytes()` and `events()` are the read
|
|
122
|
+
surfaces the dashboard adapter needs; the rendering is the adapter's.
|
|
123
|
+
|
|
124
|
+
## 8. Open question 3, restated with what this build learned
|
|
125
|
+
|
|
126
|
+
"Is the freeze still needed once the transcript sweep is a crash fallback?" — kept,
|
|
127
|
+
mechanized, and now cheap: it is one pure function and one branch. Its firing rate in v2
|
|
128
|
+
will be near zero *by construction*, which makes it hard to read, and that is the honest
|
|
129
|
+
answer to record: a near-zero frozen count in v2 is **not** evidence the doctrine was
|
|
130
|
+
wrong, it is evidence the channel it guards barely runs. The number that would overturn
|
|
131
|
+
it is a non-trivial frozen count on the fallback path, which is exactly what the counter
|
|
132
|
+
by (kind, arm) makes visible. Do not read the rate without reading the denominator.
|
|
133
|
+
|
|
134
|
+
## 9. The identity share is applied BEFORE the trim order, and gives the leftover back
|
|
135
|
+
|
|
136
|
+
Measured on the live host 2026-09-03/04: every session's wake was 8 identity elements at
|
|
137
|
+
~1.1 KB each filling all 9,000 bytes — craft 0, threads 0, hints 0, horizon 0 — while v1's
|
|
138
|
+
wake the same day carried 20 elements across four lanes. The mechanism was not a bug in the
|
|
139
|
+
trim order; it was the trim order working as declared. Identity trims LAST, so by the time
|
|
140
|
+
the loop could bound identity, every other lane is already gone. A rule that only fires
|
|
141
|
+
during trimming can never rebalance the lane that trims last.
|
|
142
|
+
|
|
143
|
+
So the share is a PRE-CUT, in `render()`, before the loop:
|
|
144
|
+
|
|
145
|
+
1. **No other lane has content ⇒ no cut at all.** A store that is nothing but identity is
|
|
146
|
+
not competing with itself, and half a budget of white space is not a smaller wake, it is
|
|
147
|
+
a worse one.
|
|
148
|
+
2. Otherwise identity keeps the longest prefix whose rendered lines fit
|
|
149
|
+
`IDENTITY_SHARE × budget`, **by whole elements** — beliefs are shown verbatim or not at
|
|
150
|
+
all — with the first element always surviving the cut. The budget may still take that
|
|
151
|
+
one later, in `TRIM_ORDER` position, which is where that decision belongs.
|
|
152
|
+
3. `TRIM_ORDER` then runs exactly as before over the remainder.
|
|
153
|
+
4. **The leftover comes back**, but only when NOTHING had to be trimmed. A lane that lost an
|
|
154
|
+
element wanted the room, and handing it to identity instead would make the share decide
|
|
155
|
+
the opposite of what it was set for. When the other lanes are all present and the budget
|
|
156
|
+
is still not spent, the held-back identity elements return in rank order while they fit.
|
|
157
|
+
|
|
158
|
+
**What rule 4 buys, and what it does not — stated because the repo's culture is to name
|
|
159
|
+
the failure.** Rule 4 closes ONE source of cross-budget reshuffle: refilling identity into
|
|
160
|
+
slack a trimmed lane left behind, which would let a larger budget produce a set that is not
|
|
161
|
+
a superset. It does not make the share monotone in general, and no rule here can. A share
|
|
162
|
+
taken by WHOLE elements has a second source: when the budget grows by δ and the widened
|
|
163
|
+
share admits an identity element of size e > δ, the room left for the other lanes shrinks
|
|
164
|
+
by e − δ. Measured on this build with 1.1 KB identity elements and 8 × ~570 B craft:
|
|
165
|
+
|
|
166
|
+
budget 8,800 → identity 3, craft 8
|
|
167
|
+
budget 9,200 → identity 4, craft 7 ← one craft element the SMALLER budget kept
|
|
168
|
+
|
|
169
|
+
That is inherent to a whole-element share, not a bug in the implementation: the alternative
|
|
170
|
+
is truncating a belief mid-sentence, which §1 forbids for better reasons. The guarantee that
|
|
171
|
+
survives, and the one that matters at a real host, is **determinism at a fixed budget** —
|
|
172
|
+
the ceiling does not change between two sessions, and for any given ceiling the same store
|
|
173
|
+
composes the same bundle. The sweep test (24,000 → 400 in 400-byte steps) still asserts the
|
|
174
|
+
subset property and still passes, but only because its fixture's identity elements (~215 B)
|
|
175
|
+
are smaller than its step; it is a real check of the trim order, not a proof about the
|
|
176
|
+
share, and a fixture with 1.1 KB elements would fail it. Do not read it as one.
|
|
177
|
+
|
|
178
|
+
The share is CAL, not structural. 0.5 was chosen against v1's measured wakes (20 elements,
|
|
179
|
+
four lanes, the same 9,000-byte ceiling), not derived; `tools/replay` re-earns it. What is
|
|
180
|
+
structural is that identity's ceiling exists at all when other lanes have content.
|
|
181
|
+
|
|
182
|
+
## 10. The delivery preface is composed at WAKE, and the renderer reserves its room
|
|
183
|
+
|
|
184
|
+
The bundle is composed at a boundary and served unchanged to every session until the next
|
|
185
|
+
one. On 2026-09-03 the memory system under the live host was switched from v1 to
|
|
186
|
+
Counterparts mid-day; the stored wake still carried a v1-era finding as a current fact,
|
|
187
|
+
nothing in the body said which system was speaking or how old the render was, and the model
|
|
188
|
+
repeated it as current until the owner corrected it. The only line naming the new system was
|
|
189
|
+
the HTML comment, and comments are furniture.
|
|
190
|
+
|
|
191
|
+
`prefaceLine()` is that missing sentence — system, lived day, today's date, live memory
|
|
192
|
+
count, and "composed at the last boundary" — and three decisions in it are deliberate:
|
|
193
|
+
|
|
194
|
+
- **Composed at wake, never at sleep.** Three of its four facts (the date, the store's
|
|
195
|
+
current size, and the fact that the body is a day old) are false the moment they are
|
|
196
|
+
baked into the body. `Self.wake(delivery?)` takes the delivery object as the *request* for
|
|
197
|
+
a preface: a reader that is not delivering (the dashboard, replay, a test) gets the
|
|
198
|
+
published bundle byte for byte, which is what the round-trip guarantee is for.
|
|
199
|
+
- **Both byte counts are re-solved for the delivered text.** Adding a line and leaving the
|
|
200
|
+
header and sentinel describing something smaller would hand every reader a sentinel that
|
|
201
|
+
fails the check it exists to pass (§1 G2). `applyPreface` runs the same fixed point
|
|
202
|
+
`compose()` does, and REFUSES on any bundle that is not a whole render — rewriting the
|
|
203
|
+
byte count of a damaged bundle would erase the damage.
|
|
204
|
+
- **The renderer reserves the room, in exactly one place.** `PREFACE_RESERVE_BYTES` is
|
|
205
|
+
subtracted from the host's reported ceiling in `core/counterpart.ts` before the boundary
|
|
206
|
+
renders, because that root is the only place that knows both numbers. One constant bounds
|
|
207
|
+
both the reserve and the preface itself, with a test at the widest plausible day, date and
|
|
208
|
+
store size — two numbers would be v1's lane-cap smell, drifting apart in the dark.
|
|
209
|
+
|
|
210
|
+
**A second splice joined it on 2026-09-20 (E1), at the other end of the bundle.**
|
|
211
|
+
`spliceBeforeSentinel` is `applyPreface`'s mechanism pointed at the foot: it inserts above
|
|
212
|
+
the tail sentinel, re-solves the same fixed point, and returns a bundle that is not a whole
|
|
213
|
+
render untouched, for the same reason. It exists because the per-directory handoff pointer
|
|
214
|
+
is a delivery-time fact for exactly the reason the preface is — one bundle is published per
|
|
215
|
+
store and read by sessions in every directory, so WHICH directory this session opened in
|
|
216
|
+
cannot be known when the body is composed.
|
|
217
|
+
|
|
218
|
+
Two things about it belong here rather than in `handoff/`:
|
|
219
|
+
|
|
220
|
+
- **`self/` does not learn what a directory is.** The block arrives composed, from
|
|
221
|
+
`core/handoff/`, and is joined to the bundle at `core/counterpart.ts#addHandoffPointer`,
|
|
222
|
+
which is the one place holding the published bundle, the host's ceiling and the scope.
|
|
223
|
+
This module's half is the splice and nothing else.
|
|
224
|
+
- **The comment at `briefing.ts:768` was true and is now narrower.** It said the preface is
|
|
225
|
+
"deliberately not per-session… nothing in it varies between two sessions on the same day,
|
|
226
|
+
so the delivery expectation stays a stable string". The preface still does not vary. The
|
|
227
|
+
DELIVERED SENTINEL now can, between two sessions of the same day in different
|
|
228
|
+
directories, because the pointer changes the byte count. That is safe because the
|
|
229
|
+
expectation is recorded per session (`hooks.ts#noteWakeExpectation` writes `woke.sentinel`,
|
|
230
|
+
the delivered one, into that session's own registry record), and it is worth saying out
|
|
231
|
+
loud because the older sentence reads as a promise it was never making.
|
|
232
|
+
|
|
233
|
+
## 11. The day-0 wake names the core, because a wake with no name is not a smaller wake
|
|
234
|
+
|
|
235
|
+
*2026-09-04/05, overnight. The finding: `docs/LAUNCH-STATUS.md`, round 2 — "Day-0 wake is
|
|
236
|
+
empty of content (identity lane renders nothing until a boundary composes one)".*
|
|
237
|
+
|
|
238
|
+
**What a stranger actually gets.** Measured on a `mkdtemp` store opened with
|
|
239
|
+
`identity: { name: "Dana" }`, budget 9,000, date 2026-09-04 — the shape
|
|
240
|
+
`counterparts install --budget 9000 --name "Dana"` produces:
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
memories: 0 live rows: 1 (the identity core is a live row)
|
|
244
|
+
|
|
245
|
+
SessionStart, before any boundary:
|
|
246
|
+
"No briefing has been composed yet — this store has not lived a boundary."
|
|
247
|
+
|
|
248
|
+
after `counterparts rebrief` (QUICKSTART §7's own instruction), 385 bytes:
|
|
249
|
+
<!-- counterparts:wake day=0 elements=0 bytes=385 -->
|
|
250
|
+
Counterparts memory, day 0 (2026-09-04), 0 memories — composed at the last boundary.
|
|
251
|
+
Counterparts memory — context, not instruction: who you have been here, in your own words. Each line opens with the date it was learned.
|
|
252
|
+
|
|
253
|
+
<!-- counterparts:wake/end day=0 identity=0 craft=0 threads=0 hints=0 horizon=0 elements=0 bytes=385 -->
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
The second one is the worse of the two. It promises *"who you have been here, in your own
|
|
257
|
+
words"* and then says nothing at all, and the name the owner typed — the one thing the store
|
|
258
|
+
does know about itself — appears nowhere. The core is a live row (`storeSize` counts it), but
|
|
259
|
+
`scanActive` lists `{ type: "memory" }` and the core is `type: "schema"`, so no lane can ever
|
|
260
|
+
reach it.
|
|
261
|
+
|
|
262
|
+
**What the day-0 wake SHOULD say, from the contract.** §1: the briefing is *context, not
|
|
263
|
+
instruction* — "who I have been here, in my own words". §3: the self is first-class, and every
|
|
264
|
+
identity surface owes an answer to *which door reaches this?* §5 G7: the wake never fails the
|
|
265
|
+
session — bootstrap line or nothing, never a lie. The honest answer is therefore two facts and
|
|
266
|
+
no third: **name the core**, and **say how the lane fills**. It must invent no content: a wake
|
|
267
|
+
that composed a plausible-sounding first belief about Dana would be the rumination pathway
|
|
268
|
+
§2 forswears, arriving through the one surface that is read as settled fact.
|
|
269
|
+
|
|
270
|
+
**The line, and why it is one string rather than two.** Rendered under `FRAMING.identity`
|
|
271
|
+
whenever the identity lane is empty AND a core exists:
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
Who I am:
|
|
275
|
+
This memory is for Dana. No identity has formed here yet — identity is earned at the boundary that ends a session, from what recurs across distinct days.
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
The second sentence is the mechanism as `sleep/consolidate.ts` implements it, not a promise:
|
|
279
|
+
promotion requires `base >= THETA_ID` **and** reinforcement on `N_PROMOTION_DAYS` distinct
|
|
280
|
+
lived days (`physics/index.ts#promotionEligibility`), decided at consolidation inside the
|
|
281
|
+
cycle `Counterpart.sessionEnd` runs. The numbers are CAL and stay out of the prose.
|
|
282
|
+
|
|
283
|
+
It deliberately does NOT say "nothing has been lived here yet" — the delivery preface already
|
|
284
|
+
states the live memory count on the line above (`0 memories` on day 0), and a line claiming
|
|
285
|
+
emptiness would go false the moment the first note landed while the identity lane, which takes
|
|
286
|
+
days to fill, was still empty. **One string that is true on day 0 and on day 30** beats two
|
|
287
|
+
strings and a branch: the preface carries the count, this line carries the *who*.
|
|
288
|
+
|
|
289
|
+
- **No bullet, and the counts do not move.** It is furniture, like `FRAMING.context`, not an
|
|
290
|
+
element: `- ` is reserved for a resolved statement, and `FRAMING.context` promises that every
|
|
291
|
+
such line opens with its encode date, which this line has none of. `counts.identity` stays 0
|
|
292
|
+
and the header and sentinel still read `elements=0`, so a zero-element bundle is still legible
|
|
293
|
+
as one (§1 G2).
|
|
294
|
+
- **No core, no line.** A store installed without `--name` renders exactly what it renders
|
|
295
|
+
today. `self/` never invents a name (INTERFACE-GAPS #8), and a nudge to go and set one is
|
|
296
|
+
the console's job, which already does it.
|
|
297
|
+
- **Untrimmable, and it costs less than the lane it stands in for.** It exists only when the
|
|
298
|
+
identity lane spends zero bytes, so it can never displace an element; it is inside the
|
|
299
|
+
composed total and the byte fixed point like everything else, and the under-floor case still
|
|
300
|
+
publishes the floor with `overBudget` (§6 above).
|
|
301
|
+
|
|
302
|
+
**Which door — and the two that were rejected.**
|
|
303
|
+
|
|
304
|
+
- **The renderer (`self/briefing.ts` + `Self.build`) — chosen.** It is the only door that
|
|
305
|
+
reaches the state above: the 385-byte bundle is composed by the renderer and served to every
|
|
306
|
+
session until the next boundary, and nothing downstream can add to it. It is also where the
|
|
307
|
+
contract puts wake CONTENT.
|
|
308
|
+
- **The hook's bootstrap line (`adapters/claude-code/hooks.ts`) — rejected.** It can only
|
|
309
|
+
touch the *first* state, the one before any bundle exists. The moment the stranger follows
|
|
310
|
+
QUICKSTART §7 and runs `rebrief`, the bootstrap line is gone and the nameless bundle is what
|
|
311
|
+
every session reads. It would also put identity prose in the adapter, where constitution 5
|
|
312
|
+
keeps host vocabulary and nothing else.
|
|
313
|
+
- **`BOOTSTRAP` naming the core — rejected on §5 G1.** Wake performs no ranking, no prose
|
|
314
|
+
read, no model call and no write. `findIdentityCore` reads prose. Naming the core in the
|
|
315
|
+
bootstrap line means a prose read on the wake path, which is the guarantee that keeps
|
|
316
|
+
cold-start cost constant in store size. The bootstrap line stays exactly as it is: it is
|
|
317
|
+
true, and "this store has not lived a boundary" is the fact a reader needs.
|
|
318
|
+
|
|
319
|
+
**The cost, named.** `Self.build` now asks the store for the core's name — but only after
|
|
320
|
+
ranking, and only when `lanes.identity.length === 0`. A store with even one identity element
|
|
321
|
+
never makes the lookup and never renders the line. That guard is also the live-store argument
|
|
322
|
+
in the PR's G12 declaration: the owner's store has lived many boundaries and carries eight or
|
|
323
|
+
more identity elements, so neither the lookup nor the branch is reachable there.
|
|
324
|
+
|
|
325
|
+
**Two defects the adversarial review found, and the shape of both.** Neither was reachable
|
|
326
|
+
through `Self`; both were reachable through this module's exported API, which is the same
|
|
327
|
+
thing one refactor later.
|
|
328
|
+
|
|
329
|
+
- **The guard existed at one seam and the contract claimed two.** `Self.build` gated the
|
|
330
|
+
name LOOKUP on the ranked lane; `compose` gated the RENDER on the post-trim, mutated
|
|
331
|
+
copy, and `render` forwarded `coreName` into every iteration of the trim loop. The loop
|
|
332
|
+
pops from `kept.identity` last, but it pops: two real identity beliefs and a 400-byte
|
|
333
|
+
ceiling produced a day-30 wake asserting *"No identity has formed here yet"* — identity
|
|
334
|
+
amnesia printed over a store that has identity, which is the failure this module's own
|
|
335
|
+
header quotes (scar §2.3). The guard is now computed ONCE, in `render`, on the lane as
|
|
336
|
+
it arrived, and forwarded from there. *A predicate evaluated at two seams on two
|
|
337
|
+
different values is not a guard; it is a coincidence that has been holding.*
|
|
338
|
+
- **The name was the one string in the module that skipped `flatten`.** Every statement is
|
|
339
|
+
flattened because "a statement is a line here"; the name — the only user-supplied string
|
|
340
|
+
this module renders, and new with this change — was interpolated raw, so newlines in it
|
|
341
|
+
injected lines into the delivered wake, a forged `- <date> <claim>` bullet among them
|
|
342
|
+
that the dashboard's splitter then filed under a lane heading the store had no rows for.
|
|
343
|
+
The sentinel still verified and the name is the owner's own, so this is an invariant
|
|
344
|
+
defect and not a privilege boundary — but constitution 6 promises the prose is
|
|
345
|
+
hand-editable, and a paste accident is the whole distance to it. `flatten(name)`, inside
|
|
346
|
+
`identityCoreLine`, where the line is built.
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## The cap moved off the lived day, then off the shared day, then back onto a day of its own (I32, 2026-09-11; finding 12, 2026-09-17; the long session, 2026-09-18)
|
|
351
|
+
|
|
352
|
+
**First move, and the scar under it.** `dayKey` keyed the ask cap on the store's
|
|
353
|
+
LIVED day from 2026-09-04, and the reasoning was sound as far as it went: E8 says
|
|
354
|
+
episode pacing and the regrow window run on lived days, and a per-session cap
|
|
355
|
+
multiplies itself by however many times the owner typed `claude`. What it missed
|
|
356
|
+
is WHO ADVANCES THAT CLOCK. The lived day moves inside the sleep cycle, and the
|
|
357
|
+
sleep cycle runs only in the detached worker — so the cap's reset depended on the
|
|
358
|
+
machinery whose failure the cap would then hide, and on 2026-09-04 that machinery
|
|
359
|
+
stopped. The clock froze at 185 for seven days, `self.episode.day.185` sat at its
|
|
360
|
+
cap of 4, and every Stop from then on read `capped`. Thirty-nine asks a person was
|
|
361
|
+
present for were never made, and the store's own record said "capped", which was
|
|
362
|
+
true and told you nothing. The cap moved to the CALENDAR date, which fixed the
|
|
363
|
+
freeze.
|
|
364
|
+
|
|
365
|
+
**Second move: the sharing was the rest of the bug.** Diagnosed 2026-09-17
|
|
366
|
+
(`docs/finding-12-diagnosis-2026-09-17.md`) on the live store: four asks shared by
|
|
367
|
+
every session a calendar day held refused 196 of 264 Stops, and the crash-fallback
|
|
368
|
+
sweep wrote 888 memories against the author's 193. The owner runs five or more
|
|
369
|
+
sessions a day, so the day's allowance was usually spent by sessions that had
|
|
370
|
+
ended before this one began — the experiencer was not losing a fight about who
|
|
371
|
+
writes, it was almost never invited. When it was asked it answered every time.
|
|
372
|
+
|
|
373
|
+
**Third move: a session's whole life was too long a window the other way.** On
|
|
374
|
+
2026-09-17 a coordinating session spent all six asks inside one working day and
|
|
375
|
+
then kept running; its end-of-day handoff work — the stretch most worth writing —
|
|
376
|
+
was never offered the pen, and nothing short of a new session could give the
|
|
377
|
+
allowance back. The cap was doing to one long session what the shared day cap did
|
|
378
|
+
to every short one.
|
|
379
|
+
|
|
380
|
+
**The rule now:** the cap is the SESSION's own **per calendar day**
|
|
381
|
+
(`MAX_ASKS_PER_SESSION`, 6, owner's ruling 2026-09-18), and a session must still
|
|
382
|
+
have done real work first — the substance pacer is untouched, and it is the pacer,
|
|
383
|
+
not the count, that spaces asks out: six of them need roughly 6 + 5×8 turns AND the
|
|
384
|
+
bytes to match. The 2026-09-04 measurement against per-session (six asks in one
|
|
385
|
+
evening) was taken under the OLD re-ask rule, an OR across two pacers with a byte
|
|
386
|
+
half a third of v1's; the AND landed the same day.
|
|
387
|
+
|
|
388
|
+
**Which day, and why that one.** The store's CALENDAR date (`Store#today`, UTC),
|
|
389
|
+
not the lived day — I32's argument unchanged: the lived clock is advanced by the
|
|
390
|
+
detached worker, and a cap whose reset depends on the machinery it is capping is a
|
|
391
|
+
cap that can be spent forever. It is held on the session's own state
|
|
392
|
+
(`asksToday` + `asksDay`) rather than in a counter of its own, so nothing outside
|
|
393
|
+
the session can spend it and there is no second row to go stale. `asks` stays the
|
|
394
|
+
session's whole-life count, because the first-ask branch and `appendChapter`'s
|
|
395
|
+
"is a chapter open?" test both read it and neither means "today".
|
|
396
|
+
|
|
397
|
+
**A state written before the day stamp reads as zero spent today**, not as today's
|
|
398
|
+
count. Read the other way a session already at its cap would be capped on every
|
|
399
|
+
later day too, with no write that could ever move it off — the starvation this move
|
|
400
|
+
exists to end; read this way it costs at most one extra allowance on the day the
|
|
401
|
+
stamp lands, and the pacer still spaces those out.
|
|
402
|
+
|
|
403
|
+
**What is deliberately unchanged.** Episode PACING and the regrow window still run
|
|
404
|
+
on lived days (E8 stands). Exhausting the allowance INSIDE one day still binds —
|
|
405
|
+
accepted for now. Refusals stay on the record: a capped Stop still writes an
|
|
406
|
+
`adapter.ask` row with `outcome: "capped"` and `reason: "session-ask-cap"`, the
|
|
407
|
+
same reason string as before, because the door is the same one and only its window
|
|
408
|
+
moved.
|
|
409
|
+
|
|
410
|
+
**What went away with the day.** `dayKey`, `Self.dayAsks`, `bumpDayAsks` and the
|
|
411
|
+
`self.episode.day.*` meta rows: nothing read them but the cap, and "how many asks
|
|
412
|
+
did this date hold" is a question the durable `adapter.ask` rows answer better,
|
|
413
|
+
each stamped with the host's UTC date and its outcome. Old `self.episode.day.*`
|
|
414
|
+
rows on a live store are inert — nothing reads or writes them again.
|
|
415
|
+
|
|
416
|
+
**The wake render now leaves ONE durable row per boundary (`self.briefing`,
|
|
417
|
+
2026-09-14, IMPROVEMENTS U9).** `self.briefing.trim` fires once per trimmed
|
|
418
|
+
element and `self.briefing.rendered` carries the lane counts, and both lived
|
|
419
|
+
only in this module's ring, so "what did the wake trim today, and what actually
|
|
420
|
+
rendered" was not answerable from the store. **The row is not written here.**
|
|
421
|
+
`self/` holds no store handle and must not grow one (SEAMS G), so the
|
|
422
|
+
composition root collects what the cycle's render emitted — through the SELF
|
|
423
|
+
relay it already wires, armed for the span of one `runCycle` — and appends the
|
|
424
|
+
row after the cycle returns. Payload: `reason: "rendered"`, `date`, `day`,
|
|
425
|
+
`bytes`, `budget`, `counts` per lane in `LANE_ORDER` for what RENDERED, and
|
|
426
|
+
`trimmed: [{ id, lane }]` — ids only, capped at `BRIEFING_TRIM_LOG_CAP` (this
|
|
427
|
+
module's constant, since the trim is this module's), with the full number beside
|
|
428
|
+
it as `trimmedTotal`. No render, no row: the briefing phase is cadenced daily, so
|
|
429
|
+
a second boundary on one lived day writes nothing and `sleep.cycle`'s own
|
|
430
|
+
`phases` list says why. **One case where `phases` does NOT say why, named rather
|
|
431
|
+
than glossed:** a host that reported no ceiling makes `selfRenderer` refuse and
|
|
432
|
+
return void, and `sleep/briefing.ts` counts a void render as `changed: 1`, so the
|
|
433
|
+
phase reads `ran` while no row exists. The refusal is loud in its own right —
|
|
434
|
+
`briefing.no-budget` — but it predates these rows and is not fixed by them.
|
|
435
|
+
Unlatched, and pruned at the store's 90-lived-day window.
|
|
436
|
+
`rebrief()` leaves one too, under `reason: "rebrief"`. It renders, trims and
|
|
437
|
+
PUBLISHES, so a rebrief with no row would leave the last `self.briefing` in the
|
|
438
|
+
store describing a bundle nobody is reading any more — the log reporting a wake
|
|
439
|
+
that has been replaced. The reason keeps the two apart: the boundary's row is the
|
|
440
|
+
day's record, the rebrief's is the owner pulling the lever mid-day, and a reader
|
|
441
|
+
counting wake renders per day has to be able to tell them apart. A rebrief that
|
|
442
|
+
REFUSES for want of a ceiling renders nothing and writes nothing.
|
|
443
|
+
|
|
444
|
+
## 12. The self page: one row, two doors, and what it cost to stay out of sleep's way (2026-09-18)
|
|
445
|
+
|
|
446
|
+
The wake's "Who I am" printed a rotating list of about twenty identity elements,
|
|
447
|
+
re-ranked at every boundary, while the entity the store calls the self was a
|
|
448
|
+
`type: "schema"` row whose body was its own name. Owner rulings 8 and 9 of
|
|
449
|
+
2026-09-18 (`docs/plan-parallel-rebuild-2026-09-18.md` §2) replace the list with
|
|
450
|
+
a written page — prose, first person, the same every morning, kept with versions,
|
|
451
|
+
amendable by a woken session and by the owner.
|
|
452
|
+
|
|
453
|
+
**Where it lives, and why there.** One row: `type: "schema"`, `kind: "self"`,
|
|
454
|
+
`meta.role = "page"` — the identity core's shelf, one role along. The
|
|
455
|
+
alternatives were an `episode` (which is the journal's type, and would put the
|
|
456
|
+
page into `reconcileEpisodes`, the journal export and the chapter surfaces) or a
|
|
457
|
+
`memory` (which would put it into a briefing lane, to be ranked and trimmed as an
|
|
458
|
+
element, which is the thing it replaces). A schema row is neither, and it buys
|
|
459
|
+
three exemptions that already existed rather than three new ones:
|
|
460
|
+
|
|
461
|
+
- `dedup` skips every schema row by name (`sleep/types.ts#isSchemaRow`), so
|
|
462
|
+
nothing that resembles the page is ever merged into it;
|
|
463
|
+
- `prune` blocks on `protected` (`physics#pruneVerdict`), and the row is born
|
|
464
|
+
with it — the page is standing ink, which is what that flag has always meant;
|
|
465
|
+
- `scanActive` lists `{ type: "memory" }`, so the page can never enter a lane.
|
|
466
|
+
|
|
467
|
+
`decay` and `consolidate` do walk it, and that is fine: both write physics
|
|
468
|
+
columns and neither touches prose. `schemas/#toMetaRecord` returns null for any
|
|
469
|
+
role but entity, belief and current-state, so the page is skipped by that index
|
|
470
|
+
build rather than mis-filed in it. Proved by a test that runs seven cycles and a
|
|
471
|
+
prune over a store holding a page with two versions.
|
|
472
|
+
|
|
473
|
+
**What is NOT special-cased, on purpose.** Old page versions take the ordinary
|
|
474
|
+
90-day retention (owner ruling 1): `pruneSupersededVersions` deletes by
|
|
475
|
+
`version_day` alone and there is no exemption to make one for. The page's bytes
|
|
476
|
+
ARE weighed by the standing self-schema counter, like the identity core's — it is
|
|
477
|
+
`kind: self` prose that accumulates on the self, which is precisely what that
|
|
478
|
+
valve watches, and `PAGE_MAX_BYTES` bounds it at a fraction of the trip point.
|
|
479
|
+
|
|
480
|
+
**The switch, and why the default is the boring one.** What "Who I am" shows
|
|
481
|
+
while no page exists is the owner's choice and he has not made it. So
|
|
482
|
+
`PAGE_EMPTY_SHOWS_LIST` has two values and defaults to keeping the list: with no
|
|
483
|
+
page the wake renders byte for byte what it rendered before, day-0 line included.
|
|
484
|
+
Deploying the page therefore changes nothing in the owner's wake until somebody
|
|
485
|
+
writes one, and on a brand-new store the list is empty anyway. With the switch
|
|
486
|
+
off, the list goes and `PAGE_FORMING_LINE` stands in its place.
|
|
487
|
+
|
|
488
|
+
**The still-forming line is about the PAGE; the day-0 line is about IDENTITY.**
|
|
489
|
+
They are two sentences with two subjects and they must not be printed as one. A
|
|
490
|
+
store with twenty identity elements and no page has not failed to form an
|
|
491
|
+
identity; it has failed to write one down. Under the default switch that store
|
|
492
|
+
sees exactly what it always saw. PR #71's rule — a store that HAS identity never
|
|
493
|
+
says it does not — is untouched.
|
|
494
|
+
|
|
495
|
+
**Over the limit, twice.** `PAGE_WAKE_BYTES` (6,144, about 6 KB of the owner's
|
|
496
|
+
9,000-byte ceiling, clamped to the caller's budget so a page can never outgrow
|
|
497
|
+
the whole wake) cuts the RENDER at a paragraph or section boundary and adds a
|
|
498
|
+
marker naming the bytes shown, the bytes there are, and the command that reads it
|
|
499
|
+
whole. `PAGE_MAX_BYTES` (16,384) refuses the WRITE, and refuses rather than cuts,
|
|
500
|
+
because what gets cut at write time is the only copy. Between the two a write is
|
|
501
|
+
accepted and warned. When the page plus the furniture will not fit the caller's
|
|
502
|
+
ceiling at all, the floor publishes with `overBudget: true` — the tripwire that
|
|
503
|
+
has always existed for an under-floor ceiling, not a new one.
|
|
504
|
+
|
|
505
|
+
**Staleness is calendar days, not lived ones.** The lived clock has run seven
|
|
506
|
+
days across fifteen calendar ones on the owner's own store, so a lived window
|
|
507
|
+
would report a fortnight of silence as three days — the same reasoning
|
|
508
|
+
`adapters/fired.ts` states for its own window. The dateline prints the DATE and,
|
|
509
|
+
when stale, the number of days the tunable allows; it deliberately does not print
|
|
510
|
+
"N days ago", because the bundle is composed at one boundary and served unchanged
|
|
511
|
+
until the next.
|
|
512
|
+
|
|
513
|
+
**It renders on an `omit` composition too.** The fallback woken as the self (spec
|
|
514
|
+
§15 item 3) is the composition that most needs to know who it is writing as, and
|
|
515
|
+
`omit` stands aside protected and confidential MEMORIES — the page's `protected`
|
|
516
|
+
flag is the prune's vocabulary, not a confidentiality class. The day-0 line stays
|
|
517
|
+
suppressed there, for the reason the 2026-09-17 review gave.
|
|
518
|
+
|
|
519
|
+
**Two things the reader should know are true and slightly odd.** With a page
|
|
520
|
+
present the identity lane renders empty, so `self.briefing`'s `counts.identity`
|
|
521
|
+
is 0 and the `self.rendered.<id>` rotation stops advancing — both honest, and
|
|
522
|
+
both readable in the row. And `FRAMING.context`'s "each line opens with the date
|
|
523
|
+
it was learned" is a claim about the element lines; the day-0 line has carried no
|
|
524
|
+
date since it shipped, and the page carries its own date on its own line.
|
|
525
|
+
|
|
526
|
+
### 12a. What the default switch does NOT do, measured (2026-09-18)
|
|
527
|
+
|
|
528
|
+
S1's brief describes value (b) of `PAGE_EMPTY_SHOWS_LIST` two ways in one
|
|
529
|
+
paragraph: *"'still forming' followed by today's identity list as a fallback"*
|
|
530
|
+
and *"deploying this changes nothing in the owner's wake until a page exists"*.
|
|
531
|
+
Those are different renders, and only the second can be true of a store that has
|
|
532
|
+
identity. What is built is the second, plus this: the forming line prints on
|
|
533
|
+
value (a) alone, never above a list, and never on a lane that merely happens to
|
|
534
|
+
be empty.
|
|
535
|
+
|
|
536
|
+
The third reading — print it whenever the lane is empty, so a brand-new store
|
|
537
|
+
says the words verbatim — was built and then backed out, because it was measured
|
|
538
|
+
rather than argued: the line is FURNITURE, so it is untrimmable, and it adds ~127
|
|
539
|
+
bytes to the floor of every wake whose identity lane is empty. `test/claude-code`'s
|
|
540
|
+
host-budget case (a host reporting 400 bytes) then composed 539 and published
|
|
541
|
+
`overBudget`, which is scar §2.18's guarantee paying for a sentence. Two other
|
|
542
|
+
existing wake tests turned over with it, both asserting the older rule that a
|
|
543
|
+
lane with nothing in it renders no heading at all.
|
|
544
|
+
|
|
545
|
+
What a brand-new store says instead is the day-0 line, which has said the same
|
|
546
|
+
thing in this module's own words since it shipped: *"No identity has formed here
|
|
547
|
+
yet — identity is earned at the boundary that ends a session, from what recurs
|
|
548
|
+
across distinct days."* If the owner wants the page's own sentence verbatim on a
|
|
549
|
+
fresh store, the switch is one value away — which is what a switch with two
|
|
550
|
+
values and an unmade choice is for.
|
|
551
|
+
|
|
552
|
+
## 13. What the adversarial review of the page found, and what each fix cost (2026-09-18)
|
|
553
|
+
|
|
554
|
+
Two blockers, four majors. The two blockers were both in `self/`, both small,
|
|
555
|
+
and both the same mistake in different clothes: a number that looked like it
|
|
556
|
+
bounded something and did not.
|
|
557
|
+
|
|
558
|
+
**The cut threw away the room it had.** `cutAtBoundary` took the last blank line
|
|
559
|
+
in the window wherever it was. A page that opens `## Core\n\n` and then runs
|
|
560
|
+
without another blank line — a markdown bullet list, or one long paragraph, which
|
|
561
|
+
between them are most of what a model writes for "who I am" — has its only `\n\n`
|
|
562
|
+
at byte 7, so a 9,698-byte page rendered 110 bytes: a heading and a marker. The
|
|
563
|
+
write had been ACCEPTED, with a warning that said the wake would show a cut of it.
|
|
564
|
+
And because a page suppresses the identity list, the wake then carried no identity
|
|
565
|
+
at all — the silence failure scar §2.3 is about, reached through a door that said
|
|
566
|
+
everything was fine. The fix is a threshold: take a boundary only if it keeps more
|
|
567
|
+
than `BOUNDARY_KEEP_SHARE` (a quarter) of the room, else fall to the next finer
|
|
568
|
+
one, else cut bytes. A quarter and not a half on purpose — a page whose only break
|
|
569
|
+
sits at 2.5 KB of a 6 KB room should take that clean cut rather than fall through
|
|
570
|
+
to a mid-sentence one.
|
|
571
|
+
|
|
572
|
+
**The cap was measured against the wrong number.** The page was clamped to the
|
|
573
|
+
whole budget, so a long page filled the budget exactly and the header, the framing
|
|
574
|
+
line, the heading, the dateline and the sentinel pushed the composition past it —
|
|
575
|
+
with nothing to trim, because the identity lane is empty by then and the page is
|
|
576
|
+
furniture the trim loop cannot pop. An 8,657-byte page published `overBudget` at
|
|
577
|
+
400, 900, 2,000 and 6,000. This is the same measurement that kept the
|
|
578
|
+
still-forming line out of the default switch (§12a), and the review's sharpest
|
|
579
|
+
observation is that the argument had been accepted against a 127-byte sentence
|
|
580
|
+
and not applied to a 6 KB block. `PAGE_FLOOR_RESERVE_BYTES` (512, against a
|
|
581
|
+
measured widest of 444) is subtracted first, and two floors sit under it: below
|
|
582
|
+
`PAGE_MIN_RENDER_BYTES` the wake says the page exists and does not fit in one
|
|
583
|
+
line, and below the furniture itself it says nothing at all, because a ceiling
|
|
584
|
+
that small has no room for prose about prose and the over-budget tripwire should
|
|
585
|
+
be left for a host that really is misconfigured.
|
|
586
|
+
|
|
587
|
+
**`protected` meant two things and the comment said one.** The page is born
|
|
588
|
+
`protected` so the floor prune cannot take it; `sweepFallback` filters on exactly
|
|
589
|
+
that flag to decide what leaves the machine, and its own comment said "nothing
|
|
590
|
+
protected or confidential" — which this page made false. The flag is the prune's
|
|
591
|
+
vocabulary and does not settle egress by itself, but it is close enough that the
|
|
592
|
+
answer has to be written down: `PAGE_ON_EGRESS`, default true (the owner's
|
|
593
|
+
decision of 2026-09-17), with the comment and the contract corrected to say what
|
|
594
|
+
goes out and why. **Nothing marks a page confidential.** There is one page; the
|
|
595
|
+
switch is the decision.
|
|
596
|
+
|
|
597
|
+
**Removal was the only way out, and it was a loaded gun.** `revisePage("")`
|
|
598
|
+
refuses, the dashboard is read-only, and the page is the most conspicuous schema
|
|
599
|
+
row an owner has — `enumerate()` lists it and `status` prints its id. So the one
|
|
600
|
+
affordance for "stop leading my wake with this" was `counterparts remove <id>`,
|
|
601
|
+
which tombstones the row and leaves `Schemas.load` reading a blank `prose_path`:
|
|
602
|
+
a store that will not open, with the wake hook swallowing the error so the symptom
|
|
603
|
+
is silence. (Pre-existing — the identity core has had it since it shipped — and
|
|
604
|
+
the `schemas/` skip is its own PR.) The door this needed is `--clear`, and the
|
|
605
|
+
shape of it is the interesting part: the body becomes a VERSION and the row is
|
|
606
|
+
ARCHIVED, so "no page" is a state every reader already understands
|
|
607
|
+
(`findSelfPage` lists live rows) and nothing is destroyed. Blanking the body was
|
|
608
|
+
the alternative and it is worse — a live page whose text is a placeholder is the
|
|
609
|
+
"empty is a valid state" failure the bootstrap line exists to avoid.
|
|
610
|
+
|
|
611
|
+
**The version log named the wrong write.** `store.revise` records the REPLACING
|
|
612
|
+
write's reason on the row it archives, so version 1 — the first page — was
|
|
613
|
+
labelled with the second write's words, while the current page's own
|
|
614
|
+
`Last change:` line read the row's meta and was right. One word meaning opposite
|
|
615
|
+
things on two surfaces. The durable rows carry what is wanted, and the arithmetic
|
|
616
|
+
is exact: the write that produced version `seq` is the one whose row says
|
|
617
|
+
`version: seq - 1`, because a revision archives the body that was standing and
|
|
618
|
+
numbers it with the revision it is making. The store is untouched; only the
|
|
619
|
+
presentation changed, with `replacedBy` keeping the store's value under its true
|
|
620
|
+
name.
|
|
621
|
+
|
|
622
|
+
**Two writers, last one wins, both told it worked.** Not data loss — every lost
|
|
623
|
+
body is a version — but silent reversion of the page every session reads, which
|
|
624
|
+
is the same felt outcome and harder to notice. `ifVersion` is optional on purpose:
|
|
625
|
+
passed, a write that crossed with another is refused and handed the current page
|
|
626
|
+
to merge; omitted, nothing changes. That is a courtesy between writers rather than
|
|
627
|
+
a lock, which is what keeps it inside the owner's "no safeguards up front".
|
|
628
|
+
|
|
629
|
+
**And the page could be promoted.** `consolidate.ts` had no `isSchemaRow` guard
|
|
630
|
+
where `dedup.ts` has had one since it shipped, so forty cycles over a page
|
|
631
|
+
carrying the physics repeated recall credit leaves produced `promoted_identity`,
|
|
632
|
+
`band identity` and a `band.promoted` crossing record — on a row no lane can ever
|
|
633
|
+
rank. The wake was unaffected; the telemetry was not, and the promotion
|
|
634
|
+
diagnostics counted it. One line, mirroring dedup's, and it covers the identity
|
|
635
|
+
core too. Excluding the page from recall — which the coordinator decided, and
|
|
636
|
+
which is right on its own terms, since the page is already delivered whole every
|
|
637
|
+
morning — closes the credit path that made it reachable. Both are one line to
|
|
638
|
+
reverse.
|
|
639
|
+
|
|
640
|
+
### 13a. Three things the second pass narrowed or fixed (2026-09-18)
|
|
641
|
+
|
|
642
|
+
**The promotion guard is the promotion ARM, not the phase.** The first cut
|
|
643
|
+
skipped schema rows from `consolidate` whole, mirroring `dedup`. That also stops
|
|
644
|
+
a belief being CONSOLIDATED — `+CONS_BONUS` on `base` — which changes the
|
|
645
|
+
strength trajectory of every belief on the owner's live store from the first
|
|
646
|
+
cycle after deploy, for a fix about a telemetry row. Only the crossing is
|
|
647
|
+
withheld now: a belief consolidates exactly as it always has and simply never
|
|
648
|
+
crosses, which is the whole of what "this row entered the identity band" should
|
|
649
|
+
never say about a standing claim.
|
|
650
|
+
|
|
651
|
+
**A cleared page is found by its own durable row, not by id order.** Clear →
|
|
652
|
+
restore → clear leaves TWO archived page-role rows and no live one, and
|
|
653
|
+
`store.list` is `ORDER BY id` over hashed ids — so the version log would have
|
|
654
|
+
read whichever sorted first, and the `--restore <seq>` pointer the clear had just
|
|
655
|
+
printed would have been resolved against the wrong row. `pageRowId` reads the
|
|
656
|
+
newest `self.page.revised` row carrying `cleared: true` and takes its `ref`.
|
|
657
|
+
|
|
658
|
+
**What clear/restore does NOT carry, said out loud.** The history of a cleared
|
|
659
|
+
page is reachable for as long as it is the last thing cleared. Write a NEW page
|
|
660
|
+
and the live row wins: the older cleared page's versions sit on an archived row
|
|
661
|
+
no console door reaches. That is an acceptable limit for now — nothing is
|
|
662
|
+
destroyed, and the row is still in the store for anyone who goes looking — and
|
|
663
|
+
the two messages that offer `--restore` say "until a new page is written" rather
|
|
664
|
+
than promising more than they can keep.
|
|
665
|
+
|
|
666
|
+
## 14. One row for the life of the page, and a guard that fits the finding (2026-09-18, second review)
|
|
667
|
+
|
|
668
|
+
**The undo closed behind the owner.** `--clear` archived the row; `revisePage`
|
|
669
|
+
looks for a LIVE page; so the `--restore <seq>` the clear message itself
|
|
670
|
+
recommends minted a fresh row, and four versions with full attribution sat on a
|
|
671
|
+
row no surface could reach. Proved through the real console: `--versions` listing
|
|
672
|
+
four, then `--restore 4`, then `--versions` answering "No earlier versions". The
|
|
673
|
+
mechanism built to answer "the owner can see and undo a bad write" destroyed
|
|
674
|
+
access to exactly what it was protecting, on its main path.
|
|
675
|
+
|
|
676
|
+
**The shape that fixes it is one row for the life of the page.** A clear is an
|
|
677
|
+
ordinary REVISION — so the body it replaces becomes an ordinary version,
|
|
678
|
+
attributed like any other — to a fixed cleared-body line, with `meta.cleared`
|
|
679
|
+
set. The row stays live and keeps its whole chain. `readSelfPage` returns null
|
|
680
|
+
for a cleared row, so every reader sees a store with no page and the wake goes
|
|
681
|
+
back to its empty-page behaviour; the next write or restore revises the SAME row
|
|
682
|
+
and drops the flag. Two properties fall out and both are asserted: there is never
|
|
683
|
+
a second page row, live or archived, however often it is cleared; and nothing
|
|
684
|
+
needs the event log to find the page or its history. The named limit from the
|
|
685
|
+
first attempt — an older cleared page's versions unreachable once a new page is
|
|
686
|
+
written — does not exist any more, because there is no older row. So does
|
|
687
|
+
MINOR-E: the cleared-page lookup no longer depends on rows sleep prunes at 90
|
|
688
|
+
days, and there is no arbitrary id-ordered fallback to pick the wrong page with.
|
|
689
|
+
|
|
690
|
+
The reviewer's own preferred fix was a `Store.unarchive`. This gets the same
|
|
691
|
+
result without a new store verb, which matters while the floor (F5) is being
|
|
692
|
+
rebuilt underneath.
|
|
693
|
+
|
|
694
|
+
**And a guard that fits the finding.** The promotion guard was schema rows
|
|
695
|
+
generally. `physics#decay` returns 1 for a promoted row, so withholding the
|
|
696
|
+
crossing from beliefs, current-states and entities stops them becoming
|
|
697
|
+
decay-exempt — a retention change for three row classes across the owner's whole
|
|
698
|
+
store, inside a PR about one page. Measured, master against the branch, identical
|
|
699
|
+
fixtures, 40 cycles:
|
|
700
|
+
|
|
701
|
+
```
|
|
702
|
+
master first attempt
|
|
703
|
+
memory band identity, promoted 1 identical
|
|
704
|
+
belief band identity, promoted 1 band semantic, promoted 0
|
|
705
|
+
current-state band identity, promoted 1 band semantic, promoted 0
|
|
706
|
+
entity band identity, promoted 1 band semantic, promoted 0
|
|
707
|
+
page band identity, promoted 1 band semantic, promoted 0
|
|
708
|
+
band.promoted events: 5 1
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
The guard is now the PAGE, by role, and the same measurement over the fix leaves
|
|
712
|
+
one line different: the page, and `band.promoted` 5 → 4. Whether a belief should
|
|
713
|
+
cross into the identity band at all is a real question — it is odd, and
|
|
714
|
+
`enumerate()` has no type filter, so beliefs that crossed appear in `status`'s
|
|
715
|
+
identity list — but it has a one-query answer against the live store that nobody
|
|
716
|
+
has, and it is not this change's to take.
|
|
717
|
+
|
|
718
|
+
The identity core is deliberately NOT exempted: it could cross on master, and
|
|
719
|
+
exempting it would be the same quiet retention change one row smaller.
|
|
720
|
+
|
|
721
|
+
## 15. The nightly page writer: how the day is chosen, why the claim is a row, and the one thing it refuses to claim to know (2026-09-20, S2)
|
|
722
|
+
|
|
723
|
+
S1 put a written page at the head of every wake and left nothing to fill it. On the
|
|
724
|
+
owner's live store that was survivable — a session that happens to think of it can write
|
|
725
|
+
one — but on a store a stranger installed this morning it means the page never forms at
|
|
726
|
+
all. So S2 is the mechanism, and these are the four choices it turned on.
|
|
727
|
+
|
|
728
|
+
**The day is a CALENDAR date, and it is always yesterday.** The lived day was the obvious
|
|
729
|
+
candidate and is wrong here for the reason `episodes.ts` already gives about the ask cap
|
|
730
|
+
(I32): `livedDay` advances inside `advanceClock`, which runs inside the sleep cycle, which
|
|
731
|
+
runs inside the detached worker. A worker that cannot start freezes that clock — it did,
|
|
732
|
+
for seven days — while the calendar keeps going. A nightly mechanism keyed to a clock the
|
|
733
|
+
night itself advances can miss every night and still look on time. The row carries both:
|
|
734
|
+
`about`, the calendar date it read, and `day`, the lived day it ran on, which is what every
|
|
735
|
+
other durable row in this store is stamped with.
|
|
736
|
+
|
|
737
|
+
It does not chase a backlog, and that is a decision rather than an omission. A machine that
|
|
738
|
+
was off for a week comes back and writes about the day just gone. Six model calls and six
|
|
739
|
+
revisions of one page in one morning is how a page starts drifting, and the memories of
|
|
740
|
+
those days are still in the store and still reach the page through the ordinary lanes.
|
|
741
|
+
|
|
742
|
+
**The claim is a durable row, not a lock file.** The obvious shape was `spawn.ts`'s: a file
|
|
743
|
+
opened `wx`, a pid, a staleness window. The row is better here for two reasons the file
|
|
744
|
+
cannot match. It is *the same object the fired view and doctor already read*, so "did last
|
|
745
|
+
night happen" is answered by the mechanism's own record rather than by a second artefact
|
|
746
|
+
nobody looks at; and it works across machines, because two laptops sharing a store over a
|
|
747
|
+
sync folder share the row and would not share a pid. What the row gives up is atomicity in
|
|
748
|
+
the last few milliseconds: two hooks that both read "no claim" in the same tick can both
|
|
749
|
+
write one. That is why the allowance is a count rather than a boolean — a duplicate ask is
|
|
750
|
+
already inside the budget, and the second writer's `ifVersion` refuses cleanly with a row
|
|
751
|
+
saying so.
|
|
752
|
+
|
|
753
|
+
**Two asks per day, and it is not a second pacer.** The scar this module carries about
|
|
754
|
+
pacers (CONTRACT §3) is precise: it is about the BLOCKED MOMENT at Stop, where two asks on
|
|
755
|
+
two substance pacers drew about a dozen asks from a 13-turn evening. Nothing here goes near
|
|
756
|
+
it — the writer's ask fires at SessionStart, consults no substance, spends none of
|
|
757
|
+
`MAX_ASKS_PER_SESSION`, and rides in the same field the first-launch scope question uses.
|
|
758
|
+
Its cadence is the day boundary. The count exists because one ask per day is brittle in
|
|
759
|
+
practice: the first session of a morning is often deep in something else, and a night lost
|
|
760
|
+
to that is a day missing from the page forever. Two was chosen over three because the
|
|
761
|
+
whole design of the doctor line is that a mechanism must not nag, and the same is true of
|
|
762
|
+
the ask itself.
|
|
763
|
+
|
|
764
|
+
**The one thing it refuses to claim.** "Nothing to say" had to be a first-class outcome —
|
|
765
|
+
a day that changed nothing about who the self is should end with no revision, and that must
|
|
766
|
+
be recorded rather than inferred from silence. Host mode can report it honestly: a
|
|
767
|
+
windowless session handed one instruction and one tool, which exits clean without calling
|
|
768
|
+
the tool, has answered. Session mode cannot. A session that was asked and wrote nothing may
|
|
769
|
+
have decided there was nothing to say, or may have been three hours into a refactor and
|
|
770
|
+
never read the block. Storing `nothing-to-say` there would be the engine putting words in
|
|
771
|
+
the writer's mouth, which is §2.4 from the other direction. So session mode stores the
|
|
772
|
+
claim, and `pageWriterStatus` READS a claim whose day has ended as `nothing-to-say` with
|
|
773
|
+
`derived: true` — and every surface that prints it prints that it was derived. The claim
|
|
774
|
+
carries the date it was MADE (`on`) as well as the date it is about, because "is this still
|
|
775
|
+
in flight" is a question about the first and not the second.
|
|
776
|
+
|
|
777
|
+
**What is still unproved, and it is host mode's half.** Nothing in this build has started a
|
|
778
|
+
real `claude -p`. The launcher, its argument and environment shape, its watchdog and its
|
|
779
|
+
claim are all exercised against a stub executable; what a real machine has to answer is
|
|
780
|
+
whether a background process can reach the keychain for the subscription login
|
|
781
|
+
(`claude setup-token` is the documented route — spec §16). Until somebody runs it, `session`
|
|
782
|
+
is the mode that is actually known to work, which is why it is the default.
|
|
783
|
+
|
|
784
|
+
## 16. Two things the first build of the writer got wrong, both invisible to its own tests (2026-09-20, review of S2)
|
|
785
|
+
|
|
786
|
+
Both were found by asking what the mechanism does on a REAL store rather than on a
|
|
787
|
+
fixture, and both would have made session mode — the default — quietly not work.
|
|
788
|
+
|
|
789
|
+
**The block repeated the page, so on any store a few days old the ask was deferred every
|
|
790
|
+
morning and nothing durable said so.** The first version handed the writer the page body
|
|
791
|
+
followed by up to 8 KB of the day's memories, and then checked whether the total fitted
|
|
792
|
+
beside the wake under the host's ceiling. On the fixture — a 60-byte page and one memory —
|
|
793
|
+
it always fitted. On a store with a 4 KB page and a productive day behind it, against the
|
|
794
|
+
9 KB ceiling this host reports, it never does: the wake has already spent most of the
|
|
795
|
+
ceiling, and the page is in the wake, so the block was re-sending the single biggest thing
|
|
796
|
+
the reader already had. The deferral was correct behaviour (never truncate, never smuggle
|
|
797
|
+
past the ceiling) and its only trace was a ring event that dies with the hook process,
|
|
798
|
+
which is I32's shape exactly: a mechanism refused every time with no row anyone can read.
|
|
799
|
+
|
|
800
|
+
Two fixes, and the second is the one that generalises. The block now POINTS at the page
|
|
801
|
+
(version, bytes, last revised, "it is at the head of your wake, call the tool with no
|
|
802
|
+
arguments to read it whole") instead of repeating it — which is also just true, in both
|
|
803
|
+
modes, since host mode's whole reason for existing is that the child runs the ordinary
|
|
804
|
+
SessionStart hook. And the day is sized to the room that is actually left: the empty block
|
|
805
|
+
is measured first, with the same function that composes the full one so the two cannot
|
|
806
|
+
drift, and the memories get the remainder. A day that does not all fit is delivered SHORT
|
|
807
|
+
with the count on the run's row, rather than the whole ask being dropped.
|
|
808
|
+
|
|
809
|
+
The third fix is the diagnostic, because the first two do not make deferral impossible:
|
|
810
|
+
doctor's line now reads `pageWriterDue` itself and goes amber when a night has been owed
|
|
811
|
+
for more than two days with nothing delivered. A deferral still leaves no durable row —
|
|
812
|
+
nothing claimed is the correct behaviour — so the only honest way to see it is to notice
|
|
813
|
+
that the night is still owed.
|
|
814
|
+
|
|
815
|
+
**`by: "writer"` could never fire in session mode, because the real MCP server is
|
|
816
|
+
unbound.** The server is launched from a static host configuration and never learns which
|
|
817
|
+
session it serves; it binds lazily, on the first tool call that carries an id
|
|
818
|
+
(`requireBoundSession`). A session answering the page-writer ask right after its wake has
|
|
819
|
+
called nothing else, so `this.session` was null, so the registry mark was never read, so
|
|
820
|
+
every night's revision was filed as an ordinary amendment and the night then read as
|
|
821
|
+
`nothing-to-say`. The inverse of the honesty the outcome exists for, and the test passed
|
|
822
|
+
because `openServer({ session })` sets the id at launch, which production does not do.
|
|
823
|
+
|
|
824
|
+
The ask now names the session id and the tool takes an optional `session`, the way the Stop
|
|
825
|
+
ask and `chapter` already do. It is honoured NON-FATALLY: `requireBoundSession` is reused
|
|
826
|
+
so there is one definition of corroboration, and its refusal value is discarded. A page
|
|
827
|
+
amendment has never needed a session and must not start being refused for lack of one; what
|
|
828
|
+
a bad claim costs is the `writer` label, and the ring says why.
|
|
829
|
+
|
|
830
|
+
## 17. What the adversarial review found, and the one thing that could not be fixed (2026-09-20, review of S2)
|
|
831
|
+
|
|
832
|
+
Five MAJORs, none a blocker, and every one of them a case where the mechanism was honest
|
|
833
|
+
about something that was not true. They are worth keeping together because they share a
|
|
834
|
+
shape: **the fixture was smaller than the world.** A 60-byte page and one memory fits any
|
|
835
|
+
budget, dies on any signal, and has no second day; the defects lived in the gap between
|
|
836
|
+
that and a real store.
|
|
837
|
+
|
|
838
|
+
**The block told the writer the day was empty.** `dayMemories` stopped at the first memory
|
|
839
|
+
that would not fit, so any room smaller than the LARGEST memory's cost dropped every one of
|
|
840
|
+
them — and `writerInstruction`, handed an empty list, said "Nothing was written down on
|
|
841
|
+
<date>". The reviewer reproduced it across a 260-byte band of ordinary budgets on a 3 KB
|
|
842
|
+
page and a 20-memory day. The next morning that reads as a derived `nothing-to-say`, and the
|
|
843
|
+
narrator says "nothing about who I am moved that day" about a day with twenty things in it.
|
|
844
|
+
Three fixes, because one was not enough: the loop fills past a miss instead of stopping;
|
|
845
|
+
the empty branch distinguishes "the day was empty" from "I could not see the day" using
|
|
846
|
+
`dropped`, which was in scope and discarded; and a block that can carry NONE of the day
|
|
847
|
+
defers rather than spending one of the night's two asks on a sentence.
|
|
848
|
+
|
|
849
|
+
**A memory could close the block it was quoted in.** `flattenLine` collapsed whitespace and
|
|
850
|
+
nothing else, and the framing sentence sat at the top of the block while the untrusted
|
|
851
|
+
material sat at the bottom. A memory is exactly what the sweep proposes from a transcript,
|
|
852
|
+
so this was a first-class injection into the one prompt that revises the identity page. The
|
|
853
|
+
markers go now — this block's and the wake's, which `page.ts` already refuses on the way IN
|
|
854
|
+
— and the sentence that says the list is material moved down to sit beside it. The general
|
|
855
|
+
lesson, which is not new: framing is positional, and a warning above content the reader has
|
|
856
|
+
not met yet is a warning about nothing.
|
|
857
|
+
|
|
858
|
+
**A child that ignores SIGTERM hung the worker.** Both alarms signalled and neither
|
|
859
|
+
resolved, and the promise resolved only on `close`, so a trapping child kept the worker
|
|
860
|
+
inside its `finally` holding the store open — measured at 25 seconds against a 3-second
|
|
861
|
+
child watchdog. The fix is the ordinary escalation nobody wrote the first time: SIGTERM,
|
|
862
|
+
grace, SIGKILL to the process group, and then a reap timer that resolves the promise whether
|
|
863
|
+
or not the OS ever confirms. The child is `detached` now solely so there is a group to kill.
|
|
864
|
+
|
|
865
|
+
**`no-memories` was declared and never returned.** `hasDayBefore` asks whether the store
|
|
866
|
+
holds anything older than today, which is true for ever after the first memory, so a machine
|
|
867
|
+
used twice a week was asked every single morning about five empty days. The dead enum member
|
|
868
|
+
was the evidence that the first build meant to prevent exactly this.
|
|
869
|
+
|
|
870
|
+
**One typo turned memory off.** The `pageWriter` block was strict on the argument that
|
|
871
|
+
`host` starts a process — and the argument does not survive contact with the code, because
|
|
872
|
+
`mode` is an exact-string allowlist and a typo can only ever resolve to the fallback.
|
|
873
|
+
Strictness bought nothing and cost the owner his store's memory for a misspelling in an
|
|
874
|
+
optional block, which is the failure the F2 ruling moved `snapshots` out of strictness to
|
|
875
|
+
avoid. It is lenient now, with the fallback PINNED to `session` — the one protection
|
|
876
|
+
strictness was really offering, kept — and a doctor amber naming the key and the value.
|
|
877
|
+
|
|
878
|
+
**And the one that could not be fixed, only told the truth about.** The docstring and the
|
|
879
|
+
CONTRACT both said the day arrives "newest and most salient first". There is no newest:
|
|
880
|
+
inside one calendar day `learned_on` is a date, `birth_day` is the lived day, and `newId` is
|
|
881
|
+
six random bytes, so every row of a day ties on every clock the store has. The reviewer
|
|
882
|
+
offered two options — tie-break on rowid, or delete the word — and the first is not
|
|
883
|
+
available from the `Store` API. So the word is gone, from the code, the block and the
|
|
884
|
+
contract, and what is asserted instead is the property that is real: the cut is
|
|
885
|
+
deterministic, which is what §1 G3 asks for. A tie-break on insertion order would need
|
|
886
|
+
`store/` to expose one, and that is a real ask rather than a fix to make here.
|
|
887
|
+
|
|
888
|
+
## 18. What the floor (F5) changed underneath the writer, measured rather than assumed (2026-09-20)
|
|
889
|
+
|
|
890
|
+
Merged `origin/master` at `3f6a6eb` — bodies, versions and the journal are rows in
|
|
891
|
+
`counterparts.sqlite` now. The merge was clean; one test needed rewriting, because it was
|
|
892
|
+
the one place in this file that still knew a body was a file. Three interactions were
|
|
893
|
+
checked by running them, and all three came out needing no change to the mechanism:
|
|
894
|
+
|
|
895
|
+
**A body the new floor refuses never reaches it.** `put`/`revise` now refuse whitespace-only
|
|
896
|
+
and NUL-only bodies (`store/prose.ts#bodyForStorage`) and a throw out of `revisePage` would
|
|
897
|
+
break the one guarantee this path makes — every call returns a reason and leaves a row.
|
|
898
|
+
Measured: `""` is refused `empty` by `self/`'s own check, and `" "` and `"\0\0\0"` are
|
|
899
|
+
both refused `gate-refused (content-empty)` by the battery, which sits in front of the
|
|
900
|
+
store. The store never sees any of them.
|
|
901
|
+
|
|
902
|
+
**A FAULTED page row does not reach the writer, because it does not reach anything.** F5's
|
|
903
|
+
fault state — `body = ''` with the content hash still naming the words that were there — is
|
|
904
|
+
raised by `Schemas.load`, which reads every schema row at open. Measured: `Counterpart.open`
|
|
905
|
+
throws, so the session stands down and doctor reads RED naming the id. There is no wake for
|
|
906
|
+
the writer to fail and no boundary for it to break. That is the S1 review's MAJOR-1 carried
|
|
907
|
+
onto the new floor, and it is still `schemas/`'s to answer rather than this mechanism's.
|
|
908
|
+
|
|
909
|
+
**A TOMBSTONED page row cannot be made.** `planRemoval` refuses the page row by name
|
|
910
|
+
(`is-the-self-page`, S1) and the destruction seam under it refuses an id with no dark
|
|
911
|
+
removal record first — measured, `chaseRemoved` throws `REMOVAL_NOT_DARK`. So the state
|
|
912
|
+
`Schemas.load` skips is unreachable for this row, which is why the writer carries no special
|
|
913
|
+
case for it. **If either of those doors ever opens**, the hazard to look at first is that
|
|
914
|
+
`findPageRow` skips a row whose body will not read, so `revisePage` would mint a SECOND page
|
|
915
|
+
row beside the damaged one and break S1's one-row invariant. It is filed rather than guarded
|
|
916
|
+
because today nothing can get there, and a guard against an unreachable state is a guard
|
|
917
|
+
nobody can test.
|
|
918
|
+
|
|
919
|
+
## 19. The writer beside E2, and why it declares no refusal channel (2026-09-20)
|
|
920
|
+
|
|
921
|
+
Merged `origin/master` at `d60db90` (E2 — the "what was prevented" rows). One semantic
|
|
922
|
+
conflict git could not see, and three interactions checked by running them.
|
|
923
|
+
|
|
924
|
+
**The conflict: two `daysBetween`.** E2 put one in `fired.ts` and imports it into
|
|
925
|
+
`doctor.ts`; S2 had landed a local copy of the same four lines for the page writer's
|
|
926
|
+
staleness reading, and the merge put them side by side. Resolved by deleting the local one
|
|
927
|
+
— one definition, shared with the fired view, which is the rule this module already keeps
|
|
928
|
+
for every other reading the two surfaces share. The one behavioural difference is kept and
|
|
929
|
+
named: the shared one returns a NEGATIVE when a clock has moved backwards where the local
|
|
930
|
+
one clamped to zero, and the comparison it feeds uses `>`, so a future date reads "not
|
|
931
|
+
overdue" rather than "today".
|
|
932
|
+
|
|
933
|
+
**E2's young rule and this mechanism's doctor line agree, by different roads.** E2 grades a
|
|
934
|
+
store too new when it is under two LIVED days and has no durable row older than two
|
|
935
|
+
CALENDAR days — both clocks, because a store whose worker has been dead a fortnight also
|
|
936
|
+
reads lived day 0 and that store needs the full list. The page writer's own line has been
|
|
937
|
+
green-when-never-run-on-a-store-with-no-yesterday since S2 shipped, which is the same answer
|
|
938
|
+
read off whether a day before today holds anything. Measured: on a fresh store both say
|
|
939
|
+
young, and the roll-call comes back on its own after two `advanceClock` calls.
|
|
940
|
+
|
|
941
|
+
**And it declares no refusal channel, which is the honest answer rather than an empty one.**
|
|
942
|
+
`RefusalSource.only` exists because reading a namespace wholesale made a healthy store
|
|
943
|
+
report `BLOCKED prune … dwell-too-short ×240` permanently — the test it sets is whether a
|
|
944
|
+
NAMED RULE turned away a candidate that otherwise qualified, the owner saying no, rather
|
|
945
|
+
than arithmetic saying not yet. Nearly every skip here is the second kind, and one of them
|
|
946
|
+
is worse than that: after the night's first ask, `already-claimed` is what a perfectly
|
|
947
|
+
healthy store says at every session start until midnight. Declaring these would rebuild the
|
|
948
|
+
false alarm one namespace over.
|
|
949
|
+
|
|
950
|
+
The one that is arguably a real gate is `no-room` — the host's ceiling turning away a block
|
|
951
|
+
that qualified. It is left out anyway, because it already has a louder and better-aimed
|
|
952
|
+
surface: doctor's Page writer line goes amber after two owed days and names
|
|
953
|
+
`injectionBudgetBytes` in the fix. Two surfaces for one fact, one of them permanent on any
|
|
954
|
+
store with a tight ceiling, is the shape the review was about.
|
|
955
|
+
|
|
956
|
+
## 20. The page is not embedded — a working default, not a ruling (2026-09-20, landed with E1)
|
|
957
|
+
|
|
958
|
+
E1's adversarial review asked whether the self page was in the same position as the
|
|
959
|
+
per-directory handoff, which E1 had just excluded from embedding. It was: `missingVectors()`
|
|
960
|
+
held it, and with a sync embedder wired — which the live adapter does — `indexOne` embedded
|
|
961
|
+
it at every `revise`. E1 flagged it rather than fixing it, correctly: a one-line predicate in
|
|
962
|
+
`store/` is not the place to set this module's policy.
|
|
963
|
+
|
|
964
|
+
**Who decided, said exactly.** The COORDINATING SESSION asked for the exclusion the same
|
|
965
|
+
day, and it landed with E1's PR. **The owner has not ruled on it.** A coordinator's ask is
|
|
966
|
+
never his word, and nothing here is recorded as a ruling that was not one — this is a
|
|
967
|
+
working default in the ordinary sense (CLAUDE.md: decisions are defaults, revisable without
|
|
968
|
+
ceremony), and one line in `store/#noVector` reverses it. It is worth putting to him if the
|
|
969
|
+
page is ever wanted searchable by meaning, because all three reasons below stop being true
|
|
970
|
+
at once in that case.
|
|
971
|
+
|
|
972
|
+
The three reasons it was asked for, recorded here because they are about the PAGE and not
|
|
973
|
+
about the seam:
|
|
974
|
+
|
|
975
|
+
1. **A vector buys the page nothing.** `recall/activate.ts#isSelfPage` skips it — the page
|
|
976
|
+
is delivered whole at every wake and never surfaces in a turn — so nothing the semantic
|
|
977
|
+
channel ranks could ever deliver it.
|
|
978
|
+
2. **It is the most identity-bearing prose in the store**, up to `PAGE_MAX_BYTES` of it, and
|
|
979
|
+
embedding sends it to an API for that nothing. Constitution 6: data leaves the machine by
|
|
980
|
+
the owner's explicit choice, and an indexer that indexes everything is not one.
|
|
981
|
+
3. **It floors the embed backlog.** `unembeddedCount()` is the number `doctor` and the
|
|
982
|
+
parallel run watch, and its job is to say what is actionable; on a keyless store a page
|
|
983
|
+
in it never falls out.
|
|
984
|
+
|
|
985
|
+
The rule is `store/#noVector`, which names `role: "page"` and `role: "handoff"`. The page's
|
|
986
|
+
row keeps its LEXICAL index, so the dashboard's search and the console's `remove` flow still
|
|
987
|
+
find it — neither is a recall path. Nothing retracts a vector a page already has; the one
|
|
988
|
+
door is `counterparts verify --rebuild`, and the measurement is in
|
|
989
|
+
`core/handoff/INTERFACE-GAPS.md` §7. The owner's live store has never had a page written, so
|
|
990
|
+
nothing has been embedded there.
|
|
991
|
+
## 21. The journal's markdown copy: what the build chose, and what the plan got wrong (2026-09-20, F6)
|
|
992
|
+
|
|
993
|
+
`docs/plan-step3-the-floor-2026-09-17.md` §1.5 designed this module before the
|
|
994
|
+
floor existed. Four of its choices survived contact with the code and three did
|
|
995
|
+
not; all seven are here so the next reader does not have to diff them.
|
|
996
|
+
|
|
997
|
+
**Kept from the plan.** A new module called from the chapter door immediately
|
|
998
|
+
after the store write; `journal/<YYYY>/<YYYY-MM-DD>-<episodeId>.md`; whole-file
|
|
999
|
+
rewrite per append; the observer writes nothing; a failure is caught and becomes
|
|
1000
|
+
a `journal.copy.failed` row rather than an exception.
|
|
1001
|
+
|
|
1002
|
+
**Changed, with the reason.**
|
|
1003
|
+
|
|
1004
|
+
1. **One function, not a writer and a deleter.** The plan had a writer; removal
|
|
1005
|
+
needed a deleter; two functions would have expressed one invariant twice.
|
|
1006
|
+
`syncJournalCopy(store, id)` asks the invariant instead — *a file exists
|
|
1007
|
+
exactly when a live episode row does, and holds exactly what that row holds* —
|
|
1008
|
+
so the chapter door's rewrite and the destruction console's removal are the
|
|
1009
|
+
same call, and the thing the tests assert is the sentence rather than two
|
|
1010
|
+
implementations of it.
|
|
1011
|
+
2. **Per append, not per session end.** The plan's §7.6 recorded this as
|
|
1012
|
+
undetermined. The code answers it: the episode row is revised on every append
|
|
1013
|
+
(`episodes.ts#appendChapter`), so the file is a whole-file rewrite either way
|
|
1014
|
+
and per-append costs nothing extra while per-session-end loses a crashed
|
|
1015
|
+
session's last chapter.
|
|
1016
|
+
3. **No doctor count over seven days.** The plan wanted one; the brief wanted a
|
|
1017
|
+
line only while a failure stands, and the brief is right for the reason
|
|
1018
|
+
`snapshotFindings` states about permanently amber lines. A derived copy that
|
|
1019
|
+
refills itself has no interesting count. `journalCopyFindings` returns **no
|
|
1020
|
+
finding at all** in the ordinary case.
|
|
1021
|
+
|
|
1022
|
+
**Two things the plan did not think about, and the reviews did.**
|
|
1023
|
+
|
|
1024
|
+
4. **The temp file is a residue surface.** A crashed rename leaves
|
|
1025
|
+
`<final>.md.tmp-<rand>` holding a chapter's words, `journal/` is in the backup
|
|
1026
|
+
set at the time, and so a leak would ride into every snapshot. (That flag is
|
|
1027
|
+
`false` since the f6f7 review — §16 — which removes the snapshot half of the
|
|
1028
|
+
argument and leaves the other half standing: a crashed rename otherwise
|
|
1029
|
+
leaves a chapter's words in a file nothing owns, inside the store, for ever.)
|
|
1030
|
+
Hence one filename matcher
|
|
1031
|
+
that finds the final name, an older date's name and a crashed temp
|
|
1032
|
+
(`journalFileEpisodeId`), and a sweep bounded by mtime — bounded for exactly
|
|
1033
|
+
the reason `cli/export.ts`'s temp sweep is: an unbounded one would take a
|
|
1034
|
+
concurrent writer's file between its write and its rename.
|
|
1035
|
+
5. **The backfill is bounded twice, and it does not run where the first draft of
|
|
1036
|
+
this note said it did.** `Self.boundary` is the consolidation cycle's last
|
|
1037
|
+
content write (through `core/briefing.ts#selfRenderer`, SEAMS G), so the
|
|
1038
|
+
backfill runs in the **detached worker**, not in the session's Stop hook —
|
|
1039
|
+
that calls `Counterpart.boundary`, a different method that appends spans and
|
|
1040
|
+
thinks about nothing. The bounds stay: a count (25) *and* a wall clock
|
|
1041
|
+
(250 ms), because the worker is watchdogged and shares a cycle with decay,
|
|
1042
|
+
dedup and the prune. The honest consequence, stated rather than glossed: a
|
|
1043
|
+
store with a thousand episodes and no `journal/` fills over forty WORKER
|
|
1044
|
+
RUNS, which is weeks on a normal cadence, not minutes. The chapter door is
|
|
1045
|
+
what keeps a live store current; the backfill is for episodes that predate
|
|
1046
|
+
the feature or a directory somebody deleted.
|
|
1047
|
+
It fills what is MISSING and does not re-derive what is present —
|
|
1048
|
+
re-rendering every episode to prove nothing had changed would read every body
|
|
1049
|
+
in the store at every boundary.
|
|
1050
|
+
|
|
1051
|
+
**What is NOT built, and what would earn it.** There is no repair path from file
|
|
1052
|
+
back to row and no reconciler: the file is downstream, and a parser here would
|
|
1053
|
+
re-create exactly the two-can-disagree problem the floor deleted `parseProse` to
|
|
1054
|
+
end. The store CONTRACT's §4 says that second half in its own words now: markdown
|
|
1055
|
+
is an export, AND the journal keeps a file copy — a copy, derived, write-only,
|
|
1056
|
+
classified in the layout but deliberately out of the backup set, regenerated from
|
|
1057
|
+
its rows if it is deleted.
|