counterparts 0.3.3 → 0.3.4

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 (128) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/docs/module-map.md +3 -2
  3. package/package.json +1 -1
  4. package/src/adapters/claude-code/NOTES.md +16 -0
  5. package/src/adapters/claude-code/doctor.ts +146 -0
  6. package/src/adapters/claude-code/hooks.ts +31 -3
  7. package/src/adapters/claude-code/transcript.ts +7 -0
  8. package/src/adapters/cli/CONTRACT.md +11 -0
  9. package/src/adapters/cli/INTERFACE-GAPS.md +16 -0
  10. package/src/adapters/cli/NOTES.md +25 -0
  11. package/src/adapters/cli/commands.ts +173 -4
  12. package/src/adapters/cli/dream-core.ts +126 -0
  13. package/src/adapters/cli/help.ts +17 -0
  14. package/src/adapters/cli/mechanisms.ts +169 -101
  15. package/src/adapters/dashboard/CONTRACT.md +5 -0
  16. package/src/adapters/dashboard/INTERFACE-GAPS.md +12 -0
  17. package/src/adapters/dashboard/NOTES.md +38 -0
  18. package/src/adapters/dashboard/registries.ts +31 -1
  19. package/src/adapters/dashboard/web/README.md +45 -16
  20. package/src/adapters/dashboard/web/app.html +2 -0
  21. package/src/adapters/dashboard/web/flow.ts +12 -0
  22. package/src/adapters/dashboard/web/lanes.ts +141 -0
  23. package/src/adapters/dashboard/web/mechanisms/association/index.js +1 -2
  24. package/src/adapters/dashboard/web/mechanisms/consolidation/index.js +8 -5
  25. package/src/adapters/dashboard/web/mechanisms/consolidation/panel.js +7 -7
  26. package/src/adapters/dashboard/web/mechanisms/decay/index.js +1 -2
  27. package/src/adapters/dashboard/web/mechanisms/dreaming/index.js +19 -0
  28. package/src/adapters/dashboard/web/mechanisms/emotional/index.js +1 -2
  29. package/src/adapters/dashboard/web/mechanisms/episodic-semantic/index.js +4 -5
  30. package/src/adapters/dashboard/web/mechanisms/index.js +5 -3
  31. package/src/adapters/dashboard/web/mechanisms/interference/index.js +1 -2
  32. package/src/adapters/dashboard/web/mechanisms/prospective/index.js +1 -2
  33. package/src/adapters/dashboard/web/mechanisms/reconsolidation/index.js +1 -2
  34. package/src/adapters/dashboard/web/mechanisms/regions.js +1 -1
  35. package/src/adapters/dashboard/web/mechanisms/retrieval/index.js +1 -2
  36. package/src/adapters/dashboard/web/mechanisms/salience/index.js +1 -2
  37. package/src/adapters/dashboard/web/mechanisms/schema/index.js +1 -2
  38. package/src/adapters/dashboard/web/narrate.ts +68 -13
  39. package/src/adapters/dashboard/web/pages/home/home.css +29 -13
  40. package/src/adapters/dashboard/web/pages/home/index.js +2 -0
  41. package/src/adapters/dashboard/web/pages/home/sections/explorer.js +22 -7
  42. package/src/adapters/dashboard/web/pages/home/sections/hero.js +15 -3
  43. package/src/adapters/dashboard/web/pages/home/sections/live-activity.js +15 -9
  44. package/src/adapters/dashboard/web/pages/home/sections/recent-chapters.js +6 -2
  45. package/src/adapters/dashboard/web/pages/home/sections/tiles.js +35 -18
  46. package/src/adapters/dashboard/web/pages/memories/index.js +30 -36
  47. package/src/adapters/dashboard/web/pages/memories/memories.css +97 -72
  48. package/src/adapters/dashboard/web/pages/memories/row.js +51 -0
  49. package/src/adapters/dashboard/web/pages/memories/sections/feel.js +176 -0
  50. package/src/adapters/dashboard/web/pages/memories/sections/hold.js +67 -0
  51. package/src/adapters/dashboard/web/pages/memories/sections/list.js +65 -43
  52. package/src/adapters/dashboard/web/pages/memories/sections/search.js +26 -23
  53. package/src/adapters/dashboard/web/pages/memories/state.js +12 -5
  54. package/src/adapters/dashboard/web/pages/self/index.js +4 -2
  55. package/src/adapters/dashboard/web/pages/self/sections/dreams.js +76 -0
  56. package/src/adapters/dashboard/web/pages/self/sections/journal.js +1 -1
  57. package/src/adapters/dashboard/web/pages/self/sections/page.js +1 -1
  58. package/src/adapters/dashboard/web/pages/self/sections/settling.js +50 -20
  59. package/src/adapters/dashboard/web/pages/self/sections/wake.js +1 -1
  60. package/src/adapters/dashboard/web/pages/self/self.css +23 -20
  61. package/src/adapters/dashboard/web/pages/self/state.js +0 -2
  62. package/src/adapters/dashboard/web/server.ts +9 -0
  63. package/src/adapters/dashboard/web/shared/memory-marks.css +17 -0
  64. package/src/adapters/dashboard/web/shared/memory-marks.js +81 -0
  65. package/src/adapters/dashboard/web/shared/memory-modal.js +240 -62
  66. package/src/adapters/dashboard/web/shared/modal.css +67 -0
  67. package/src/adapters/dashboard/web/shared/tip.js +1 -1
  68. package/src/adapters/dashboard/web/shared/widgets/feed.css +4 -0
  69. package/src/adapters/dashboard/web/shared/widgets/feed.js +56 -14
  70. package/src/adapters/dashboard/web/shared/widgets/light.css +1 -0
  71. package/src/adapters/dashboard/web/shared/widgets/light.js +7 -5
  72. package/src/adapters/dashboard/web/shared/widgets/tips.css +19 -0
  73. package/src/adapters/dashboard/web/{pages/self → shared/widgets}/tips.js +15 -9
  74. package/src/adapters/dashboard/web/views/activity.ts +18 -2
  75. package/src/adapters/dashboard/web/views/archive-words.ts +27 -10
  76. package/src/adapters/dashboard/web/views/dreams.ts +199 -0
  77. package/src/adapters/dashboard/web/views/mechanism-panel.ts +116 -35
  78. package/src/adapters/dashboard/web/views/mechanisms.ts +81 -326
  79. package/src/adapters/dashboard/web/views/memories.ts +245 -43
  80. package/src/adapters/dashboard/web/views/memory-words.ts +133 -0
  81. package/src/adapters/dashboard/web/views/memory.ts +215 -7
  82. package/src/adapters/dashboard/web/views/mind.ts +133 -57
  83. package/src/adapters/dashboard/web/views/overview.ts +80 -42
  84. package/src/adapters/dashboard/web/views/search.ts +35 -1
  85. package/src/adapters/dashboard/web/views/shared.ts +14 -0
  86. package/src/adapters/dashboard/web/views.ts +2 -0
  87. package/src/adapters/fired.ts +85 -5
  88. package/src/adapters/mcp/NOTES.md +11 -0
  89. package/src/adapters/mcp/server.ts +90 -1
  90. package/src/adapters/mcp/tools.ts +129 -1
  91. package/src/adapters/mechanism-evidence.ts +465 -0
  92. package/src/core/counterpart.ts +113 -4
  93. package/src/core/dream/CONTRACT.md +143 -0
  94. package/src/core/dream/INTERFACE-GAPS.md +24 -0
  95. package/src/core/dream/NOTES.md +84 -0
  96. package/src/core/dream/index.ts +1067 -0
  97. package/src/core/dream/mark.ts +14 -0
  98. package/src/core/dream/tunables.ts +56 -0
  99. package/src/core/physics/CONTRACT.md +92 -24
  100. package/src/core/physics/NOTES.md +139 -0
  101. package/src/core/physics/index.ts +345 -68
  102. package/src/core/recall/NOTES.md +16 -0
  103. package/src/core/recall/index.ts +9 -2
  104. package/src/core/remember/CONTRACT.md +5 -0
  105. package/src/core/remember/spans.ts +11 -1
  106. package/src/core/self/CONTRACT.md +3 -0
  107. package/src/core/self/INTERFACE-GAPS.md +7 -0
  108. package/src/core/self/NOTES.md +30 -0
  109. package/src/core/self/identity.ts +95 -5
  110. package/src/core/self/index.ts +17 -0
  111. package/src/core/self/tunables.ts +17 -0
  112. package/src/core/sleep/CONTRACT.md +17 -1
  113. package/src/core/sleep/INTERFACE-GAPS.md +19 -0
  114. package/src/core/sleep/NOTES.md +36 -0
  115. package/src/core/sleep/consolidate.ts +149 -96
  116. package/src/core/sleep/decay.ts +11 -0
  117. package/src/core/sleep/index.ts +4 -1
  118. package/src/core/sleep/tunables.ts +9 -0
  119. package/src/core/sleep/types.ts +17 -0
  120. package/src/core/sleep/upgrade.ts +168 -0
  121. package/src/core/store/CONTRACT.md +12 -0
  122. package/src/core/store/NOTES.md +48 -0
  123. package/src/core/store/index.ts +610 -8
  124. package/src/core/store/operational.ts +314 -3
  125. package/src/core/store/owner-op-seam.ts +79 -1
  126. package/src/core/types.ts +28 -0
  127. package/src/adapters/dashboard/web/pages/memories/sections/constellation.js +0 -178
  128. package/src/adapters/dashboard/web/pages/memories/sections/kinds.js +0 -42
