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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,86 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.4 — 2026-09-26
4
+
5
+ Memories stay strong by coming back, the core is for what is about the two of you, and
6
+ Counterparts can dream. **The store's format changes (v7 → v8).** The first Claude Code
7
+ session after installing copies the store (as every upgrade since 0.3.1 has) and upgrades
8
+ it; until then `counterparts doctor` says (amber) that the next session will upgrade it,
9
+ and the dashboard asks you to open a session. Close every session before installing, and
10
+ run `/mcp` → Reconnect in any you missed.
11
+
12
+ Staying strong.
13
+
14
+ - **A memory that comes back fades more slowly.** Each time a memory is used again on a
15
+ later day, it gets harder to lose — a lot after a week or more, a little the next day,
16
+ and never less than before. This replaces the one-time bonus a memory used to get for
17
+ surviving its first day.
18
+ - **Nothing you already have moves down.** Every memory in your store keeps the old
19
+ bonus path exactly, so no memory drops a band or will be let go sooner because of the
20
+ upgrade. The first sleep after the upgrade checks this on every memory, and `doctor`
21
+ prints what it found (an "Upgrade" line).
22
+ - **The days a memory was already used count as coming back.** At the upgrade, every
23
+ day a memory was used before counts toward fading more slowly. A memory the old rules
24
+ were about to make core but the new ones do not (a well-used fact, say) stays strong
25
+ that way instead, and `doctor`'s Upgrade line says how many there were.
26
+ - **"Nearby, if it helps" takes turns.** The wake's "Nearby" lane no longer shows the
27
+ same strong memory every day. A memory Claude uses because it was showing there still
28
+ counts as a use, but not as coming back; one shown a lot gives way for a while, and
29
+ returns to the lane over a few days.
30
+
31
+ The core.
32
+
33
+ - **Only memories about Claude, or about the two of you, become core** — kind `self`, and
34
+ memories about a person that name you. Facts, skills and places never do, however often
35
+ they come back.
36
+ - **Two ways in.** Strongly felt (by you or by Claude) and it came back at least once, a
37
+ couple of days later. Or it kept coming back — on five separate days over three weeks.
38
+ - **At most three a night**, strongest first; the rest wait for the next sleep.
39
+ - **You can send one back.** `counterparts core` lists the core (with how each got
40
+ there), what dreams nominated, and what you sent back; `counterparts core --demote <id>
41
+ --reason "..."` returns a memory to ordinary fading from today and keeps it out.
42
+
43
+ Dreaming.
44
+
45
+ - **Once a day, when there is something new, Claude may ask you "I haven't dreamed since
46
+ … — OK if I dream for a few minutes?"** at a natural moment. Say no and it will not
47
+ ask again that day. Say yes and a background agent replays what you lived since the
48
+ last dream beside what it resembles.
49
+ - **What a dream can do**: merge near-copies into one memory in better words (the
50
+ originals are kept), link memories that belong together, replay what matters (it
51
+ strengthens them a little), write down a pattern it notices (labelled "Dreamed", and
52
+ it starts weak until it proves true), flag two memories that disagree (Claude raises
53
+ them with you next session), record how an old feeling sits now, and nominate a
54
+ memory for the core. It cannot delete anything, change the self page, make anything
55
+ core, or rewrite a memory in place.
56
+ - **A dream journal.** Every dream keeps a journal entry, apart from your memories — a
57
+ dream is never remembered as something that happened. `counterparts dream` lists
58
+ them, `--show <id>` shows the journal and every change, and `--undo <id>` reverses a
59
+ whole dream. The dashboard's self page shows the journal and what each dream changed.
60
+
61
+ Seeing it.
62
+
63
+ - `counterparts mechanisms` and the dashboard: Consolidation now lights up on real
64
+ evidence (memories coming back, merges, memories becoming core); **Dreaming** is a new
65
+ light beside it; Gist is partly built (a dream's pattern). The self page shows what
66
+ became core lately and by which way, what you sent back, and what dreams nominated.
67
+ - `counterparts fired` has rows for returns, dream replays, dreams, dream changes, the
68
+ daily ask, demotions and the upgrade check.
69
+
70
+ **The dashboard's Memories tab, round 2.** One idea across the tab: brighter means held
71
+ more firmly. The map of everything held plots strength against age, marks the core with a
72
+ ★ and turns amber what would be let go within two weeks if it isn't used. Kinds are chips
73
+ in the list's filter row; each row shows a title, its date, the kind and its feelings, and
74
+ sorts newest or oldest first. A memory's card shows its strength curve, why it mattered,
75
+ the days it was used, its versions as one timeline, and the raw numbers under "details".
76
+
77
+ **The dashboard's Home tab, round 2.** One headline count, four small tiles (memories,
78
+ core with the closest candidate's progress, chapters, replaced), and the mechanism lights
79
+ as built, partly built or not built, with a new "waiting" ring for a mechanism that ran on
80
+ schedule with nothing to do. The dashboard and `counterparts mechanisms` now read the same
81
+ evidence for each light, so the two agree. Home's feed shows memory events only; the
82
+ housekeeping stays in the flow feed.
83
+
3
84
  ## 0.3.3 — 2026-09-26
4
85
 
5
86
  Reminders with dates, and feelings start to matter. The store's format is unchanged (still
@@ -22,7 +22,8 @@ code and the `NOTES.md` / `INTERFACE-GAPS.md` next to it.*
22
22
  | `self/` | autobiographical self | Identity documents, episodes, the wake briefing (v0's briefing, grown up). Governed: frozen self-reinforcement rules. |
23
23
  | `prospective/` | prospective memory | Future intentions, cued by time or context; fire / suppress / reference telemetry. |
24
24
  | `handoff/` | working context for a place | The per-directory handoff: where the work here stands, written as a field on the end-of-session ask, shown as a two-line pointer at the next wake in that directory, expiring in lived days. **Never a memory** — out of recall, out of credit, out of consolidation, out of identity. **Added 2026-09-20 (E1, spec §6.4 / §15 item 6).** |
25
- | `sleep/` | systems consolidation | Pure math on a cycle: decay tick (active-day clock), floor-pruning (real forgetting), re-render of the wake briefing. Zero standing model calls. |
25
+ | `sleep/` | systems consolidation | Pure math on a cycle: decay tick (active-day clock), floor-pruning (real forgetting), the core's two lanes (at most three a night), re-render of the wake briefing. Zero standing model calls. |
26
+ | `dream/` | sleep replay + REM | Dreaming: once a day, if the owner says yes, a background agent (the same model) replays what was lived since the last dream beside what it resembles — merges, links, replays, a pattern, a flagged contradiction, a softened feeling, a core nomination — each recorded for undo, with a dream journal kept apart from lived memory. The module holds the bookkeeping and the rules; the dreamer is the model. **Added 2026-09-26.** |
26
27
  | *(`time.ts`)* | — (a clock, not a memory) | The one module that converts: a moment (UTC ms from `store.now()`) to a person's local date or clock line, "today" in a zone, and calendar dates as said (day, month, year, range). A file, not a module; a test keeps hand-built dates out of `src/`. **Added 2026-09-25 (`docs/time.md`).** |
27
28
  | *(`feelings-wheel.ts`)* | — (a vocabulary) | The feelings wheel as a typed list: six cores, the middle and outer rings, valence, and the key scheme (`<core>.<word>` only for a word printed under two cores). Read by `store/` to validate the `feelings` table. **Added 2026-09-25.** |
28
29
  | *(observer)* | — (instrument stance) | **RESOLVED (owner, 2026-08-25): a MODE, not a module** — one predicate threaded through the core API, checked at the store seam. Spec moved to `docs/observer-mode.md`. |
@@ -36,7 +37,7 @@ input — does `encode` shrink to gates-and-tagging inside `remember`'s pipeline
36
37
  | adapter | job |
37
38
  |---|---|
38
39
  | `claude-code/` | Hooks: wake injection at session start, end-of-session remember, crash detection. The launch adapter. |
39
- | `mcp/` | Deliberate tools: note, recall, status — plus the Stop ask's two return channels, `session_end` (memories) and `chapter` (the episode's own journal, **added 2026-09-04**, because the ask named a door no adapter had built). |
40
+ | `mcp/` | Deliberate tools: note, recall, status — plus the Stop ask's two return channels, `session_end` (memories) and `chapter` (the episode's own journal, **added 2026-09-04**, because the ask named a door no adapter had built) — and `dream`, the dreamer's phases (**added 2026-09-26**). |
40
41
  | `cli/` | `counterparts` command: status, install, owner operations (delete, export, backup). |
