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.
Files changed (195) hide show
  1. package/CONSTITUTION.md +68 -0
  2. package/LICENSE +21 -0
  3. package/README.md +348 -0
  4. package/docs/ELI5.md +84 -0
  5. package/docs/QUICKSTART.md +1258 -0
  6. package/docs/module-map.md +81 -0
  7. package/package.json +63 -0
  8. package/src/adapters/claude-code/CONTRACT.md +606 -0
  9. package/src/adapters/claude-code/INTERFACE-GAPS.md +655 -0
  10. package/src/adapters/claude-code/NOTES.md +1055 -0
  11. package/src/adapters/claude-code/bin/hook.ts +820 -0
  12. package/src/adapters/claude-code/bin/runner.ts +522 -0
  13. package/src/adapters/claude-code/config.ts +778 -0
  14. package/src/adapters/claude-code/credentials.ts +199 -0
  15. package/src/adapters/claude-code/doctor.ts +2557 -0
  16. package/src/adapters/claude-code/embed-client.ts +617 -0
  17. package/src/adapters/claude-code/hooks.ts +2240 -0
  18. package/src/adapters/claude-code/index.ts +224 -0
  19. package/src/adapters/claude-code/interpret-client.ts +395 -0
  20. package/src/adapters/claude-code/page-writer.ts +462 -0
  21. package/src/adapters/claude-code/primacy.ts +162 -0
  22. package/src/adapters/claude-code/spawn.ts +241 -0
  23. package/src/adapters/claude-code/standdown.ts +536 -0
  24. package/src/adapters/claude-code/transcript.ts +661 -0
  25. package/src/adapters/claude-code/vectors.ts +415 -0
  26. package/src/adapters/cli/CONTRACT.md +255 -0
  27. package/src/adapters/cli/INTERFACE-GAPS.md +350 -0
  28. package/src/adapters/cli/NOTES.md +936 -0
  29. package/src/adapters/cli/bin/counterparts.ts +74 -0
  30. package/src/adapters/cli/commands.ts +6095 -0
  31. package/src/adapters/cli/export.ts +766 -0
  32. package/src/adapters/cli/index.ts +103 -0
  33. package/src/adapters/cli/install.ts +670 -0
  34. package/src/adapters/cli/removal.ts +1186 -0
  35. package/src/adapters/cli/repair-dates.ts +659 -0
  36. package/src/adapters/cli/self-page.ts +229 -0
  37. package/src/adapters/cli/snapshot.ts +279 -0
  38. package/src/adapters/cli/start-fresh.ts +1228 -0
  39. package/src/adapters/config-path.ts +342 -0
  40. package/src/adapters/dashboard/CONTRACT.md +67 -0
  41. package/src/adapters/dashboard/INTERFACE-GAPS.md +139 -0
  42. package/src/adapters/dashboard/NOTES.md +474 -0
  43. package/src/adapters/dashboard/activity.ts +121 -0
  44. package/src/adapters/dashboard/ansi.ts +82 -0
  45. package/src/adapters/dashboard/bin/dashboard.ts +479 -0
  46. package/src/adapters/dashboard/browse.ts +298 -0
  47. package/src/adapters/dashboard/identity.ts +182 -0
  48. package/src/adapters/dashboard/index.ts +183 -0
  49. package/src/adapters/dashboard/layout.ts +149 -0
  50. package/src/adapters/dashboard/registries.ts +291 -0
  51. package/src/adapters/dashboard/resolve.ts +206 -0
  52. package/src/adapters/dashboard/source.ts +48 -0
  53. package/src/adapters/dashboard/status.ts +327 -0
  54. package/src/adapters/dashboard/stories.ts +194 -0
  55. package/src/adapters/dashboard/web/app.html +1731 -0
  56. package/src/adapters/dashboard/web/brain.html +463 -0
  57. package/src/adapters/dashboard/web/fired.ts +31 -0
  58. package/src/adapters/dashboard/web/flow.ts +457 -0
  59. package/src/adapters/dashboard/web/narrate.ts +1042 -0
  60. package/src/adapters/dashboard/web/reveal.ts +135 -0
  61. package/src/adapters/dashboard/web/server.ts +287 -0
  62. package/src/adapters/dashboard/web/views.ts +1744 -0
  63. package/src/adapters/expansions.ts +569 -0
  64. package/src/adapters/fired.ts +1580 -0
  65. package/src/adapters/mcp/CONTRACT.md +240 -0
  66. package/src/adapters/mcp/INTERFACE-GAPS.md +271 -0
  67. package/src/adapters/mcp/NOTES.md +205 -0
  68. package/src/adapters/mcp/bin/serve.ts +349 -0
  69. package/src/adapters/mcp/deliberate.ts +619 -0
  70. package/src/adapters/mcp/index.ts +101 -0
  71. package/src/adapters/mcp/protocol.ts +170 -0
  72. package/src/adapters/mcp/server.ts +1740 -0
  73. package/src/adapters/mcp/stdio.ts +56 -0
  74. package/src/adapters/mcp/tools.ts +779 -0
  75. package/src/adapters/scopes.ts +657 -0
  76. package/src/adapters/sessions.ts +402 -0
  77. package/src/adapters/snapshots.ts +1069 -0
  78. package/src/adapters/stance-env.ts +137 -0
  79. package/src/core/associate/CONTRACT.md +118 -0
  80. package/src/core/associate/INTERFACE-GAPS.md +173 -0
  81. package/src/core/associate/NOTES.md +194 -0
  82. package/src/core/associate/buffer.ts +66 -0
  83. package/src/core/associate/edges.ts +188 -0
  84. package/src/core/associate/index.ts +570 -0
  85. package/src/core/associate/pending.ts +383 -0
  86. package/src/core/associate/spread.ts +149 -0
  87. package/src/core/associate/tunables.ts +123 -0
  88. package/src/core/bridge.ts +272 -0
  89. package/src/core/briefing.ts +67 -0
  90. package/src/core/counterpart.ts +3855 -0
  91. package/src/core/encode/CONTRACT.md +151 -0
  92. package/src/core/encode/INTERFACE-GAPS.md +135 -0
  93. package/src/core/encode/NOTES.md +146 -0
  94. package/src/core/encode/aliases.ts +71 -0
  95. package/src/core/encode/battery.ts +284 -0
  96. package/src/core/encode/chunk.ts +265 -0
  97. package/src/core/encode/emotion.ts +119 -0
  98. package/src/core/encode/floor.ts +76 -0
  99. package/src/core/encode/index.ts +100 -0
  100. package/src/core/encode/precision.ts +162 -0
  101. package/src/core/encode/preselect.ts +269 -0
  102. package/src/core/encode/salience.ts +108 -0
  103. package/src/core/encode/secrets.ts +265 -0
  104. package/src/core/encode/tunables.ts +99 -0
  105. package/src/core/encode/types.ts +286 -0
  106. package/src/core/encode/words.ts +75 -0
  107. package/src/core/handoff/CONTRACT.md +199 -0
  108. package/src/core/handoff/INTERFACE-GAPS.md +166 -0
  109. package/src/core/handoff/NOTES.md +206 -0
  110. package/src/core/handoff/index.ts +957 -0
  111. package/src/core/mint.ts +279 -0
  112. package/src/core/observer.ts +28 -0
  113. package/src/core/physics/CONTRACT.md +341 -0
  114. package/src/core/physics/NOTES.md +155 -0
  115. package/src/core/physics/clock.ts +51 -0
  116. package/src/core/physics/index.ts +1054 -0
  117. package/src/core/prospective/CONTRACT.md +137 -0
  118. package/src/core/prospective/INTERFACE-GAPS.md +112 -0
  119. package/src/core/prospective/NOTES.md +160 -0
  120. package/src/core/prospective/derive.ts +188 -0
  121. package/src/core/prospective/index.ts +1030 -0
  122. package/src/core/prospective/tunables.ts +72 -0
  123. package/src/core/prospective/windows.ts +187 -0
  124. package/src/core/recall/CONTRACT.md +326 -0
  125. package/src/core/recall/INTERFACE-GAPS.md +163 -0
  126. package/src/core/recall/NOTES.md +472 -0
  127. package/src/core/recall/activate.ts +521 -0
  128. package/src/core/recall/cues.ts +275 -0
  129. package/src/core/recall/gate.ts +441 -0
  130. package/src/core/recall/index.ts +692 -0
  131. package/src/core/recall/probe.ts +239 -0
  132. package/src/core/recall/reference.ts +201 -0
  133. package/src/core/recall/render.ts +285 -0
  134. package/src/core/recall/session.ts +403 -0
  135. package/src/core/recall/tunables.ts +329 -0
  136. package/src/core/remember/CONTRACT.md +293 -0
  137. package/src/core/remember/INTERFACE-GAPS.md +189 -0
  138. package/src/core/remember/NOTES.md +373 -0
  139. package/src/core/remember/fallback.ts +452 -0
  140. package/src/core/remember/index.ts +103 -0
  141. package/src/core/remember/owner-strike-seam.ts +479 -0
  142. package/src/core/remember/proposals.ts +609 -0
  143. package/src/core/remember/spans.ts +1310 -0
  144. package/src/core/remember/tunables.ts +111 -0
  145. package/src/core/remember/updates.ts +198 -0
  146. package/src/core/retrieval.ts +96 -0
  147. package/src/core/revision.ts +441 -0
  148. package/src/core/schemas/CONTRACT.md +190 -0
  149. package/src/core/schemas/INTERFACE-GAPS.md +172 -0
  150. package/src/core/schemas/NOTES.md +260 -0
  151. package/src/core/schemas/aliases.ts +160 -0
  152. package/src/core/schemas/index.ts +1459 -0
  153. package/src/core/schemas/tunables.ts +44 -0
  154. package/src/core/schemas/types.ts +387 -0
  155. package/src/core/self/CONTRACT.md +459 -0
  156. package/src/core/self/INTERFACE-GAPS.md +284 -0
  157. package/src/core/self/NOTES.md +1057 -0
  158. package/src/core/self/briefing.ts +980 -0
  159. package/src/core/self/episodes.ts +483 -0
  160. package/src/core/self/freeze.ts +103 -0
  161. package/src/core/self/identity.ts +604 -0
  162. package/src/core/self/index.ts +2130 -0
  163. package/src/core/self/journal-file.ts +760 -0
  164. package/src/core/self/page.ts +404 -0
  165. package/src/core/self/tunables.ts +244 -0
  166. package/src/core/self/writer.ts +714 -0
  167. package/src/core/sleep/CONTRACT.md +298 -0
  168. package/src/core/sleep/INTERFACE-GAPS.md +262 -0
  169. package/src/core/sleep/NOTES.md +770 -0
  170. package/src/core/sleep/briefing.ts +86 -0
  171. package/src/core/sleep/consolidate.ts +241 -0
  172. package/src/core/sleep/cycle.ts +598 -0
  173. package/src/core/sleep/decay.ts +237 -0
  174. package/src/core/sleep/dedup.ts +373 -0
  175. package/src/core/sleep/index.ts +112 -0
  176. package/src/core/sleep/log.ts +116 -0
  177. package/src/core/sleep/markers.ts +164 -0
  178. package/src/core/sleep/prune.ts +170 -0
  179. package/src/core/sleep/strength-cache.ts +176 -0
  180. package/src/core/sleep/tunables.ts +135 -0
  181. package/src/core/sleep/types.ts +542 -0
  182. package/src/core/store/CONTRACT.md +446 -0
  183. package/src/core/store/NOTES.md +1068 -0
  184. package/src/core/store/cache.ts +709 -0
  185. package/src/core/store/db.ts +275 -0
  186. package/src/core/store/errors.ts +134 -0
  187. package/src/core/store/index.ts +2450 -0
  188. package/src/core/store/operational.ts +610 -0
  189. package/src/core/store/owner-op-seam.ts +428 -0
  190. package/src/core/store/paths.ts +494 -0
  191. package/src/core/store/prose.ts +165 -0
  192. package/src/core/store/render.ts +87 -0
  193. package/src/core/store/walk-seam.ts +78 -0
  194. package/src/core/types.ts +68 -0
  195. package/tools/install-loop/run.sh +1063 -0