@@ -8,18 +8,21 @@
8
8
  * alarms when they are good news. This view is the page a regular user reads;
9
9
  * `--all` still prints the full `fired` report, unchanged, for the diagnosis.
10
10
  *
11
- * **It reads nothing of its own.** Every count comes off the rows `fired.ts`
12
- * already computed. The table below only says which of those rows are the
13
- * evidence for which mechanism, and how to say the count in plain words.
11
+ * **Whether a mechanism fired is not this file's call** (2026-09-26, an
12
+ * experiment). It asks `mechanism-evidence.ts`, the one judgement the dashboard's
13
+ * lights ask too, so the two can no longer disagree about which rows count. The
14
+ * WORDS and the WINDOW stay this console's own: seven calendar days, the same
15
+ * window the `fired` report counts over, and its own phrasing.
14
16
  *
15
- * **Deliberately light.** The grouping and the words are this console's own,
16
- * for now. The site and the dashboard have their own lists and are all still
17
- * moving, so nothing here is shared with them or tested against them — the
18
- * only coupling is to `MECHANISMS`, whose ids this table names.
17
+ * The plumbing line still reads the `fired` report's rows.
19
18
  *
20
19
  * The truth per mechanism is `docs/research/mechanism-audit-2026-09-24.md`.
21
20
  */
