counterparts 0.3.3 → 0.3.5

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 (168) hide show
  1. package/CHANGELOG.md +197 -0
  2. package/docs/module-map.md +3 -2
  3. package/package.json +1 -1
  4. package/src/adapters/claude-code/NOTES.md +29 -0
  5. package/src/adapters/claude-code/doctor.ts +272 -0
  6. package/src/adapters/claude-code/hooks.ts +46 -3
  7. package/src/adapters/claude-code/index.ts +2 -0
  8. package/src/adapters/claude-code/transcript.ts +7 -0
  9. package/src/adapters/cli/CONTRACT.md +11 -0
  10. package/src/adapters/cli/INTERFACE-GAPS.md +16 -0
  11. package/src/adapters/cli/NOTES.md +37 -0
  12. package/src/adapters/cli/commands.ts +202 -4
  13. package/src/adapters/cli/dream-core.ts +193 -0
  14. package/src/adapters/cli/export.ts +21 -2
  15. package/src/adapters/cli/help.ts +20 -0
  16. package/src/adapters/cli/mechanisms.ts +175 -101
  17. package/src/adapters/dashboard/CONTRACT.md +5 -0
  18. package/src/adapters/dashboard/INTERFACE-GAPS.md +12 -0
  19. package/src/adapters/dashboard/NOTES.md +38 -0
  20. package/src/adapters/dashboard/registries.ts +31 -1
  21. package/src/adapters/dashboard/source.ts +8 -0
  22. package/src/adapters/dashboard/web/README.md +144 -38
  23. package/src/adapters/dashboard/web/actions.ts +45 -3
  24. package/src/adapters/dashboard/web/app.html +2 -0
  25. package/src/adapters/dashboard/web/ask-voice.ts +364 -0
  26. package/src/adapters/dashboard/web/flow.ts +12 -0
  27. package/src/adapters/dashboard/web/lanes.ts +171 -0
  28. package/src/adapters/dashboard/web/mechanisms/association/index.js +2 -2
  29. package/src/adapters/dashboard/web/mechanisms/association/panel.js +1 -3
  30. package/src/adapters/dashboard/web/mechanisms/consolidation/index.js +9 -5
  31. package/src/adapters/dashboard/web/mechanisms/consolidation/panel.js +31 -17
  32. package/src/adapters/dashboard/web/mechanisms/decay/index.js +2 -2
  33. package/src/adapters/dashboard/web/mechanisms/decay/panel.js +1 -3
  34. package/src/adapters/dashboard/web/mechanisms/dreaming/index.js +20 -0
  35. package/src/adapters/dashboard/web/mechanisms/dreaming/panel.js +20 -0
  36. package/src/adapters/dashboard/web/mechanisms/emotional/index.js +2 -2
  37. package/src/adapters/dashboard/web/mechanisms/emotional/panel.js +24 -0
  38. package/src/adapters/dashboard/web/mechanisms/episodic-semantic/index.js +5 -5
  39. package/src/adapters/dashboard/web/mechanisms/episodic-semantic/panel.js +11 -0
  40. package/src/adapters/dashboard/web/mechanisms/index.js +19 -6
  41. package/src/adapters/dashboard/web/mechanisms/interference/index.js +2 -2
  42. package/src/adapters/dashboard/web/mechanisms/prospective/index.js +2 -2
  43. package/src/adapters/dashboard/web/mechanisms/prospective/panel.js +18 -0
  44. package/src/adapters/dashboard/web/mechanisms/reconsolidation/index.js +2 -2
  45. package/src/adapters/dashboard/web/mechanisms/reconsolidation/panel.js +1 -3
  46. package/src/adapters/dashboard/web/mechanisms/regions.js +1 -1
  47. package/src/adapters/dashboard/web/mechanisms/retrieval/index.js +2 -2
  48. package/src/adapters/dashboard/web/mechanisms/retrieval/panel.js +54 -15
  49. package/src/adapters/dashboard/web/mechanisms/salience/index.js +2 -2
  50. package/src/adapters/dashboard/web/mechanisms/salience/panel.js +1 -2
  51. package/src/adapters/dashboard/web/mechanisms/schema/index.js +2 -2
  52. package/src/adapters/dashboard/web/narrate.ts +118 -13
  53. package/src/adapters/dashboard/web/pages/health/health.css +14 -0
  54. package/src/adapters/dashboard/web/pages/health/index.js +5 -1
  55. package/src/adapters/dashboard/web/pages/health/sections/cycle.js +8 -5
  56. package/src/adapters/dashboard/web/pages/health/sections/wake.js +49 -0
  57. package/src/adapters/dashboard/web/pages/home/home.css +137 -39
  58. package/src/adapters/dashboard/web/pages/home/index.js +10 -6
  59. package/src/adapters/dashboard/web/pages/home/sections/explorer.js +129 -38
  60. package/src/adapters/dashboard/web/pages/home/sections/hero.js +20 -4
  61. package/src/adapters/dashboard/web/pages/home/sections/live-activity.js +18 -9
  62. package/src/adapters/dashboard/web/pages/home/sections/tiles.js +28 -18
  63. package/src/adapters/dashboard/web/pages/home/sections/tonight.js +74 -0
  64. package/src/adapters/dashboard/web/pages/home/sections/written.js +76 -0
  65. package/src/adapters/dashboard/web/pages/memories/fold.js +48 -0
  66. package/src/adapters/dashboard/web/pages/memories/index.js +30 -36
  67. package/src/adapters/dashboard/web/pages/memories/memories.css +102 -72
  68. package/src/adapters/dashboard/web/pages/memories/row.js +57 -0
  69. package/src/adapters/dashboard/web/pages/memories/sections/feel.js +176 -0
  70. package/src/adapters/dashboard/web/pages/memories/sections/hold.js +67 -0
  71. package/src/adapters/dashboard/web/pages/memories/sections/list.js +65 -43
  72. package/src/adapters/dashboard/web/pages/memories/sections/search.js +73 -30
  73. package/src/adapters/dashboard/web/pages/memories/state.js +12 -5
  74. package/src/adapters/dashboard/web/pages/self/index.js +19 -13
  75. package/src/adapters/dashboard/web/pages/self/sections/dreams.js +77 -0
  76. package/src/adapters/dashboard/web/pages/self/sections/journal.js +32 -13
  77. package/src/adapters/dashboard/web/pages/self/sections/map.js +217 -0
  78. package/src/adapters/dashboard/web/pages/self/sections/page.js +121 -62
  79. package/src/adapters/dashboard/web/pages/self/sections/settling.js +68 -48
  80. package/src/adapters/dashboard/web/pages/self/sections/traits.js +101 -0
  81. package/src/adapters/dashboard/web/pages/self/sections/wake.js +46 -53
  82. package/src/adapters/dashboard/web/pages/self/self.css +128 -92
  83. package/src/adapters/dashboard/web/pages/self/state.js +4 -2
  84. package/src/adapters/dashboard/web/server.ts +29 -1
  85. package/src/adapters/dashboard/web/shared/absence.js +1 -3
  86. package/src/adapters/dashboard/web/shared/memory-card-words.js +96 -0
  87. package/src/adapters/dashboard/web/shared/memory-marks.css +17 -0
  88. package/src/adapters/dashboard/web/shared/memory-marks.js +81 -0
  89. package/src/adapters/dashboard/web/shared/memory-modal.js +231 -62
  90. package/src/adapters/dashboard/web/shared/modal.css +67 -0
  91. package/src/adapters/dashboard/web/shared/tip.js +1 -1
  92. package/src/adapters/dashboard/web/shared/widgets/feed.css +4 -0
  93. package/src/adapters/dashboard/web/shared/widgets/feed.js +93 -14
  94. package/src/adapters/dashboard/web/shared/widgets/light.css +1 -0
  95. package/src/adapters/dashboard/web/shared/widgets/light.js +7 -5
  96. package/src/adapters/dashboard/web/shared/widgets/tips.css +19 -0
  97. package/src/adapters/dashboard/web/{pages/self → shared/widgets}/tips.js +15 -9
  98. package/src/adapters/dashboard/web/views/activity.ts +49 -3
  99. package/src/adapters/dashboard/web/views/archive-words.ts +27 -10
  100. package/src/adapters/dashboard/web/views/core-road.ts +56 -0
  101. package/src/adapters/dashboard/web/views/dreams.ts +199 -0
  102. package/src/adapters/dashboard/web/views/health.ts +61 -9
  103. package/src/adapters/dashboard/web/views/mechanism-panel.ts +447 -77
  104. package/src/adapters/dashboard/web/views/mechanisms.ts +181 -325
  105. package/src/adapters/dashboard/web/views/memories.ts +245 -43
  106. package/src/adapters/dashboard/web/views/memory-words.ts +133 -0
  107. package/src/adapters/dashboard/web/views/memory.ts +280 -7
  108. package/src/adapters/dashboard/web/views/mind.ts +708 -102
  109. package/src/adapters/dashboard/web/views/overview.ts +77 -46
  110. package/src/adapters/dashboard/web/views/search.ts +80 -3
  111. package/src/adapters/dashboard/web/views/self-map.ts +124 -0
  112. package/src/adapters/dashboard/web/views/shared.ts +14 -0
  113. package/src/adapters/dashboard/web/views/tonight.ts +158 -0
  114. package/src/adapters/dashboard/web/views/traits.ts +197 -0
  115. package/src/adapters/dashboard/web/views/written-returned.ts +93 -0
  116. package/src/adapters/dashboard/web/views.ts +8 -4
  117. package/src/adapters/fired.ts +107 -5
  118. package/src/adapters/mcp/CONTRACT.md +3 -0
  119. package/src/adapters/mcp/NOTES.md +51 -0
  120. package/src/adapters/mcp/bin/serve.ts +6 -1
  121. package/src/adapters/mcp/index.ts +4 -0
  122. package/src/adapters/mcp/server.ts +343 -3
  123. package/src/adapters/mcp/tools.ts +324 -1
  124. package/src/adapters/mechanism-evidence.ts +488 -0
  125. package/src/core/counterpart.ts +198 -5
  126. package/src/core/dream/CONTRACT.md +227 -0
  127. package/src/core/dream/INTERFACE-GAPS.md +49 -0
  128. package/src/core/dream/NOTES.md +190 -0
  129. package/src/core/dream/index.ts +1197 -0
  130. package/src/core/dream/mark.ts +14 -0
  131. package/src/core/dream/mind.ts +110 -0
  132. package/src/core/dream/reflect.ts +1154 -0
  133. package/src/core/dream/tunables.ts +56 -0
  134. package/src/core/physics/CONTRACT.md +114 -24
  135. package/src/core/physics/NOTES.md +187 -0
  136. package/src/core/physics/index.ts +438 -68
  137. package/src/core/recall/NOTES.md +16 -0
  138. package/src/core/recall/index.ts +9 -2
  139. package/src/core/remember/CONTRACT.md +5 -0
  140. package/src/core/remember/spans.ts +11 -1
  141. package/src/core/self/CONTRACT.md +11 -1
  142. package/src/core/self/INTERFACE-GAPS.md +11 -0
  143. package/src/core/self/NOTES.md +45 -0
  144. package/src/core/self/identity.ts +95 -5
  145. package/src/core/self/index.ts +17 -0
  146. package/src/core/self/tunables.ts +17 -0
  147. package/src/core/sleep/CONTRACT.md +18 -1
  148. package/src/core/sleep/INTERFACE-GAPS.md +19 -0
  149. package/src/core/sleep/NOTES.md +87 -0
  150. package/src/core/sleep/consolidate.ts +270 -96
  151. package/src/core/sleep/decay.ts +11 -0
  152. package/src/core/sleep/index.ts +14 -1
  153. package/src/core/sleep/tunables.ts +9 -0
  154. package/src/core/sleep/types.ts +34 -0
  155. package/src/core/sleep/upgrade.ts +168 -0
  156. package/src/core/store/CONTRACT.md +27 -0
  157. package/src/core/store/NOTES.md +137 -0
  158. package/src/core/store/errors.ts +12 -0
  159. package/src/core/store/feelings.ts +16 -0
  160. package/src/core/store/index.ts +1100 -15
  161. package/src/core/store/operational.ts +662 -7
  162. package/src/core/store/owner-op-seam.ts +188 -1
  163. package/src/core/store/traits.ts +161 -0
  164. package/src/core/types.ts +43 -0
  165. package/src/adapters/dashboard/web/pages/home/sections/recent-chapters.js +0 -13
  166. package/src/adapters/dashboard/web/pages/memories/sections/constellation.js +0 -178
  167. package/src/adapters/dashboard/web/pages/memories/sections/kinds.js +0 -42
  168. package/src/adapters/dashboard/web/shared/widgets/chapters.js +0 -15