@@ -0,0 +1,459 @@
1
+ # `self/` — CONTRACT
2
+
3
+ ## 1. Purpose
4
+
5
+ The autobiographical self: identity documents, the first-person episode journal, and the
6
+ wake briefing that restores a continuous self — at session start for a live session, and,
7
+ composed read-only against a caller's own budget, for any background writer of memories
8
+ before it reads a transcript (owner ruling 2026-09-17). A composition bound for a model
9
+ call outside this machine stands confidential and protected rows out with
10
+ `BoundaryRequest.omit`; the published bundle and the identity rotation are written by
11
+ `boundary()` and by nothing else, so no such reader can move what a live session wakes to.
12
+
13
+ ## 2. Brain analog
14
+
15
+ Autobiographical memory and the narrative self — episodic replay feeding a stable
16
+ self-schema, re-inhabited on waking rather than looked up. **Named deviations**
17
+ (constitution line 12): (a) humans never author their episodes — encoding is involuntary —
18
+ while here it is a ritual, which is the authorship thesis; (b) identity-band memories do
19
+ not decay here, where flashbulb memories do in humans; (c) **transcript-derived
20
+ self-reinforcement is deliberately not copied** — it is the rumination / illusory-truth
21
+ pathway, a documented bug of human cognition rather than architecture (owner ruling
22
+ 2026-08-24).
23
+
24
+ ## 3. Keeps
25
+
26
+ - **The briefing, grown up.** [v0] `top-60 by strength → Active Context / Core Knowledge /
27
+ Recent Patterns / Fading Context, under 2000 characters` — the ancestor of v1's composed
28
+ bundle and of this module's output. The section vocabulary is v0's and is worth re-reading
29
+ before inventing another.
30
+ - **Identity is re-inhabited, not retrieved** — core memories are constitutive, not
31
+ competed for in a ranker — and the briefing is framed as **context, not instruction**.
32
+ [v1 §1] **Mechanized 2026-09-14: the identity lane ROTATES** (`identity.ts#byRotation`,
33
+ least-recently-rendered first, never-rendered ahead of everything; strength, born-day and
34
+ id only break ties), and `Self.boundary` stamps the ids it KEPT with the day
35
+ (`self.rendered.<id>`). Before this the lane sorted by strength and the owner's live store
36
+ rendered the same three of twenty identity beliefs every day (IMPROVEMENTS U6): eight tied
37
+ at the clamp, oldest-born won, and the oldest-born were the ones written on migration day
38
+ under a fresh clock.
39
+ - **Zero compute, zero model calls, zero network at wake**; the cost was paid by the
40
+ previous boundary, so cold-start cost is constant in store size. [v1 §1 G1]
41
+ - **A composed byte budget, a declared trim order (v1: hints → craft → threads → horizon →
42
+ identity last), and untrimmable riders.** A budget on a sub-lane is not a budget, and trim
43
+ order *within* a lane is policy too: *truncation must never be iteration luck.* [v1 §1 G3,
44
+ scar §2.3]
45
+ - **Header and tail sentinel each state the bundle's own true counts and bytes**, so a
46
+ truncated injection is detectable from a truncation preview alone. [v1 §1 G2]
47
+ - **Delivery telemetry distinct from render telemetry** — v1 shipped 11 days of truncated
48
+ wakes because only the render was instrumented. [v1 §1, scar §2.3]
49
+ - **Atomic publish**; an empty or short read is an error, never silently valid. [v1 §1 G5] —
50
+ v1's empty concurrent read printed "your persistent memory is initializing" over a full
51
+ store: identity amnesia disguised as a fresh install.
52
+ - **The wake never fails the session** — bootstrap line or nothing, then a clean exit.
53
+ [v1 §1 G7]
54
+ - **Episodes are substance-paced, appended live, asked exactly once per blocked moment, the
55
+ advance committed before the ask blocks, and collection never depends on the ritual.**
56
+ [v1 §13 G1–G5] *Broken and restored 2026-09-04: v2 raised a second ask (authorship) on a
57
+ second pacer beside this one, and the two fired on different Stops — about a dozen asks
58
+ in a 13-turn evening. The pacing itself had drifted too: v1 re-asked on bytes AND turns,
59
+ v2 on bytes OR turns with a byte threshold a third of v1's. One ask, one pacer, a
60
+ conjunction — and a cap each SESSION spends on itself alone, per calendar day
61
+ (`MAX_ASKS_PER_SESSION`). Measured 2026-09-17: a cap of four shared by every session a
62
+ calendar day held refused 196 of 264 Stops, and the crash-fallback sweep wrote 888
63
+ memories to the author's 193 — the author was not losing a fight, it was almost never
64
+ invited. Amended 2026-09-18: spent over a session's whole life the same cap starved the
65
+ long sessions instead, so the count starts over with the store's calendar date. The
66
+ conjunction, not the count, is what holds the cadence.*
67
+ - **Episodes are context and source, in that order**, ingested once as ordinary self-kind
68
+ memories with named handles. **"Episode" is not a memory kind.** [v1 §13 G6, Appendix A #11]
69
+ *Reachable only from 2026-09-04: `ingestEpisode` had no caller outside its own tests, so
70
+ the journal was a file that never became a memory. The door is `reconcileEpisodes` at
71
+ `Counterpart.sessionEnd` — the boundary, not a script.*
72
+ - **Forgetting applies to what an episode PRODUCED, never to the episode.** The journal is
73
+ the owner's own account and the source the memory was made from, so it is outside decay,
74
+ dedup, consolidation and the floor prune (`sleep/CONTRACT.md` §5 G15,
75
+ `sleep/types.ts#isJournal`); the memory minted from it fades like anything else.
76
+ Constitution 6 (the owner owns the data, in prose readable in any editor) and 7 (memory
77
+ changes like human memory — which is a claim about memories). *Measured 2026-09-04: all
78
+ 224 migrated episodes sit in the episodic band at zero on every dimension, so the phases
79
+ that walk "every row" would have archived the whole journal at the floor — and an
80
+ archived episode stops reconciling, so the memories it had not yet minted would never
81
+ exist.*
82
+ - **The narration→span join is identity-safe** — spans with no session identity are skipped
83
+ outright, because every anonymous session collapses to the same marker. [v1 §13 G7]
84
+ - **Ingestion is ordinary and the gates apply**: a first-person reflection is not exempt from
85
+ never durably encoding a credential. [v1 §13 G8]
86
+ - **Add-first regrowth within a bounded window that CLOSES** — a deliberate deviation from
87
+ human reconsolidation, which reopens on every retrieval. [v1 §13 G11–G12]
88
+ - **Named handles are aliases, not a second lookup path** — "the lighthouse conversation" enters
89
+ through the ordinary rarity-weighted name channel. [v1 §9.2]
90
+ - **Lived salience is the only legitimate identity input.** [v1 §14.2, earned 2026-08-24]
91
+ - **Freeze, but keep counting** — the frozen arm runs the identical walk with identical
92
+ guards, mutates nothing, and emits the same per-occasion event with a frozen marker.
93
+ *The event IS the measurement; the movement is what is withheld.* [v1 earned-mechanism #8]
94
+ - **Recompression is render-only and archive-first, and the author's verbatim marks are
95
+ durable state no model-facing path can set or clear** — "a choice that lives in prose is a
96
+ choice the next autonomous run silently overrules." [v1 §7 G1–G4]
97
+ - **Every derived surface owes a scheduled reconciler** — "a script the owner runs
98
+ occasionally" is not one — and every identity surface owes an answer to *which door
99
+ reaches this?* (v1's craft file was reachable through neither of its two doors for weeks).
100
+ [v1 §1 known gap]
101
+
102
+ ## 4. Drops / simplifies
103
+
104
+ - **The v1 self-store tool is superseded by experiencer authorship.** Self-writing became
105
+ the primary path — the doctrine that identity strength comes from lived salience is kept
106
+ whole, and the end-of-session write *is* the front door it names. Not a silent drop: it
107
+ resolves v1's own open watch, which recorded the deliberate channel at zero uses for a
108
+ month while the doctrine named it as one of only three legitimate identity inputs.
109
+ **If a doctrine names the only legitimate inputs, those inputs must be reachable by
110
+ construction, not by a tool description nobody reads.**
111
+ - **The frozen-reinforcement machinery simplifies to a rule about authorship.** With the
112
+ transcript sweep demoted to crash fallback, the channel the freeze blocks barely runs. The
113
+ freeze stays — mechanized, on the fallback path, keeping its marker and its count — but as
114
+ a guard on an exception rather than a permanent slice through the main loop. Softening is
115
+ untouched on every kind: **the fallback remains a reporter on identity — it may soften, it
116
+ never strengthens.**
117
+ - **The second-signature queue for permanent protection is dropped; legibility is kept.**
118
+ **PROPOSED** — owner call at check-in; evidence and counter-argument in
119
+ `schemas/CONTRACT.md` §4. The wake's untrimmable second-signature reminder goes with it;
120
+ the self-store pointer goes with the tool.
121
+ - **The identity *index* as a separate derived surface — its own budget, warmth ordering,
122
+ promotion path, and reconciler — is dropped.** **PROPOSED** — owner call at check-in. Why
123
+ it looks safe: the index existed because canonical identity prose was too big to inject,
124
+ and its promotion path had **zero production callers**, so the "warm shelf" could only
125
+ cool. With identity elements as ordinary memories carrying strength, the briefing ranks by
126
+ `strength` — v0's original design, needing no second structure and no reconciler to go
127
+ stale. Recompression then applies to the briefing render, as v1's applied to the index.
128
+ - **The wake byte budget is not a core constant.** v1's 9,000 bytes was 90% of one host's
129
+ injection cliff. **In v2 the ceiling is a host capability the adapter reports** (scar
130
+ §2.18). The trim order, the sentinel, and the composed-budget discipline are core; the
131
+ number is not.
132
+
133
+ ## 5. Contract
134
+
135
+ **Inputs** — identity-kind memories and their strengths; the episode journal; **the written
136
+ self page, when the store holds one**; open `unresolved` memories; the prospective horizon;
137
+ the host's reported injection ceiling (or, for a read-only composition, the caller's own
138
+ byte cap); the lived day; the observer predicate; optionally a caller's `omit` predicate,
139
+ which stands rows out before any lane sees them.
140
+ **Outputs** — one pre-rendered briefing, published atomically; ingested episode memories;
141
+ **one revision of the self page, with its version and a durable row**; recompression
142
+ proposals and their archive; render and delivery telemetry.
143
+
144
+ **Guarantees** — **[M]** mechanized · **[A]** advisory:
145
+
146
+ 1. **[M]** The briefing is pre-rendered by the previous boundary and is that boundary's last
147
+ content write. Wake performs no ranking, no prose read, no model call, no network access.
148
+ *A wake that is a DELIVERY also composes its preface (G3), which costs two meta reads and
149
+ one `COUNT(*)` — the store's size is a delivery-time fact a bundle rendered yesterday
150
+ cannot state. Nothing else, and a non-delivering read still pays one meta row.*
151
+ **A second caller may compose without publishing** — `build()` ranks and renders and
152
+ writes nothing, so a background reader pays a scan and changes no durable state: not the
153
+ published bundle, not the identity lane's `self.rendered.<id>` rotation, not a counter.
154
+ Pinned by a test that snapshots both across a fallback sweep.
155
+ 2. **[M]** The budget governs the composed total, not each lane; the trim order is explicit
156
+ and tested; the budget test runs **at production scale** — fixtures cannot reveal an
157
+ overflow (scar §2.3). **The identity lane has a SHARE of that total** (`IDENTITY_SHARE`):
158
+ while the other lanes have content, identity takes at most that fraction, by whole
159
+ elements; when they cannot fill the remainder, identity takes the leftover back. It is
160
+ not a lane budget — the total still governs — it is how the total is SPLIT when lanes
161
+ compete, and it exists because identity trims LAST: measured 2026-09-03/04, a migrated
162
+ store's ~1.1 KB identity elements filled all 9,000 bytes of every session's wake with 8
163
+ identity statements and four empty lanes, while v1's wake the same day carried 20
164
+ elements across four lanes. *Named limit: a share taken by whole elements is
165
+ deterministic at a fixed budget — the host's case — but does not preserve the
166
+ smaller-budget-is-a-subset property across budgets when one element is larger than the
167
+ difference between them (NOTES §9, with the measurement). Truncating a belief to keep
168
+ that property is the worse trade.* **An identity lane with no elements renders ONE line
169
+ of furniture naming the identity core** (`briefing.ts#identityCoreLine`) when a core
170
+ exists, and nothing when none does — the core is `type: "schema"` and no lane can reach
171
+ it, so a store seeded by `install --name` composed a wake that named nobody (measured
172
+ 2026-09-04: 385 bytes, `elements=0`, four empty lanes and the owner's name nowhere in
173
+ it). It is furniture and not an element: the counts and `elements` do not move, it
174
+ carries no date because it has none, and it invents no content — it says who the memory
175
+ is for and how the lane fills, and nothing else — and the name is FLATTENED, like every
176
+ other string that reaches the bundle, because it is the only user-supplied one this
177
+ module renders. **The empty lane guards BOTH seams**: the lookup, on the ranked lane,
178
+ and the render, on the lane as it ARRIVED at `render` — never on the post-trim copy, so
179
+ a store whose identity elements the budget trimmed away can never assert that it has
180
+ none. A store with one identity element neither pays for the lookup nor renders the
181
+ line (NOTES §11).
182
+ 3. **[M]** Header and sentinel each state true counts and bytes. Because both state a number
183
+ that composing them changes, composition iterates to a fixed point. A delivery-side event
184
+ exists, not only a render-side one. **The delivered bundle carries a preface composed at
185
+ WAKE and never stored** — which system, which lived day, today's date, how many live
186
+ memories — because a bundle composed at a boundary is served unchanged to every session
187
+ until the next one and cannot say any of that about the day it is read (2026-09-03: the
188
+ memory system changed mid-day, the body went on speaking as the old one, and only the
189
+ HTML comment named the new). Both stated byte counts are re-solved for the DELIVERED
190
+ text, the renderer reserves the preface's room from the host's ceiling, and a damaged
191
+ bundle is delivered exactly as found — never rewritten. **Every rendered element opens
192
+ with the date it was learned** — `- YYYY-MM-DD · statement`, and
193
+ `- YYYY-MM-DD (of YYYY-MM-DD) · statement` when the content date differs (neutral,
194
+ because the horizon lane's dates are in the future). Leading, not trailing: the age is
195
+ read before the claim, the element's own text still ends the line, and it costs 14 bytes
196
+ at day precision against 21 for a trailing form — counted in the composed budget and in
197
+ the identity share, on the same line the sentinel counts. The element text itself is
198
+ never altered; the annotation lives outside it, so a belief still renders verbatim for
199
+ contradiction detection, and the word "learned" is stated once in `FRAMING.context`
200
+ rather than once per element. An undated row (a chased one reads `learned_on = ''`)
201
+ renders with no prefix rather than an invented date. 2026-09-04: the wake carried no
202
+ date of any kind, and a migrated element learned 2026-07-26 was read as a current fact
203
+ and repeated to the owner as one. **A MIGRATED element's encode date is rendered as an
204
+ upper bound** — `- by 2026-09-03 · statement`, +3 bytes — because the importer writes
205
+ the IMPORT date wherever v1 carried none and nothing in the row tells those apart from
206
+ the ones that kept v1's own: the first dated wake, run live 2026-09-05, read
207
+ `2026-09-03 ·` on all eleven elements, a July incident and a mid-August finding among
208
+ them. A wrong date is worse than no date; it is a confident claim in the one line the
209
+ reader discounts everything else by. The exception is a migrated row carrying a CONTENT
210
+ date, which renders plainly as any other does: `happened_on` is evidence about the thing
211
+ itself and survived the import unaltered, and hedging real evidence would make `by` mean
212
+ nothing. *Named cost: a migrated row that DID keep v1's own date and has no content date
213
+ is hedged too — weaker, never wrong, and the alternative needs a per-row discriminator
214
+ the import did not record.*
215
+ 4. **[M]** Status does not accumulate on the self. A memory whose truth expires with a date
216
+ is not an identity element, discriminated at encode time by one question: *would this
217
+ still be a true memory worth holding after the date passes?* A standing counter reports
218
+ self-schema bytes and trips before it can dominate a prompt again (earned-mechanism #5:
219
+ ~72 KB, measured). The counter weighs what THIS system accumulates on the self:
220
+ episodes (the journal, not the schema) and migrated rows are excluded and counted
221
+ beside the fallback-minted quarantine — a migrated store read 3 MB tripped on day 0
222
+ before anyone had written to it (2026-09-03).
223
+ 5. **[M]** Identity strength comes from lived salience only. A fallback-authored
224
+ confirmation against a self- or skill-kind element moves nothing — no `uses`, no strength,
225
+ no band crossing, no lived day burned — and emits its frozen marker anyway, on the
226
+ identical walk, so the frozen rate stays comparable to the live one.
227
+ 6. **[M]** Softening is untouched on every kind. Freezing both directions would make the
228
+ identity model unrevisable in both.
229
+ 7. **[M]** Claims about other people are ordinary memory — learning about others from what
230
+ they say is not self-narration.
231
+ 8. **[M]** The freeze is decided on the *resolved* element, so a confirmation addressed to
232
+ the wrong id still freezes.
233
+ 9. **[M]** Recompression touches the render, never the canonical; the complete proposal set
234
+ — accepted *and* rejected, with reasons and both texts — is archived **before** anything
235
+ is applied; every proposal is re-judged at write time and rejected if empty, over cap, or
236
+ not actually shorter; protected content is excluded independently of any mark.
237
+ 10. **[M]** Episodes ingest idempotently by identity, against active *and* archived memories,
238
+ so archival decisions are not resurrected by a stray touch.
239
+ 11. **[M]** Observers receive the wake and are never asked for an episode. Accepted cost:
240
+ instrument runs leave no episode (scar E7).
241
+ 12. **[M]** Every derived surface has a scheduled reconciler, and a test asserts each runs at
242
+ a boundary — not from a script the owner remembers to run. **The episode journal's is
243
+ `reconcileEpisodes`, called by `Counterpart.sessionEnd` before the cycle**, so an
244
+ ingested episode is inside the boundary that decays it and renders the briefing around
245
+ it. It skips on a state read plus a hash, so an episode already ingested at its current
246
+ text costs no scan. Found the day it was wired: `ingestEpisode` had no production
247
+ caller at all, which is precisely the "which door reaches this?" failure §3 names.
248
+ **The owner's out-of-band lever is `counterparts rebrief`** (`Counterpart.rebrief`,
249
+ through the same `selfRenderer` the sleep step uses — there is no second renderer): it
250
+ re-renders and republishes now, reserving the preface's room exactly as the boundary
251
+ does, refusing under observer, and advancing no sleep marker and running no other sleep
252
+ phase. It exists because a change to the lane rules merged mid-day cannot reach a single
253
+ session's wake until the next boundary (measured 2026-09-04, the day the share shipped).
254
+ 13. **[A]** The ask's wording is a preference and a probe. That an ask exists at
255
+ every session-ending path, that there is exactly ONE of it per blocked moment, and that
256
+ its orphanable tail is bounded and logged, is mechanized. Tool names and session ids are
257
+ the ADAPTER's vocabulary and live there (constitution 5); this module's `askText` is the
258
+ host-agnostic wording.
259
+ 14. **[M]** Chapters are counted by what was WRITTEN, asks by what was asked, and the two
260
+ are separate fields. The ask names `chapters + 1`. A second append with no new ask
261
+ continues the chapter it is part of — appending in the moment is the doctrine's headline
262
+ case (§13 G2), not an edge. Measured 2026-09-04: with the ask advancing the chapter
263
+ count, the hook's number reached 7 in a session whose episode held nothing.
264
+
265
+ 15. **[M]** **The self page is one row, written through one seam, and outside sleep's
266
+ reach** (2026-09-18, owner rulings 8 and 9). `revisePage(body, { reason, by, session?,
267
+ ifVersion? })` is the only door — the MCP tool, the owner's console and the nightly
268
+ writer all arrive there — and it crosses the same gate battery the journal does, so a
269
+ credential cannot land in the one piece of prose every session reads. **A redaction is
270
+ reported**: accepted is not the same as unaltered, and both doors say so. Every
271
+ accepted revision leaves a version (`store.revise` archives the prior one first) and a
272
+ durable `self.page.revised` row; every refusal leaves a `self.page.refused` row and a
273
+ named reason; an observer writes neither. The page is `type: "schema"`,
274
+ `kind: "self"`, `meta.role = "page"`, born `protected` — which is what keeps the floor
275
+ prune off it; dedup skips schema rows and (since 2026-09-18) so does the PROMOTION ARM
276
+ of consolidate, so nothing promotes it into the identity band while beliefs go on
277
+ consolidating unchanged, and `scanActive` cannot see it. **It is not a
278
+ recall candidate and cannot be expanded by id**: the page is delivered whole at every
279
+ wake, and a row that is already in the context is not a memory coming to mind. Its OLD
280
+ VERSIONS take the ordinary retention, deliberately un-special-cased (owner ruling 1).
281
+ Proved by a test that runs a full cycle and the prune over a store holding a page with
282
+ two versions.
283
+ 16. **[M]** **The page is what "Who I am" prints, first and as is**, under
284
+ `PAGE_WAKE_BYTES` clamped to the caller's budget **less `PAGE_FLOOR_RESERVE_BYTES`, the
285
+ furniture the wake wraps it in** — the page is furniture the trim loop cannot pop, so a
286
+ page sized against the whole ceiling puts the composition over it with nothing left to
287
+ trim. Over the cap it renders cut, at a paragraph then a line boundary and
288
+ only where that boundary KEEPS most of the room — a page that offers neither is cut at
289
+ a whole code point — with a marker naming the bytes shown,
290
+ the bytes there are, and the command that reads it whole. Where the room is too small
291
+ to be a page the wake says the page exists and does not fit, in one line; where there
292
+ is no room for that either it says nothing. It replaces the rotating identity list by
293
+ emptying the lane before the share, the trim order or the counts see it, so
294
+ `counts.identity` and `elements=` state what the bundle actually carries and no
295
+ `TrimEvent` is written for elements nothing dropped. It is furniture, like the day-0
296
+ line: no `- ` bullet, no place in the counts. While NO page exists the wake renders
297
+ exactly what it rendered before (`PAGE_EMPTY_SHOWS_LIST`, the owner's unmade choice),
298
+ and the page's still-forming line is about the PAGE, never about identity.
299
+ 17. **[M]** **`protected` on the page is the floor prune's word, and it no longer implies
300
+ "stays on this machine."** A composition that filters (`omit`) is one that will leave
301
+ the machine, and whether the page goes with it is `PAGE_ON_EGRESS` — a switch, default
302
+ TRUE, which is the owner's decision of 2026-09-17 (spec §15 item 3: the background
303
+ writer is woken as the self before it reads a transcript). Turned off, that composition
304
+ gets no page and falls back to the identity list the predicate left standing. Nothing
305
+ marks a page confidential: there is one page, and the switch is the decision.
306
+ 18. **[M]** **ONE ROW FOR THE LIFE OF THE PAGE, and a page is unwritten rather than
307
+ removed.** `clearPage` is an ordinary revision — the body it replaces becomes an
308
+ ordinary version, attributed like any other — to a fixed cleared line, with
309
+ `meta.cleared` set. The row stays live and keeps its whole version chain;
310
+ `readSelfPage` returns null for it, so every reader sees a store with no page and the
311
+ wake goes back to its empty-page behaviour exactly as if none had been written. The
312
+ next write or `restorePage(seq)` revises the SAME row and drops the flag. Two
313
+ properties follow and both are asserted: **there is never a second page row, live or
314
+ archived**, however often it is cleared; and **nothing needs the event log** to find
315
+ the page or its history (attribution still reads it, and says so when a row has been
316
+ pruned). It is the OWNER's door: no MCP tool reaches it, because a session that could
317
+ unwrite the page could erase the self between two turns. The owner's `remove` refuses
318
+ the page row by name and points at it.
319
+ 19. **[M]** **THE NIGHTLY PAGE WRITER RUNS ON THE CALENDAR, AT MOST ONCE, AND IS NOT A
320
+ SECOND PACER** (`writer.ts`, S2, 2026-09-20 — true for now). A run is ABOUT one
321
+ calendar date, always yesterday, and never chases a backlog. It is keyed to the
322
+ calendar and not the lived day for I32's reason: the lived clock advances inside the
323
+ cycle the detached worker runs, and a nightly mechanism keyed to a clock the night
324
+ itself advances can miss every night and look on time. **The first durable row for a
325
+ date is the CLAIM**, so two boundaries — or two machines' worth of hooks against one
326
+ store — do not both set a night going; at most `PAGE_WRITER_ASKS_PER_DAY` sessions are
327
+ offered one day. That is a COUNT and not a pacer: guarantee 3's scar is about the
328
+ BLOCKED MOMENT at Stop, where one ask on one conjunction is the rule, and this ask
329
+ rides beside the wake at SessionStart the way the first-launch scope question does,
330
+ consulting no substance and spending none of `MAX_ASKS_PER_SESSION`.
331
+ **A store with no yesterday writes nothing and leaves no row**, so a line about it
332
+ cannot nag from the day a fresh install is made. **No revision is a first-class
333
+ outcome**: host mode reports it (a windowless session handed one tool that did not use
334
+ it has answered), session mode cannot tell it from "never got to it" and so does not
335
+ claim to — it stores the claim, and the READING of a claim whose day has ended is
336
+ `nothing-to-say`, marked `derived` wherever it is shown — except an abandoned
337
+ `started`, which reads `failed`, because host mode closes its own claim on every path
338
+ it can reach. `by: "writer"` is the DOOR's and is not claimable from a tool call: the
339
+ evidence is a date the SessionStart hook wrote on the session's registry record, or
340
+ one the launcher pinned onto a windowless child's environment, honoured only while
341
+ that night's claim is open.
342
+ **The block does not repeat the page**: the reader woke with it at the head of its own
343
+ wake in both modes, and sending it twice would spend up to `PAGE_MAX_BYTES` of the
344
+ very ceiling the block has to fit inside — which on a real page and a real day is the
345
+ difference between an ask that is delivered and one deferred every morning. What it
346
+ names instead is the version, which is what `ifVersion` needs and the one thing the
347
+ wake does not carry. The day is sized to the room the wake left and then the composed
348
+ block is MEASURED against the ceiling, because the estimate is the block's shortest
349
+ shape and the delivered one is longer; a day that did not all fit is delivered SHORT
350
+ with the count on the row, and a block that can carry none of the day is deferred
351
+ rather than spending a night's claim.
352
+ **It never says a day was empty that was not.** "The day was empty" and "I could not
353
+ see the day" are different things, and `dropped` is what tells them apart; a room too
354
+ small for the largest memory still carries the smaller ones. **Quoted material carries
355
+ no structure and no authority**: this block's markers and the wake's are stripped from
356
+ every string that reaches it, and the line that says the list is material rather than
357
+ instruction sits WITH the list.
358
+ **A day with nothing in it is not a night**: `no-memories` is returned before anything
359
+ is claimed or asked, so a machine used twice a week is not asked about five empty days.
360
+ A DEFERRAL leaves a durable `skipped` row — deduped one per night per reason — which
361
+ claims nothing and can never close a night; a REFUSAL does not close one either, since
362
+ a refusal is the writer still trying, and a later success supersedes it in the reading
363
+ while both rows stay.
364
+ **Order is salience, then the store's own id order.** Nothing claims "newest": within
365
+ one calendar day `learned_on` is a date, `birth_day` is the lived day and ids are
366
+ random, so there is no recency to sort by. What is guaranteed is that the cut is
367
+ deterministic (§1 G3), not that it is the end of the day.
368
+ 20. **[M]** **THE WRITER CAN WRITE THE PAGE AND ONE ROW, AND NOTHING ELSE.** The page goes
369
+ through `revisePage` — the one seam, with its caps, its gate battery and its version
370
+ chain — and `writer.ts` never touches it; what this module writes is the run's own
371
+ durable row. No memory is created, none promoted, no strength moves. **No model call
372
+ happens in core**: this module composes what the writer is handed and the ADAPTER makes
373
+ the call, exactly as `counterpart.ts#sweepWake` composes and `interpret-client.ts`
374
+ calls. A writer failure costs the writer: it never fails a wake, a boundary or a
375
+ session, and with the writer off or never run the wake is byte-identical to a build
376
+ without it (asserted).
377
+ 21. **[M]** **THE JOURNAL HAS A MARKDOWN COPY, AND IT IS DERIVED, WRITE-ONLY AND
378
+ DISPOSABLE** (F6, 2026-09-20; owner decision 2 of 2026-09-17 §15 item 9, ruling 2 of
379
+ 2026-09-18). One `.md` per episode under `<store>/journal/<YYYY>/`, rendered by
380
+ `store/render.ts#renderMarkdown` and by nothing else — as is, no summary, front matter
381
+ limited to what identifies the episode. Four properties, each asserted: **nothing in
382
+ `src/` reads a copy back** (the row is the truth); **deleting `journal/` loses nothing**
383
+ — the next chapter, or the detached worker's next bounded backfill pass (`Self.boundary`
384
+ is the consolidation cycle's last content write, not the Stop hook), writes it again; **a copy
385
+ never fails a session** — it cannot throw, and a failure is a durable
386
+ `journal.copy.failed` row with a reason code while the chapter itself is already
387
+ committed; **an observer writes neither the file nor the row**. Written atomically
388
+ (temp beside it, then rename) because a crashed rename otherwise leaves a chapter's
389
+ words in a file nothing owns. **The directory is classified but NOT backed up** (f6f7
390
+ review MAJOR-5): copying a derived directory put removed episodes' words into every
391
+ rotating snapshot as plain markdown, and a restored store regenerates every file from
392
+ its rows at the next boundary. *This is the one module in `self/` that treats `Store.dir` as
393
+ a filesystem root; `remember/spans.ts` is the precedent.* The owner's `remove` chases it
394
+ as a named surface — see `adapters/cli/CONTRACT.md`.
395
+
396
+ **The briefing's tunables** — every one CAL (scar §2.8), all of them in `tunables.ts`, none
397
+ of them a budget. The composed budget is the caller's and lives nowhere in this module.
398
+
399
+ | Knob | Value | What it bounds |
400
+ | --- | --- | --- |
401
+ | `IDENTITY_MAX` | 24 | Identity elements *considered*. The budget and the share are the real bounds; this only stops a pathological store from composing a megabyte to throw it away. |
402
+ | `IDENTITY_SHARE` | 0.5 | The largest fraction of the composed budget identity may take **while other lanes have content to spend the rest on** (G2). By whole elements; released back to identity when nothing else can use the room. |
403
+ | `CRAFT_MAX` | 8 | Craft (skill-kind) elements considered. |
404
+ | `THREADS_MAX` | 12 | Open threads considered. Dark on a migrated store — INTERFACE-GAPS §8, and no cap can fix a missing source. |
405
+ | `HINTS_MAX` | 8 | Warm-shelf hints considered. |
406
+ | `HORIZON_MAX` | 6 | Arriving occasions considered (source borrowed — INTERFACE-GAPS §3). |
407
+ | `WARM_FLOOR` | 0.35 | Decayed strength a non-identity element must reach to be craft or a hint. Identity faces no floor. |
408
+ | `BUDGET_PRESSURE` | 0.9 | Fraction of the budget that fires the pressure event (scar §2.4). |
409
+ | `PAGE_WAKE_BYTES` | 6,144 | Bytes of the wake the self page may take, clamped to the caller's budget. Over it the page RENDERS cut, at a paragraph or line boundary, with a marker naming both numbers. |
410
+ | `PAGE_MAX_BYTES` | 16,384 | The hard WRITE limit. Past it a revision is refused rather than cut — what gets cut at write time is the only copy. |
411
+ | `PAGE_STALE_DAYS` | 14 | Calendar days after which the wake says the page has not been revised. Calendar, not lived: the lived clock has run 7 days across 15 calendar ones here. |
412
+ | `PAGE_EMPTY_SHOWS_LIST` | true | What "Who I am" shows while NO page has been written: `true` keeps the rotating list exactly as it is today, `false` prints the still-forming line instead. A page that exists replaces the list under both. The owner's choice, unmade; the default changes nothing until a page is written. |
413
+ | `PAGE_ON_EGRESS` | true | Whether a composition that FILTERS (`omit` — the crash fallback woken as the self) carries the page. The owner's decision of 2026-09-17; `false` gives that composition no page and the identity list the filter left standing. |
414
+ | `PAGE_WRITER_MEMORY_BYTES` | 8,192 | Bytes of the day just gone the nightly writer is handed. It reads one day, not a life, and what did not fit is counted on the run's row. |
415
+ | `PAGE_WRITER_MEMORY_MAX` | 40 | ...and a ceiling on the count, so a day of very short memories cannot become a hundred bullets. |
416
+ | `PAGE_WRITER_ASKS_PER_DAY` | 2 | How many SESSIONS may be offered one day's writing in session mode. A count, not a pacer (G19): the first session of a morning may be deep in something else, and two makes that survivable without asking all day. |
417
+ | `FIRST_ASK_TURNS` / `FIRST_ASK_BYTES` | 6 / 4,000 | The first ask needs both — or `SOLO_ASK_BYTES` alone. |
418
+ | `SOLO_ASK_BYTES` | 12,000 | Bytes alone, so a one-prompt agentic session still journals. |
419
+ | `REASK_TURNS` / `REASK_BYTES` | 8 / 8,000 | Further substance since the last ask, **both** required. |
420
+ | `MAX_ASKS_PER_SESSION` | 6 | Asks ONE SESSION may raise ON ONE CALENDAR DAY, its own count and nobody else's. A backstop on the total, not the cadence — the re-ask pair puts six asks at roughly 46 real turns. Per day, shared, it refused 196 of 264 Stops (2026-09-17); over a session's whole life it starved a session that spanned days (2026-09-18). |
421
+
422
+ `PAGE_FLOOR_RESERVE_BYTES` (512) and `PAGE_MIN_RENDER_BYTES` (240) are **not** tunable, for
423
+ the reason `PREFACE_RESERVE_BYTES` is not: the first is the room the wake's own furniture
424
+ takes around the page — measured at its widest (444) by a test, not guessed — and the
425
+ second is the smallest room worth rendering a page into rather than a fragment.
426
+
427
+ `PREFACE_RESERVE_BYTES` (128) is **not** tunable: it is the room the renderer subtracts from
428
+ the host's ceiling because delivery will add exactly that line, and one test bounds the
429
+ preface at its widest plausible day, date and store size against the same constant.
430
+
431
+ ## 6. Scars honored
432
+
433
+ **E7** (observers receive but deposit nothing) · **E8** (episode pacing and the regrow
434
+ window run on lived days; the ask CAP ran on them too from 2026-09-04 and moved to the
435
+ CALENDAR DATE on 2026-09-11 — the lived-day clock advances only inside the sleep cycle a
436
+ detached worker runs, so a worker that could not start left the cap spent forever, I32 —
437
+ and on 2026-09-17 it moved onto the SESSION, where no clock spends it at all) · **the journal
438
+ is neither a memory nor a duplicate of one** (every sleep phase walked every row: dedup
439
+ merged the first real ingestion into its own journal at the boundary that minted it, and
440
+ prune would have archived all 224 migrated episodes at the floor — one predicate,
441
+ `sleep/types.ts#isJournal`, now holds the rule for all four) · **§2.3** (composed budget, sentinel, delivery telemetry, atomic
442
+ write) · **§2.4** (frozen markers are the measurement; a withheld move is a record, not a
443
+ silence) · **§2.7** (episode ingestion traverses the same gate as everything else — v1's
444
+ most heavily gated surface, 66% of all gate fires) · **§2.10** (strengthening without a live
445
+ softening path is a ratchet) · **§2.17** (every identity surface names the door that reaches
446
+ it) · **§2.18** (the injection ceiling is a host limit, never assumed) · **§2.19**
447
+ (permanence and write bar scale together).
448
+
449
+ ## 7. Open questions
450
+
451
+ 1. **Does the briefing keep v0's four sections or v1's lanes?** v0's are legible to a
452
+ reader; v1's map to real data structures. The lineage argues for reconciling them once
453
+ rather than accreting both.
454
+ 2. **What is the honest reconciler cadence** when a session ends without a boundary?
455
+ Pre-rendering means the briefing is always one session stale by design — a feature until
456
+ the day's own episode is the thing the next session needs.
457
+ 3. **Is the freeze still needed** once the transcript sweep is a crash fallback? It costs
458
+ almost nothing to keep and keeps generating the evidence that could overturn it — which
459
+ is also why its firing rate will now be near zero and hard to read.