21
+ import type { EventRow, ReadOnlyStore } from "../../core/store/index.js";
22
+ import { FIRED_DAYS, daysBefore, rowDate } from "../fired.js";
22
23
  import type { FiredReport, FiredRow } from "../fired.js";
24
+ import { mechanismEvidence, payloadOf } from "../mechanism-evidence.js";
25
+ import type { EvidenceWindow, Verdict } from "../mechanism-evidence.js";
23
26
 
24
27
  /** The three lights. */
25
28
  export const LIGHT = {
@@ -31,22 +34,25 @@ export type Light = (typeof LIGHT)[keyof typeof LIGHT];
31
34
 
32
35
  export type Group = "Encoding" | "Storage" | "Retrieval" | "Transformation";
33
36
 
34
- /** The evidence rows, by `MECHANISMS` id, as the view reads them. */
37
+ /** The `fired` report's rows, by `MECHANISMS` id — for totals the words carry. */
35
38
  type Rows = (id: string) => FiredRow | undefined;
36
39
 
37
40
  export interface MemoryMechanism {
38
41
  readonly name: string;
39
42
  readonly group: Group;
40
- /** `MECHANISMS` ids that are this mechanism's evidence. */
43
+ /** The `mechanism-evidence.ts` id whose verdict decides the light. */
44
+ readonly id: string;
45
+ /** `MECHANISMS` ids this line accounts for — kept off the plumbing line. */
41
46
  readonly evidence: readonly string[];
42
- /** The light and one plain line, from the evidence rows. */
43
- readonly read: (rows: Rows) => { light: Light; says: string };
47
+ /** The light and one plain line, from the shared verdict (and the report's
48
+ * totals, for the words only). */
49
+ readonly read: (v: Verdict, rows: Rows) => { light: Light; says: string };
44
50
  }
45
51
 
46
- /** Rows landed in the window, summed over the named ids. */
47
- function week(rows: Rows, ...ids: string[]): number {
52
+ /** A proof's count inside the window, summed over the named keys. */
53
+ function part(v: Verdict, ...keys: string[]): number {
48
54
  let n = 0;
49
- for (const id of ids) n += rows(id)?.firedInWindow ?? 0;
55
+ for (const p of v.parts) if (keys.includes(p.key)) n += p.count;
50
56
  return n;
51
57
  }
52
58
 
@@ -60,18 +66,50 @@ const NOT_BUILT = (why: string) => (): { light: Light; says: string } => ({
60
66
  });
61
67
 
62
68
  /**
63
- * THE ELEVEN, in the site's four groups and its order. `evidence` lists every
64
- * id a `read` looks at, so the test can check each one still exists.
69
+ * THE CONSOLE'S WINDOW: seven CALENDAR days, today included, in the store's
70
+ * zone — the same window the `fired` report counts over. The lived-day bound
71
+ * only keeps the read cheap (a lived day is never longer than a calendar day).
72
+ */
73
+ export function calendarWindow(store: ReadOnlyStore, today: string): EvidenceWindow {
74
+ let livedDay = 0;
75
+ try {
76
+ livedDay = store.livedDay();
77
+ } catch {
78
+ livedDay = 0;
79
+ }
80
+ const from = daysBefore(today, FIRED_DAYS - 1);
81
+ const zone = store.zone();
82
+ return {
83
+ sinceDay: Math.max(0, livedDay - FIRED_DAYS),
84
+ today: livedDay,
85
+ contains: (row: EventRow) => {
86
+ const date = rowDate(row, payloadOf(row), zone);
87
+ return date >= from && date <= today;
88
+ },
89
+ };
90
+ }
91
+
92
+ /** The shared verdicts over the console's window. */
93
+ export function consoleVerdicts(store: ReadOnlyStore, today: string): Verdict[] {
94
+ return mechanismEvidence(store, calendarWindow(store, today)).verdicts;
95
+ }
96
+
97
+ /**
98
+ * THE TWELVE (Dreaming joined the eleven on 2026-09-26, beside Consolidation),
99
+ * in the site's four groups and its order. Whether each one fired
100
+ * is `mechanism-evidence.ts`'s call, shared with the dashboard; the words are
101
+ * this console's own.
65
102
  */
66
103
  export const MEMORY_MECHANISMS: readonly MemoryMechanism[] = [
67
104
  // ── Encoding ──
68
105
  {
69
106
  name: "Salience",
70
107
  group: "Encoding",
108
+ id: "salience",
71
109
  evidence: ["deposit", "chunk-gate"],
72
- read: (rows) => {
73
- const n = week(rows, "deposit", "chunk-gate");
74
- return n > 0
110
+ read: (v) => {
111
+ const n = part(v, "deposit", "chunk");
112
+ return v.fired
75
113
  ? { light: LIGHT.working, says: `${plural(n, "memory", "memories")} written and scored` }
76
114
  : { light: LIGHT.idle, says: "built, not firing yet: no memories written this week" };
77
115
  },
@@ -79,21 +117,20 @@ export const MEMORY_MECHANISMS: readonly MemoryMechanism[] = [
79
117
  {
80
118
  name: "Emotion",
81
119
  group: "Encoding",
120
+ id: "emotional",
82
121
  evidence: ["feelings", "emotion-weight", "mood-match"],
83
122
  // Emotion part A (2026-09-26): a memory's strongest feeling lifts it and
84
123
  // slows its fading, and a recorded mood lifts matching memories in recall.
85
- // Working when a memory carrying feeling was written this week or a mood
86
- // lifted a memory that came to mind; the totals ride along either way.
87
- read: (rows) => {
124
+ read: (v, rows) => {
88
125
  const weighted = rows("emotion-weight")?.total ?? 0;
89
126
  const withFeelings = rows("feelings")?.total ?? 0;
90
- const newWeighted = week(rows, "emotion-weight");
91
- const matched = week(rows, "mood-match");
127
+ const newWeighted = part(v, "weighted");
128
+ const matched = part(v, "moodMatched");
92
129
  const held = `${plural(weighted, "memory", "memories")} held higher and fading slower (${String(withFeelings)} with recorded feelings)`;
93
- if (newWeighted + matched > 0) {
130
+ if (v.fired) {
94
131
  const parts: string[] = [];
95
132
  if (newWeighted > 0) parts.push(`${plural(newWeighted, "new memory", "new memories")} carrying feeling`);
96
- if (matched > 0) parts.push(`${plural(matched, "turn")} where a mood brought matching memories closer`);
133
+ if (matched > 0) parts.push(`${plural(matched, "memory", "memories")} a matching mood brought closer`);
97
134
  return { light: LIGHT.working, says: `${parts.join("; ")}; ${held}` };
98
135
  }
99
136
  return {
@@ -109,34 +146,25 @@ export const MEMORY_MECHANISMS: readonly MemoryMechanism[] = [
109
146
  {
110
147
  name: "Forgetting",
111
148
  group: "Storage",
149
+ id: "decay",
112
150
  evidence: ["decay", "prune", "fade", "sleep-cycle"],
113
- read: (rows) => {
114
- // `memory.pruned` and `band.transition` are one row per memory; the fade
115
- // is one row per night that faded a card.
116
- const letGo = week(rows, "prune");
117
- const dropped = week(rows, "decay");
118
- const faded = week(rows, "fade");
119
- const cycles = week(rows, "sleep-cycle");
151
+ read: (v) => {
152
+ if (!v.fired) return { light: LIGHT.idle, says: "built, not firing yet: nothing faded this week" };
153
+ const letGo = part(v, "pruned");
154
+ const dropped = part(v, "faded");
155
+ const cards = part(v, "cards");
120
156
  const parts: string[] = [];
121
157
  if (letGo > 0) parts.push(`${plural(letGo, "memory", "memories")} let go at the floor`);
122
158
  if (dropped > 0) parts.push(`${plural(dropped, "memory", "memories")} faded a band`);
123
- if (faded > 0) parts.push("unused names faded");
124
- if (parts.length > 0) {
125
- if (letGo === 0) parts.push("nothing at the floor yet");
126
- return { light: LIGHT.working, says: parts.join("; ") };
127
- }
128
- if (cycles > 0) {
129
- return {
130
- light: LIGHT.working,
131
- says: `decay ran in ${plural(cycles, "sleep cycle")}; nothing at the floor yet`,
132
- };
133
- }
134
- return { light: LIGHT.idle, says: "built, not firing yet: no sleep cycle ran this week" };
159
+ if (cards > 0) parts.push("unused names faded");
160
+ if (letGo === 0) parts.push("nothing at the floor yet");
161
+ return { light: LIGHT.working, says: parts.join("; ") };
135
162
  },
136
163
  },
137
164
  {
138
165
  name: "Interference",
139
166
  group: "Storage",
167
+ id: "interference",
140
168
  evidence: [],
141
169
  read: NOT_BUILT("only exact duplicates are merged"),
142
170
  },
@@ -144,35 +172,34 @@ export const MEMORY_MECHANISMS: readonly MemoryMechanism[] = [
144
172
  {
145
173
  name: "Retrieval",
146
174
  group: "Retrieval",
175
+ id: "retrieval",
147
176
  evidence: ["recall-decision", "credit"],
148
- read: (rows) => {
149
- const turns = week(rows, "recall-decision");
150
- // `recall.credit` is one row per session end, not per memory — so it is
151
- // said as a fact, never as a count of memories.
152
- const credited = week(rows, "credit") > 0;
153
- if (turns === 0) {
154
- return { light: LIGHT.idle, says: "built, not firing yet: no turns checked this week" };
155
- }
156
- return {
157
- light: LIGHT.working,
158
- says: credited
159
- ? `${plural(turns, "turn")} checked; memories used were strengthened`
160
- : `${plural(turns, "turn")} checked; nothing used yet, so nothing strengthened`,
161
- };
177
+ read: (v) => {
178
+ if (!v.fired) return { light: LIGHT.idle, says: "built, not firing yet: nothing came to mind this week" };
179
+ const turns = part(v, "turns");
180
+ const lookups = part(v, "lookups");
181
+ const credited = part(v, "credited");
182
+ const parts: string[] = [];
183
+ if (turns > 0) parts.push(`${plural(turns, "turn")} brought memories to mind`);
184
+ if (lookups > 0) parts.push(plural(lookups, "deliberate look-up"));
185
+ parts.push(
186
+ credited > 0
187
+ ? `${plural(credited, "memory", "memories")} used and strengthened`
188
+ : "nothing used yet, so nothing strengthened",
189
+ );
190
+ return { light: LIGHT.working, says: parts.join("; ") };
162
191
  },
163
192
  },
164
193
  {
165
194
  name: "Association",
166
195
  group: "Retrieval",
196
+ id: "association",
167
197
  evidence: ["association-saved", "association"],
168
- read: (rows) => {
169
- const saved = week(rows, "association-saved");
198
+ read: (v, rows) => {
199
+ const saved = part(v, "links");
170
200
  const held = rows("association")?.total ?? 0;
171
- if (saved > 0) {
172
- return {
173
- light: LIGHT.working,
174
- says: `links saved after ${plural(saved, "session")}; ${plural(held, "link")} held`,
175
- };
201
+ if (v.fired) {
202
+ return { light: LIGHT.working, says: `${plural(saved, "link")} written this week; ${plural(held, "link")} held` };
176
203
  }
177
204
  return {
178
205
  light: LIGHT.idle,
@@ -186,17 +213,16 @@ export const MEMORY_MECHANISMS: readonly MemoryMechanism[] = [
186
213
  {
187
214
  name: "Prospective",
188
215
  group: "Retrieval",
216
+ id: "prospective",
189
217
  evidence: ["prospective-dated", "prospective-fired", "prospective-plain"],
190
- // Built end to end since 2026-09-26: `note` and `session_end` take a date,
191
- // a quiet one comes back as a footnote cue (`prospective.fire`), a plain
192
- // one is said on its day (`prospective.plain`). Grey only when nothing is
193
- // dated at all — then there is truly nothing for it to do.
194
- read: (rows) => {
195
- const dated = rows("prospective-dated")?.total ?? 0;
196
- const quiet = week(rows, "prospective-fired");
197
- const plain = week(rows, "prospective-plain");
218
+ // Built end to end since 2026-09-26. With nothing dated it is still built,
219
+ // just holding nothing — so it is idle, never "not built" (2026-09-26).
220
+ read: (v, rows) => {
221
+ const dated = v.held ?? rows("prospective-dated")?.total ?? 0;
222
+ const quiet = part(v, "quiet");
223
+ const plain = part(v, "plain");
198
224
  const held = `${plural(dated, "dated memory", "dated memories")} held`;
199
- if (quiet + plain > 0) {
225
+ if (v.fired) {
200
226
  const parts: string[] = [];
201
227
  if (plain > 0) parts.push(`${String(plain)} said plainly`);
202
228
  if (quiet > 0) parts.push(`${String(quiet)} as quiet footnotes`);
@@ -207,49 +233,75 @@ export const MEMORY_MECHANISMS: readonly MemoryMechanism[] = [
207
233
  }
208
234
  return dated > 0
209
235
  ? { light: LIGHT.idle, says: `built, nothing due this week: ${held}` }
210
- : { light: LIGHT.notBuilt, says: "nothing dated yet: a note with a date comes back around that day" };
236
+ : { light: LIGHT.idle, says: "built, nothing dated yet: a note with a date comes back around that day" };
211
237
  },
212
238
  },
213
239
  // ── Transformation ──
214
240
  {
215
241
  name: "Consolidation",
216
242
  group: "Transformation",
217
- evidence: ["sleep-cycle", "promotion", "dedup"],
218
- read: (rows) => {
219
- const cycles = week(rows, "sleep-cycle");
220
- if (cycles === 0) {
221
- return { light: LIGHT.idle, says: "built, not firing yet: no sleep cycle ran this week" };
243
+ id: "consolidation",
244
+ evidence: ["sleep-cycle", "promotion", "dedup", "returns", "dream-replays", "core-demote", "upgrade-census"],
245
+ read: (v) => {
246
+ if (v.fired) {
247
+ const parts: string[] = [];
248
+ const returns = part(v, "returns");
249
+ const promoted = part(v, "promoted");
250
+ const merged = part(v, "merged") + part(v, "dreamMerged");
251
+ const rose = part(v, "rose");
252
+ if (returns > 0) parts.push(`${plural(returns, "return")} made memories fade more slowly`);
253
+ if (promoted > 0) parts.push(`${plural(promoted, "memory", "memories")} became core`);
254
+ if (merged > 0) parts.push(`${plural(merged, "near-copy", "near-copies")} merged`);
255
+ if (rose > 0) parts.push(`${plural(rose, "memory", "memories")} settled a band higher`);
256
+ return { light: LIGHT.working, says: parts.join("; ") };
257
+ }
258
+ const s = v.schedule;
259
+ if (s !== null && s.onTime && s.lastRanDay !== null) {
260
+ const next = s.nextInDays <= 0 ? "at the next session's end" : `in ${plural(s.nextInDays, "lived day")}`;
261
+ return { light: LIGHT.idle, says: `built, ran on schedule with nothing to change; next run ${next}` };
262
+ }
263
+ return { light: LIGHT.idle, says: "built, not firing yet: nothing consolidated this week" };
264
+ },
265
+ },
266
+ {
267
+ name: "Dreaming",
268
+ group: "Transformation",
269
+ id: "dreaming",
270
+ evidence: ["dream", "dream-changes", "dream-ask"],
271
+ read: (v) => {
272
+ const dreams = part(v, "dreams");
273
+ const changes = part(v, "changes");
274
+ if (v.fired) {
275
+ return {
276
+ light: LIGHT.working,
277
+ says: `${plural(dreams, "dream")} this week${changes > 0 ? ` (${plural(changes, "change")})` : ""}`,
278
+ };
222
279
  }
223
- const promoted = week(rows, "promotion");
224
- const merged = week(rows, "dedup");
225
- const extra: string[] = [];
226
- if (promoted > 0) extra.push(`${plural(promoted, "memory", "memories")} became core`);
227
- if (merged > 0) extra.push(`${plural(merged, "duplicate")} merged`);
228
280
  return {
229
- light: LIGHT.working,
230
- says: `${plural(cycles, "sleep cycle")} ran${extra.length > 0 ? `; ${extra.join(", ")}` : ""}`,
281
+ light: LIGHT.idle,
282
+ says:
283
+ v.lastFiredDay === null
284
+ ? "built, not firing yet: no dream yet (a session asks, once a day, and you say yes or not today)"
285
+ : `built, not firing this week: the last dream was on lived day ${String(v.lastFiredDay)}`,
231
286
  };
232
287
  },
233
288
  },
234
289
  {
235
290
  name: "Reconsolidation",
236
291
  group: "Transformation",
292
+ id: "reconsolidation",
237
293
  evidence: ["revision", "accommodation"],
238
- read: (rows) => {
239
- const pressed = week(rows, "revision");
240
- const replaced = week(rows, "accommodation");
241
- if (pressed + replaced > 0) {
242
- const parts: string[] = [];
243
- if (replaced > 0) parts.push(`${plural(replaced, "memory", "memories")} corrected, old version kept`);
244
- if (pressed > 0) parts.push(`${plural(pressed, "belief")} challenged`);
245
- return { light: LIGHT.working, says: parts.join("; ") };
246
- }
247
- return { light: LIGHT.idle, says: "built, not firing yet: nothing corrected this week" };
294
+ read: (v) => {
295
+ const pressed = part(v, "pressure");
296
+ return v.fired
297
+ ? { light: LIGHT.working, says: `${plural(pressed, "correction")} weighed against old memories` }
298
+ : { light: LIGHT.idle, says: "built, not firing yet: nothing corrected this week" };
248
299
  },
249
300
  },
250
301
  {
251
302
  name: "Schemas",
252
303
  group: "Transformation",
304
+ id: "schema",
253
305
  // Entity cards are built; beliefs about them have no live producer.
254
306
  evidence: ["entity-birth"],
255
307
  read: NOT_BUILT("nothing forms beliefs about people and projects yet"),
@@ -257,11 +309,27 @@ export const MEMORY_MECHANISMS: readonly MemoryMechanism[] = [
257
309
  {
258
310
  name: "Gist",
259
311
  group: "Transformation",
312
+ id: "episodic-semantic",
260
313
  evidence: ["gist"],
261
- read: NOT_BUILT("many episodes are not yet distilled into one lasting memory"),
314
+ // PARTLY (2026-09-26): a dream can write the pattern it sees as a gist.
315
+ read: (v) =>
316
+ v.fired
317
+ ? { light: LIGHT.working, says: `${plural(part(v, "gist"), "pattern")} dreamed into a memory of its own` }
318
+ : { light: LIGHT.idle, says: "partly built, not firing this week: only a dream writes a gist so far" },
262
319
  },
263
320
  ];
264
321
 
322
+ /** One line's reading: the shared verdict for its id, in the console's words. */
323
+ export function readMechanism(
324
+ m: MemoryMechanism,
325
+ verdicts: readonly Verdict[],
326
+ rows: Rows,
327
+ ): { light: Light; says: string } {
328
+ const v = verdicts.find((x) => x.id === m.id);
329
+ if (v === undefined) return { light: LIGHT.notBuilt, says: "not built yet" };
330
+ return m.read(v, rows);
331
+ }
332
+
265
333
  /**
266
334
  * THE PLUMBING ROWS WHOSE FIRING MEANS SOMETHING FAILED, with the words to say
267
335
  * it in. Every other plumbing row — a failure that never happened, an owner
@@ -298,7 +366,7 @@ export function plumbingLine(report: FiredReport): string {
298
366
 
299
367
  /** The whole short view, as plain lines: one per mechanism in the site's four
300
368
  * groups and order, then the plumbing in one line. */
301
- export function mechanismsLines(report: FiredReport): string[] {
369
+ export function mechanismsLines(report: FiredReport, verdicts: readonly Verdict[]): string[] {
302
370
  const byId = new Map(report.rows.map((r) => [r.id, r]));
303
371
  const rows: Rows = (id) => byId.get(id);
304
372
  const width = Math.max(...MEMORY_MECHANISMS.map((m) => m.name.length)) + 2;
@@ -307,7 +375,7 @@ export function mechanismsLines(report: FiredReport): string[] {
307
375
  lines.push("This memory is new, so most of these have had nothing to do yet.", "");
308
376
  }
309
377
  for (const m of MEMORY_MECHANISMS) {
310
- const { light, says } = m.read(rows);
378
+ const { light, says } = readMechanism(m, verdicts, rows);
311
379
  lines.push(`${light} ${m.name.padEnd(width)}${says}`);
312
380
  }
313
381
  lines.push(
@@ -33,6 +33,11 @@ Legibility is the product's answer to the trust question a brain never has to fa
33
33
  content hash. For now that is what it prints; until 2026-09-18 it printed the markdown
34
34
  file's path instead, which named a filesystem layout rather than the memory, and which
35
35
  the bodies-in-rows work takes away.
36
+ - **The dream journal, and what crossed into the core.** [new, 2026-09-26] Each dream
37
+ with its journal and every change it made (the memories it touched, clickable; an undone
38
+ change struck through), and the core's recent history — the crossings with their lane,
39
+ the owner's demotions with his reason, a dream's nominations. A dream is shown as a
40
+ dream: its journal is read from the `dreams` table and never presented as a memory.
36
41
 
37
42
  ## 4. Drops / simplifies
38
43
 
@@ -153,3 +153,15 @@ appends a raw string name would go unlisted without failing `tsc`.
153
153
  small by construction. Negligible today; wrong at a hundred names.
154
154
 
155
155
  **Owner:** `store/`.
156
+
157
+
158
+ ## §6 — Returns are kept by moment, the lights' window by lived day (2026-09-26)
159
+
160
+ **Have:** `store.returnCounts(sinceAt)` counts the `returns` table from a UTC
161
+ moment; the mechanism window is seven LIVED days. A light that wants "returns in
162
+ the window" has to find the window's opening moment some other way (the earliest
163
+ durable row on or after the window's first lived day is the honest proxy).
164
+
165
+ **Want:** `returnCounts({ sinceDay })` — the table already carries `day`.
166
+
167
+ **Owner:** `store/`.
@@ -473,3 +473,41 @@ preload's temp `HOME`, read until `ctrl-c to stop.`, then killed — the shape
473
473
  preload.ts names as safe for a spawned child. The install loop's `serve` step asserts
474
474
  both refusals under its `perl alarm`, in the same step, so the step count QUICKSTART
475
475
  quotes did not move.
476
+
477
+
478
+ ## 2026-09-26 — dreaming and the core lanes, shown
479
+
480
+ The dreaming + consolidation build (`core/dream/`, physics §5.3/§5.11) gave the
481
+ dashboard three things to show, all read-only:
482
+
483
+ - **The dream journal** (`views/dreams.ts#dreamsView`, `/api/dreams`, and the
484
+ `dreams` part of `/api/mind`; drawn by `pages/self/sections/dreams.js` under
485
+ the journal). Each dream: date, state (`begun` → "dreaming", `journaled` →
486
+ "woke", `undone`), title, the journal entry rendered as markdown, and every
487
+ change in order. A merge names the memory it made and then its originals
488
+ through `revealHere`, so they read as they stood rather than as what they
489
+ became; everything else goes through `reveal`, so a confidential memory a
490
+ dream touched is withheld as everywhere. The journal is the owner's to read in
491
+ full — it lives in the `dreams` table and is never a memory.
492
+ - **What crossed lately** (`views/dreams.ts#coreHistory`, `settling.history`,
493
+ drawn at the top of the settling section): the newest crossings into the core
494
+ with the lane that carried each (fast: strongly felt and came back; slow: kept
495
+ coming back over weeks), the owner's demotions with his reason, and a dream's
496
+ nominations — which are only that; a lane promotes.
497
+ - **The seven new durable names** (`dream.begun`, `dream.changed`,
498
+ `dream.journaled`, `dream.undone`, `dream.ask`, `band.demoted`,
499
+ `physics.upgrade.census`) are in `DURABLE_EVENTS` with a gloss, a narrator, a
500
+ flow node (a dream is a kind of sleep, so `sleep`; the ask is put to a
501
+ `session`; a demotion is the owner reaching into the `store`) and a ref kind
502
+ (a dream's rows point at the DREAM, not at a memory, so `none`). The
503
+ `band.promoted` narrator now names the lane when the row carries one.
504
+
505
+ Two small things the build learned. The candidates on the settling section are
506
+ now memories about me or about us, measured by the lanes (`views/mind.ts`), and a
507
+ place or a plain fact is counted apart as "not for the core" rather than "out of
508
+ reach by use". And the adapter's import scan reads a quote right after the word
509
+ `from` as a module path, so `d["from"]` in a view is written as a destructure.
510
+
511
+ The Consolidation and Dreaming LIGHTS are deliberately not here: master moved the
512
+ mechanism lights into `src/adapters/mechanism-evidence.ts` (#250), and the
513
+ builder wires those two there after the rebase.
@@ -93,6 +93,16 @@ import { RETENTION_EVENT } from "../../core/remember/index.js";
93
93
  // The vector cache's identity check (2026-09-23, #190): the one durable row the
94
94
  // store writes when an open changed what box 3's vectors are filed under.
95
95
  import { EMBEDDER_RECONCILED_EVENT } from "../../core/store/index.js";
96
+ // Dreaming (2026-09-26, `dream/`): the five rows a dream leaves, from the module
97
+ // itself; the v8 upgrade's one-time census, from `sleep/`.
98
+ import {
99
+ DREAM_ASK_EVENT,
100
+ DREAM_BEGUN_EVENT,
101
+ DREAM_CHANGED_EVENT,
102
+ DREAM_JOURNALED_EVENT,
103
+ DREAM_UNDONE_EVENT,
104
+ } from "../../core/dream/index.js";
105
+ import { V8_CENSUS_EVENT } from "../../core/sleep/index.js";
96
106
 
97
107
  /** Display order for the bands, weakest commitment first. EXHAUSTIVE BY TYPE. */
98
108
  const BAND_ORDER = {
@@ -183,7 +193,16 @@ export type DurableEventName =
183
193
  | typeof JOURNAL_COPY_FAILED_EVENT
184
194
  | typeof STORE_EXPORT_EVENT
185
195
  | typeof RETENTION_EVENT
186
- | typeof EMBEDDER_RECONCILED_EVENT;
196
+ | typeof EMBEDDER_RECONCILED_EVENT
197
+ | typeof DREAM_BEGUN_EVENT
198
+ | typeof DREAM_CHANGED_EVENT
199
+ | typeof DREAM_JOURNALED_EVENT
200
+ | typeof DREAM_UNDONE_EVENT
201
+ | typeof DREAM_ASK_EVENT
202
+ // The owner's demotion (`Counterpart.demoteCore`) writes this name as a
203
+ // literal; it is the mirror of `band.promoted`.
204
+ | "band.demoted"
205
+ | typeof V8_CENSUS_EVENT;
187
206
 
188
207
  export const DURABLE_EVENTS = {
189
208
  "adapter.ask": "the Stop ask was evaluated (asked, paced out, or capped for the day)",
@@ -282,6 +301,17 @@ export const DURABLE_EVENTS = {
282
301
  // The vector cache's identity check (2026-09-23, #190). Written only when an
283
302
  // open CHANGED something — never for a match — so a quiet week is no rows.
284
303
  "store.embedder.reconciled": "an open changed which model the stored vectors are filed under (reset to a new table and refilled, a paid model's vectors held until somebody chooses, a hold released, untagged vectors adopted, a decision deferred, or vectors dropped by a rebuild)",
304
+ // Dreaming (2026-09-26). Five rows, each ids and counts only: the journal's
305
+ // words live in the `dreams` table, never in the log.
306
+ "dream.begun": "a dream began: the dreamer was shown what was lived since the last one (how many new memories, how many shown in all, how many chapters)",
307
+ "dream.changed": "a dream changed memories (how many changes landed and were refused, by kind: merges, links, replays, gists, contradictions, feelings, nominations)",
308
+ "dream.journaled": "a dream ended with its journal entry written (how long, and what it changed)",
309
+ "dream.undone": "the owner reversed a whole dream (how many of its changes were put back)",
310
+ "dream.ask": "the day's dream ask was put to a session, or the owner said not today",
311
+ // The owner's door out of the core (2026-09-26).
312
+ "band.demoted": "the owner sent a core memory back to ordinary fading (and why is kept beside it)",
313
+ // The v8 upgrade's one-time proof (2026-09-26).
314
+ "physics.upgrade.census": "after the v8 upgrade, every memory was measured by the old arithmetic and the new (how many moved a band, down or up, and how many would be let go sooner or later)",
285
315
  } as const satisfies Record<DurableEventName, string>;
286
316
 
287
317
  export const DURABLE_EVENT_NAMES: readonly DurableEventName[] = Object.keys(