counterparts 0.3.4 → 0.3.6

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 (156) hide show
  1. package/CHANGELOG.md +205 -0
  2. package/docs/module-map.md +2 -2
  3. package/package.json +1 -1
  4. package/src/adapters/claude-code/CONTRACT.md +48 -30
  5. package/src/adapters/claude-code/NOTES.md +38 -0
  6. package/src/adapters/claude-code/doctor.ts +202 -20
  7. package/src/adapters/claude-code/hooks.ts +39 -294
  8. package/src/adapters/claude-code/index.ts +2 -2
  9. package/src/adapters/cli/NOTES.md +12 -0
  10. package/src/adapters/cli/commands.ts +84 -20
  11. package/src/adapters/cli/dream-core.ts +105 -11
  12. package/src/adapters/cli/export.ts +21 -2
  13. package/src/adapters/cli/help.ts +13 -9
  14. package/src/adapters/cli/mechanisms.ts +7 -1
  15. package/src/adapters/cli/self-page.ts +5 -2
  16. package/src/adapters/dashboard/activity.ts +18 -5
  17. package/src/adapters/dashboard/registries.ts +1 -1
  18. package/src/adapters/dashboard/source.ts +8 -0
  19. package/src/adapters/dashboard/stories.ts +3 -1
  20. package/src/adapters/dashboard/web/README.md +131 -54
  21. package/src/adapters/dashboard/web/actions.ts +45 -3
  22. package/src/adapters/dashboard/web/app.html +1 -4
  23. package/src/adapters/dashboard/web/app.js +3 -7
  24. package/src/adapters/dashboard/web/ask-voice.ts +364 -0
  25. package/src/adapters/dashboard/web/lanes.ts +32 -2
  26. package/src/adapters/dashboard/web/mechanisms/association/index.js +1 -0
  27. package/src/adapters/dashboard/web/mechanisms/association/panel.js +1 -3
  28. package/src/adapters/dashboard/web/mechanisms/consolidation/index.js +1 -0
  29. package/src/adapters/dashboard/web/mechanisms/consolidation/panel.js +31 -17
  30. package/src/adapters/dashboard/web/mechanisms/decay/index.js +1 -0
  31. package/src/adapters/dashboard/web/mechanisms/decay/panel.js +1 -3
  32. package/src/adapters/dashboard/web/mechanisms/dreaming/index.js +3 -2
  33. package/src/adapters/dashboard/web/mechanisms/dreaming/panel.js +20 -0
  34. package/src/adapters/dashboard/web/mechanisms/emotional/index.js +1 -0
  35. package/src/adapters/dashboard/web/mechanisms/emotional/panel.js +24 -0
  36. package/src/adapters/dashboard/web/mechanisms/episodic-semantic/index.js +1 -0
  37. package/src/adapters/dashboard/web/mechanisms/episodic-semantic/panel.js +11 -0
  38. package/src/adapters/dashboard/web/mechanisms/index.js +15 -4
  39. package/src/adapters/dashboard/web/mechanisms/interference/index.js +1 -0
  40. package/src/adapters/dashboard/web/mechanisms/prospective/index.js +1 -0
  41. package/src/adapters/dashboard/web/mechanisms/prospective/panel.js +27 -0
  42. package/src/adapters/dashboard/web/mechanisms/reconsolidation/index.js +1 -0
  43. package/src/adapters/dashboard/web/mechanisms/reconsolidation/panel.js +1 -3
  44. package/src/adapters/dashboard/web/mechanisms/retrieval/index.js +1 -0
  45. package/src/adapters/dashboard/web/mechanisms/retrieval/panel.js +54 -15
  46. package/src/adapters/dashboard/web/mechanisms/salience/index.js +1 -0
  47. package/src/adapters/dashboard/web/mechanisms/salience/panel.js +16 -5
  48. package/src/adapters/dashboard/web/mechanisms/schema/index.js +1 -0
  49. package/src/adapters/dashboard/web/narrate.ts +78 -9
  50. package/src/adapters/dashboard/web/pages/health/health.css +151 -0
  51. package/src/adapters/dashboard/web/pages/health/index.js +28 -13
  52. package/src/adapters/dashboard/web/pages/health/sections/archive.js +5 -2
  53. package/src/adapters/dashboard/web/pages/health/sections/checks.js +31 -24
  54. package/src/adapters/dashboard/web/pages/health/sections/cycle.js +8 -5
  55. package/src/adapters/dashboard/web/pages/health/sections/mechanisms.js +251 -0
  56. package/src/adapters/dashboard/web/pages/health/sections/wake.js +49 -0
  57. package/src/adapters/dashboard/web/pages/home/brain.js +17 -36
  58. package/src/adapters/dashboard/web/pages/home/go.js +7 -0
  59. package/src/adapters/dashboard/web/pages/home/home.css +54 -123
  60. package/src/adapters/dashboard/web/pages/home/index.js +47 -56
  61. package/src/adapters/dashboard/web/pages/home/sections/brain.js +84 -0
  62. package/src/adapters/dashboard/web/pages/home/sections/feel.js +37 -0
  63. package/src/adapters/dashboard/web/pages/home/sections/hero.js +43 -16
  64. package/src/adapters/dashboard/web/pages/home/sections/map.js +25 -0
  65. package/src/adapters/dashboard/web/pages/home/sections/today.js +41 -0
  66. package/src/adapters/dashboard/web/pages/memories/fold.js +48 -0
  67. package/src/adapters/dashboard/web/pages/memories/index.js +9 -3
  68. package/src/adapters/dashboard/web/pages/memories/memories.css +5 -0
  69. package/src/adapters/dashboard/web/pages/memories/row.js +8 -2
  70. package/src/adapters/dashboard/web/pages/memories/sections/feel.js +33 -14
  71. package/src/adapters/dashboard/web/pages/memories/sections/hold.js +9 -4
  72. package/src/adapters/dashboard/web/pages/memories/sections/search.js +59 -11
  73. package/src/adapters/dashboard/web/pages/self/index.js +15 -11
  74. package/src/adapters/dashboard/web/pages/self/sections/dreams.js +6 -2
  75. package/src/adapters/dashboard/web/pages/self/sections/journal.js +31 -12
  76. package/src/adapters/dashboard/web/pages/self/sections/map.js +273 -0
  77. package/src/adapters/dashboard/web/pages/self/sections/page.js +121 -62
  78. package/src/adapters/dashboard/web/pages/self/sections/settling.js +31 -41
  79. package/src/adapters/dashboard/web/pages/self/sections/traits.js +102 -0
  80. package/src/adapters/dashboard/web/pages/self/sections/wake.js +45 -52
  81. package/src/adapters/dashboard/web/pages/self/self.css +110 -72
  82. package/src/adapters/dashboard/web/pages/self/state.js +4 -0
  83. package/src/adapters/dashboard/web/server.ts +20 -1
  84. package/src/adapters/dashboard/web/shared/absence.js +1 -3
  85. package/src/adapters/dashboard/web/shared/base.css +0 -1
  86. package/src/adapters/dashboard/web/shared/doctor.js +68 -0
  87. package/src/adapters/dashboard/web/shared/layout.css +0 -1
  88. package/src/adapters/dashboard/web/shared/memory-card-words.js +96 -0
  89. package/src/adapters/dashboard/web/shared/memory-modal.js +13 -22
  90. package/src/adapters/dashboard/web/shared/widgets/feed.js +22 -15
  91. package/src/adapters/dashboard/web/shell/pulse.js +1 -16
  92. package/src/adapters/dashboard/web/views/activity.ts +43 -7
  93. package/src/adapters/dashboard/web/views/archive-words.ts +6 -0
  94. package/src/adapters/dashboard/web/views/core-road.ts +56 -0
  95. package/src/adapters/dashboard/web/views/dreams.ts +8 -5
  96. package/src/adapters/dashboard/web/views/flow-view.ts +9 -5
  97. package/src/adapters/dashboard/web/views/health.ts +74 -13
  98. package/src/adapters/dashboard/web/views/mechanism-panel.ts +395 -93
  99. package/src/adapters/dashboard/web/views/mechanisms.ts +106 -5
  100. package/src/adapters/dashboard/web/views/memories.ts +33 -22
  101. package/src/adapters/dashboard/web/views/memory.ts +99 -32
  102. package/src/adapters/dashboard/web/views/mind.ts +590 -53
  103. package/src/adapters/dashboard/web/views/overview.ts +57 -99
  104. package/src/adapters/dashboard/web/views/search.ts +58 -7
  105. package/src/adapters/dashboard/web/views/self-map.ts +124 -0
  106. package/src/adapters/dashboard/web/views/today.ts +181 -0
  107. package/src/adapters/dashboard/web/views/traits.ts +296 -0
  108. package/src/adapters/dashboard/web/views.ts +7 -5
  109. package/src/adapters/fired.ts +32 -11
  110. package/src/adapters/mcp/CONTRACT.md +3 -0
  111. package/src/adapters/mcp/NOTES.md +40 -0
  112. package/src/adapters/mcp/bin/serve.ts +6 -1
  113. package/src/adapters/mcp/index.ts +4 -0
  114. package/src/adapters/mcp/server.ts +471 -21
  115. package/src/adapters/mcp/tools.ts +237 -18
  116. package/src/adapters/mechanism-evidence.ts +26 -3
  117. package/src/adapters/sessions.ts +5 -0
  118. package/src/core/counterpart.ts +210 -2
  119. package/src/core/dream/CONTRACT.md +180 -27
  120. package/src/core/dream/INTERFACE-GAPS.md +25 -0
  121. package/src/core/dream/NOTES.md +265 -0
  122. package/src/core/dream/index.ts +745 -139
  123. package/src/core/dream/mind.ts +110 -0
  124. package/src/core/dream/reflect.ts +1734 -0
  125. package/src/core/dream/tunables.ts +33 -4
  126. package/src/core/physics/CONTRACT.md +23 -1
  127. package/src/core/physics/NOTES.md +48 -0
  128. package/src/core/physics/index.ts +100 -7
  129. package/src/core/remember/owes.ts +4 -1
  130. package/src/core/schemas/index.ts +8 -1
  131. package/src/core/self/CONTRACT.md +41 -19
  132. package/src/core/self/INTERFACE-GAPS.md +4 -0
  133. package/src/core/self/NOTES.md +41 -0
  134. package/src/core/self/index.ts +22 -3
  135. package/src/core/self/journal-file.ts +5 -2
  136. package/src/core/self/page.ts +60 -30
  137. package/src/core/self/writer.ts +114 -19
  138. package/src/core/sleep/CONTRACT.md +2 -1
  139. package/src/core/sleep/NOTES.md +51 -0
  140. package/src/core/sleep/consolidate.ts +146 -25
  141. package/src/core/sleep/index.ts +12 -2
  142. package/src/core/sleep/types.ts +17 -0
  143. package/src/core/store/CONTRACT.md +15 -0
  144. package/src/core/store/NOTES.md +92 -1
  145. package/src/core/store/errors.ts +16 -3
  146. package/src/core/store/feelings.ts +159 -22
  147. package/src/core/store/index.ts +572 -29
  148. package/src/core/store/operational.ts +351 -7
  149. package/src/core/store/owner-op-seam.ts +110 -1
  150. package/src/core/store/traits.ts +179 -0
  151. package/src/core/types.ts +17 -2
  152. package/src/adapters/dashboard/web/pages/home/sections/explorer.js +0 -221
  153. package/src/adapters/dashboard/web/pages/home/sections/live-activity.js +0 -31
  154. package/src/adapters/dashboard/web/pages/home/sections/recent-chapters.js +0 -17
  155. package/src/adapters/dashboard/web/pages/home/sections/tiles.js +0 -69
  156. package/src/adapters/dashboard/web/shared/widgets/chapters.js +0 -15
