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,474 @@
1
+ # `dashboard/` — NOTES
2
+
3
+ Working notes from the build. The CONTRACT is the spec; this is what building
4
+ against it decided, and why. Everything here is a **working default, revisable
5
+ without ceremony** (constitution line 13).
6
+
7
+ ## OQ1 — terminal or local web? **Terminal, for now.**
8
+
9
+ The contract said the guarantees are identical either way, and they are. Terminal
10
+ won on three grounds, none of them permanent:
11
+
12
+ 1. **It is the shape the guarantees are easiest to prove in.** A view that returns
13
+ a string is a pure function of the store, so "byte-identical directory after
14
+ every view renders" is a loop in a test rather than a browser harness. The
15
+ observer guarantee is the reason this adapter exists at all; making it cheap to
16
+ assert is worth more than pixels at this stage.
17
+ 2. **Zero new surface.** A local web view needs a server, a port, a lifetime, and a
18
+ decision about who may reach it — four things Amendment 15 says are earned after
19
+ the simple thing fails, not before.
20
+ 3. **It is where the owner already is.** The parallel run against v1 happens in a
21
+ terminal session; the instrument should not require leaving it.
22
+
23
+ **What would revise this:** the moment the owner wants to *click* — a memory graph,
24
+ a strength curve over lived days, a diff between two versions. None of those read
25
+ well as text, and none of them are in the five views. The view functions know
26
+ nothing about a terminal; a web adapter would reuse the data-shaping and replace
27
+ only the last step. Nothing here is a fork in the road.
28
+
29
+ ## OQ1, revisited — 2026-09-04: **both. The web view is built.**
30
+
31
+ The revision condition the entry above named — *the moment the owner wants to
32
+ click* — arrived, and it arrived for exactly the reason it predicted: a memory
33
+ graph, a strength curve over lived days, a belief's pressure against its bar.
34
+ The owner ruled for a local web view (2026-09-04) and it is in `web/`.
35
+
36
+ **Nothing in the terminal answer's reasoning is discarded**, because each of its
37
+ three grounds was a claim about how to keep a guarantee cheap, not a claim about
38
+ pixels:
39
+
40
+ 1. *"A view that returns a string is a pure function of the store."* So is
41
+ `router(url, host, source)`: it takes an already-opened observer source,
42
+ returns a plain `{status, headers, body}`, and binds no socket. The
43
+ byte-identical assertion is the same loop, over endpoints instead of over
44
+ views (`test/dashboard-web.test.ts`). The property did not get harder to
45
+ prove; it got a second shape.
46
+ 2. *"Zero new surface — a server, a port, a lifetime, and a decision about who
47
+ may reach it."* All four are now answered rather than avoided: `node:http`
48
+ (not `Bun.serve`, so Node is not foreclosed), 127.0.0.1 only, the process's
49
+ own lifetime, and a Host-header allowlist checked before any view is
50
+ computed. Amendment 15 says complexity is *earned*; this is the moment it
51
+ was, and the four answers are the price.
52
+ 3. *"It is where the owner already is."* Still true, and the five terminal views
53
+ are untouched. `bin/dashboard.ts serve` is a sixth subcommand beside them,
54
+ not a replacement for them.
55
+
56
+ **What the web shape added that the terminal shape did not have.** Two things,
57
+ and both are rules the terminal views should probably adopt:
58
+
59
+ - **Confidential rows are withheld** (`web/reveal.ts`). `recall/activate.ts`
60
+ has a predicate the surfacing gate uses; the terminal views resolve straight
61
+ through it. On a screen that gets screenshotted, that is the one surface in
62
+ the system where the rule would not hold. The row still renders — id, band,
63
+ strength, its dot on the chart — and only the sentence is gone, because a
64
+ memory whose *existence* the owner cannot see would be the worse failure.
65
+ - **Refs are resolved BY EVENT NAME.** `recall.decision` carries a session id in
66
+ its `ref`, and the terminal feed puts it through the memory resolver and
67
+ prints `[no longer at this address]` beside a turn that went perfectly well.
68
+ A false absence is worse than no line. Filed against the terminal view.
69
+
70
+ **What is genuinely new, rather than the same data in colour.** The flow page:
71
+ Counterparts' own architecture drawn from a node registry, with each node's
72
+ brain analog AND where that analogy deliberately breaks, and an event→node map
73
+ declared `satisfies Record<DurableEventName, NodeKey>` — the fourth totality
74
+ axis, in the same shape as the other three. A durable event the core learns to
75
+ write now fails `tsc` until someone has decided which part of the machine it
76
+ belongs to.
77
+
78
+ **One exception was opened, narrowly.** `web/server.ts` is the only file in this
79
+ directory that may import `node:fs` — `readFileSync`, for two static HTML pages
80
+ that ship beside it — and `node:http`. The directory-wide ban mechanizes "there
81
+ is no dashboard state file because nothing here can open one"; a read-only
82
+ import keeps that exactly, and the test pins the binding by name so it cannot
83
+ widen into a write. It also joins the enumerated network-verb list in
84
+ `test/claude-code.test.ts`, with the inbound-only claim asserted beside it.
85
+
86
+ ## The web view, second pass — 2026-09-04, after a design review
87
+
88
+ A design director scored the first pass **6.5/10** against a ship bar of 8.5,
89
+ with measurements rather than taste. The console-error bar passed cleanly; what
90
+ held it back was presentation of content the same review called better than any
91
+ dev-tool dashboard it had judged. Nine findings were acted on, and four of them
92
+ turned out to be *bugs* rather than styling:
93
+
94
+ **The one that mattered most.** "How I changed my mind" rendered `it began as X…`
95
+ and `it now says X…` as byte-identical strings — the one surface whose whole job
96
+ is to show a change showed none. The cause was not truncation: `contestedRows`
97
+ resolved BOTH ends with `reveal`, which walks the supersede chain, so both
98
+ resolved to the same row. The origin is now read with `revealHere` (unfollowed),
99
+ which is what `stories.ts` had been doing all along and for exactly this reason.
100
+ On top of that, `divergentPair` shows both versions around the point they
101
+ DIVERGE rather than from character zero, because a revision usually keeps most
102
+ of its sentence — truncating from the start spends the width on the shared
103
+ prefix and cuts the change off the end.
104
+
105
+ **A filesystem path was in every screenshot.** The header chip rendered the data
106
+ dir's absolute path and the memory modal's subtitle was 150 characters of
107
+ somebody's tmpdir. The chip is now the store's NAME with the path in `title=`;
108
+ the modal shows the path relative to the store, with the absolute one behind a
109
+ copy button. What identifies a memory's file is its place inside the store; the
110
+ machine it is sitting on is not part of that.
111
+
112
+ **Contrast was a measured failure, not a dark-theme choice.** `--faint` (the
113
+ per-memory metadata row — the line constitution 16 is actually about) measured
114
+ **1.86:1**, and `--dim` (the narration lede, the nav, the legends, the table
115
+ headers) measured **3.35:1**. They are now **4.97:1** and **6.36:1**, with
116
+ `--ink` unchanged at 11.8:1, so the hierarchy survives as a real three-step ramp
117
+ and only the floor moved. AA is 4.5.
118
+
119
+ **The page scrolled sideways at 390** on two of five pages — the task's
120
+ never-allowed case. Grid items default to `min-width:auto`, so a seven-column
121
+ table refused to shrink and `.tablewrap{overflow-x:auto}` never engaged; the
122
+ emulator then widened the layout viewport to 448 to swallow it, which is why
123
+ `scrollLeft` looked innocent. One line: `.cols>*,.cols-wide>*{min-width:0}`.
124
+
125
+ **And a UA-stylesheet trap worth remembering.** `[hidden]{display:none}` loses
126
+ to any selector carrying an id, so `#flowcv{display:block}` kept the canvas on
127
+ screen after `hidden` was set and the new mobile flow list rendered below an
128
+ invisible blank box. `[hidden]{display:none!important}` is now declared once.
129
+
130
+ ### What the loop learned to measure
131
+
132
+ The two findings above were found by a human reading pixel values, and neither
133
+ should ever have to be found that way again. `tools/visual-loop` now computes
134
+ WCAG contrast in the page against the background an ancestor actually paints,
135
+ records the layout viewport every request actually got, shoots 1024×768 (where
136
+ the flow diagram's silent clipping and colliding edge labels lived and nowhere
137
+ else), and — because two of this page's claims cannot be checked from a still —
138
+ **causes one real event**: it deposits a memory through the real door of its own
139
+ temp store, waits for a comet to be in flight, photographs it, and asserts the
140
+ flow node's counter moved. The counters had been fetched once at boot, so a page
141
+ left open reported yesterday.
142
+
143
+ ### Two things deliberately not done
144
+
145
+ - **The all-monospace type system.** One proportional face for prose against
146
+ mono for data would lift every page at once, and the review names it as the
147
+ reason a 9 is not available. It is also the change with the widest blast
148
+ radius, and it is not what stands between this and shipping.
149
+ - **The health page's identifier wall.** `adapter.wake.injected`, `gate.chunk`,
150
+ `sweep.gate` — 24 dotted names across two tables that partly repeat each
151
+ other. The honest fix is to lead each row with the plain-English gloss it
152
+ already carries in its third column and merge the two tables; that is a
153
+ restructuring, not a patch, and it is filed rather than half-done.
154
+
155
+ ## The web view, third pass — 2026-09-04, and the number that disagreed with itself
156
+
157
+ Two of the four findings this round were the same shape as last round's: a
158
+ presentation complaint with a bug underneath it.
159
+
160
+ **A note left the page reporting a number the server no longer agreed with.**
161
+ `counterparts note` deposits a memory and writes **no durable event**. The flow
162
+ page polled the event log to know whether anything had happened — which is the
163
+ wrong question, because the log is not the whole truth — so the sequence never
164
+ moved, the refetch never fired, and a page left open said `143 came through`
165
+ indefinitely while `/api/flow` already answered 144. Straight after the
166
+ console's flagship "remember this". `/api/meta` now carries a row count, the
167
+ poll compares it, and a deposit that left no trace in the log still refreshes
168
+ the counters and lights the path it actually took: session → remember → encode →
169
+ store, on **named** edges, because the first edge into ENCODE is the dotted
170
+ crash fallback and a note did not crash. No feed row is invented — the feed IS
171
+ the durable log, and a row there would be a claim that something was recorded.
172
+ The chip says `last deposit`, not `last event`, for the same reason.
173
+
174
+ *Postscript, 2026-09-05:* `counterparts note` is no longer an example of this.
175
+ `gate.deposit` (replay §2a) gives the authored door a durable row like every
176
+ other door, so a note moves the sequence and takes the event branch, and its
177
+ animation is driven by the row's own node rather than by the synthesized
178
+ three-edge path. The fingerprint stays: a freshness check that is only correct
179
+ while one particular writer happens to log is not a freshness check, and a store
180
+ seeded around the door still gains rows the log never sees. The `last deposit`
181
+ arm is now what it should always have claimed to be — the arm for those.
182
+
183
+ **The overview counted beliefs as memories.** `census()` keeps every live row
184
+ that is not the journal, and that includes schema rows — entities, and the
185
+ beliefs about them. So the headline tile read 145 while `counterparts status`
186
+ said 121 memories beside 24 beliefs and entities, on the same store, in the same
187
+ second. Two of this product's own surfaces disagreeing about its most basic
188
+ number is worse than either number being wrong. The census still keeps both
189
+ populations, because the bands, the kinds and the constellation are true of a
190
+ belief exactly as they are of a memory — but each row now says which it is, and
191
+ every surface that uses the word counts only memories. Beliefs and entities got
192
+ a tile of their own beside the first; hiding them would have been the other half
193
+ of the same mistake. The test reads the definition off the store rather than off
194
+ either surface, so the console and the dashboard are held to one rule instead of
195
+ to each other.
196
+
197
+ **The date that never changed.** Fifteen identity rows of `learned 2026-09-04`
198
+ under fifteen rows of `strength 1.00` — two of three visible fields constant, in
199
+ the README's first image. It had been filed as a limitation of the demo store.
200
+ It was not: `learnedOn` is the day a row ENTERED the store, which for anything
201
+ built or migrated in one run is the same morning, while the lived days spread
202
+ across the whole month and were already in the store. Rows carry `born day N ·
203
+ last used day M` now; the calendar date moved to the memory's card, labelled
204
+ `recorded`, saying what it means on a migrated store.
205
+
206
+ **Tap targets.** 29.2px nav links and an 18px `brain` link on a phone, against
207
+ 44. Below 720px the nav stops wrapping and becomes one scrolling strip with real
208
+ 44px hits, and the header lost a row (150px → 132.6px). Literally one row is not
209
+ available at 390 with six sections and four chips; three tidy rows — identity,
210
+ state, navigation — is the honest floor.
211
+
212
+ The loop measures tap heights the way it measures contrast, shoots a fold-height
213
+ frame at the size the README publishes, takes `--name` so the store in every
214
+ screenshot has a name a person would give it (`fernbrook-demo`, not
215
+ `counterparts-vl-rich-zjReXw` — the round-2 basename fix was only ever as good
216
+ as the directory's name), and, after the durable deposit it already caused,
217
+ types a note and asserts the counters moved on screen. That last check fails on
218
+ the build before this one, which is the only kind of regression test worth
219
+ having for a bug that only exists while somebody is looking.
220
+
221
+ ## OQ2 — which views ship during the parallel run?
222
+
223
+ The contract asked what the minimum is "beyond status + revision stories". Answer:
224
+ all five, because the two it named are unreadable without the other three.
225
+
226
+ - `stories` names ids constantly (challenger, successor, entity). Without `browse`
227
+ the owner cannot follow one, and the story becomes a column of hex.
228
+ - `status` reports counts. Without `identity` the two counts that are *permanent* —
229
+ identity band and protected set — are numbers with no list behind them, which is
230
+ precisely the shape scar §2.19 rejects.
231
+ - `activity` is the only view where the render-time-resolution rule is visible as a
232
+ behaviour rather than as an implementation note.
233
+
234
+ Five is still minimal-first: v1's 3.1k-line panel system is not ported, there is no
235
+ navigation, no state, no interactivity, and nothing is cached.
236
+
237
+ ## Narration
238
+
239
+ The brain voice ("I have lived 4 days", "what I let go") is not decoration. Two
240
+ things fall out of it that a legend-and-table dashboard does not get:
241
+
242
+ - It forces the view to state what it does **not** know. "Ways out, counted since
243
+ birth — never a per-cycle number I do not durably hold" is a sentence the first
244
+ person made unavoidable; a table of numbers would have silently implied a
245
+ per-cycle figure that box 2 does not carry.
246
+ - It makes an absence a claim. `(none yet)` next to `place` says *I have never held
247
+ a place*, which is a fact the owner can act on. A blank row says nothing.
248
+
249
+ ## Absence has two words, deliberately
250
+
251
+ `(none yet)` — asked, and the answer is zero.
252
+ `(never run)` — never asked.
253
+
254
+ Scar §2.4 is about exactly this distinction, and v1's "zero births" ambiguity is
255
+ the case study: a count of zero that could equally mean *refused* or *never
256
+ proposed* is not evidence about anything. The cycle-phase table uses `(never run)`;
257
+ the count tables use `(none yet)`.
258
+
259
+ **And a third, for one node, added 2026-09-04 — and RETIRED 2026-09-05, one day
260
+ later.** ENCODE on the flow diagram rendered `(never run)` beside STORE's `143
261
+ memories held` — a flat contradiction to anyone who did not click it, and both
262
+ words were false. The gate battery HAD run, on all 143; it wrote a durable record
263
+ on one of its two paths. The crash-sweep path recorded what it gated, because
264
+ nobody was watching it happen. The authored path was gated in line, in front of
265
+ the person who asked, and wrote no row at all. So the node said `143 passed · no
266
+ gate record yet` and `UNLOGGED_PATH` (in `web/flow.ts`) carried the whole
267
+ sentence for the panel behind it, including where that would change — replay §2a.
268
+
269
+ §2a closed the next day: `gate.deposit` is the authored door's own record, so
270
+ both of encode's paths are in the log, the node has an ordinary count to show,
271
+ and the `UNLOGGED_PATH` entry went away with the condition it described. **The
272
+ map stays, empty.** The word is still needed the moment another node's work is
273
+ real and deliberately unrecorded, and the rule it obeys is the same as the first
274
+ two: never borrow an absence word that means something else, and never render an
275
+ absence that is not one. The one sentence that survives the retirement is the
276
+ fallback line for a store whose memories PREDATE the gate log (or were seeded
277
+ around the door) — `N passed · no gate record for them`, which is a fact about
278
+ those rows and not a claim about the machinery.
279
+
280
+ ## What the totality rule is anchored to
281
+
282
+ Three registries, none of them a copy (`registries.ts` has the full argument):
283
+
284
+ | axis | source | staleness caught by |
285
+ |---|---|---|
286
+ | kinds | `Object.keys(physics.TUNABLES.KINDS)` | nothing to catch — it *is* the registry |
287
+ | bands | `BAND_ORDER … satisfies Record<Band, number>` | `tsc`, in this directory |
288
+ | cycle phases | `sleep`'s exported `PHASES` tuple | nothing to catch — imported |
289
+ | durable events | `DURABLE_EVENTS … satisfies Record<DurableEventName, string>` | `tsc`, in this directory |
290
+
291
+ The fourth was not in the task. It was added when the build found that `sleep/`
292
+ appends three durable event names beside `schemas/`'s one, and that a feed showing
293
+ only what happened to fire is the starvation failure with the log as its hiding
294
+ place. `band.promoted (never run)` is now a line the owner reads.
295
+
296
+ ## Two things the build learned by running
297
+
298
+ - **`self.enumerate` drops what it cannot read.** A removed identity element left
299
+ no trace in the enumeration — right for a briefing, wrong for an inspection
300
+ surface. The identity band is queryable, so that half is recovered here and
301
+ printed as a named absence; the protected half is not recoverable and is filed
302
+ (INTERFACE-GAPS §3).
303
+ - **A read-only tool cannot leave the directory bit-identical.** `openCache` writes
304
+ its schema-version row on every construction. Box 3, rebuildable, nothing
305
+ canonical — but it is a stance-blind write on the read path, and it is filed
306
+ (INTERFACE-GAPS §1). The suite proves the strict property for boxes 1 and 2 and
307
+ the across-renders property for box 3, rather than excluding the file quietly.
308
+
309
+ ## 2026-09-04 — three fixes from the launch inventory (§E-W2, §I4)
310
+
311
+ 1. **`browse` listed episodes as memories.** `store.list()` returns the whole
312
+ `memories` table and its filter has no "memories only" switch, so an `epi_…`
313
+ row printed as `kind self`, `band episodic`, strength 0.00, and the footer
314
+ over-counted by one per lived day (the inventory saw `27 memories` over 26).
315
+ `renderList` now skips `isJournal(row)` — the same door `status.ts` has used
316
+ since it started counting the journal apart. Opening one by address still
317
+ works: `browse --id epi_…` renders the episode. Skipping it from the CENSUS is
318
+ not hiding it from the owner who asks for it.
319
+ 2. **`stories` admitted any row with pressure.** `contestedBeliefs` unions the
320
+ durable pressure log with rows still carrying pressure, and that second half
321
+ walked every row. Same skip: nothing argues with the account of a day, and an
322
+ episode admitted there would open a story with no challenge log behind it.
323
+ `status.ts`'s `everContested` reads through this function, so it is fixed too.
324
+ 3. **The entry script printed a stack trace for every store code but one.**
325
+ `run()` caught `STORE_UNINITIALIZED` and rethrew the rest, so a data dir with
326
+ `claude-code.json` inside it gave nine frames of `LAYOUT_UNCLASSIFIED` and
327
+ exit 1 — to the exact stranger who most needs a sentence. Now one
328
+ `describeStoreError` handles EVERY `StoreError`, at open and at render: the
329
+ named codes get their sentence, an unknown code gets its code and detail (ids
330
+ and counts only, never prose — `store/errors.ts` §5 G10), and anything that is
331
+ not a `StoreError` still throws, because that would be a bug here.
332
+ `LAYOUT_UNCLASSIFIED` repeats what `cli/commands.ts`'s `init` teaches, in the
333
+ same words: the adapter's configuration goes BESIDE the store, never inside it.
334
+
335
+ One trap found while writing it: the dir the sentence NAMES cannot be resolved
336
+ eagerly, because `dataDir()` throws `DATA_DIR_FORBIDDEN` when the env points
337
+ inside v1's live store — a handler that throws while describing an error is
338
+ the same bug one frame further down. `targetDir()` is the defensive read, and
339
+ there is a test for the code no branch was written for.
340
+
341
+ **`browse` and `stories` now filter the journal, the way `status` always has.**
342
+ Three views, one rule, three copies of it — if a fourth view ever needs it, that
343
+ is the moment the skip becomes a helper rather than the moment it becomes a
344
+ policy.
345
+
346
+ ## The web view, fourth pass — 2026-09-05, the leftovers
347
+
348
+ Four of the six things the third pass filed as NOT done, plus the two refusals
349
+ the cold stranger asked for. What they had in common is that each one was a
350
+ surface telling the truth to somebody who already knew the system.
351
+
352
+ **The overview was not on the signal the flow page was on.** The third pass
353
+ gave the poll a second question — `/api/meta`'s row count, because the event
354
+ log is not the whole truth and a `note` writes nothing into it — and then
355
+ refreshed the flow diagram alone. So the page the dashboard OPENS on kept its
356
+ boot-time tiles: `memories held` frozen at whatever it was when the tab was
357
+ opened, on the first screen of the product, beside a tab that moved. The same
358
+ bug, one page over, found by reading the fix rather than by watching the page.
359
+ `renderOverview` splits into a fetch and a `paintOverview(d, withFeed)`; the
360
+ refresh path calls the paint without the feed, because the poll prepends
361
+ flashed rows into that panel and a repaint underneath would wipe them
362
+ mid-flash — unless the feed is still its absence line, where there is nothing
363
+ of the poll's to lose and a store's first event should not need a reload. The
364
+ loop types a note and reads the tile back off the DOM: a page that never
365
+ repaints answers the payload correctly, so the assertion cannot ask the payload.
366
+
367
+ **The health page's identifier wall.** Filed twice as "a restructuring, not a
368
+ patch", and it was: eleven `adapter.*` names in one table and all nineteen in
369
+ the other, seven of them listed twice on one screen with near-duplicate
370
+ glosses, and a first screen of 23 dotted names against a column of `(never
371
+ run)`. One table now. The gloss the registry already carried LEADS each row and
372
+ the dotted name is the second line, which is the order a reader needs them in —
373
+ what this records, then what it is called. `host` marks the rows an adapter
374
+ wrote, which is the only thing the split was really saying, and the
375
+ adapter-specific caveat rides beside the name. Two columns rather than three,
376
+ which is also most of what the shredded third column at 390 was about. The
377
+ merge is only safe if totality survives it, so the test asserts both halves:
378
+ every durable name, exactly once, each led by a sentence that is not its own
379
+ name. And what has actually happened is listed above what never has, with the
380
+ rule stated on the page — a reference table nobody can read is not a reference.
381
+
382
+ **`serve` refuses the default store.** It printed a loud line and opened it: on
383
+ a machine with an install that is the owner's live memory, every element of it,
384
+ on a socket, in a browser — and the warning arrives after the socket is bound,
385
+ which is the wrong end of the transaction. `--dir` names a store, `--yes` means
386
+ the default, and neither is a warning. The refusal is a pure function of the
387
+ parsed arguments, so the test needs no store and no socket, and the install
388
+ loop asserts it on the INSTALLED binary under a `perl alarm` — because the
389
+ failure mode of a regression here is a server that starts and never returns,
390
+ and a hanging loop is a loop nobody reads.
391
+
392
+ **And the refusal says two different things, because it knows two different
393
+ amounts.** `~/.counterparts/store` on a machine with an install IS the owner's
394
+ live memory — that is what the layout means, and the sentence may say so.
395
+ `COUNTERPARTS_DATA_DIR` is whatever somebody exported: an adversarial review
396
+ pointed `serve` at a scratch demo store through that variable and got a refusal
397
+ asserting it was live memory, which was simply false about that directory. It
398
+ still refuses on the variable — QUICKSTART §7 instructs the reader to export it
399
+ with the live store's path in it, so honouring it would put the hole straight
400
+ back — but it now names the variable and says why the choice is made in the
401
+ command, rather than claiming whose memory is at the other end. A refusal that
402
+ overstates its case teaches the reader to discount the next one.
403
+
404
+ **A view of a store that is not there is a refusal, not a render.** Both
405
+ consoles said the right sentence and exited 0, so a script wrapping either one
406
+ sailed past a mistyped `--dir`. `runReport` carries the second half of the
407
+ answer and the entry point spends it: stderr, exit 1. And the remedy names the
408
+ dir that was actually passed — `counterparts init` offered on its own, under a
409
+ line that had just named `--dir /somewhere`, is advice that works, somewhere
410
+ else.
411
+
412
+ **`strength 1.00` is gone from the identity rows.** Every element in that band
413
+ is at 1.00 by construction, so the field said one thing fifteen times in the
414
+ README's first image — a tautology dressed as a measurement. The row says
415
+ `promoted day N` where the log recorded a crossing, and nothing where it did
416
+ not: a seeded or migrated core was never watched crossing, and an invented day
417
+ would be worse than an absent one. With `born day` and `last used day` beside
418
+ it, three numbers vary where two were constant.
419
+
420
+ **And the loop shoots `brain.html` at 390 for the first time.** The phone pass
421
+ skipped the page on the argument that a 390-wide hologram proves nothing. True
422
+ of the hologram; false of its header, which is where the page's two links out
423
+ live — and they measured 13px against a 44px minimum, unseen for as long as
424
+ nobody took the picture. A shot nobody takes is a surface nobody checks. 51
425
+ shots now, zero findings.
426
+
427
+ **Still open, and named rather than half-done:** the all-monospace type system
428
+ (the 9.5 item, unchanged in its reasoning); the mobile flow list flattening a
429
+ branching architecture into one arrow chain; edge labels dropped silently on
430
+ collision at 1024; the letterboxed canvas at 1024x768; the event modal's raw
431
+ `band.transition` title; the empty store's one sentence five times over; and
432
+ the heatmap's row labels, which are still a third list of raw dotted names —
433
+ the merged table above is where their glosses live now, and the heatmap has no
434
+ room for a sentence per row.
435
+
436
+ ## 2026-09-05 — `--yes` means one thing, so `serve` takes `--default-store`
437
+
438
+ **The rule.** `--yes` means exactly one thing everywhere in this package: "skip an
439
+ interactive confirmation." It never means "use the default store." Owner ruling,
440
+ 2026-09-05, after the console caught two of its own commands disagreeing about the
441
+ flag (cli NOTES, same date; LAUNCH-STATUS G31).
442
+
443
+ **Why the rename.** `serve --yes` was the last flag with the second meaning. The
444
+ fourth pass (above) made the default store opt-in by name, and the name it chose was
445
+ the console's confirmation-skipper. That reads fine on this binary alone — it is
446
+ read-only, and "yes, I mean it" is a fair gloss — and wrongly across the package,
447
+ where the same token on `migrate-cache --apply --yes` skips a typed `yes` and still
448
+ demands `--dir`. A flag that puts a whole store on a socket should say WHICH store,
449
+ so it is `--default-store`: the noun, not the assent. `serve` has no confirmation to
450
+ skip, so `--yes` did not stay behind as a no-op; it is an unknown flag. Nothing is
451
+ published, so nothing needed a deprecation.
452
+
453
+ **Where it is enforced.** `parseServe` reads `--default-store` (and `=true`);
454
+ `serveRefusal` gates on it, and both of its sentences — the env-var case and the
455
+ default case — name it as the way through. `unknownFlag` is new and bin-wide:
456
+ `parseArgv` collected every `--flag` into a map and read the ones it knew, so an
457
+ undeclared flag was silently dropped — the same silence the console closed on
458
+ 2026-09-04. Two allowlists in the bin, one per subcommand; checked after help and
459
+ before the store is resolved; one line, in this binary's refusal shape (`Refused: …
460
+ Nothing was opened.`), listing what the subcommand takes. `serve()` prints it to
461
+ stderr and returns 1 before the server module is loaded; `runReport` returns it as a
462
+ refusal and the entry point spends it as stderr, exit 1. The views' half is the one
463
+ deliberate behaviour change beyond the rename: `status --dirr <path>` used to render
464
+ the default store without a word about the flag.
465
+
466
+ **Tests** (`test/dashboard-web.test.ts`): `serve --yes` refused as unknown — alone,
467
+ as `--yes=true`, and beside `--dir` — with `COUNTERPARTS_DATA_DIR` at an empty scratch
468
+ dir that stays empty; `serve --default-store` with the variable at a missing store
469
+ refused BY THAT DIR'S NAME, so the variable was read past the gate; and a spawned
470
+ `serve --default-store` against the seeded scratch store — explicit env carrying
471
+ preload's temp `HOME`, read until `ctrl-c to stop.`, then killed — the shape
472
+ preload.ts names as safe for a spawned child. The install loop's `serve` step asserts
473
+ both refusals under its `perl alarm`, in the same step, so the step count QUICKSTART
474
+ quotes did not move.
@@ -0,0 +1,121 @@
1
+ /**
2
+ * `activity` — what has happened lately, resolved at render.
3
+ *
4
+ * The event log is content-BY-REFERENCE by law (store §5 G10): ids, hashes,
5
+ * counts, scores, kinds, tiers — never body text, never a user turn. That law is
6
+ * what keeps the log from becoming the verbatim honeypot the design rejects, and
7
+ * it is exactly what makes this view necessary: a feed of raw rows is a wall of
8
+ * hex. So every id in a row — its `ref`, and every id-shaped value inside its
9
+ * payload — is resolved HERE, at the moment of printing (scar §2.20).
10
+ *
11
+ * Which means the feed tells the truth as of now: a memory the owner removed
12
+ * this morning reads as removed in a line written three days ago, because the
13
+ * line never held its text.
14
+ *
15
+ * The feed is honest about its own bounds. Events are bounded-retention
16
+ * telemetry, not canonical memory — `pruneEvents` sweeps them past H lived days,
17
+ * keeping only the ones latched by a `dedupKey`. A feed that showed six rows
18
+ * without saying that would be quietly claiming six things ever happened.
19
+ */
20
+ import { PLAIN } from "./ansi.js";
21
+ import type { Style } from "./ansi.js";
22
+ import { NEVER, NONE, heading, indent, plural, stack, subheading, table, truncate } from "./layout.js";
23
+ import { DURABLE_EVENTS, DURABLE_EVENT_NAMES } from "./registries.js";
24
+ import { resolvePayload, resolveRef } from "./resolve.js";
25
+ import type { DashboardSource } from "./source.js";
26
+
27
+ export const DEFAULT_FEED = 30;
28
+
29
+ export interface ActivityOptions {
30
+ readonly style?: Style;
31
+ readonly limit?: number;
32
+ /** Only this event name. */
33
+ readonly name?: string;
34
+ /** Only events about this id (the stored ref, not the resolved head). */
35
+ readonly ref?: string;
36
+ }
37
+
38
+ export function renderActivity(src: DashboardSource, opts: ActivityOptions = {}): string {
39
+ const style = opts.style ?? PLAIN;
40
+ const store = src.store;
41
+ const limit = opts.limit ?? DEFAULT_FEED;
42
+
43
+ const filter: { name?: string; ref?: string; limit: number } = { limit: 1000 };
44
+ if (opts.name !== undefined) filter.name = opts.name;
45
+ if (opts.ref !== undefined) filter.ref = opts.ref;
46
+
47
+ // `eventLog` returns oldest first, so a story reads in the order it happened.
48
+ // The FEED wants the opposite — newest first is what "lately" means.
49
+ const all = store.eventLog(filter);
50
+ const shown = all.slice(-limit).reverse();
51
+
52
+ const bound =
53
+ `I keep events for ${plural(store.retentionDays, "lived day")}; older ones are swept unless ` +
54
+ "a replay latch holds them. This is what I still have, not everything that ever happened.";
55
+
56
+ if (shown.length === 0) {
57
+ return stack(
58
+ heading("What has happened lately", style),
59
+ style.warn(`${NONE} — my durable log is empty.`),
60
+ vocabulary(src, style),
61
+ `${subheading("The bounds of this feed", style)}\n${indent(bound)}`,
62
+ );
63
+ }
64
+
65
+ const rows: string[][] = [];
66
+ for (const row of shown) {
67
+ const when = new Date(row.at).toISOString().replace("T", " ").slice(0, 19);
68
+ const subject = row.ref === null ? style.dim("—") : resolveRef(store, row.ref, 44).label;
69
+ rows.push([`day ${row.day}`, style.dim(when), row.name, subject]);
70
+ const detail = payloadLine(src, row.payload, style);
71
+ if (detail !== null) rows.push(["", "", "", indentDetail(detail)]);
72
+ }
73
+
74
+ return stack(
75
+ heading("What has happened lately", style),
76
+ indent(table(rows)),
77
+ vocabulary(src, style),
78
+ `${subheading("The bounds of this feed", style)}\n${indent(bound)}`,
79
+ `Showing ${shown.length} of ${plural(all.length, "event")} I hold.`,
80
+ );
81
+ }
82
+
83
+ /**
84
+ * TOTALITY, applied to the log (CONTRACT §5 [M], scar §2.17). Every event name
85
+ * that can reach box 2 is listed with its count — filters and all — so "prune
86
+ * has never once fired" reads as a sentence instead of as an absence of rows.
87
+ * This is the block that would have caught v1's starved curation path.
88
+ */
89
+ function vocabulary(src: DashboardSource, style: Style): string {
90
+ const rows = DURABLE_EVENT_NAMES.map((name) => {
91
+ const count = src.store.eventLog({ name, limit: 10_000 }).length;
92
+ return [
93
+ name,
94
+ count === 0 ? style.warn(NEVER) : String(count),
95
+ DURABLE_EVENTS[name],
96
+ ];
97
+ });
98
+ return `${subheading("Everything I am able to record durably, and how often I have", style)}\n${indent(
99
+ table(rows, { right: [1] }),
100
+ )}`;
101
+ }
102
+
103
+ function indentDetail(detail: string): string {
104
+ return `↳ ${detail}`;
105
+ }
106
+
107
+ function payloadLine(src: DashboardSource, payload: string | null, style: Style): string | null {
108
+ if (payload === null) return null;
109
+ let parsed: unknown;
110
+ try {
111
+ parsed = JSON.parse(payload);
112
+ } catch {
113
+ return style.warn("(payload unreadable)");
114
+ }
115
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
116
+ return truncate(String(parsed), 72);
117
+ }
118
+ return resolvePayload(src.store, parsed as Record<string, unknown>, 40)
119
+ .map((p) => `${p.key} ${p.value}`)
120
+ .join(" · ");
121
+ }