counterparts 0.3.5 → 0.3.7
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.
- package/CHANGELOG.md +205 -0
- package/docs/module-map.md +1 -0
- package/package.json +1 -1
- package/src/adapters/claude-code/CONTRACT.md +110 -30
- package/src/adapters/claude-code/NOTES.md +96 -0
- package/src/adapters/claude-code/bin/hook.ts +62 -2
- package/src/adapters/claude-code/bin/nightly.ts +76 -0
- package/src/adapters/claude-code/config.ts +80 -0
- package/src/adapters/claude-code/doctor.ts +386 -25
- package/src/adapters/claude-code/hooks.ts +273 -311
- package/src/adapters/claude-code/index.ts +20 -2
- package/src/adapters/claude-code/night-run.ts +504 -0
- package/src/adapters/claude-code/page-writer.ts +50 -16
- package/src/adapters/cli/commands.ts +53 -16
- package/src/adapters/cli/dream-core.ts +54 -8
- package/src/adapters/cli/help.ts +7 -6
- package/src/adapters/cli/self-page.ts +5 -2
- package/src/adapters/dashboard/activity.ts +18 -5
- package/src/adapters/dashboard/registries.ts +1 -1
- package/src/adapters/dashboard/stories.ts +3 -1
- package/src/adapters/dashboard/web/README.md +108 -93
- package/src/adapters/dashboard/web/app.html +0 -6
- package/src/adapters/dashboard/web/app.js +3 -7
- package/src/adapters/dashboard/web/mechanisms/prospective/panel.js +11 -2
- package/src/adapters/dashboard/web/mechanisms/salience/panel.js +16 -4
- package/src/adapters/dashboard/web/narrate.ts +25 -6
- package/src/adapters/dashboard/web/pages/health/health.css +139 -0
- package/src/adapters/dashboard/web/pages/health/index.js +23 -12
- package/src/adapters/dashboard/web/pages/health/sections/archive.js +5 -2
- package/src/adapters/dashboard/web/pages/health/sections/checks.js +31 -24
- package/src/adapters/dashboard/web/pages/{home/sections/explorer.js → health/sections/mechanisms.js} +38 -75
- package/src/adapters/dashboard/web/pages/home/brain.js +17 -36
- package/src/adapters/dashboard/web/pages/home/go.js +7 -0
- package/src/adapters/dashboard/web/pages/home/home.css +56 -204
- package/src/adapters/dashboard/web/pages/home/index.js +48 -58
- package/src/adapters/dashboard/web/pages/home/sections/brain.js +84 -0
- package/src/adapters/dashboard/web/pages/home/sections/feel.js +27 -0
- package/src/adapters/dashboard/web/pages/home/sections/hero.js +43 -20
- package/src/adapters/dashboard/web/pages/home/sections/map.js +26 -0
- package/src/adapters/dashboard/web/pages/home/sections/today.js +41 -0
- package/src/adapters/dashboard/web/pages/memories/index.js +36 -19
- package/src/adapters/dashboard/web/pages/memories/memories.css +32 -42
- package/src/adapters/dashboard/web/pages/memories/row.js +37 -24
- package/src/adapters/dashboard/web/pages/memories/sections/feel.js +13 -154
- package/src/adapters/dashboard/web/pages/memories/sections/hold.js +34 -31
- package/src/adapters/dashboard/web/pages/memories/sections/list.js +70 -36
- package/src/adapters/dashboard/web/pages/memories/sections/search.js +90 -85
- package/src/adapters/dashboard/web/pages/memories/sections/tools.js +5 -4
- package/src/adapters/dashboard/web/pages/memories/state.js +11 -5
- package/src/adapters/dashboard/web/pages/self/index.js +2 -0
- package/src/adapters/dashboard/web/pages/self/sections/dreams.js +4 -1
- package/src/adapters/dashboard/web/pages/self/sections/map.js +453 -96
- package/src/adapters/dashboard/web/pages/self/sections/page.js +2 -2
- package/src/adapters/dashboard/web/pages/self/sections/traits.js +10 -9
- package/src/adapters/dashboard/web/pages/self/self.css +28 -20
- package/src/adapters/dashboard/web/shared/base.css +0 -1
- package/src/adapters/dashboard/web/shared/doctor.js +68 -0
- package/src/adapters/dashboard/web/shared/layout.css +0 -1
- package/src/adapters/dashboard/web/shared/memory-marks.css +1 -4
- package/src/adapters/dashboard/web/shared/memory-marks.js +2 -16
- package/src/adapters/dashboard/web/shared/memory-modal.js +45 -24
- package/src/adapters/dashboard/web/shared/modal.css +5 -0
- package/src/adapters/dashboard/web/shared/voice.js +18 -0
- package/src/adapters/dashboard/web/shared/widgets/feed.js +13 -43
- package/src/adapters/dashboard/web/shared/widgets/feel-radar.js +137 -0
- package/src/adapters/dashboard/web/shell/pulse.js +1 -16
- package/src/adapters/dashboard/web/views/activity.ts +10 -4
- package/src/adapters/dashboard/web/views/archive-words.ts +7 -1
- package/src/adapters/dashboard/web/views/dreams.ts +8 -5
- package/src/adapters/dashboard/web/views/flow-view.ts +9 -5
- package/src/adapters/dashboard/web/views/health.ts +13 -4
- package/src/adapters/dashboard/web/views/mechanism-panel.ts +24 -11
- package/src/adapters/dashboard/web/views/memories.ts +131 -29
- package/src/adapters/dashboard/web/views/memory-words.ts +29 -1
- package/src/adapters/dashboard/web/views/memory.ts +6 -3
- package/src/adapters/dashboard/web/views/mind.ts +19 -12
- package/src/adapters/dashboard/web/views/overview.ts +56 -91
- package/src/adapters/dashboard/web/views/search.ts +13 -5
- package/src/adapters/dashboard/web/views/today.ts +181 -0
- package/src/adapters/dashboard/web/views/traits.ts +117 -18
- package/src/adapters/dashboard/web/views.ts +2 -2
- package/src/adapters/fired.ts +9 -10
- package/src/adapters/mcp/NOTES.md +29 -0
- package/src/adapters/mcp/deliberate.ts +80 -5
- package/src/adapters/mcp/index.ts +2 -0
- package/src/adapters/mcp/server.ts +339 -42
- package/src/adapters/mcp/tools.ts +84 -34
- package/src/adapters/sessions.ts +5 -0
- package/src/core/associate/CONTRACT.md +33 -4
- package/src/core/associate/INTERFACE-GAPS.md +70 -0
- package/src/core/associate/NOTES.md +220 -1
- package/src/core/associate/buffer.ts +12 -9
- package/src/core/associate/contiguity.ts +81 -0
- package/src/core/associate/edges.ts +117 -6
- package/src/core/associate/index.ts +224 -7
- package/src/core/associate/pending.ts +7 -3
- package/src/core/associate/spread.ts +154 -69
- package/src/core/associate/tunables.ts +75 -5
- package/src/core/counterpart.ts +539 -25
- package/src/core/dream/CONTRACT.md +175 -40
- package/src/core/dream/NOTES.md +225 -1
- package/src/core/dream/index.ts +1869 -288
- package/src/core/dream/mind.ts +120 -39
- package/src/core/dream/reflect.ts +1074 -298
- package/src/core/dream/slices.ts +217 -0
- package/src/core/dream/tunables.ts +105 -16
- package/src/core/fit/CONTRACT.md +80 -0
- package/src/core/fit/INTERFACE-GAPS.md +16 -0
- package/src/core/fit/NOTES.md +37 -0
- package/src/core/fit/index.ts +499 -0
- package/src/core/recall/CONTRACT.md +13 -2
- package/src/core/recall/INTERFACE-GAPS.md +10 -0
- package/src/core/recall/NOTES.md +76 -0
- package/src/core/recall/activate.ts +320 -62
- package/src/core/recall/gate.ts +73 -4
- package/src/core/recall/index.ts +46 -10
- package/src/core/recall/render.ts +12 -1
- package/src/core/recall/session.ts +8 -0
- package/src/core/recall/tunables.ts +30 -0
- package/src/core/remember/owes.ts +4 -1
- package/src/core/retrieval.ts +15 -6
- package/src/core/schemas/index.ts +8 -1
- package/src/core/self/CONTRACT.md +33 -18
- package/src/core/self/NOTES.md +26 -0
- package/src/core/self/index.ts +22 -3
- package/src/core/self/journal-file.ts +5 -2
- package/src/core/self/page.ts +60 -30
- package/src/core/self/writer.ts +114 -19
- package/src/core/sleep/NOTES.md +11 -0
- package/src/core/sleep/decay.ts +16 -1
- package/src/core/sleep/prune.ts +16 -1
- package/src/core/store/NOTES.md +3 -1
- package/src/core/store/errors.ts +4 -3
- package/src/core/store/feelings.ts +143 -22
- package/src/core/store/index.ts +200 -16
- package/src/core/store/traits.ts +24 -6
- package/src/adapters/dashboard/web/pages/home/sections/live-activity.js +0 -34
- package/src/adapters/dashboard/web/pages/home/sections/tiles.js +0 -62
- package/src/adapters/dashboard/web/pages/home/sections/tonight.js +0 -74
- package/src/adapters/dashboard/web/pages/home/sections/written.js +0 -76
- package/src/adapters/dashboard/web/views/tonight.ts +0 -158
- package/src/adapters/dashboard/web/views/written-returned.ts +0 -93
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,210 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.7 — 2026-09-29
|
|
4
|
+
|
|
5
|
+
Dreaming asks where you can see it, and "on its own" now means a separate background
|
|
6
|
+
session the hook starts itself. Memory also fits more into a night, reads long
|
|
7
|
+
memories whole, and lets links bring a memory to mind. **The store's format does not
|
|
8
|
+
change** (it stays v9), so nothing is copied or upgraded. Close every session before
|
|
9
|
+
installing anyway: the hooks switch to the new code at once, while a session left open
|
|
10
|
+
keeps the old memory server. Run `/mcp` → Reconnect in any you missed.
|
|
11
|
+
|
|
12
|
+
Dreaming.
|
|
13
|
+
|
|
14
|
+
- **The day's question shows in your terminal.** On the first prompt of a new day, with
|
|
15
|
+
memories waiting to be dreamed, you see: `Counterparts: I haven't dreamed since …
|
|
16
|
+
(N new memories). Say "dream" to start, or "dream on your own" to let me do it each
|
|
17
|
+
day.` Claude doesn't ask it again; it waits for your word.
|
|
18
|
+
- **`ask` is the default now** (it was `auto`). Say "dream" and the run starts in a
|
|
19
|
+
background agent, as before.
|
|
20
|
+
- **"Dream on your own" means a headless nightly run.** With the setting `auto`, the
|
|
21
|
+
first prompt of the day starts the run itself, in a separate, windowless `claude`
|
|
22
|
+
session, and tells you: `Counterparts: dreaming in the background (a few minutes).
|
|
23
|
+
Say "no dreams" to turn it off.` Nothing is asked of the session you're in. That
|
|
24
|
+
session is locked down: it can use only the counterparts memory tools (dream,
|
|
25
|
+
reflect, self page, recall), Claude Code's own tools that run commands, read or
|
|
26
|
+
write files, reach the network or start agents are turned off, it loads only the
|
|
27
|
+
counterparts MCP server, it starts in a neutral folder (the store's own, so no
|
|
28
|
+
project's instructions or hooks load), and it has a turn limit and a 20-minute
|
|
29
|
+
watchdog.
|
|
30
|
+
- **Every run leaves one record**: done, partial (with the parts that ran: writer,
|
|
31
|
+
dream, reflection), failed, timed out, or could not start, with the reason. What the
|
|
32
|
+
run did is told on the next prompt, in any session, once. `counterparts dream` and
|
|
33
|
+
doctor's new **Nightly run** line show the latest run.
|
|
34
|
+
- **If the run can't start, it asks instead**, with the reason in one line: `I
|
|
35
|
+
couldn't start dreaming on my own: the claude command was not found. Say "dream" to
|
|
36
|
+
do it here.` The next day tries on its own again.
|
|
37
|
+
- **If you had set `auto` yourself before this version, it is set back to `ask`
|
|
38
|
+
once**, and you're told once, in the terminal. `auto` used to mean "Claude starts a
|
|
39
|
+
background agent in your session"; it now means a separate session, so it's yours to
|
|
40
|
+
choose again ("dream on your own"). A store that never chose a setting simply gets
|
|
41
|
+
the new default, `ask`.
|
|
42
|
+
- **"No dreams" takes effect from the next run**; a run already under way finishes,
|
|
43
|
+
and it says so.
|
|
44
|
+
- The run's words say "while I slept" and "since you last slept", not "last night":
|
|
45
|
+
it runs at the day's first session, usually the morning.
|
|
46
|
+
- **The reflection leans toward rewriting the page** each day, unless there's really
|
|
47
|
+
nothing new; it's told when the page writer already revised it earlier in the run,
|
|
48
|
+
and that every version is kept.
|
|
49
|
+
- **Fixed before release:** since 0.3.6, on the development branch, the dream and
|
|
50
|
+
the reflection were shown only the counts of what they were handed, not the
|
|
51
|
+
memories themselves. They see the memories again. (0.3.6 as published was not
|
|
52
|
+
affected.)
|
|
53
|
+
|
|
54
|
+
Fitting more into a night.
|
|
55
|
+
|
|
56
|
+
- **New memories wait their turn instead of being dropped.** Memories not yet dreamed
|
|
57
|
+
form a queue, ranked by how much they matter, not by how new they are. What fits in
|
|
58
|
+
tonight's room is dreamed; the rest wait for the next night, and the dream says how
|
|
59
|
+
many ("12 new memories wait for the next night"). A memory still not dreamed after
|
|
60
|
+
seven days of use ages out, counted.
|
|
61
|
+
- **Detail by importance.** Every memory the dream is shown gets a line (what it is,
|
|
62
|
+
its date, its strongest feeling, why it's here); the most important come whole.
|
|
63
|
+
The reflection now sees the whole core and every memory from the last few days.
|
|
64
|
+
- **Journals as chapters.** A long journal is sent a chapter at a time, only the
|
|
65
|
+
chapters added since the last dream, and entries that didn't fit are carried to the
|
|
66
|
+
next night. Before, a grown journal was re-sent from chapter 1 and the newest
|
|
67
|
+
chapters were the ones cut.
|
|
68
|
+
- **Long answers come in parts** ("part 1 of 3") rather than cut.
|
|
69
|
+
- **Recall by id reads up to 10 memories at once, each whole**, in parts when it is
|
|
70
|
+
long, so a dream merge, a journal or a long episode can be read through the memory
|
|
71
|
+
tool. Ids past the room wait, named, with the call that fetches them.
|
|
72
|
+
- **Doctor's new Lookups line** says how often the dream and the reflection looked up
|
|
73
|
+
a memory they were shown only in part.
|
|
74
|
+
- `note`, `session_end` and `chapter` ask Claude for a one-line title.
|
|
75
|
+
- **Nightly upkeep resumes where it stopped.** Pruning and fading pick up after the
|
|
76
|
+
last memory they looked at, instead of the same random slice each night.
|
|
77
|
+
- **Open things are found by state**, not among the newest few: a contradiction a
|
|
78
|
+
dream flagged many nights ago is still raised, and a morning share not yet told is
|
|
79
|
+
still carried. A flagged contradiction that keeps coming up is shown less each
|
|
80
|
+
time, until one of its memories is used again.
|
|
81
|
+
|
|
82
|
+
Links between memories.
|
|
83
|
+
|
|
84
|
+
- **Links can bring a memory to mind.** When the memories a prompt calls up are
|
|
85
|
+
strongly linked to another one that shares none of its words, that one may be shown
|
|
86
|
+
quietly, at the end, marked `Linked:` (at most two). Doctor's **Association** line
|
|
87
|
+
says how many were shown and how many Claude then opened.
|
|
88
|
+
- **Memories written close together in a session are linked**, lightly, when the
|
|
89
|
+
session ends: each to the next one or two. Links still fade unless use strengthens
|
|
90
|
+
them. What the nightly run writes is left out.
|
|
91
|
+
- **Steadier links.** A new link starts faint and a link's strength no longer depends
|
|
92
|
+
on how many others its memory has. Links a dream or a summary proposes are added
|
|
93
|
+
only where there's room; they never push out a link learned from use. Spreading
|
|
94
|
+
goes strongest-first and stops when what it carries gets faint. Dead links are
|
|
95
|
+
swept.
|
|
96
|
+
- Four fixes: a dream re-linking two memories no longer brought back a link's old
|
|
97
|
+
strength; a memory used twice in one day still links with what it was used with;
|
|
98
|
+
a link could no longer push a memory the prompt found strongly down the list; and
|
|
99
|
+
importance is weighed before the list is cut, not after.
|
|
100
|
+
|
|
101
|
+
The dashboard.
|
|
102
|
+
|
|
103
|
+
- **Memories, round 4, so it reads for anyone.** One search box, "Find a memory"
|
|
104
|
+
(type to find by words, Enter to ask by meaning; the answers replace the list).
|
|
105
|
+
**How well I remember** (renamed, journal counted as its own part). Two rows of
|
|
106
|
+
filters: kinds (about myself, people, things, skills, places, facts, journal, core)
|
|
107
|
+
and the six feelings, with "kept · put away · both" beside them. Every row the same
|
|
108
|
+
brightness; "fading" only where it is. The card is trimmed to the text, the
|
|
109
|
+
feelings chart, one sentence on how well it's remembered and when it would be put
|
|
110
|
+
away, why it mattered, and when it was written; the rest is under "details".
|
|
111
|
+
"Archived" reads "put away". **"+ Add a memory"**. The "Reading here changes
|
|
112
|
+
nothing" badge is gone from every page. Home and Memories share one feelings
|
|
113
|
+
chart.
|
|
114
|
+
- **The Self map reads at a glance** (on Home and Self): its rings are named on the
|
|
115
|
+
map ("who I am", "almost there", "about me and us"), the core and almost-there
|
|
116
|
+
memories carry short names, and links show only when you hover or tap a dot. On
|
|
117
|
+
Home, the brain is back on the right, beside Today.
|
|
118
|
+
|
|
119
|
+
## 0.3.6 — 2026-09-28
|
|
120
|
+
|
|
121
|
+
The nightly run: once a day, Claude writes its page, dreams and reflects in one
|
|
122
|
+
background run, and starts it on its own. **The store's format does not change** (it
|
|
123
|
+
stays v9), so nothing is copied or upgraded. Close every session before installing
|
|
124
|
+
anyway: a session left open keeps the old memory server while the hooks switch to the
|
|
125
|
+
new code at once, and the new dream start needs both. Run `/mcp` → Reconnect in any
|
|
126
|
+
you missed.
|
|
127
|
+
|
|
128
|
+
The nightly run.
|
|
129
|
+
|
|
130
|
+
- **One background run, once a calendar day: the page writer, then the dream, then
|
|
131
|
+
the reflection.** The first prompt of a new day tells Claude to start it, when at
|
|
132
|
+
least 3 memories are new since the last dream. Claude hands it to one background
|
|
133
|
+
agent and tells you one line: "Dreaming in the background (a few minutes). Say 'no
|
|
134
|
+
dreams' anytime to turn it off." With fewer than 3 new memories nothing runs, and
|
|
135
|
+
they carry over to the next day.
|
|
136
|
+
- **Dreaming has a setting: auto, ask or off.** `auto` is the default: the run starts
|
|
137
|
+
on its own and says so. `ask` asks you first, as 0.3.5 did. `off` asks nothing.
|
|
138
|
+
Say "no dreams" in a session, or run `counterparts dream --setting off`; turn it
|
|
139
|
+
back on the same way (`--setting auto`). `counterparts dream` and doctor's Dreaming
|
|
140
|
+
line say which it is.
|
|
141
|
+
- **The page writer is back in the run.** It no longer waits for room in the session
|
|
142
|
+
start, which is why it had stopped. It is handed the page whole and the day it
|
|
143
|
+
reads, as the first step of the run.
|
|
144
|
+
- **Who wrote each version of the page.** A version the reflection wrote is now
|
|
145
|
+
labelled "reflection", apart from the writer's. Both may write the page on the same
|
|
146
|
+
night, and every version is kept. `counterparts self-page --versions` and the
|
|
147
|
+
dashboard's Self tab say which.
|
|
148
|
+
- **A dream that was cut off picks up where it stopped.** If a dream began, changed
|
|
149
|
+
something and then went quiet for 30 minutes (its session closed, say), the next
|
|
150
|
+
session starts the run again and the dream resumes: what it already did stands. A
|
|
151
|
+
dream that began and changed nothing is closed and a fresh one starts. A run that
|
|
152
|
+
dreamed but was cut off before it reflected finishes only the reflection. At most
|
|
153
|
+
twice a day.
|
|
154
|
+
- **"Dreamed today" and "reflected today" are calendar days**, not days of use.
|
|
155
|
+
- **The reflection sees what the dream saw**, every memory the dream was shown and
|
|
156
|
+
what it made, and can cite them. It gets the self page whole. When all of that is
|
|
157
|
+
too long for one answer, it comes in parts ("part 1 of 3"), and nothing is cut.
|
|
158
|
+
- **Page sections.** The self page's own headings ("Us", "How I work", anything) are
|
|
159
|
+
read as sections, not only Core and Lately. The dashboard's Self tab, the `self_page`
|
|
160
|
+
tool and the CLI list every one.
|
|
161
|
+
- Doctor no longer marks the page writer amber just because a night is owed. It is
|
|
162
|
+
amber only when nightly runs went on for days without the writer, or it failed.
|
|
163
|
+
|
|
164
|
+
Fewer refusals.
|
|
165
|
+
|
|
166
|
+
- **Dreams and reflections are refused less, and repaired more.** An over-long or
|
|
167
|
+
two-part feeling ("steadied: after the long week") is split: the first word is the
|
|
168
|
+
feeling, the rest goes to what carried it. Texts over their limit are kept to the
|
|
169
|
+
limit and the result says so; the limits for a morning share, a reflection's entry,
|
|
170
|
+
a dream's journal and a merged memory are higher. Many refusals that protected
|
|
171
|
+
nothing now write, with a note. The ones that stay (dream words never become lived
|
|
172
|
+
memory, a confidential memory's words stay off the page, the page cites real
|
|
173
|
+
memories) now say why, with the words or the id that tripped them.
|
|
174
|
+
- **The self page may quote a lived memory a dream also quoted.** The old check
|
|
175
|
+
refused it.
|
|
176
|
+
- **A reflection can finish a second time the same day**, to supply what the first
|
|
177
|
+
finish left out or had refused: the page, the share, feelings, what a memory is
|
|
178
|
+
about, traits. It never writes a second entry. A share already told can't be
|
|
179
|
+
replaced. The same feeling sent twice is recorded once.
|
|
180
|
+
- The instructions Claude reads now say which feeling field is which, before it
|
|
181
|
+
writes.
|
|
182
|
+
|
|
183
|
+
Seeing it.
|
|
184
|
+
|
|
185
|
+
- **Newest first.** When a record held more events than a view read, several views
|
|
186
|
+
kept the oldest and called them the newest: the dashboard's feed, a memory's days
|
|
187
|
+
of use, Health's heatmap (today read empty), the flow view, contested beliefs, the
|
|
188
|
+
page's version reasons, and a few doctor counts. They read the newest now.
|
|
189
|
+
- **"Of N".** A list that is cut says so: search says "the closest 25 of N matches",
|
|
190
|
+
Health's archive "the newest 200 of N", dreams "the newest 12 of N".
|
|
191
|
+
`counterparts dream --list --all` lists every dream.
|
|
192
|
+
|
|
193
|
+
**The dashboard's Home tab, round 4.** Home now holds the best pictures from the other
|
|
194
|
+
tabs, each a way in. A headline (the day, your name, how many memories, how many new
|
|
195
|
+
today) with a health dot that links to Health. The brain beside **Today**: a few plain
|
|
196
|
+
lines about what happened to memory today, each opening that thing. **How it feels**
|
|
197
|
+
(the feelings radar) and **Around the core** (the Self tab's map). Gone from Home: the
|
|
198
|
+
four tiles, the written/came-back strip, the Tonight box and the live feed. The
|
|
199
|
+
mechanism pills and "how it works" moved to the end of Health.
|
|
200
|
+
|
|
201
|
+
**Other dashboard fixes.** "How I act" puts the faint week-ago mark where it really
|
|
202
|
+
stood a week ago, counting memories archived since, and fits a phone. Day counts are
|
|
203
|
+
whole ("14 days of use", not "14.00"). Health names archived memories in words
|
|
204
|
+
("merged in a dream", not "dream-merge"), and says its memory count leaves out the
|
|
205
|
+
cards for people and projects. Home's chapter count matches Self's. The Self map's
|
|
206
|
+
ready dots no longer sit on top of each other.
|
|
207
|
+
|
|
3
208
|
## 0.3.5 — 2026-09-27
|
|
4
209
|
|
|
5
210
|
Claude reflects after a dream, tells you about it in the morning, and rewrites its self
|
package/docs/module-map.md
CHANGED
|
@@ -24,6 +24,7 @@ code and the `NOTES.md` / `INTERFACE-GAPS.md` next to it.*
|
|
|
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
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
|
+
| `fit/` | working memory's pointers | Fitting what a mechanism has into the room it has: a line for everything, the whole text for the most important, ids and a named lookup for the rest, a count of what waits. Plus `lineOf`, `derivedFrom`, parts, and the lookup ledger that measures whether receivers use the lookup. First users: the dream and the reflection. **Added 2026-09-28 (build B).** |
|
|
27
28
|
| *(`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
29
|
| *(`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
30
|
| *(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`. |
|
package/package.json
CHANGED
|
@@ -563,22 +563,43 @@ 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
|
|
567
|
-
|
|
568
|
-
**[M]
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
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 run starts — since 2026-09-29 either on the
|
|
571
|
+
person's "dream" (the model calls the dream tool's `launch` and hands the prompt to ONE
|
|
572
|
+
background agent) or, with `auto`, headless, started by the hook itself (next section). 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 — `ask` (the default since 2026-09-29) shows the PERSON
|
|
579
|
+
the question in the terminal and waits for "dream", `auto` starts the run HEADLESS (below),
|
|
580
|
+
`off` says nothing — kept in the store's meta, set by the dream
|
|
581
|
+
tool's `setting` phase ("no dreams") or `counterparts dream --setting`, shown by doctor. The
|
|
582
|
+
line is claimed once a day across sessions (`dream_asks`), and again only for a run left
|
|
583
|
+
behind (a dream begun and quiet for 30 minutes, or — `auto` — a launch no dream followed),
|
|
584
|
+
at most twice a day.
|
|
585
|
+
|
|
586
|
+
**[M] The writer moved out of the wake and into the run (2026-09-28).** The SessionStart ask
|
|
587
|
+
that handed the first session of a day the day just gone (S2's session mode, 2026-09-20) is
|
|
588
|
+
RETIRED, and with it its deferral (`no-room`), its contest with the first-launch question
|
|
589
|
+
for the ask field, and the registry mark it wrote. The dream tool's `writer` phase — the
|
|
590
|
+
run's first call — writes the night's claim (the ordinary `asked` row, `about` = yesterday's
|
|
591
|
+
local date, carrying the SESSION and the run) and hands the writer its day through a tool
|
|
592
|
+
result, the page whole: no injection ceiling, so nothing is deferred for room.
|
|
593
|
+
The MCP server labels a `self_page` write `by: "writer"` when the write NAMES a session
|
|
594
|
+
that holds that open claim (`self/writer.ts#nightClaimFor`) — not the session the server is
|
|
595
|
+
bound to, so the owner's own page edit in the run's session stays an ordinary amendment;
|
|
596
|
+
and when the run moves past the writer without a write, its next phase answers the night
|
|
597
|
+
`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.
|
|
598
|
+
|
|
599
|
+
**[M] Host mode (not the default; left in place) starts a windowless session of the self,
|
|
600
|
+
and reads the outcome from the store.** With `pageWriter.mode: host` the nightly run claims
|
|
601
|
+
nothing for the writer (its `writer` phase says so) and the worker's child writes instead.
|
|
602
|
+
`claude -p`, so the ordinary SessionStart hook fires inside the child and the
|
|
582
603
|
writer wakes with the wake; exactly one pre-approved tool, the page's. The plan is pure and
|
|
583
604
|
decides everything; the starter is six lines. The package's own values go onto the child's
|
|
584
605
|
environment LAST (§2.13), and `COUNTERPARTS_SESSION` / `COUNTERPARTS_SCOPE` are REMOVED
|
|
@@ -588,24 +609,22 @@ as a pinned DATE (`COUNTERPARTS_PAGE_WRITER`), because a windowless child's sess
|
|
|
588
609
|
minted by the host after the launcher is gone. **The child's stdout is never parsed into a
|
|
589
610
|
verdict**: what the run did is read from the page's version chain and from the row the tool
|
|
590
611
|
left, and the exit code decides only between "nothing to say" and "could not run". The
|
|
591
|
-
child
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
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.
|
|
612
|
+
child is told nothing on its prompts (`HookInput.pageWriter`): no dream line, no reminders.
|
|
613
|
+
|
|
614
|
+
(Retired with the SessionStart ask, 2026-09-28: the measured-not-predicted sizing against the
|
|
615
|
+
host's ceiling, the durable `skipped` deferral rows, and the first-launch question's
|
|
616
|
+
once-per-night patience. `skipped` rows written before still read as they always did.)
|
|
602
617
|
|
|
603
618
|
**[M] It never costs anything else.** The writer runs last in the detached worker, inside
|
|
604
619
|
the same `finally` as the snapshot, so a day whose sweep broke is still a day that gets
|
|
605
620
|
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
|
|
607
|
-
GREEN on a night that had nothing to say,
|
|
608
|
-
|
|
621
|
+
Doctor's `Page writer` line is GREEN when it has never run on a store with no yesterday,
|
|
622
|
+
GREEN on a night that had nothing to say, GREEN when it is off (a deliberate choice; this
|
|
623
|
+
page used to say amber while a page stands, which the code has not done since the S2 review
|
|
624
|
+
— the words follow the code as of 2026-09-28), AMBER on a failure, a refusal, an unreadable
|
|
625
|
+
`pageWriter` block, or — in session mode — a night owed for days while nightly runs went on
|
|
626
|
+
without it, and never RED. A night owed because no run started (fewer than three new
|
|
627
|
+
memories, dreaming off or declined) is green: the writer runs inside the nightly run now.
|
|
609
628
|
|
|
610
629
|
**[M] The child gets the day on STDIN and a stance this package chose.** The instruction is
|
|
611
630
|
not in `argv`, where `ps` shows it to every process on the machine, and
|
|
@@ -620,6 +639,67 @@ Everything above about host mode is proved against a stub executable. What a rea
|
|
|
620
639
|
has to answer is keychain access from a background process (`claude setup-token` is the
|
|
621
640
|
documented route, spec §16), which is why `session` is the default.
|
|
622
641
|
|
|
642
|
+
### The headless nightly run (2026-09-29 — working defaults, held lightly)
|
|
643
|
+
|
|
644
|
+
**[M] With the setting `auto` the hook starts the nightly run itself; nothing in the working
|
|
645
|
+
session launches anything.** On the first prompt of a calendar day that is due
|
|
646
|
+
(`hooks.ts#dreamLines` → `startNightRun`), the hook claims the day, starts
|
|
647
|
+
`bin/nightly.ts` DETACHED (`night-run.ts#planNightRunner`, `spawn.ts#spawnDetached`) and
|
|
648
|
+
records the run `started`, with its watchdog. That process composes the launch prompt from
|
|
649
|
+
the store, starts `claude -p` with it on STDIN (`planNightChild`), waits under the run's own
|
|
650
|
+
watchdog (`dreaming.timeoutMs`, default `NIGHT_RUN_MS` 20 minutes) and records the end. The
|
|
651
|
+
outcome is read from the exit and the store, never from the child's output:
|
|
652
|
+
|
|
653
|
+
- `done`: the dream and the reflection ran (the reflection, for a reflection-alone run);
|
|
654
|
+
- `partial`: some of the run's parts ran and not all, whatever the exit, with the parts on
|
|
655
|
+
the row (`writer` when its phase was reached and recorded, `dream` journaled, `reflection`
|
|
656
|
+
finished) and the exit as its reason;
|
|
657
|
+
- `failed` or `timed-out`: nothing finished;
|
|
658
|
+
- `could-not-start`: `no-claude`, `spawn-failed`, `quick-exit` (non-zero inside
|
|
659
|
+
`NIGHT_QUICK_EXIT_MS` with nothing begun), `nothing-ran` (a clean exit that began no dream
|
|
660
|
+
and no reflection), `refused`, or `runner` (the detached process could not be started).
|
|
661
|
+
|
|
662
|
+
**[M] The child is locked down (owner decision B).** `--permission-mode default`;
|
|
663
|
+
`--allowedTools` exactly `mcp__counterparts__dream`, `…reflect`, `…self_page`, `…recall`;
|
|
664
|
+
`--disallowedTools` the built-ins that run commands or code, read, search or write files,
|
|
665
|
+
reach the network, start agents or workflows, or schedule work (`NIGHT_DENIED_TOOLS` — a
|
|
666
|
+
deny beats the user's own allow rules; `ToolSearch` stays, for hosts that defer MCP tools);
|
|
667
|
+
`--strict-mcp-config` with an `--mcp-config` naming only the counterparts server, as the
|
|
668
|
+
install registers it (`nightMcpConfig`); `--max-turns` (`NIGHT_MAX_TURNS` 60,
|
|
669
|
+
`dreaming.maxTurns`); `--model` only when `dreaming.model` is set. It starts in a NEUTRAL
|
|
670
|
+
directory — the store's own — so no project's CLAUDE.md, hooks or MCP servers load. The
|
|
671
|
+
parent's stance, page-writer, `CLAUDE_PROJECT_DIR` and `CLAUDECODE` variables are removed;
|
|
672
|
+
this package's values are written last.
|
|
673
|
+
|
|
674
|
+
**[M] Session binding: the run is attributed to the session that started it.** The launch
|
|
675
|
+
prompt names that session's id, and the id and its directory are PINNED
|
|
676
|
+
(`COUNTERPARTS_SESSION`, `COUNTERPARTS_SCOPE`) on the child's environment and on its MCP
|
|
677
|
+
server's, so the server is launched bound to it — never lazy-bound through the registry,
|
|
678
|
+
whose liveness check refuses a session left open overnight (review of #282, finding 1). The
|
|
679
|
+
child's own host-minted session is QUIET (`HookInput.nightRun`, from
|
|
680
|
+
`COUNTERPARTS_NIGHT_RUN`): its hooks capture nothing (so it owes no write-up) and give no dream
|
|
681
|
+
lines, plain reminders, Stop ask, write-up pointer or first-launch question. It still wakes
|
|
682
|
+
with the ordinary wake.
|
|
683
|
+
|
|
684
|
+
**[M] The person sees it, and a run that cannot do its job falls back to asking.** The prompt
|
|
685
|
+
hook's `systemMessage` carries "dreaming in the background (a few minutes). Say "no dreams"
|
|
686
|
+
to turn it off." when the envelope has room (the model's line never claims it was shown).
|
|
687
|
+
A run that could not start, or timed out / failed / never reported (a `started` row past its
|
|
688
|
+
watchdog plus `NIGHT_LOST_GRACE_MS`) having begun nothing, makes the next offer — the same
|
|
689
|
+
prompt, or the next — an ASK with the reason ("I couldn't start dreaming on my own: …"),
|
|
690
|
+
recorded `offered` after `could-not-start` and not counted as a relaunch. A run still inside
|
|
691
|
+
its watchdog is `dreaming-now`: no second run starts beside it. "No dreams" does not stop a
|
|
692
|
+
run in flight; it takes effect from the next run and says so (owner decision D). A run that
|
|
693
|
+
ended hands back its dream's line (a partial says so; a reflection-alone run hands back its
|
|
694
|
+
share only) at the next prompt anywhere, once (owner decision C). Doctor's Nightly run line
|
|
695
|
+
reads the record; amber only while `auto` and the latest run did not finish. Observer:
|
|
696
|
+
nothing starts. Proved against a stub executable only.
|
|
697
|
+
|
|
698
|
+
**[M] `auto` from before this version is set back to `ask` once (owner decision A).** Its
|
|
699
|
+
meaning changed, so a store with `auto` written explicitly is reset on the first prompt on
|
|
700
|
+
this version, recorded (`dream.ask`, `by: upgrade`), and the owner is told once in the
|
|
701
|
+
terminal; "dream on your own" sets it again. Any setting chosen on this version is kept.
|
|
702
|
+
|
|
623
703
|
### The next-session write-up (C2, 2026-09-23 — true for now)
|
|
624
704
|
|
|
625
705
|
**[M] A session that ended owing a write-up is written up by the next session that starts
|
|
@@ -1634,3 +1634,99 @@ reflection rewrote the page it finds the night claimed and stands down.
|
|
|
1634
1634
|
|
|
1635
1635
|
- **2026-09-27, owner ruling D3 on #256:** `openAdapter` passes `pageWriter.mode` to
|
|
1636
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.
|
|
1662
|
+
|
|
1663
|
+
## 2026-09-29 — the ask the person sees; the headless nightly run
|
|
1664
|
+
|
|
1665
|
+
Working defaults, held lightly (dream NOTES has the why).
|
|
1666
|
+
|
|
1667
|
+
- **A — the ask.** `dreamLines` no longer claims an ask: it returns the offer as
|
|
1668
|
+
`HookResult.dream`, and `bin/hook.ts#deliverTurn` claims it (`claimDream`) only when the
|
|
1669
|
+
envelope carries the person's line, after the plain reminders and before the update
|
|
1670
|
+
notice. Without room, or on a lost race, the model's line is stripped (`withoutDream`)
|
|
1671
|
+
and the next prompt offers it again.
|
|
1672
|
+
- **B — where the spawn lives.** In the hook process, beside the worker's spawn, through
|
|
1673
|
+
the same `spawnDetached` and the same injected `spawner` — so the tests see the plan and
|
|
1674
|
+
nothing starts. The detached process is `bin/nightly.ts`, not the session-end worker
|
|
1675
|
+
(whose watchdog is five minutes; a run is about five). Its own planner, not `planSpawn`:
|
|
1676
|
+
`validateWatchdog` guards span claims this process never makes, and would refuse a
|
|
1677
|
+
20-minute watchdog. Its outer `timeout` is set past the child's watchdog plus both kill
|
|
1678
|
+
graces, though in practice it is moot — `spawn`'s timeout lives in the hook process,
|
|
1679
|
+
which exits at once; the watchdog that matters is `runNight`'s, inside `bin/nightly.ts`.
|
|
1680
|
+
- **The watchdog** is `page-writer.ts#startChild`, now exported and shared (plus `cwd` and
|
|
1681
|
+
the OS spawn code): SIGTERM to the group, SIGKILL after `KILL_GRACE_MS`, stop waiting
|
|
1682
|
+
after `REAP_GRACE_MS`.
|
|
1683
|
+
- **Two opens, not one held open.** `runNight` opens the store to compose and record
|
|
1684
|
+
`started`, closes it for the run (the child's own MCP server writes meanwhile), and opens
|
|
1685
|
+
it again to record the end.
|
|
1686
|
+
- **`nightArgs` is required to start a run.** An adapter built without it (every test, any
|
|
1687
|
+
other host) records `could-not-start` / `runner` and asks instead — so no test can start
|
|
1688
|
+
a real `claude` by accident. `bin/hook.ts` passes `["run", NIGHTLY_PATH]`.
|
|
1689
|
+
- **The page writer's child is unchanged** apart from sharing `startChild`: its `pageWriter`
|
|
1690
|
+
flag still means only "no dream lines, no plain reminders". The quiet set is the night
|
|
1691
|
+
run's.
|
|
1692
|
+
- **Unproven until a real run** (the coordinator's, against a temp store): that a detached
|
|
1693
|
+
`claude -p` reaches the subscription login; that removing `CLAUDECODE` is enough for a
|
|
1694
|
+
nested start; whether `claude -p` fires UserPromptSubmit/Stop inside the child (the quiet
|
|
1695
|
+
flag covers both either way); and how long a real run takes against `NIGHT_RUN_MS`.
|
|
1696
|
+
|
|
1697
|
+
## 2026-09-29, later — the fix round after the review of #282
|
|
1698
|
+
|
|
1699
|
+
(`docs/adversarial-review-pr282-2026-09-29.md`; owner decisions A–D the same day.)
|
|
1700
|
+
|
|
1701
|
+
- **Binding is pinned, not lazy (finding 1).** A session left open overnight is stale in the
|
|
1702
|
+
registry at the morning's first prompt — a prompt is not a boundary — and the child's
|
|
1703
|
+
fresh MCP server refused the lazy bind, which then read as "the MCP server is not
|
|
1704
|
+
registered". The launching session and its directory now ride on the child's
|
|
1705
|
+
environment and in its MCP server's own `--mcp-config` env, so `serve.ts` launches bound.
|
|
1706
|
+
- **Locked down (finding 3, owner decision B).** `--disallowedTools` (names read from the
|
|
1707
|
+
2.1.284 build's own strings, since `--help` lists the flag but not the tool names;
|
|
1708
|
+
`MultiEdit` is not one there; `ToolSearch` deliberately left), `--strict-mcp-config` with
|
|
1709
|
+
a generated `--mcp-config` for counterparts only — derived from `mcp/bin/serve.ts` beside
|
|
1710
|
+
this file and `process.execPath`, i.e. THIS install's server, which is also the version
|
|
1711
|
+
the hooks run; it is not read from the user's `claude mcp` registration — a neutral
|
|
1712
|
+
working directory (the store's), and `--max-turns` (not in `--help`, but defined in that
|
|
1713
|
+
build: "Maximum number of agentic turns in non-interactive mode … only works with
|
|
1714
|
+
--print"). `--permission-mode default` is valid there: `manual` is its display name and
|
|
1715
|
+
maps to `default`.
|
|
1716
|
+
- **Fall back on everything that did not work (finding 4).** Timed out, failed, or never
|
|
1717
|
+
reported (a `started` row past its watchdog plus a grace — the row now carries the
|
|
1718
|
+
watchdog), having begun nothing: the next offer asks. `bin/nightly.ts` records its own
|
|
1719
|
+
stand-downs where the store opens, and `runNight` no longer reopens a store that would not
|
|
1720
|
+
open just to say so.
|
|
1721
|
+
- **Partial (finding 5, owner).** Parts on the row; `partial` in the record, doctor, and
|
|
1722
|
+
`counterparts dream` (the latest run under the setting; `--show` on its dream).
|
|
1723
|
+
- **The same-prompt fallback is an ask (finding 7)**, not a relaunch.
|
|
1724
|
+
- **Under way means under way (finding 10).** A `started` row inside its watchdog is
|
|
1725
|
+
`dreaming-now`, so a long `dreaming.timeoutMs` cannot let a second run start.
|
|
1726
|
+
- **`askLine` starts nothing, so it claims no headless offer (finding 9).**
|
|
1727
|
+
- **Owner decisions:** A — an explicit `auto` from before is reset to `ask` once, recorded
|
|
1728
|
+
and told; C — the hand-back stays "next prompt anywhere"; D — "no dreams" takes effect
|
|
1729
|
+
from the next run and says so.
|
|
1730
|
+
- **Still open:** the dashboard's vocabulary does not name `dream.night` or the two latch
|
|
1731
|
+
events yet (every reader guards unknown names). The host-mode page writer's child has the
|
|
1732
|
+
same exposure finding 3 describes and is not locked down here.
|
|
@@ -39,9 +39,11 @@ import { resolveZone, todayIn } from "../../../core/time.js";
|
|
|
39
39
|
import { loadConfig, withEmbedderDefault } from "../config.js";
|
|
40
40
|
import type { AdapterConfig } from "../config.js";
|
|
41
41
|
import { HOOKS, openAdapter } from "../index.js";
|
|
42
|
-
import { STOP_HUMAN_LINE, plainLine, withoutPlain } from "../hooks.js";
|
|
42
|
+
import { STOP_HUMAN_LINE, plainLine, withoutDream, withoutDreamNote, withoutPlain } from "../hooks.js";
|
|
43
43
|
import type { PlainReminder } from "../../../core/counterpart.js";
|
|
44
|
-
import type { HookInput, HookName } from "../hooks.js";
|
|
44
|
+
import type { DreamTold, HookInput, HookName } from "../hooks.js";
|
|
45
|
+
import { NIGHT_RUN_ENV } from "../night-run.js";
|
|
46
|
+
import type { DreamOffer } from "../../../core/dream/index.js";
|
|
45
47
|
import {
|
|
46
48
|
CONFIG_REFUSED,
|
|
47
49
|
CONFIG_UNREADABLE,
|
|
@@ -145,6 +147,8 @@ export const CONFIG_PATH = defaultConfigPath();
|
|
|
145
147
|
/** The worker script this hook's spawn runs. Resolved from THIS file's location,
|
|
146
148
|
* never from a working directory the host chose. */
|
|
147
149
|
export const RUNNER_PATH = fileURLToPath(new URL("./runner.ts", import.meta.url));
|
|
150
|
+
/** The headless nightly run's own process (2026-09-29, `night-run.ts`). */
|
|
151
|
+
export const NIGHTLY_PATH = fileURLToPath(new URL("./nightly.ts", import.meta.url));
|
|
148
152
|
|
|
149
153
|
async function readStdin(): Promise<string> {
|
|
150
154
|
const chunks: Buffer[] = [];
|
|
@@ -397,6 +401,9 @@ export function toHookInput(
|
|
|
397
401
|
// The host-mode page writer's headless child (`page-writer.ts` sets this):
|
|
398
402
|
// no one reads its terminal, so it must not spend a plain reminder's beat.
|
|
399
403
|
...(((opts.env ?? process.env)[PAGE_WRITER_ENV] ?? "").trim().length > 0 ? { pageWriter: true } : {}),
|
|
404
|
+
// The headless nightly run's child (`night-run.ts` sets this, 2026-09-29):
|
|
405
|
+
// a windowless session our hooks keep QUIET — no capture, no asks.
|
|
406
|
+
...(((opts.env ?? process.env)[NIGHT_RUN_ENV] ?? "").trim().length > 0 ? { nightRun: true } : {}),
|
|
400
407
|
// THE PERSON'S DAY (docs/time.md, 2026-09-25; UTC before). It dates the
|
|
401
408
|
// hook's rows, the wake preface, the prospective "today" and the date the
|
|
402
409
|
// boundary hands the lived clock — which is why the lived clock can see a
|
|
@@ -702,6 +709,7 @@ async function runHook(
|
|
|
702
709
|
const adapter = openAdapter(config, {
|
|
703
710
|
command: process.execPath,
|
|
704
711
|
args: ["run", RUNNER_PATH],
|
|
712
|
+
nightArgs: ["run", NIGHTLY_PATH],
|
|
705
713
|
// WHICH FILE THIS RUN READ, carried into the adapter so it can be RECORDED:
|
|
706
714
|
// a hook cannot print to the owner (its stdout is the model's context), so
|
|
707
715
|
// the answer goes into the session registry record and the event ring
|
|
@@ -798,6 +806,14 @@ export interface UpdateNoticeDoors {
|
|
|
798
806
|
* claimed, so nothing is shown and every one waits for a later turn.
|
|
799
807
|
*/
|
|
800
808
|
claimPlain?(input: HookInput, due: readonly PlainReminder[]): readonly PlainReminder[];
|
|
809
|
+
/**
|
|
810
|
+
* Claim the day's dream line this delivery is certainly about to show
|
|
811
|
+
* (`ClaudeCodeAdapter#claimDream`). Absent: nothing can be claimed, so the
|
|
812
|
+
* line is not shown and waits for a later prompt.
|
|
813
|
+
*/
|
|
814
|
+
claimDream?(input: HookInput, offer: DreamOffer): boolean;
|
|
815
|
+
/** Claim the one-time line about `auto` set back to `ask` (`ClaudeCodeAdapter#claimDreamNote`). */
|
|
816
|
+
claimDreamNote?(input: HookInput): boolean;
|
|
801
817
|
}
|
|
802
818
|
|
|
803
819
|
/**
|
|
@@ -828,6 +844,8 @@ export function deliverTurn(
|
|
|
828
844
|
ask: string | null;
|
|
829
845
|
notices?: readonly string[];
|
|
830
846
|
plain?: readonly PlainReminder[];
|
|
847
|
+
dream?: DreamTold;
|
|
848
|
+
dreamNote?: { notice: string; context: string };
|
|
831
849
|
},
|
|
832
850
|
payload: Record<string, unknown>,
|
|
833
851
|
/** SessionStart's priority-ordered notices (after any plain reminders), or
|
|
@@ -867,6 +885,48 @@ export function deliverTurn(
|
|
|
867
885
|
r = withoutPlain(r, due.filter((d) => !kept.has(beat(d))));
|
|
868
886
|
if (shownPlain.length > 0) ordered = [shownPlain.map(plainLine).join("\n"), ...(notices ?? [])];
|
|
869
887
|
}
|
|
888
|
+
// THE DAY'S DREAM LINE (2026-09-29), after the plain reminders and under
|
|
889
|
+
// their rule: an ask is CLAIMED only once the envelope is known to carry the
|
|
890
|
+
// person's line, and without room it waits — its model line stripped too, so
|
|
891
|
+
// the model never answers a question the person was not shown. A line whose
|
|
892
|
+
// day is already claimed (the headless run has started) keeps its model line
|
|
893
|
+
// and only loses the terminal one.
|
|
894
|
+
const told = r.dream;
|
|
895
|
+
if (told !== undefined) {
|
|
896
|
+
const probe = hostDelivery(name, r, payload, [...(ordered ?? []), told.notice]);
|
|
897
|
+
let showDream = false;
|
|
898
|
+
if (probe.dropped === null) {
|
|
899
|
+
if (told.offer === null) showDream = true;
|
|
900
|
+
else {
|
|
901
|
+
try {
|
|
902
|
+
showDream = doors.claimDream?.(input, told.offer) ?? false;
|
|
903
|
+
} catch {
|
|
904
|
+
showDream = false;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
} else if (deferred === null) {
|
|
908
|
+
deferred = probe.dropped;
|
|
909
|
+
}
|
|
910
|
+
if (showDream) ordered = [...(ordered ?? []), told.notice];
|
|
911
|
+
else if (told.offer !== null) r = withoutDream(r);
|
|
912
|
+
}
|
|
913
|
+
// THE ONE-TIME RESET LINE (owner decision A), under the same rule.
|
|
914
|
+
const note = r.dreamNote;
|
|
915
|
+
if (note !== undefined) {
|
|
916
|
+
const probe = hostDelivery(name, r, payload, [...(ordered ?? []), note.notice]);
|
|
917
|
+
let shownNote = false;
|
|
918
|
+
if (probe.dropped === null) {
|
|
919
|
+
try {
|
|
920
|
+
shownNote = doors.claimDreamNote?.(input) ?? false;
|
|
921
|
+
} catch {
|
|
922
|
+
shownNote = false;
|
|
923
|
+
}
|
|
924
|
+
} else if (deferred === null) {
|
|
925
|
+
deferred = probe.dropped;
|
|
926
|
+
}
|
|
927
|
+
if (shownNote) ordered = [...(ordered ?? []), note.notice];
|
|
928
|
+
else r = withoutDreamNote(r);
|
|
929
|
+
}
|
|
870
930
|
const shown = hostDelivery(name, r, payload, ordered);
|
|
871
931
|
const base = shown.dropped === null && deferred !== null ? { ...shown, dropped: deferred } : shown;
|
|
872
932
|
if (name !== "user-prompt-submit") return base;
|