package/CHANGELOG.md CHANGED
@@ -1,5 +1,210 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.6 — 2026-09-28
4
+
5
+ The nightly run: once a day, Claude writes its page, dreams and reflects in one
6
+ background run, and starts it on its own. **The store's format does not change** (it
7
+ stays v9), so nothing is copied or upgraded. Close every session before installing
8
+ anyway: a session left open keeps the old memory server while the hooks switch to the
9
+ new code at once, and the new dream start needs both. Run `/mcp` → Reconnect in any
10
+ you missed.
11
+
12
+ The nightly run.
13
+
14
+ - **One background run, once a calendar day: the page writer, then the dream, then
15
+ the reflection.** The first prompt of a new day tells Claude to start it, when at
16
+ least 3 memories are new since the last dream. Claude hands it to one background
17
+ agent and tells you one line: "Dreaming in the background (a few minutes). Say 'no
18
+ dreams' anytime to turn it off." With fewer than 3 new memories nothing runs, and
19
+ they carry over to the next day.
20
+ - **Dreaming has a setting: auto, ask or off.** `auto` is the default: the run starts
21
+ on its own and says so. `ask` asks you first, as 0.3.5 did. `off` asks nothing.
22
+ Say "no dreams" in a session, or run `counterparts dream --setting off`; turn it
23
+ back on the same way (`--setting auto`). `counterparts dream` and doctor's Dreaming
24
+ line say which it is.
25
+ - **The page writer is back in the run.** It no longer waits for room in the session
26
+ start, which is why it had stopped. It is handed the page whole and the day it
27
+ reads, as the first step of the run.
28
+ - **Who wrote each version of the page.** A version the reflection wrote is now
29
+ labelled "reflection", apart from the writer's. Both may write the page on the same
30
+ night, and every version is kept. `counterparts self-page --versions` and the
31
+ dashboard's Self tab say which.
32
+ - **A dream that was cut off picks up where it stopped.** If a dream began, changed
33
+ something and then went quiet for 30 minutes (its session closed, say), the next
34
+ session starts the run again and the dream resumes: what it already did stands. A
35
+ dream that began and changed nothing is closed and a fresh one starts. A run that
36
+ dreamed but was cut off before it reflected finishes only the reflection. At most
37
+ twice a day.
38
+ - **"Dreamed today" and "reflected today" are calendar days**, not days of use.
39
+ - **The reflection sees what the dream saw**, every memory the dream was shown and
40
+ what it made, and can cite them. It gets the self page whole. When all of that is
41
+ too long for one answer, it comes in parts ("part 1 of 3"), and nothing is cut.
42
+ - **Page sections.** The self page's own headings ("Us", "How I work", anything) are
43
+ read as sections, not only Core and Lately. The dashboard's Self tab, the `self_page`
44
+ tool and the CLI list every one.
45
+ - Doctor no longer marks the page writer amber just because a night is owed. It is
46
+ amber only when nightly runs went on for days without the writer, or it failed.
47
+
48
+ Fewer refusals.
49
+
50
+ - **Dreams and reflections are refused less, and repaired more.** An over-long or
51
+ two-part feeling ("steadied: after the long week") is split: the first word is the
52
+ feeling, the rest goes to what carried it. Texts over their limit are kept to the
53
+ limit and the result says so; the limits for a morning share, a reflection's entry,
54
+ a dream's journal and a merged memory are higher. Many refusals that protected
55
+ nothing now write, with a note. The ones that stay (dream words never become lived
56
+ memory, a confidential memory's words stay off the page, the page cites real
57
+ memories) now say why, with the words or the id that tripped them.
58
+ - **The self page may quote a lived memory a dream also quoted.** The old check
59
+ refused it.
60
+ - **A reflection can finish a second time the same day**, to supply what the first
61
+ finish left out or had refused: the page, the share, feelings, what a memory is
62
+ about, traits. It never writes a second entry. A share already told can't be
63
+ replaced. The same feeling sent twice is recorded once.
64
+ - The instructions Claude reads now say which feeling field is which, before it
65
+ writes.
66
+
67
+ Seeing it.
68
+
69
+ - **Newest first.** When a record held more events than a view read, several views
70
+ kept the oldest and called them the newest: the dashboard's feed, a memory's days
71
+ of use, Health's heatmap (today read empty), the flow view, contested beliefs, the
72
+ page's version reasons, and a few doctor counts. They read the newest now.
73
+ - **"Of N".** A list that is cut says so: search says "the closest 25 of N matches",
74
+ Health's archive "the newest 200 of N", dreams "the newest 12 of N".
75
+ `counterparts dream --list --all` lists every dream.
76
+
77
+ **The dashboard's Home tab, round 4.** Home now holds the best pictures from the other
78
+ tabs, each a way in. A headline (the day, your name, how many memories, how many new
79
+ today) with a health dot that links to Health. The brain beside **Today**: a few plain
80
+ lines about what happened to memory today, each opening that thing. **How it feels**
81
+ (the feelings radar) and **Around the core** (the Self tab's map). Gone from Home: the
82
+ four tiles, the written/came-back strip, the Tonight box and the live feed. The
83
+ mechanism pills and "how it works" moved to the end of Health.
84
+
85
+ **Other dashboard fixes.** "How I act" puts the faint week-ago mark where it really
86
+ stood a week ago, counting memories archived since, and fits a phone. Day counts are
87
+ whole ("14 days of use", not "14.00"). Health names archived memories in words
88
+ ("merged in a dream", not "dream-merge"), and says its memory count leaves out the
89
+ cards for people and projects. Home's chapter count matches Self's. The Self map's
90
+ ready dots no longer sit on top of each other.
91
+
92
+ ## 0.3.5 — 2026-09-27
93
+
94
+ Claude reflects after a dream, tells you about it in the morning, and rewrites its self
95
+ page from what it reflected on; what a memory is about now decides the core. **The
96
+ store's format changes (v8 → v9).** The first Claude Code session after installing
97
+ copies the store (as every upgrade since 0.3.1 has) and upgrades it; until then
98
+ `counterparts doctor` says (amber) that the next session will upgrade it, and the
99
+ dashboard asks you to open a session. Close every session before installing, and run
100
+ `/mcp` → Reconnect in any you missed.
101
+
102
+ Reflecting.
103
+
104
+ - **After a dream, Claude reflects on it, awake.** The dream's background agent now
105
+ dreams, writes its journal, then reflects, as three separate steps. The reflection is
106
+ handed the dream (marked as dreamed), the last few days' chapters and memories, what is
107
+ on its mind (dated things in the next two weeks, disagreements still standing, where
108
+ the work stands), the self page and the core, and answers three questions that change
109
+ from night to night. It sees memories and feelings, not the numbers behind the core.
110
+ - **What it writes.** An entry, kept as a memory titled "Reflected: …" when it rests on
111
+ memories it names. An entry that names nothing counts as "nothing much": it is kept on
112
+ the record, and nothing else is written or said. One reflection a lived day.
113
+ - **The self page is rewritten from the reflection.** The page had stopped changing: the
114
+ morning writer needed room in the session start that a full wake no longer left it. Now
115
+ the reflection rewrites the page from the memories it names (at least one from the core
116
+ when there is a core), and that night's morning writer stands down. A dream's own
117
+ pattern is never a source for the page, and its words may not go on it.
118
+ - **The morning share.** The reflection may leave a short note for you (at most 700
119
+ characters, naming what it rests on). Claude tells it once: when the dream hands back,
120
+ or, if that session has already ended, at the start of the next one.
121
+ - **Feelings recorded later.** The reflection may record how a memory it was shown feels
122
+ now, marked as recorded later, on that day. It may feel stronger than anything felt at
123
+ the time.
124
+ - **What a memory is about**: me, us, owner, work or world. Claude can say it when it
125
+ writes (`note` and `session_end` take `about`), and the reflection can set or change it,
126
+ with its reason. Each change is recorded; one that makes a memory about Claude, the two
127
+ of you or you is said in the next morning share.
128
+ - **You are named, not "him".** What the reflection and the dream say about you uses
129
+ your name as the store knows it (`install --name`), or "the owner" when there is none —
130
+ never a pronoun that guesses.
131
+ - `reflect` is a ninth tool for the MCP server; `counterparts dream --show <id>` includes
132
+ the dream's reflection, `--show rfl_…` shows one, and `--list` lists them. Undoing a
133
+ dream leaves its reflection. Removing a memory also redacts any reflection that named
134
+ it, and that reflection's entry. `pageWriter.mode: "off"` stops the reflection's page
135
+ write too.
136
+
137
+ The core.
138
+
139
+ - **What a memory is about decides whether it can become core**, not its kind: about me
140
+ (Claude), about us, or about the owner. A skill never becomes core. A memory marked
141
+ work or world does not either.
142
+ - **Nothing changes overnight.** The upgrade marks memories by the old rule: every
143
+ `self` memory is about me, and every memory about a person that names you is about the
144
+ owner. So the candidates the morning after are the ones from the night before, and
145
+ `doctor`'s Upgrade line says how many were marked each way.
146
+ - **A reflection naming a memory counts as it coming back.** It counts toward the fast
147
+ way in (strongly felt and came back after a gap), and toward the slow way at most once
148
+ a week per memory.
149
+ - **A memory can reach the core on reflection alone, and you can close that.** This is
150
+ on by default: a feeling the reflection records later and a reflection naming the
151
+ memory both count. When one gets there that way, the next morning share says so, and
152
+ `doctor` counts it. `counterparts core --reflected-feeling off` closes it: the fast way
153
+ then needs a feeling felt at the time and an ordinary use after a gap, and a reflection
154
+ may only move what a memory is about toward work or world. `on` opens it again.
155
+ `counterparts core` says which way it stands.
156
+
157
+ Traits.
158
+
159
+ - **A memory can carry a small note on how Claude acted in it**, on seven fixed scales
160
+ (careful–bold, agreeable–candid, guarded–open, focused–curious, following–initiating,
161
+ inward–outward, serious–playful). `note`, `session_end` and the reflection take them;
162
+ most memories carry none. They are for display only: they change nothing about the
163
+ core, fading, the self page or recall. `export --markdown` has a Traits section, and
164
+ `counterparts fired` has a traits row.
165
+ - **The dashboard's Self tab shows them as "How I act"**: one bar per scale, marking
166
+ where Claude has leaned lately and where it was a week ago. Tap a bar to see the
167
+ memories behind it.
168
+
169
+ Seeing it.
170
+
171
+ - `doctor` has a Reflection line: when it last reflected, whether the page was
172
+ rewritten, whether the share was told, the week's returns by where they came from
173
+ (awake, reflection, dream), and how many memories became core on reflection alone.
174
+ - `counterparts mechanisms` counts reflections beside dreams, and a dream's core
175
+ suggestions apart from its changes ("2 dreams this week (60 changes, 3 core
176
+ suggestions)"). The dashboard says the same.
177
+ - The dashboard's core views ask the same question sleep asks, so they never show a
178
+ memory as ready when sleep won't make it core (with `--reflected-feeling off` too).
179
+ Home's Tonight box says whether Claude will ask to dream next session, and why not
180
+ when it won't.
181
+
182
+ **The dashboard's Memories tab, round 3.** A memory's card says when one return would
183
+ make it core, and says "written, day N" until it is first used. Ask lists a chapter and
184
+ the memory it came from once. Version rows say when a dream merged near-copies. Ask now
185
+ reads your question in Claude's voice ("what do you remember about me?" searches "what
186
+ do I remember about" and your name) and shows what it searched, with "search exactly as
187
+ typed" to turn that off.
188
+
189
+ **The dashboard's Home tab, round 3.** Less on the page. The mechanism pills sit on one
190
+ line. Each mechanism shows one number, up to five of the memories behind it, and one line
191
+ on what it does; the rest is under "how it works". New: a strip of what was written and
192
+ what came back each day, a Tonight box (what the next sleep will do, what is close to the
193
+ core, what is near being let go), and how often what came to mind was used. Sleep checks
194
+ that did nothing move to the flow feed, and repeated lines fold into one. The core tile is
195
+ a count, and the chapters column is gone (both live on Self).
196
+
197
+ **The dashboard's Self tab, round 3.** The page's history is one strip, a dot a day: a
198
+ filled dot is a day it was rewritten, a hollow one says why it wasn't, in plain words. A
199
+ line above the page says when it has fallen behind. "Next time I wake, I start with:"
200
+ lists what the next session opens with. A map of the memories about Claude and the two of
201
+ you replaces the "closest to the core" list: the core in the middle, the closest near it.
202
+ The journal's day strip shows dates. The wake's size moved to Health.
203
+
204
+ **Health and empty pages.** Health no longer marks a step amber when it simply wasn't due
205
+ yet (consolidate and fade run every three lived days). Empty panels say "(none yet)" in
206
+ plain words.
207
+
3
208
  ## 0.3.4 — 2026-09-26
4
209
 
5
210
  Memories stay strong by coming back, the core is for what is about the two of you, and
@@ -23,7 +23,7 @@ code and the `NOTES.md` / `INTERFACE-GAPS.md` next to it.*
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
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
+ | `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. |
27
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`).** |
28
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.** |
29
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`. |
@@ -37,7 +37,7 @@ input — does `encode` shrink to gates-and-tagging inside `remember`'s pipeline
37
37
  | adapter | job |
38
38
  |---|---|
39
39
  | `claude-code/` | Hooks: wake injection at session start, end-of-session remember, crash detection. The launch adapter. |
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
+ | `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**). |
41
41
  | `cli/` | `counterparts` command: status, install, owner operations (delete, export, backup). |