41
42
  | `dashboard/` | The owner's window (constitution line 16): brain-view, revision stories, band/protected lists. Observer-mode by construction; minimal version ships DURING the parallel run. **Added 2026-08-25 (owner elevation).** |
42
43
  | `sessions.ts` | Not an adapter — a leaf both may import: the live-session registry a host's hooks write (`<dataDir>/sessions/`) and its tools read, so a tool launched without a session can bind to one that is real, live and in its project. Adapters stay leaves; this is the sibling they share instead of importing each other. **Added 2026-09-04**, because this host's MCP servers are launched from a static config and cannot be told which session they serve. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "counterparts",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "license": "MIT",
5
5
  "description": "Memory that turns AI tools into counterparts - a local-first, human-memory-modeled memory layer for AI.",
6
6
  "repository": {
@@ -1605,3 +1605,19 @@ beat is spent once. A full wake (the ~9 KB case above) therefore defers the plai
1605
1605
  unclaimed, and stripped from the model's copy too (`hooks.ts#withoutPlain`) — to the first
1606
1606
  prompt, whose envelope is small. When a plain line and the update notice do not fit
1607
1607
  together at a prompt, the update notice waits. Details: `docs/adversarial-review-pr243-2026-09-26.md`.
1608
+
1609
+ ## 2026-09-26 — the dream ask, and dream words tagged `dream`
1610
+
1611
+ - **The ask** rides `user-prompt-submit`'s context (the model's channel, like the quiet
1612
+ Stop ask), after the plain reminders: one line, at most once per calendar day across
1613
+ sessions (the store's `dream_asks` latch), never in the page writer's headless child,
1614
+ never under observer, never without a date. It asks the model to ask the owner at a
1615
+ natural moment. A contradiction a dream flagged is raised on the same channel, once.
1616
+ The line is claimed when composed; if the envelope ever dropped it, that day's ask is
1617
+ spent (dream INTERFACE-GAPS §2).
1618
+ - **The reader tags a block carrying `DREAM_MARK` as `dream`**, in either role and
1619
+ whoever wrote the entry — after the foreign and ritual refusals, before everything
1620
+ else. The case it exists for: a background agent's hand-back arrives in the PARENT's
1621
+ transcript as `isMeta`, origin `peer`, "Another Claude session sent a message:", which
1622
+ the reader otherwise keeps as `injected`. `test/dream.test.ts` drives that exact shape
1623
+ through parse, capture and the sweep: zero rows minted from the dream's words.
@@ -2338,6 +2338,147 @@ export function journalCopyFindings(store: Store): Finding[] {
2338
2338
  * The reading is two row reads and a date comparison, so it sits with the cheap
2339
2339
  * groups rather than with `fired`.
2340
2340
  */
2341
+ /** The meta rows the v8 upgrade and its census write (`store/operational.ts`, `sleep/upgrade.ts`). */
2342
+ const V8_UPGRADE_META = "physics.v8.upgrade";
2343
+ const V8_CENSUS_META = "physics.v8.census";
2344
+
2345
+ function metaJson(store: Store, key: string): Record<string, unknown> | null {
2346
+ const raw = store.getMeta(key);
2347
+ if (raw === undefined) return null;
2348
+ try {
2349
+ const v: unknown = JSON.parse(raw);
2350
+ return v !== null && typeof v === "object" && !Array.isArray(v) ? (v as Record<string, unknown>) : {};
2351
+ } catch {
2352
+ return {};
2353
+ }
2354
+ }
2355
+
2356
+ function metaNum(v: unknown): number {
2357
+ return typeof v === "number" && Number.isFinite(v) ? v : 0;
2358
+ }
2359
+
2360
+ /**
2361
+ * DID THE v8 UPGRADE MOVE ANY MEMORY DOWN? (dreaming + consolidation,
2362
+ * 2026-09-26.) The migration marks every row it finds as keeping its old
2363
+ * consolidation path and records what it found; the first sleep after it
2364
+ * measures every memory by the old arithmetic and the new. Green when that
2365
+ * census says nothing changed band down, nothing got weaker and nothing prunes
2366
+ * sooner; amber while the census has not run yet; red if any memory moved
2367
+ * down — the one thing the upgrade promised not to do. A store born at v8 has
2368
+ * no upgrade record and gets no line.
2369
+ */
2370
+ export function upgradeV8Findings(store: Store): Finding[] {
2371
+ const upgrade = metaJson(store, V8_UPGRADE_META);
2372
+ if (upgrade === null) return [];
2373
+ const census = metaJson(store, V8_CENSUS_META);
2374
+ const from = typeof upgrade["from"] === "string" ? upgrade["from"] : String(upgrade["from"] ?? "?");
2375
+ const rows = metaNum(upgrade["rows"]);
2376
+ const kept = metaNum(upgrade["consolidated"]);
2377
+ const data: Record<string, string | number | boolean | null> = {
2378
+ from,
2379
+ rows,
2380
+ consolidated: kept,
2381
+ identity: metaNum(upgrade["identity"]),
2382
+ censused: census !== null,
2383
+ };
2384
+ if (census === null) {
2385
+ return [
2386
+ finding(
2387
+ "upgrade-v8",
2388
+ "amber",
2389
+ "Upgrade",
2390
+ `upgraded from schema v${from} to v8 (${String(rows)} memories kept their old consolidation path); the old-versus-new check has not run yet`,
2391
+ "Nothing to do: the next sleep measures it. counterparts doctor then says whether anything moved.",
2392
+ data,
2393
+ ),
2394
+ ];
2395
+ }
2396
+ const checked = metaNum(census["checked"]);
2397
+ const down = metaNum(census["bandDown"]);
2398
+ const weaker = metaNum(census["weaker"]);
2399
+ const sooner = metaNum(census["pruneSooner"]);
2400
+ const up = metaNum(census["bandUp"]);
2401
+ const measured = {
2402
+ ...data,
2403
+ checked,
2404
+ bandDown: down,
2405
+ bandUp: up,
2406
+ weaker,
2407
+ pruneSooner: sooner,
2408
+ pruneLater: metaNum(census["pruneLater"]),
2409
+ legacyConsolidated: metaNum(census["consolidated"]),
2410
+ v7WouldPromote: metaNum(census["v7WouldPromote"]),
2411
+ };
2412
+ // By construction the three down counts read zero: they compare each row
2413
+ // with itself, returns set aside, and returns are zero at the upgrade (the
2414
+ // arithmetic for existing rows is unchanged). The branch stays as the alarm
2415
+ // if that ever stops being true. (Adversarial review of #251.)
2416
+ if (down + weaker + sooner > 0) {
2417
+ return [
2418
+ finding(
2419
+ "upgrade-v8",
2420
+ "red",
2421
+ "Upgrade",
2422
+ `the v8 upgrade moved memories down: of ${String(checked)} checked, ${String(down)} changed band down, ${String(weaker)} got weaker, ${String(sooner)} would be let go sooner`,
2423
+ "Keep this store as it is and report it: the upgrade promised no memory would move down. The copy taken before it is in the snapshots directory.",
2424
+ measured,
2425
+ ),
2426
+ ];
2427
+ }
2428
+ // WHAT THE SELF-COMPARISON CANNOT SEE (review of #251): rows the old rules
2429
+ // were about to make core. The decision (working default 2026-09-26): they
2430
+ // are let go under the new rule — only memories about me or about us become
2431
+ // core — and take the DURABILITY route instead: the upgrade credited their
2432
+ // reinforcement days as returns, so they fade as slowly as that history
2433
+ // earns. Said, green: it is the design, not a fault.
2434
+ const road = metaNum(census["v7WouldPromote"]);
2435
+ const credited = metaNum(upgrade["legacyReturns"]);
2436
+ const roadLine =
2437
+ road > 0
2438
+ ? `; ${String(road)} ${road === 1 ? "was" : "were"} on the old road to the core and ${road === 1 ? "takes" : "take"} the durability route now (only memories about me or about us become core)`
2439
+ : "";
2440
+ const creditLine = credited > 0 ? `; ${String(credited)} had their reinforcement days counted as returns` : "";
2441
+ return [
2442
+ finding(
2443
+ "upgrade-v8",
2444
+ "green",
2445
+ "Upgrade",
2446
+ `Upgrade to v8: ${String(checked)} memories checked by the old arithmetic and the new; none changed band, none weaker, none prunes sooner; ${String(metaNum(census["consolidated"]))} kept their old consolidation${up > 0 ? `; ${String(up)} moved up a band` : ""}${creditLine}${roadLine}`,
2447
+ "",
2448
+ measured,
2449
+ ),
2450
+ ];
2451
+ }
2452
+
2453
+ /**
2454
+ * DREAMING, informational (2026-09-26): when the counterpart last dreamed, and
2455
+ * whether today's ask went out or was declined. Never amber: not dreaming is
2456
+ * the owner's choice, and a quiet week is not a fault.
2457
+ */
2458
+ export function dreamingFindings(input: DoctorInput, store: Store): Finding[] {
2459
+ let last: ReturnType<Store["dreams"]>[number] | undefined;
2460
+ let ask: ReturnType<Store["dreamAsk"]>;
2461
+ try {
2462
+ last = store.dreams({ limit: 5 }).find((d) => d.state !== "undone");
2463
+ ask = store.dreamAsk(input.today);
2464
+ } catch {
2465
+ return [];
2466
+ }
2467
+ const when = last === undefined ? null : (last.date ?? `lived day ${String(last.day)}`);
2468
+ const today =
2469
+ ask === undefined ? "not asked today" : ask.state === "declined" ? "asked today; the owner said not today" : "asked today";
2470
+ return [
2471
+ finding(
2472
+ "dreaming",
2473
+ "green",
2474
+ "Dreaming",
2475
+ `${when === null ? "has not dreamed yet" : `last dreamed ${when}${last?.title ? ` — "${last.title}"` : ""}`}; ${today}`,
2476
+ "",
2477
+ { last: when, dream: last?.id ?? null, ask: ask?.state ?? null },
2478
+ ),
2479
+ ];
2480
+ }
2481
+
2341
2482
  export function selfPageFindings(store: Store): Finding[] {
2342
2483
  const page = readSelfPage(store);
2343
2484
  if (page === null) {
@@ -3076,6 +3217,11 @@ export function doctorFindings(input: DoctorInput): Finding[] {
3076
3217
  // B3's week: one bounded read of the newest `remember.prune` row. Folds into
3077
3218
  // `Background` while green.
3078
3219
  ["retention", () => retentionFindings(input, store)],
3220
+ // The v8 upgrade's proof (2026-09-26): two meta reads. Silent on a store
3221
+ // born at v8. Folds into `Background` while green.
3222
+ ["upgrade-v8", () => upgradeV8Findings(store)],
3223
+ // Dreaming (2026-09-26): informational — last dreamed, and today's ask.
3224
+ ["dreaming", () => dreamingFindings(input, store)],
3079
3225
  // LAST, and deliberately: it is the widest read here — the whole event log,
3080
3226
  // plus a pass over the ids for the table probes — so when the console's
3081
3227
  // reading is cut short this is the group that goes, and the `Budget` finding
@@ -1242,9 +1242,12 @@ export class ClaudeCodeAdapter {
1242
1242
  // for, is said at the next prompt, once (claimed at delivery).
1243
1243
  const plain = this.plainFor(input);
1244
1244
  const told = plain.due.length === 0 ? {} : { notices: plain.notices, plain: plain.due };
1245
+ // The DREAM lines (2026-09-26): the once-a-day ask, and any contradiction
1246
+ // a dream flagged that is still unraised — for the model, quietly.
1247
+ const context = `${plain.context}${this.dreamLines(input)}`;
1245
1248
  const text = input.prompt ?? "";
1246
1249
  if (text.trim().length === 0) {
1247
- return { ...out, ok: true, reason: "empty-prompt", injection: `${this.nowLine()}${plain.context.length === 0 ? "" : `\n${plain.context.trimEnd()}`}`, ...told };
1250
+ return { ...out, ok: true, reason: "empty-prompt", injection: `${this.nowLine()}${context.length === 0 ? "" : `\n${context.trimEnd()}`}`, ...told };
1248
1251
  }
1249
1252
  const result = this.counterpart.recallForTurn(
1250
1253
  {
@@ -1291,8 +1294,8 @@ export class ClaudeCodeAdapter {
1291
1294
  // sentinel stand; alone when recall surfaced nothing.
1292
1295
  injection:
1293
1296
  result.injection.length === 0
1294
- ? `${this.nowLine()}${plain.context.length === 0 ? "" : `\n${plain.context.trimEnd()}`}`
1295
- : `${this.nowLine()}\n${plain.context}${result.injection}`,
1297
+ ? `${this.nowLine()}${context.length === 0 ? "" : `\n${context.trimEnd()}`}`
1298
+ : `${this.nowLine()}\n${context}${result.injection}`,
1296
1299
  bytes: decision.bytes,
1297
1300
  sentinel: decision.sentinel,
1298
1301
  // The footnote tier is carried SEPARATELY from the loud one, because the
@@ -1304,6 +1307,31 @@ export class ClaudeCodeAdapter {
1304
1307
  });
1305
1308
  }
1306
1309
 
1310
+ /**
1311
+ * THE DREAM LINES (2026-09-26, `core/dream/`), for the MODEL only, each
1312
+ * ending in a newline: a contradiction a dream flagged, raised once awake,
1313
+ * and the day's ask — "I haven't dreamed since …" — which the model is to put
1314
+ * to the owner at a natural moment. The ask is at most once a CALENDAR day
1315
+ * across every session (the store's `dream_asks` latch decides, so of two
1316
+ * sessions racing one gets it); a "no" is the dream tool's `decline`. Never in
1317
+ * the host-mode page writer's headless child, never under observer, never
1318
+ * without a date. Only what could surface here anyway is counted or raised
1319
+ * (the dream module applies recall's gates). Never throws.
1320
+ */
1321
+ private dreamLines(input: HookInput): string {
1322
+ if (this.observer || input.at === undefined || input.pageWriter === true || input.sessionId.length === 0) return "";
1323
+ try {
1324
+ const dreams = this.counterpart.dreams;
1325
+ const lines = [...dreams.raiseLines({ session: input.sessionId })];
1326
+ const ask = dreams.askLine({ at: input.at, session: input.sessionId });
1327
+ if (ask !== null) lines.push(ask);
1328
+ if (lines.length > 0) this.emit("adapter.dream.lines", { asked: ask !== null, raised: lines.length - (ask === null ? 0 : 1) });
1329
+ return lines.map((l) => `${l}\n`).join("");
1330
+ } catch {
1331
+ return "";
1332
+ }
1333
+ }
1334
+
1307
1335
  /** `Now: Fri 25 Sep 2026, 1:40 pm MDT` — this adapter's clock, in the store's zone. */
1308
1336
  private nowLine(): string {
1309
1337
  return `Now: ${localClock(this.nowFn(), this.counterpart.store.zone())}`;
@@ -90,6 +90,7 @@ import {
90
90
  statSync,
91
91
  } from "node:fs";
92
92
 
93
+ import { carriesDreamMark } from "../../core/dream/mark.js";
93
94
  import type { Turn, TurnSource } from "../../core/remember/index.js";
94
95
 
95
96
  /**
@@ -547,6 +548,12 @@ function pieceOf(text: string, role: "user" | "assistant", author: EntryAuthor):
547
548
  // metadata says: an `isMeta` Stop-hook block read as `injected` would ENTER
548
549
  // capture, which is G11 broken by a step meant only to keep it out of pacing.
549
550
  if (source === "foreign" || source === "ritual") return { text, source };
551
+ // A DREAM'S WORDS (2026-09-26): the bundle a dreamer was shown, or the
552
+ // hand-back its background agent sends home — which this host delivers into
553
+ // the parent's transcript user-role (`isMeta`, origin `peer`) and would read
554
+ // as `injected`, kept. Refused by the mark, whoever wrote the entry and in
555
+ // either role, so a dream never reaches the sweep (`core/dream/mark.ts`).
556
+ if (carriesDreamMark(text)) return { text, source: "dream" };
550
557
  // THE ASSISTANT'S TEXT IS NEVER RECLASSIFIED BY A MARKER (review m2): its own
551
558
  // replies add pacing bytes and earn recall credit exactly as on master. The one change is
552
559
  // an entry the host SYNTHESISED as the assistant (an API error), which the
@@ -581,6 +581,17 @@ The standalone verb does not ask either: typing it is the yes.*
581
581
  treats it as foreign (never moved, never deleted, and named with one sentence saying
582
582
  what it is), and `start-fresh` leaves it byte for byte. `doctor` has no Credentials
583
583
  line; the configuration's retired settings are one green `Old settings` note.
584
+ 43. **[M] The owner's windows onto dreaming and the core (2026-09-26).** `counterparts
585
+ dream` lists the dreams, `--show <id>` prints one dream's journal and every change it
586
+ made (undone rows marked), and `--undo <id>` reverses its whole batch through
587
+ `Counterpart.dreams.undo` — the console decides nothing about what an undo does.
588
+ `counterparts core` lists the core with the lane that carried each memory there, the
589
+ dreams' nominations and the owner's demotions, and `--demote <id> --reason "…"` sends
590
+ one back to ordinary fading through `Counterpart.demoteCore`, which requires the
591
+ reason, records it, restarts fading from today and keeps the lanes from promoting it
592
+ again. Neither command is on `OWNER_OPS`: like `self-page`, reading works from an
593
+ instrument, and the write refuses at the core's own seam under observer. Confidential
594
+ rows print as `[confidential]`.
584
595
 
585
596
  ## 6. Scars honored
586
597
 
@@ -395,3 +395,19 @@ and says how much of the number is log (NOTES, 2026-09-23), which is this module
395
395
  SQL string and finalize the cache in `close()` — so a clean close is a real close. Worth
396
396
  measuring the hooks' per-turn cost before and after, since they open and close the store
397
397
  on every turn.
398
+
399
+ ## Dreaming and the core (2026-09-26)
400
+
401
+ - **`counterparts mechanisms` does not yet say "became core by the fast/slow lane"
402
+ or count a dream's changes.** The short view reads only `fired.ts`'s rows, which
403
+ count rows, not payloads; the lane is on each `band.promoted` row's payload and a
404
+ dream's change count is on `dream.changed`'s. The builder is moving the lights into
405
+ the shared `adapters/mechanism-evidence.ts` (master ef37eb1); that is where the
406
+ Consolidation / Dreaming / Gist lines belong.
407
+ - **A dream's journal cannot be removed from the console.** `remove` takes memory ids,
408
+ and a journal is not a memory (it lives in the `dreams` table). An owner who wants a
409
+ journal gone has `dream --undo`, which keeps it marked undone. A `dream --forget <id>`
410
+ would need a store write that blanks the journal text; not built.
411
+ - **`export --markdown` does not carry the dreams table** (the journals, the change
412
+ logs): it walks memories. The database export and `backup` copy the whole file, so
413
+ they do.
@@ -1800,6 +1800,31 @@ tier is primary while Voyage is frozen (ROADMAP §"Amendments"). What the build
1800
1800
  binding in `bin/counterparts.ts`. Its only caller was `credentials set`; it is a small,
1801
1801
  tested primitive, and removing it was not part of this round.
1802
1802
 
1803
+ ## `dream` and `core` (2026-09-26, dreaming + consolidation)
1804
+
1805
+ Two small commands over the core's own answers (`cli/dream-core.ts` renders, the core
1806
+ decides). Choices made here:
1807
+
1808
+ - **`--undo` is a boolean with the id after it** (`dream --undo drm_…`), because
1809
+ `start-fresh --undo` already declares `undo` as a boolean and the parser's option table
1810
+ is shared by every command; `--undo=<id>` works too. `--show` and `--demote` are new
1811
+ and are valued flags.
1812
+ - **Both are on the advanced page, not the first one.** The first page is what a person
1813
+ reads thirty seconds after installing; dreams and the core are what they look at a week
1814
+ later. `counterparts help dream` / `help core` are the full pages.
1815
+ - **A demotion needs `--reason`**, and `--reason` without `--demote` is refused rather
1816
+ than ignored: the reason is the one thing the record keeps that the store cannot
1817
+ reconstruct.
1818
+ - **`fired` gained eight rows** (`returns`, `dream`, `dream-changes`, `dream-ask`,
1819
+ `dream-replays`, `core-demote`, `upgrade-census`, and `gist` now backed by dreamed
1820
+ memories instead of "not built"). `returns` and `dream-replays` are table probes over
1821
+ the new `returns` table (dated by each row's moment); `gist` is a probe over live
1822
+ memories of source `dreamed`.
1823
+ - **Doctor gained two lines**: `Upgrade` (the v8 upgrade's census — green when nothing
1824
+ moved down, amber until the first sleep measures it, red if anything did; no line on a
1825
+ store born at v8) and `Dreaming` (informational: last dreamed, and today's ask). Both
1826
+ fold into `Background` while green.
1827
+
1803
1828
  ## `ask` by meaning, and short (2026-09-24)
1804
1829
 
1805
1830
  **By meaning.** `ask` passed `vector: null, semantic: "embedder-off"` since the days