package/CHANGELOG.md CHANGED
@@ -1,5 +1,202 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.5 — 2026-09-27
4
+
5
+ Claude reflects after a dream, tells you about it in the morning, and rewrites its self
6
+ page from what it reflected on; what a memory is about now decides the core. **The
7
+ store's format changes (v8 → v9).** The first Claude Code session after installing
8
+ copies the store (as every upgrade since 0.3.1 has) and upgrades it; until then
9
+ `counterparts doctor` says (amber) that the next session will upgrade it, and the
10
+ dashboard asks you to open a session. Close every session before installing, and run
11
+ `/mcp` → Reconnect in any you missed.
12
+
13
+ Reflecting.
14
+
15
+ - **After a dream, Claude reflects on it, awake.** The dream's background agent now
16
+ dreams, writes its journal, then reflects, as three separate steps. The reflection is
17
+ handed the dream (marked as dreamed), the last few days' chapters and memories, what is
18
+ on its mind (dated things in the next two weeks, disagreements still standing, where
19
+ the work stands), the self page and the core, and answers three questions that change
20
+ from night to night. It sees memories and feelings, not the numbers behind the core.
21
+ - **What it writes.** An entry, kept as a memory titled "Reflected: …" when it rests on
22
+ memories it names. An entry that names nothing counts as "nothing much": it is kept on
23
+ the record, and nothing else is written or said. One reflection a lived day.
24
+ - **The self page is rewritten from the reflection.** The page had stopped changing: the
25
+ morning writer needed room in the session start that a full wake no longer left it. Now
26
+ the reflection rewrites the page from the memories it names (at least one from the core
27
+ when there is a core), and that night's morning writer stands down. A dream's own
28
+ pattern is never a source for the page, and its words may not go on it.
29
+ - **The morning share.** The reflection may leave a short note for you (at most 700
30
+ characters, naming what it rests on). Claude tells it once: when the dream hands back,
31
+ or, if that session has already ended, at the start of the next one.
32
+ - **Feelings recorded later.** The reflection may record how a memory it was shown feels
33
+ now, marked as recorded later, on that day. It may feel stronger than anything felt at
34
+ the time.
35
+ - **What a memory is about**: me, us, owner, work or world. Claude can say it when it
36
+ writes (`note` and `session_end` take `about`), and the reflection can set or change it,
37
+ with its reason. Each change is recorded; one that makes a memory about Claude, the two
38
+ of you or you is said in the next morning share.
39
+ - **You are named, not "him".** What the reflection and the dream say about you uses
40
+ your name as the store knows it (`install --name`), or "the owner" when there is none —
41
+ never a pronoun that guesses.
42
+ - `reflect` is a ninth tool for the MCP server; `counterparts dream --show <id>` includes
43
+ the dream's reflection, `--show rfl_…` shows one, and `--list` lists them. Undoing a
44
+ dream leaves its reflection. Removing a memory also redacts any reflection that named
45
+ it, and that reflection's entry. `pageWriter.mode: "off"` stops the reflection's page
46
+ write too.
47
+
48
+ The core.
49
+
50
+ - **What a memory is about decides whether it can become core**, not its kind: about me
51
+ (Claude), about us, or about the owner. A skill never becomes core. A memory marked
52
+ work or world does not either.
53
+ - **Nothing changes overnight.** The upgrade marks memories by the old rule: every
54
+ `self` memory is about me, and every memory about a person that names you is about the
55
+ owner. So the candidates the morning after are the ones from the night before, and
56
+ `doctor`'s Upgrade line says how many were marked each way.
57
+ - **A reflection naming a memory counts as it coming back.** It counts toward the fast
58
+ way in (strongly felt and came back after a gap), and toward the slow way at most once
59
+ a week per memory.
60
+ - **A memory can reach the core on reflection alone, and you can close that.** This is
61
+ on by default: a feeling the reflection records later and a reflection naming the
62
+ memory both count. When one gets there that way, the next morning share says so, and
63
+ `doctor` counts it. `counterparts core --reflected-feeling off` closes it: the fast way
64
+ then needs a feeling felt at the time and an ordinary use after a gap, and a reflection
65
+ may only move what a memory is about toward work or world. `on` opens it again.
66
+ `counterparts core` says which way it stands.
67
+
68
+ Traits.
69
+
70
+ - **A memory can carry a small note on how Claude acted in it**, on seven fixed scales
71
+ (careful–bold, agreeable–candid, guarded–open, focused–curious, following–initiating,
72
+ inward–outward, serious–playful). `note`, `session_end` and the reflection take them;
73
+ most memories carry none. They are for display only: they change nothing about the
74
+ core, fading, the self page or recall. `export --markdown` has a Traits section, and
75
+ `counterparts fired` has a traits row.
76
+ - **The dashboard's Self tab shows them as "How I act"**: one bar per scale, marking
77
+ where Claude has leaned lately and where it was a week ago. Tap a bar to see the
78
+ memories behind it.
79
+
80
+ Seeing it.
81
+
82
+ - `doctor` has a Reflection line: when it last reflected, whether the page was
83
+ rewritten, whether the share was told, the week's returns by where they came from
84
+ (awake, reflection, dream), and how many memories became core on reflection alone.
85
+ - `counterparts mechanisms` counts reflections beside dreams, and a dream's core
86
+ suggestions apart from its changes ("2 dreams this week (60 changes, 3 core
87
+ suggestions)"). The dashboard says the same.
88
+ - The dashboard's core views ask the same question sleep asks, so they never show a
89
+ memory as ready when sleep won't make it core (with `--reflected-feeling off` too).
90
+ Home's Tonight box says whether Claude will ask to dream next session, and why not
91
+ when it won't.
92
+
93
+ **The dashboard's Memories tab, round 3.** A memory's card says when one return would
94
+ make it core, and says "written, day N" until it is first used. Ask lists a chapter and
95
+ the memory it came from once. Version rows say when a dream merged near-copies. Ask now
96
+ reads your question in Claude's voice ("what do you remember about me?" searches "what
97
+ do I remember about" and your name) and shows what it searched, with "search exactly as
98
+ typed" to turn that off.
99
+
100
+ **The dashboard's Home tab, round 3.** Less on the page. The mechanism pills sit on one
101
+ line. Each mechanism shows one number, up to five of the memories behind it, and one line
102
+ on what it does; the rest is under "how it works". New: a strip of what was written and
103
+ what came back each day, a Tonight box (what the next sleep will do, what is close to the
104
+ core, what is near being let go), and how often what came to mind was used. Sleep checks
105
+ that did nothing move to the flow feed, and repeated lines fold into one. The core tile is
106
+ a count, and the chapters column is gone (both live on Self).
107
+
108
+ **The dashboard's Self tab, round 3.** The page's history is one strip, a dot a day: a
109
+ filled dot is a day it was rewritten, a hollow one says why it wasn't, in plain words. A
110
+ line above the page says when it has fallen behind. "Next time I wake, I start with:"
111
+ lists what the next session opens with. A map of the memories about Claude and the two of
112
+ you replaces the "closest to the core" list: the core in the middle, the closest near it.
113
+ The journal's day strip shows dates. The wake's size moved to Health.
114
+
115
+ **Health and empty pages.** Health no longer marks a step amber when it simply wasn't due
116
+ yet (consolidate and fade run every three lived days). Empty panels say "(none yet)" in
117
+ plain words.
118
+
119
+ ## 0.3.4 — 2026-09-26
120
+
121
+ Memories stay strong by coming back, the core is for what is about the two of you, and
122
+ Counterparts can dream. **The store's format changes (v7 → v8).** The first Claude Code
123
+ session after installing copies the store (as every upgrade since 0.3.1 has) and upgrades
124
+ it; until then `counterparts doctor` says (amber) that the next session will upgrade it,
125
+ and the dashboard asks you to open a session. Close every session before installing, and
126
+ run `/mcp` → Reconnect in any you missed.
127
+
128
+ Staying strong.
129
+
130
+ - **A memory that comes back fades more slowly.** Each time a memory is used again on a
131
+ later day, it gets harder to lose — a lot after a week or more, a little the next day,
132
+ and never less than before. This replaces the one-time bonus a memory used to get for
133
+ surviving its first day.
134
+ - **Nothing you already have moves down.** Every memory in your store keeps the old
135
+ bonus path exactly, so no memory drops a band or will be let go sooner because of the
136
+ upgrade. The first sleep after the upgrade checks this on every memory, and `doctor`
137
+ prints what it found (an "Upgrade" line).
138
+ - **The days a memory was already used count as coming back.** At the upgrade, every
139
+ day a memory was used before counts toward fading more slowly. A memory the old rules
140
+ were about to make core but the new ones do not (a well-used fact, say) stays strong
141
+ that way instead, and `doctor`'s Upgrade line says how many there were.
142
+ - **"Nearby, if it helps" takes turns.** The wake's "Nearby" lane no longer shows the
143
+ same strong memory every day. A memory Claude uses because it was showing there still
144
+ counts as a use, but not as coming back; one shown a lot gives way for a while, and
145
+ returns to the lane over a few days.
146
+
147
+ The core.
148
+
149
+ - **Only memories about Claude, or about the two of you, become core** — kind `self`, and
150
+ memories about a person that name you. Facts, skills and places never do, however often
151
+ they come back.
152
+ - **Two ways in.** Strongly felt (by you or by Claude) and it came back at least once, a
153
+ couple of days later. Or it kept coming back — on five separate days over three weeks.
154
+ - **At most three a night**, strongest first; the rest wait for the next sleep.
155
+ - **You can send one back.** `counterparts core` lists the core (with how each got
156
+ there), what dreams nominated, and what you sent back; `counterparts core --demote <id>
157
+ --reason "..."` returns a memory to ordinary fading from today and keeps it out.
158
+
159
+ Dreaming.
160
+
161
+ - **Once a day, when there is something new, Claude may ask you "I haven't dreamed since
162
+ … — OK if I dream for a few minutes?"** at a natural moment. Say no and it will not
163
+ ask again that day. Say yes and a background agent replays what you lived since the
164
+ last dream beside what it resembles.
165
+ - **What a dream can do**: merge near-copies into one memory in better words (the
166
+ originals are kept), link memories that belong together, replay what matters (it
167
+ strengthens them a little), write down a pattern it notices (labelled "Dreamed", and
168
+ it starts weak until it proves true), flag two memories that disagree (Claude raises
169
+ them with you next session), record how an old feeling sits now, and nominate a
170
+ memory for the core. It cannot delete anything, change the self page, make anything
171
+ core, or rewrite a memory in place.
172
+ - **A dream journal.** Every dream keeps a journal entry, apart from your memories — a
173
+ dream is never remembered as something that happened. `counterparts dream` lists
174
+ them, `--show <id>` shows the journal and every change, and `--undo <id>` reverses a
175
+ whole dream. The dashboard's self page shows the journal and what each dream changed.
176
+
177
+ Seeing it.
178
+
179
+ - `counterparts mechanisms` and the dashboard: Consolidation now lights up on real
180
+ evidence (memories coming back, merges, memories becoming core); **Dreaming** is a new
181
+ light beside it; Gist is partly built (a dream's pattern). The self page shows what
182
+ became core lately and by which way, what you sent back, and what dreams nominated.
183
+ - `counterparts fired` has rows for returns, dream replays, dreams, dream changes, the
184
+ daily ask, demotions and the upgrade check.
185
+
186
+ **The dashboard's Memories tab, round 2.** One idea across the tab: brighter means held
187
+ more firmly. The map of everything held plots strength against age, marks the core with a
188
+ ★ and turns amber what would be let go within two weeks if it isn't used. Kinds are chips
189
+ in the list's filter row; each row shows a title, its date, the kind and its feelings, and
190
+ sorts newest or oldest first. A memory's card shows its strength curve, why it mattered,
191
+ the days it was used, its versions as one timeline, and the raw numbers under "details".
192
+
193
+ **The dashboard's Home tab, round 2.** One headline count, four small tiles (memories,
194
+ core with the closest candidate's progress, chapters, replaced), and the mechanism lights
195
+ as built, partly built or not built, with a new "waiting" ring for a mechanism that ran on
196
+ schedule with nothing to do. The dashboard and `counterparts mechanisms` now read the same
197
+ evidence for each light, so the two agree. Home's feed shows memory events only; the
198
+ housekeeping stays in the flow feed.
199
+
3
200
  ## 0.3.3 — 2026-09-26
4
201
 
5
202
  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.** Since 2026-09-27 it also holds REFLECTION (`reflect.ts`), the waking self: usually right after a dream, lived, with its own record — an entry, the self page rewritten from the core, a morning share, feelings recorded later, and what a memory is about. |
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**), and `reflect`, the waking self's (**added 2026-09-27**). |
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.5",
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,32 @@ 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.
1624
+
1625
+
1626
+ ## 2026-09-27 — an untold morning share is carried on the prompt
1627
+
1628
+ `dreamLines` (UserPromptSubmit) now also carries a reflection's share that was never
1629
+ told, once, into a later session's context — only when the session that reflected has
1630
+ ended (its registry record ended, or quiet past `SESSION_TTL_MS`), so both do not tell
1631
+ it. Here and not in the SessionStart wake, whose byte ceiling is what stranded the page
1632
+ writer (self NOTES §27). The SessionStart page writer is left as it was: on a night the
1633
+ reflection rewrote the page it finds the night claimed and stands down.
1634
+
1635
+ - **2026-09-27, owner ruling D3 on #256:** `openAdapter` passes `pageWriter.mode` to
1636
+ `Counterpart.open`, so `off` stops the reflection's page write in the hooks' process too.
@@ -2338,6 +2338,270 @@ 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
+ /** The meta row the v9 upgrade writes (`store/operational.ts#V9_UPGRADE_KEY`). */
2454
+ const V9_UPGRADE_META = "physics.v9.upgrade";
2455
+
2456
+ /**
2457
+ * WHAT THE v9 UPGRADE CARRIED (2026-09-27, reflection + core by meaning),
2458
+ * informational. The core's first question moved from a kind label to a mark
2459
+ * set by meaning; the upgrade carried the old rule onto the rows it found, so
2460
+ * the candidates did not change overnight — this line says so, and how many
2461
+ * marks have been set by meaning since. Silent on a store born at v9.
2462
+ */
2463
+ export function upgradeV9Findings(store: Store): Finding[] {
2464
+ const upgrade = metaJson(store, V9_UPGRADE_META);
2465
+ if (upgrade === null) return [];
2466
+ const me = metaNum(upgrade["markedMe"]);
2467
+ const owner = metaNum(upgrade["markedOwner"]);
2468
+ const candidates = metaNum(upgrade["candidates"]);
2469
+ let since = 0;
2470
+ let work = 0;
2471
+ try {
2472
+ for (const e of store.coreEvents({ action: "about", limit: 10_000 })) {
2473
+ since += 1;
2474
+ if ((e.reason ?? "").startsWith("work")) work += 1;
2475
+ }
2476
+ } catch {
2477
+ since = 0;
2478
+ }
2479
+ return [
2480
+ finding(
2481
+ "upgrade-v9",
2482
+ "green",
2483
+ "Upgrade",
2484
+ `Upgrade to v9: what a memory is about is now marked by meaning; the old rule was carried so nothing changed overnight — ${String(me)} self ${me === 1 ? "memory" : "memories"} marked about me, ${String(owner)} about the owner (${String(candidates)} core ${candidates === 1 ? "candidate" : "candidates"}); ${String(since)} ${since === 1 ? "mark" : "marks"} set by the writer or a reflection since${work > 0 ? `, ${String(work)} of them "work" (out of the candidates)` : ""}`,
2485
+ "",
2486
+ { markedMe: me, markedOwner: owner, candidates, marksSince: since, work },
2487
+ ),
2488
+ ];
2489
+ }
2490
+
2491
+ /**
2492
+ * REFLECTION, informational (2026-09-27): when the waking self last
2493
+ * reflected, what it did, what became of the morning share; the week's
2494
+ * returns by source; and how many memories became core on reflection alone.
2495
+ * Never amber: a quiet week is not a fault.
2496
+ */
2497
+ export function reflectionFindings(input: DoctorInput, store: Store): Finding[] {
2498
+ let last: ReturnType<Store["reflections"]>[number] | undefined;
2499
+ let returns: ReturnType<Store["returnCounts"]>;
2500
+ let alone = 0;
2501
+ // RE-LABELS BY A REFLECTION (owner ruling D2 on #256): every mark a
2502
+ // reflection changed, and apart, those that moved a memory INTO me, us or
2503
+ // the owner (a core candidate it was not before).
2504
+ let relabeled = 0;
2505
+ let movedIn = 0;
2506
+ // A promotion the fast lane made only on a feeling a reflection recorded
2507
+ // later — the half of "on reflection" the open door lets through (review
2508
+ // of #256, S4). Counted apart from `alone`; one memory can be both.
2509
+ let later = 0;
2510
+ try {
2511
+ last = store.reflections({ limit: 5 }).find((r) => r.state === "reflected");
2512
+ returns = store.returnCounts({ sinceAt: Date.parse(`${input.today}T00:00:00Z`) - 6 * 86_400_000 });
2513
+ for (const row of store.eventLog({ name: "band.promoted" })) {
2514
+ try {
2515
+ const p = JSON.parse(row.payload ?? "{}") as { reflectionOnly?: unknown; feelingRecordedLater?: unknown };
2516
+ if (p.reflectionOnly === true) alone += 1;
2517
+ if (p.feelingRecordedLater === true) later += 1;
2518
+ } catch {
2519
+ continue;
2520
+ }
2521
+ }
2522
+ for (const e of store.coreEvents({ action: "about", limit: 10_000 })) {
2523
+ if (e.actor !== "reflection") continue;
2524
+ const m = /^(\w+) \(was (\w+)\)/.exec(e.reason ?? "");
2525
+ if (m === null || m[1] === m[2]) continue;
2526
+ relabeled += 1;
2527
+ const core = (x: string | undefined): boolean => x === "me" || x === "us" || x === "owner";
2528
+ if (core(m[1]) && !core(m[2])) movedIn += 1;
2529
+ }
2530
+ } catch {
2531
+ return [];
2532
+ }
2533
+ const share: Record<string, string> = {
2534
+ none: "no share",
2535
+ offered: "its morning share not told yet",
2536
+ carried: "its morning share carried to a later session",
2537
+ told: "its morning share told",
2538
+ };
2539
+ const what =
2540
+ last === undefined
2541
+ ? "has not reflected yet"
2542
+ : `last reflected ${last.date ?? `lived day ${String(last.day)}`} (${last.dream_id === null ? "on its own" : "after a dream"}): ${
2543
+ last.entry_id === null ? "nothing much" : "an entry"
2544
+ }${last.page_version === null ? "" : ", the self page rewritten"}, ${share[last.share_state] ?? last.share_state}`;
2545
+ const byHow = `returns this week — awake ${String(returns.awake)}, reflection ${String(returns.reflection)}, dream ${String(returns.dream)}`;
2546
+ const aloneLine =
2547
+ (alone > 0 ? `; ${String(alone)} ${alone === 1 ? "memory" : "memories"} became core on reflection alone` : "") +
2548
+ (later > 0 ? `; ${String(later)} ${later === 1 ? "memory" : "memories"} became core on a feeling a reflection recorded later` : "") +
2549
+ (relabeled > 0
2550
+ ? `; ${String(relabeled)} ${relabeled === 1 ? "mark" : "marks"} changed by a reflection, ${String(movedIn)} of them into me, us or the owner`
2551
+ : "");
2552
+ return [
2553
+ finding(
2554
+ "reflection",
2555
+ "green",
2556
+ "Reflection",
2557
+ `${what}; ${byHow}${aloneLine}`,
2558
+ "",
2559
+ {
2560
+ last: last?.date ?? null,
2561
+ reflection: last?.id ?? null,
2562
+ page: last?.page_version !== null && last?.page_version !== undefined,
2563
+ share: last?.share_state ?? null,
2564
+ returnsAwake: returns.awake,
2565
+ returnsReflection: returns.reflection,
2566
+ returnsDream: returns.dream,
2567
+ promotedOnReflectionAlone: alone,
2568
+ promotedOnFeelingRecordedLater: later,
2569
+ relabeledByReflection: relabeled,
2570
+ relabeledIntoCore: movedIn,
2571
+ },
2572
+ ),
2573
+ ];
2574
+ }
2575
+
2576
+ /**
2577
+ * DREAMING, informational (2026-09-26): when the counterpart last dreamed, and
2578
+ * whether today's ask went out or was declined. Never amber: not dreaming is
2579
+ * the owner's choice, and a quiet week is not a fault.
2580
+ */
2581
+ export function dreamingFindings(input: DoctorInput, store: Store): Finding[] {
2582
+ let last: ReturnType<Store["dreams"]>[number] | undefined;
2583
+ let ask: ReturnType<Store["dreamAsk"]>;
2584
+ try {
2585
+ last = store.dreams({ limit: 5 }).find((d) => d.state !== "undone");
2586
+ ask = store.dreamAsk(input.today);
2587
+ } catch {
2588
+ return [];
2589
+ }
2590
+ const when = last === undefined ? null : (last.date ?? `lived day ${String(last.day)}`);
2591
+ const today =
2592
+ ask === undefined ? "not asked today" : ask.state === "declined" ? "asked today; the owner said not today" : "asked today";
2593
+ return [
2594
+ finding(
2595
+ "dreaming",
2596
+ "green",
2597
+ "Dreaming",
2598
+ `${when === null ? "has not dreamed yet" : `last dreamed ${when}${last?.title ? ` — "${last.title}"` : ""}`}; ${today}`,
2599
+ "",
2600
+ { last: when, dream: last?.id ?? null, ask: ask?.state ?? null },
2601
+ ),
2602
+ ];
2603
+ }
2604
+
2341
2605
  export function selfPageFindings(store: Store): Finding[] {
2342
2606
  const page = readSelfPage(store);
2343
2607
  if (page === null) {
@@ -3076,6 +3340,14 @@ export function doctorFindings(input: DoctorInput): Finding[] {
3076
3340
  // B3's week: one bounded read of the newest `remember.prune` row. Folds into
3077
3341
  // `Background` while green.
3078
3342
  ["retention", () => retentionFindings(input, store)],
3343
+ // The v8 upgrade's proof (2026-09-26): two meta reads. Silent on a store
3344
+ // born at v8. Folds into `Background` while green.
3345
+ ["upgrade-v8", () => upgradeV8Findings(store)],
3346
+ // Dreaming (2026-09-26): informational — last dreamed, and today's ask.
3347
+ ["dreaming", () => dreamingFindings(input, store)],
3348
+ // v9 (2026-09-27): what the upgrade carried, and the reflection.
3349
+ ["upgrade-v9", () => upgradeV9Findings(store)],
3350
+ ["reflection", () => reflectionFindings(input, store)],
3079
3351
  // LAST, and deliberately: it is the widest read here — the whole event log,
3080
3352
  // plus a pass over the ids for the table probes — so when the console's
3081
3353
  // reading is cut short this is the group that goes, and the `Budget` finding
@@ -73,6 +73,7 @@ import {
73
73
  ASK_ROW_COUNTING,
74
74
  decideUpdateNotice,
75
75
  installedBuild,
76
+ isLive,
76
77
  markUpdateNoticeShown,
77
78
  owedWriteUps,
78
79
  progressKey,
@@ -1242,9 +1243,12 @@ export class ClaudeCodeAdapter {
1242
1243
  // for, is said at the next prompt, once (claimed at delivery).
1243
1244
  const plain = this.plainFor(input);
1244
1245
  const told = plain.due.length === 0 ? {} : { notices: plain.notices, plain: plain.due };
1246
+ // The DREAM lines (2026-09-26): the once-a-day ask, and any contradiction
1247
+ // a dream flagged that is still unraised — for the model, quietly.
1248
+ const context = `${plain.context}${this.dreamLines(input)}`;
1245
1249
  const text = input.prompt ?? "";
1246
1250
  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 };
1251
+ return { ...out, ok: true, reason: "empty-prompt", injection: `${this.nowLine()}${context.length === 0 ? "" : `\n${context.trimEnd()}`}`, ...told };
1248
1252
  }
1249
1253
  const result = this.counterpart.recallForTurn(
1250
1254
  {
@@ -1291,8 +1295,8 @@ export class ClaudeCodeAdapter {
1291
1295
  // sentinel stand; alone when recall surfaced nothing.
1292
1296
  injection:
1293
1297
  result.injection.length === 0
1294
- ? `${this.nowLine()}${plain.context.length === 0 ? "" : `\n${plain.context.trimEnd()}`}`
1295
- : `${this.nowLine()}\n${plain.context}${result.injection}`,
1298
+ ? `${this.nowLine()}${context.length === 0 ? "" : `\n${context.trimEnd()}`}`
1299
+ : `${this.nowLine()}\n${context}${result.injection}`,
1296
1300
  bytes: decision.bytes,
1297
1301
  sentinel: decision.sentinel,
1298
1302
  // The footnote tier is carried SEPARATELY from the loud one, because the
@@ -1304,6 +1308,45 @@ export class ClaudeCodeAdapter {
1304
1308
  });
1305
1309
  }
1306
1310
 
1311
+ /**
1312
+ * THE DREAM LINES (2026-09-26, `core/dream/`), for the MODEL only, each
1313
+ * ending in a newline: a contradiction a dream flagged, raised once awake,
1314
+ * and the day's ask — "I haven't dreamed since …" — which the model is to put
1315
+ * to the owner at a natural moment. The ask is at most once a CALENDAR day
1316
+ * across every session (the store's `dream_asks` latch decides, so of two
1317
+ * sessions racing one gets it); a "no" is the dream tool's `decline`. Never in
1318
+ * the host-mode page writer's headless child, never under observer, never
1319
+ * without a date. Only what could surface here anyway is counted or raised
1320
+ * (the dream module applies recall's gates). Never throws.
1321
+ *
1322
+ * v9 (2026-09-27): a MORNING SHARE the reflecting session never told is
1323
+ * carried here, ONCE, by the next session — only when the session that
1324
+ * reflected has ended (its registry record is ended or quiet), so the two
1325
+ * do not both tell it. Here, on the prompt, rather than in the SessionStart
1326
+ * wake, whose byte ceiling is what stranded the page writer.
1327
+ */
1328
+ private dreamLines(input: HookInput): string {
1329
+ if (this.observer || input.at === undefined || input.pageWriter === true || input.sessionId.length === 0) return "";
1330
+ try {
1331
+ const dreams = this.counterpart.dreams;
1332
+ const lines = [...dreams.raiseLines({ session: input.sessionId })];
1333
+ const pending = this.counterpart.reflections.pendingShare({ session: input.sessionId });
1334
+ if (pending !== null) {
1335
+ const record = pending.session === null ? null : readSession(this.counterpart.store.dir, pending.session);
1336
+ if (record === null || !isLive(record, this.nowFn())) {
1337
+ const carried = this.counterpart.reflections.carryLine({ session: input.sessionId, reflection: pending.id });
1338
+ if (carried !== null) lines.push(carried);
1339
+ }
1340
+ }
1341
+ const ask = dreams.askLine({ at: input.at, session: input.sessionId });
1342
+ if (ask !== null) lines.push(ask);
1343
+ if (lines.length > 0) this.emit("adapter.dream.lines", { asked: ask !== null, raised: lines.length - (ask === null ? 0 : 1) });
1344
+ return lines.map((l) => `${l}\n`).join("");
1345
+ } catch {
1346
+ return "";
1347
+ }
1348
+ }
1349
+
1307
1350
  /** `Now: Fri 25 Sep 2026, 1:40 pm MDT` — this adapter's clock, in the store's zone. */
1308
1351
  private nowLine(): string {
1309
1352
  return `Now: ${localClock(this.nowFn(), this.counterpart.store.zone())}`;
@@ -169,6 +169,8 @@ export function openAdapter(
169
169
  ...(config.observer === undefined ? {} : { observer: config.observer }),
170
170
  ...(config.owner === undefined ? {} : { owner: config.owner }),
171
171
  ...(config.timeZone === undefined ? {} : { timeZone: config.timeZone }),
172
+ // Owner ruling D3 on #256: `pageWriter.mode: off` stops the reflection's page write too.
173
+ ...(config.pageWriter?.mode === undefined ? {} : { pageWriterMode: config.pageWriter.mode }),
172
174
  ...(config.identity === undefined
173
175
  ? {}
174
176
  : { identity: { name: config.identity.name, aliases: [...(config.identity.aliases ?? [])] } }),