42
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).** |
43
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.4",
3
+ "version": "0.3.6",
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": {
@@ -563,22 +563,42 @@ row, saying which source answered, existed until the keys were removed — §1a.
563
563
  back immediately. Doctor prints these steps as the remedy on any Snapshot
564
564
  finding that is not green.
565
565
 
566
- ### The nightly page writer, in two modes (S2, 2026-09-20 — true for now)
567
-
568
- **[M] Session mode is the default, and it costs the wake nothing.** When the writer is owed
569
- the day just gone, the SessionStart hook puts the core's instruction in `HookResult.ask` —
570
- the same field, beside the wake and never inside it, that the first-launch scope question
571
- uses and for the same reason: the bundle's byte count and its tail sentinel are load-bearing.
572
- The wake's `injection`, `bytes` and `sentinel` are byte-identical with the writer off and
573
- with it on, and that is asserted rather than argued. **The first-launch question wins the
574
- field** when both want it; the writer's is deferred with a ring event and the night stays
575
- owed. **No room under the reported ceiling defers rather than truncating**, and claims
576
- nothing. One session is asked once — a compaction re-firing SessionStart asks nothing — and
577
- the mark is a DATE on the session's registry record, which is also the only evidence the
578
- MCP server accepts for writing `by: "writer"` on the revision that comes back.
579
-
580
- **[M] Host mode starts a windowless session of the self, and reads the outcome from the
581
- store.** `claude -p`, so the ordinary SessionStart hook fires inside the child and the
566
+ ### The nightly run, and the page writer inside it (2026-09-28 — working defaults, held lightly)
567
+
568
+ **[M] Once per local calendar day, the first session's line starts the nightly run.** On the
569
+ first prompt of a calendar day (`hooks.ts#dreamLines`, UserPromptSubmit), when at least three
570
+ memories are new since the last dream, the line tells the model to call the dream tool's
571
+ `launch` and hand the prompt to ONE background agent, then tell the owner in one line:
572
+ "Dreaming in the background (a few minutes). Say 'no dreams' anytime to turn it off." The
573
+ run is, in order (`DREAM_TUNABLES.NIGHT_ORDER`, the owner's call): the page writer, the dream,
574
+ the reflection — the writer first so it reads yesterday before any merge archives an
575
+ original, survives a session cut off mid-run, and the dream and the reflection see the fresh
576
+ page.
577
+ Fewer than three new: nothing runs, and they carry over (new = since the last dream). The
578
+ owner's setting decides the line — `auto` (the default) starts the run, `ask` asks first as
579
+ it did from 2026-09-26, `off` says nothing — kept in the store's meta, set by the dream
580
+ tool's `setting` phase ("no dreams") or `counterparts dream --setting`, shown by doctor. The
581
+ line is claimed once a day across sessions (`dream_asks`), and again only for a run left
582
+ behind (a dream begun and quiet for 30 minutes, or — `auto` — a launch no dream followed),
583
+ at most twice a day.
584
+
585
+ **[M] The writer moved out of the wake and into the run (2026-09-28).** The SessionStart ask
586
+ that handed the first session of a day the day just gone (S2's session mode, 2026-09-20) is
587
+ RETIRED, and with it its deferral (`no-room`), its contest with the first-launch question
588
+ for the ask field, and the registry mark it wrote. The dream tool's `writer` phase — the
589
+ run's first call — writes the night's claim (the ordinary `asked` row, `about` = yesterday's
590
+ local date, carrying the SESSION and the run) and hands the writer its day through a tool
591
+ result, the page whole: no injection ceiling, so nothing is deferred for room.
592
+ The MCP server labels a `self_page` write `by: "writer"` when the write NAMES a session
593
+ that holds that open claim (`self/writer.ts#nightClaimFor`) — not the session the server is
594
+ bound to, so the owner's own page edit in the run's session stays an ordinary amendment;
595
+ and when the run moves past the writer without a write, its next phase answers the night
596
+ `nothing-to-say`. The registry mark and host mode's environment pin are still read. The wake's `injection`, `bytes` and `sentinel` are untouched by any of it.
597
+
598
+ **[M] Host mode (not the default; left in place) starts a windowless session of the self,
599
+ and reads the outcome from the store.** With `pageWriter.mode: host` the nightly run claims
600
+ nothing for the writer (its `writer` phase says so) and the worker's child writes instead.
601
+ `claude -p`, so the ordinary SessionStart hook fires inside the child and the
582
602
  writer wakes with the wake; exactly one pre-approved tool, the page's. The plan is pure and
583
603
  decides everything; the starter is six lines. The package's own values go onto the child's
584
604
  environment LAST (§2.13), and `COUNTERPARTS_SESSION` / `COUNTERPARTS_SCOPE` are REMOVED
@@ -588,24 +608,22 @@ as a pinned DATE (`COUNTERPARTS_PAGE_WRITER`), because a windowless child's sess
588
608
  minted by the host after the launcher is gone. **The child's stdout is never parsed into a
589
609
  verdict**: what the run did is read from the page's version chain and from the row the tool
590
610
  left, and the exit code decides only between "nothing to say" and "could not run". The
591
- child's own SessionStart raises no writer ask — session mode only — or a session started to
592
- do the writing would be asked to do it.
593
-
594
- **[M] The ask is measured, not predicted, and a deferral is not a silence.** The composed
595
- block is checked against the host's reported ceiling AFTER composing (the estimate is its
596
- shortest shape; the delivered one is longer), and re-composed once against the room the
597
- first attempt proved was really there. A block that will not fit, or that can carry none of
598
- the day, is DEFERRED — and the deferral leaves a durable `skipped` row, deduped one per
599
- night per reason, which claims nothing and can never close a night. The first-launch scope
600
- question still wins the field, but only once per night: on a blank store it is exactly what
601
- is pending on nights 1–3, and an unanswered one used to starve the writer for ever.
611
+ child is told nothing on its prompts (`HookInput.pageWriter`): no dream line, no reminders.
612
+
613
+ (Retired with the SessionStart ask, 2026-09-28: the measured-not-predicted sizing against the
614
+ host's ceiling, the durable `skipped` deferral rows, and the first-launch question's
615
+ once-per-night patience. `skipped` rows written before still read as they always did.)
602
616
 
603
617
  **[M] It never costs anything else.** The writer runs last in the detached worker, inside
604
618
  the same `finally` as the snapshot, so a day whose sweep broke is still a day that gets
605
619
  written about; it never throws; and a failure never fails a wake, a boundary or a session.
606
- Doctor's `Page writer` line is GREEN when it has never run on a store with no yesterday and
607
- GREEN on a night that had nothing to say, AMBER only on a failure or a refusal or on the
608
- writer being off while a page stands, and never RED.
620
+ Doctor's `Page writer` line is GREEN when it has never run on a store with no yesterday,
621
+ GREEN on a night that had nothing to say, GREEN when it is off (a deliberate choice; this
622
+ page used to say amber while a page stands, which the code has not done since the S2 review
623
+ — the words follow the code as of 2026-09-28), AMBER on a failure, a refusal, an unreadable
624
+ `pageWriter` block, or — in session mode — a night owed for days while nightly runs went on
625
+ without it, and never RED. A night owed because no run started (fewer than three new
626
+ memories, dreaming off or declined) is green: the writer runs inside the nightly run now.
609
627
 
610
628
  **[M] The child gets the day on STDIN and a stance this package chose.** The instruction is
611
629
  not in `argv`, where `ps` shows it to every process on the machine, and
@@ -1621,3 +1621,41 @@ together at a prompt, the update notice waits. Details: `docs/adversarial-review
1621
1621
  transcript as `isMeta`, origin `peer`, "Another Claude session sent a message:", which
1622
1622
  the reader otherwise keeps as `injected`. `test/dream.test.ts` drives that exact shape
1623
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.
1637
+
1638
+ ## 2026-09-28 — the nightly run starts on its own; the writer's ask leaves the wake
1639
+
1640
+ Working defaults, held lightly. The dream line (`dreamLines`, UserPromptSubmit) follows
1641
+ the owner's dreaming setting: `auto` (the default) tells the model to call the dream
1642
+ tool's `launch` now, hand the prompt to one background agent — the page writer, the
1643
+ dream, the reflection — and tell the owner in one line how to say "no dreams"; `ask`
1644
+ keeps the 09-26 ask; `off` says nothing. The line claims the day once across sessions
1645
+ and again only for a run left behind (dream CONTRACT §5.1).
1646
+
1647
+ The SessionStart page-writer ask is RETIRED (`deliverPageWriterAsk`,
1648
+ `writerStarvedByScope`, `noteWriterDeferred`, `SCOPE_PATIENCE_DEFERRALS`,
1649
+ `ASK_SEPARATOR_BYTES`): the writer gets its day through the dream tool's `writer`
1650
+ phase, where no injection ceiling applies, so `no-room` cannot happen and the
1651
+ first-launch scope question has the ask field to itself. The registry mark
1652
+ (`pageWriterFor`) is still read by the MCP door, and nothing writes it now. Host mode
1653
+ is left in place, not the default.
1654
+
1655
+ Doctor's Page writer line: a night owed because no run started (fewer than three new
1656
+ memories, dreaming off or declined) is GREEN — the ordinary state of a quiet week; it is
1657
+ amber only when nightly runs went on for days without the writer, or on a failure, a
1658
+ refusal or an unreadable block. The fix text no longer names `injectionBudgetBytes` or
1659
+ host mode. The CONTRACT's old "amber while off and a page stands" was drift — the code
1660
+ had said green since the S2 review — and the CONTRACT now says what the code does.
1661
+ Doctor's Dreaming line leads with the setting.