counterparts 0.3.16 → 0.3.17

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 (116) hide show
  1. package/CHANGELOG.md +279 -0
  2. package/docs/ELI5.md +1 -1
  3. package/docs/QUICKSTART.md +17 -1
  4. package/docs/module-map.md +2 -2
  5. package/package.json +1 -1
  6. package/src/adapters/claude-code/CONTRACT.md +20 -0
  7. package/src/adapters/claude-code/NOTES.md +20 -0
  8. package/src/adapters/claude-code/bin/hook.ts +1 -1
  9. package/src/adapters/claude-code/bin/runner.ts +3 -3
  10. package/src/adapters/claude-code/claim.ts +141 -33
  11. package/src/adapters/claude-code/doctor.ts +183 -10
  12. package/src/adapters/claude-code/hooks.ts +33 -10
  13. package/src/adapters/claude-code/night-catch-up.ts +1 -1
  14. package/src/adapters/claude-code/night-run.ts +22 -1
  15. package/src/adapters/claude-code/standdown.ts +18 -1
  16. package/src/adapters/claude-code/transcript.ts +35 -5
  17. package/src/adapters/cli/CONTRACT.md +16 -0
  18. package/src/adapters/cli/commands.ts +508 -14
  19. package/src/adapters/cli/coverage.ts +1 -1
  20. package/src/adapters/cli/help.ts +6 -0
  21. package/src/adapters/cli/mechanisms.ts +4 -1
  22. package/src/adapters/cli/rollback.ts +816 -0
  23. package/src/adapters/config.ts +8 -0
  24. package/src/adapters/dashboard/CONTRACT.md +1 -1
  25. package/src/adapters/dashboard/registries.ts +1 -1
  26. package/src/adapters/dashboard/status.ts +16 -8
  27. package/src/adapters/dashboard/web/actions.ts +20 -2
  28. package/src/adapters/dashboard/web/flow.ts +1 -1
  29. package/src/adapters/dashboard/web/narrate.ts +2 -2
  30. package/src/adapters/dashboard/web/pages/flow/sections/symmetry.js +7 -4
  31. package/src/adapters/dashboard/web/pages/memories/index.js +9 -1
  32. package/src/adapters/dashboard/web/pages/memories/sections/search.js +7 -7
  33. package/src/adapters/dashboard/web/shared/memory-modal.js +61 -2
  34. package/src/adapters/dashboard/web/shared/modal.css +5 -0
  35. package/src/adapters/dashboard/web/views/health.ts +12 -6
  36. package/src/adapters/dashboard/web/views/mechanisms.ts +34 -4
  37. package/src/adapters/dashboard/web/views/memory.ts +12 -0
  38. package/src/adapters/fired.ts +1 -1
  39. package/src/adapters/lifecycle.ts +113 -8
  40. package/src/adapters/mcp/CONTRACT.md +26 -4
  41. package/src/adapters/mcp/NOTES.md +53 -0
  42. package/src/adapters/mcp/deliberate.ts +11 -13
  43. package/src/adapters/mcp/facts.ts +48 -49
  44. package/src/adapters/mcp/index.ts +1 -3
  45. package/src/adapters/mcp/meaning.ts +3 -3
  46. package/src/adapters/mcp/server.ts +242 -62
  47. package/src/adapters/mcp/tools.ts +179 -83
  48. package/src/adapters/mcp/write-up.ts +2 -2
  49. package/src/adapters/mechanism-evidence.ts +41 -2
  50. package/src/adapters/plugin.ts +36 -7
  51. package/src/adapters/sessions.ts +51 -0
  52. package/src/core/associate/CONTRACT.md +7 -1
  53. package/src/core/briefing.ts +51 -27
  54. package/src/core/contradictions.ts +2 -2
  55. package/src/core/counterpart.ts +627 -40
  56. package/src/core/coverage/NOTES.md +15 -0
  57. package/src/core/coverage/index.ts +7 -3
  58. package/src/core/coverage/tunables.ts +18 -4
  59. package/src/core/dream/CONTRACT.md +15 -4
  60. package/src/core/dream/NOTES.md +53 -0
  61. package/src/core/dream/index.ts +99 -10
  62. package/src/core/dream/reflect.ts +58 -9
  63. package/src/core/fit/index.ts +7 -0
  64. package/src/core/handoff/CONTRACT.md +6 -0
  65. package/src/core/handoff/NOTES.md +6 -4
  66. package/src/core/handoff/index.ts +9 -6
  67. package/src/core/handoff/last-here.ts +212 -9
  68. package/src/core/mint.ts +22 -2
  69. package/src/core/physics/CONTRACT.md +127 -21
  70. package/src/core/physics/NOTES.md +115 -0
  71. package/src/core/physics/index.ts +560 -74
  72. package/src/core/prospective/CONTRACT.md +14 -8
  73. package/src/core/prospective/NOTES.md +15 -0
  74. package/src/core/prospective/derive.ts +15 -12
  75. package/src/core/prospective/index.ts +7 -1
  76. package/src/core/prospective/tunables.ts +11 -3
  77. package/src/core/recall/CONTRACT.md +25 -2
  78. package/src/core/recall/NOTES.md +79 -3
  79. package/src/core/recall/activate.ts +55 -7
  80. package/src/core/recall/index.ts +30 -5
  81. package/src/core/recall/mood.ts +2 -2
  82. package/src/core/recall/probe.ts +164 -2
  83. package/src/core/recall/reference.ts +10 -0
  84. package/src/core/recall/tunables.ts +17 -2
  85. package/src/core/remember/CONTRACT.md +2 -2
  86. package/src/core/remember/NOTES.md +10 -0
  87. package/src/core/self/CONTRACT.md +42 -7
  88. package/src/core/self/INTERFACE-GAPS.md +17 -0
  89. package/src/core/self/NOTES.md +115 -1
  90. package/src/core/self/behind.ts +9 -4
  91. package/src/core/self/briefing.ts +150 -13
  92. package/src/core/self/episodes.ts +12 -1
  93. package/src/core/self/identity.ts +54 -33
  94. package/src/core/self/index.ts +278 -8
  95. package/src/core/self/work.ts +5 -1
  96. package/src/core/sleep/CONTRACT.md +7 -1
  97. package/src/core/sleep/NOTES.md +58 -0
  98. package/src/core/sleep/consolidate.ts +53 -4
  99. package/src/core/sleep/cycle.ts +42 -10
  100. package/src/core/sleep/decay.ts +165 -5
  101. package/src/core/sleep/dedup.ts +3 -1
  102. package/src/core/sleep/prune.ts +36 -3
  103. package/src/core/sleep/strength-cache.ts +10 -0
  104. package/src/core/sleep/types.ts +107 -4
  105. package/src/core/sleep/upgrade.ts +9 -7
  106. package/src/core/store/CONTRACT.md +9 -0
  107. package/src/core/store/NOTES.md +106 -0
  108. package/src/core/store/cache.ts +127 -6
  109. package/src/core/store/db.ts +43 -3
  110. package/src/core/store/errors.ts +9 -0
  111. package/src/core/store/feelings.ts +13 -0
  112. package/src/core/store/index.ts +390 -26
  113. package/src/core/store/operational.ts +434 -10
  114. package/src/core/store/pre-migration.ts +3 -1
  115. package/src/core/store/rollback-hold.ts +127 -0
  116. package/src/core/types.ts +25 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,284 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.17 — 2026-10-11
4
+
5
+ The plugin's sidebar shows what memory is doing in 35 columns: what came to mind for your
6
+ last message, what was quietly offered, what this session saved, which mechanisms fired
7
+ today, and last night's dream. Forgetting now changes what comes to mind: each memory fades
8
+ on its own curve, slower the more it mattered, was felt or was used, and one that falls
9
+ below reach stops coming up on its own, though asking still finds it, labelled faded. One
10
+ under the floor for 14 lived days is archived, never deleted. Memories written before this
11
+ version are read at the defaults for what they are about (`counterparts claims-era` turns
12
+ that off). Claude's in-the-moment tool is `remember` now (`note` still works), the wake is
13
+ put together when a session starts and names the other folders worked in today, and
14
+ `counterparts rollback` is the way back. **Nothing to run after upgrading from 0.3.16**:
15
+ the hooks, the memory server's registration and Claude Desktop's entry are the same as
16
+ 0.3.16's (coming from 0.3.14 or earlier, see those versions' notes on `counterparts
17
+ connect`). If your Claude Code settings allow `mcp__counterparts__note`, you'll be asked
18
+ once to allow `mcp__counterparts__remember`. **The store's format changes (v12 to v13, and
19
+ the search cache v5 to v6)**: the first open after the upgrade copies your memory to
20
+ `snapshots/…-pre-migration-v12-to-v13` and upgrades it. 0.3.16 refuses the upgraded store,
21
+ and a memory server still running 0.3.16 answers "Counterparts was updated" until it is
22
+ reconnected (`/mcp`) or restarted, so close your sessions, quit Claude Desktop and stop the
23
+ dashboard before installing. To go back to 0.3.16, run `counterparts rollback` while 0.3.17
24
+ is still installed, then QUICKSTART's "Going back to an earlier version": `counterparts
25
+ disconnect`, the 0.3.16 reinstall, then `counterparts connect`.
26
+
27
+ The sidebar mod, v0.2 (#375).
28
+
29
+ - **The sidebar shows what memory is doing, in 35 columns.** A small brain beside the
30
+ title (click COUNTERPARTS for the dashboard), the day, the count and a search box; then
31
+ **Memories**, what was said to Claude in full for your last message, and
32
+ **Subconscious**, the titles it was quietly given (`↗ opened` on one it looked up);
33
+ **Saved this session**, newest first; **Mechanisms today**, how many times each of the
34
+ twelve fired today, as bars (a click on one lists what its firings were about: the
35
+ memories that came to mind, what faded, what was merged, never bare counts); and **Last
36
+ Dream**, its first sentence (a click opens more of the dream). Each item takes up to
37
+ three lines, and when they don't all fit, fewer show. A click opens any item in place,
38
+ and again closes it; a long one shows 20 lines and ends with **more**, which opens that
39
+ memory on the dashboard (the dashboard now opens one memory by `#memories?id=`). Dates
40
+ in titles read short ("Oct 9"; today's are dropped). A click on a section's heading
41
+ gives it the room. Three rows of switches at the bottom: Counterparts in this folder
42
+ and Claude Code's own memory (each as safe as before: a pause still asks first, and an
43
+ unknown state is never shown as on), the view, and the brain. On a laptop screen the
44
+ sections fold to fit, each keeping its heading.
45
+ - **Closed, it says the newest thing in one line.** `/counterparts quiet` (or the pane's
46
+ ✕) shows it dim at the end of the line under the prompt, as in "remembered: …", "stored:
47
+ …" or "dreamed: …", always ending with "· /counterparts opens it". The amber status line
48
+ is gone except to warn that a folder is paused or off, and clearing it gives the row
49
+ back. `/counterparts brain turning|still|off` (or the footer) sets the brain: turning
50
+ sways gently, still lights only when something fires, off leaves it out. A view or brain
51
+ you set before carries over; v0.1's "full" opens the sidebar, its "quiet" and "hidden"
52
+ are quiet.
53
+ - **The dashboard counts each mechanism's firings today.** `/api/mechanisms` carries
54
+ `firedToday` on every mechanism: how many times it fired on today's date, counting
55
+ rows rather than amounts, and one dream once. With a dashboard from before this
56
+ release the sidebar counts them itself from the activity feed.
57
+
58
+ Forgetting (#372, #377, #379, #385, #386).
59
+
60
+ - **Forgetting now changes what comes to mind (store v13).** Each memory fades on its own
61
+ curve: steep at first and flat later, slower the more it mattered, the more it was felt,
62
+ used or came back. A routine note leaves the working layer in about two days; a felt
63
+ reading lasts months; a strong fact about a year. Under a line ("below reach") a memory
64
+ stops coming up on its own — in turns, as a pointer from a link, or in the wake's work
65
+ lines — but asking for it still finds it, labelled faded, and
66
+ using it, opening it or a dream replaying it brings it back. A memory that has sat under
67
+ the floor for 14 lived days (was 90) is archived — never deleted, still readable by id.
68
+ A reminder is held at full strength until its date and the week after, then fades on its own curve as if it had
69
+ never been held (so a routine one written weeks before its date is archived that night —
70
+ never deleted, still readable by id); a repeating date is held
71
+ around each time it comes round. Chapters, their copies and live handoffs are never let
72
+ go. A feeling now counts once for how high a memory stands and once for how slowly it
73
+ fades, and softens from the day it was recorded. The nightly pass reads only the
74
+ memories whose standing changes that day. The dashboard counts "below reach now" and
75
+ "exited" apart. Skills and places now count their salience as fully as any other memory
76
+ (they counted it at 0.4, which left a quiet skill out of reach from the day it was written).
77
+ The band-symmetry check now warns only when memories climb with nothing behind it; fading
78
+ down a band is the curve working. The store upgrades to v13 on the first open, after taking a copy; a
79
+ build from before refuses the upgraded store, and the copy is the way back. These are
80
+ lightly held decisions; they are listed in `docs/IMPROVEMENTS.md` under "Decisions to
81
+ review".
82
+ - **A dated memory goes back to fading normally once its day and the week after have
83
+ passed.** It is still held at full strength until then, and a repeating date is still held
84
+ around each time it comes round. After that it no longer fades faster: it reads as if it had
85
+ never been held, counted from when it was made or last used. So an old routine reminder
86
+ leaves at once, and one written weeks before its date is archived that same night — never
87
+ deleted, still readable by id. A strongly felt dated fact lasts as long as any memory like it.
88
+ - **Old claims are read as defaults (an era, not a rewrite).** Memories written before this
89
+ build reached the store, with a salience claim made under the old field text ("set it on
90
+ anything that should last"), are read by the forgetting curve at the default for what they
91
+ are about — a done work event 0.20, other work 0.25, the world 0.35, me 0.40 — when that is
92
+ lower, so the store starts to fade. No claim is rewritten. The core, memories about you or
93
+ about us, things marked as said by you (memories written since 10-08), protected memories
94
+ and dated ones still ahead or repeating keep their claim; older rulings of yours with no
95
+ such mark may fade. `counterparts claims-era` says whether it is on and how many memories it
96
+ affects; `--off` reads every claim as stored again, `--on` puts it back; doctor shows the
97
+ same in one line. The reading is what turns back: a memory let go at the floor while it
98
+ was on stays archived (readable by id). A lightly held decision, listed in
99
+ `docs/IMPROVEMENTS.md`.
100
+ - **Asking for facts shows faded memories in full, among the rest.** A match that has faded
101
+ (below reach) is ranked with the live ones by how well it matched, its words shown and
102
+ labelled faded, and the header counts them ("3 of them faded"). It was a title line after
103
+ the main results, which left counting questions one item short. Things that come up on
104
+ their own still leave faded memories out; being shown strengthens nothing, opening or
105
+ quoting one does. Meaning mode is unchanged.
106
+ - **Say which memories you drew on.** `session_end` and `chapter` take an optional `drewOn`
107
+ list: the ids of memories shown this session (a footnote, a recall result) that changed
108
+ what was done or said. Each gets half a use, so it holds longer: once a day per memory, at
109
+ most three per ask, and only ids this session was actually shown. An id it was not shown,
110
+ a superseded memory or one faded under a newer one is refused by name. Opening it later
111
+ the same day still lifts it to a full use. A wake line is still credited by opening it.
112
+ - **Each further use adds less.** What a memory gains from being used now levels off gently
113
+ instead of climbing in a straight line to a cap at five uses.
114
+ - **The doctor counts it.** The Credit line says how many `drewOn` credits landed over the
115
+ last week, beside the newest boundary's reading.
116
+
117
+ Writing memories (#369, #374, #383).
118
+
119
+ - **`note` is now `remember`, and memory is asked for by attention.** The tool Claude
120
+ writes a memory with in the moment is called `remember`. **The old name `note` still
121
+ works** for at least this release — a session that started before the upgrade keeps
122
+ calling `note` and is served exactly as `remember`; only `remember` is listed. Its words
123
+ changed with it: memory forms only from what Claude writes here and at the end-of-session
124
+ ask (nothing reads the transcript afterwards), so it asks Claude to write in the moment,
125
+ as things catch its attention — a line read and why it struck, something said about the
126
+ person or about Claude, news, a decision, a work event — one idea per call. The
127
+ end-of-session ask now asks for "what caught your attention since you last wrote, one idea
128
+ each — what you read, what they said, what happened" (474 characters at most), and no
129
+ longer says "nothing worth keeping is a real answer"; an empty list is still accepted, as
130
+ the `memories` field says. The salience field gives an anchored scale by attention (about
131
+ 0.1–0.2 a routine merge or status change; 0.4 or more a line that struck, or a reading
132
+ engaged with; the person's rulings, preferences and corrections high even about work), and
133
+ `relevance` now means how much it bears on the person, on Claude or on the two of them —
134
+ not only on the task. A dated decision, a kill or renew date and an outside deadline are
135
+ named as `eventDate`s. The CLI's `counterparts note` keeps its name.
136
+ - **Three things you may notice after upgrading.** If your Claude Code settings already allow
137
+ `mcp__counterparts__note`, you will be asked once to allow `mcp__counterparts__remember`.
138
+ A few strongly felt memories claimed at 0.42–0.50 now start episodic rather than semantic.
139
+ The text of a session that still owes a write-up is now kept up to 14 days of use plus the
140
+ ordinary 7 days, not 2.
141
+ - **An unclaimed memory starts by what it is about.** A memory written without a salience
142
+ used to start at 0.25 whatever it was. Now: 0.20 for a work event that is done, 0.25 for
143
+ other work and for an unmarked one, 0.35 for the world (readings, news), 0.40 for the
144
+ person, the two of you or Claude (or said by the person). All stay under the semantic
145
+ floor, and a strong feeling on a silent memory lifts it to at most 0.49: a default sets how
146
+ high a memory starts, never its band.
147
+ - **The core's fast lane can open again.** "Strongly felt" is read against the word's own
148
+ default: a feeling at 0.6, or one at 0.5 or more that is 0.1 above what its word is stored
149
+ at when nobody weighs it, now counts. Since the feelings wheel gave every word a default (all at or under 0.55),
150
+ nothing written without a number could reach the old 0.6 bar. A word nobody weighed
151
+ still never opens the lane on its own.
152
+ - **Mood no longer lifts memories in recall** (both weights 0, the code kept for a re-test):
153
+ memories it lifted were used less than others (1.3% against 2.4%). Recall also stops
154
+ reading recent feelings each turn while it is off.
155
+ - **What a session said and nobody wrote up stays owed for fourteen days of use**, not
156
+ three, so the nightly write-up (oldest first, four sessions a night) reaches it; past that
157
+ it is let go and said as lost. And a session at its ask limit for the day is still asked
158
+ when it holds an unwritten stretch that is due.
159
+ - **A memory written with `remember` (or its old name `note`) reaches the next session's
160
+ wake the same day.** Only write-ups, chapters and the self page used to bring the wake up
161
+ to date between days, so a note left Still open, Nearby and Arriving as they were for up
162
+ to a day, in every directory, a question it answered included. Now every memory that
163
+ lands, and every handoff written or retired, re-renders the wake at that turn's end, in
164
+ the background.
165
+ - **You can say what a memory is about.** `counterparts about <id>` prints its mark (me,
166
+ us, owner, work or world) and who set it; `counterparts about <id> owner --why "..."`
167
+ changes it as you, keeping the why, recorded the way a nightly reflection's re-mark is.
168
+ It works on an archived memory too, and an earlier version's id marks the current one.
169
+ The dashboard's memory card shows the mark and has a small picker that runs the same
170
+ command. A personal memory written in a project, left unmarked or marked work, counts as
171
+ that project's work and is shown only there; marking it owner or us shows it everywhere.
172
+ - **Claude can fix a mark in the moment.** `remember` takes `remark: {id, about, why}` for
173
+ a memory the session was shown, recorded as set by the counterpart itself. A dream's or a
174
+ reflection's words can only be moved toward work or world this way; you can mark them
175
+ anything.
176
+ - **A full night still offers the unmarked memories to be marked.** The nightly
177
+ reflection is offered up to five memories nobody has marked; on a busy night they were
178
+ squeezed out of its bundle entirely (10-10: none). They now keep a small room of their
179
+ own, a line each at least, and unmarked skills are offered too.
180
+
181
+ The wake, and other folders (#376, #380, #382, #387).
182
+
183
+ - **A session's wake is put together when the session starts.** "Still open", "Arriving:",
184
+ the Yesterday line and the self page are read at that moment, so the morning's first
185
+ sessions see yesterday's chapters and a question or reminder noted last night, not the
186
+ wake the evening's last turn left. "Nearby" and "Who I am" still come from the last turn's
187
+ end. Reads only, no model call: a few milliseconds.
188
+ - **"Today, elsewhere."** One line in the wake names the other folders worked in today:
189
+ when, whether a session there is still open, how many memories it wrote, and its chapter's
190
+ title when that chapter is about you or me (the "About me, from another directory" rule).
191
+ Never what was said there, a work memory's title, or a handoff. Folders whose scope is not
192
+ on are not named. It is at most 300 bytes (more folders become "+N more"), and it is
193
+ given room ahead of "Nearby", "Still open" past its first item, "Work here", the
194
+ Yesterday line's titles, "Last here" and the older handoffs, so it prints beside a long
195
+ page. The page, "Arriving:", "Still open"'s first item and a plain reminder due today
196
+ still come first, and on days no other folder was active the wake is unchanged.
197
+ - **"Since you started."** A session that is already open now hears what changed in other
198
+ folders while it worked: one line for the assistant, at a prompt, such as "Since you
199
+ started (10:40): ~/deadfront ended 11:05, 3 memories; ~/random open since 10:52, 2
200
+ memories." Only when something changed there (a session started or ended, a
201
+ chapter, new memories), never at the first prompt after the wake, and at most once an
202
+ hour. The same rules as "Today, elsewhere": counts, not what was said; a chapter's title
203
+ only when it is about you or me; folders whose scope is not on are not named. It takes
204
+ only the room recall left, and waits for the next prompt when there is none. Reads only,
205
+ no model call: about 5 ms on a prompt that checks, nothing in the hour after a line.
206
+ - **The Yesterday line keeps other folders' chapters to their folders.** At a session start
207
+ it names a chapter from another folder by title only when that chapter is about you or me
208
+ and that folder's scope is on, the rule "About me, from another directory" and "Today,
209
+ elsewhere" already keep. Other chapters join the line's count ("and 2 more"); when that is
210
+ all there was, the line says how many sessions wrote chapters in other folders. Chapters
211
+ written in this folder are named as before.
212
+
213
+ Going back (#384, #382).
214
+
215
+ - **`counterparts rollback` takes your memory back to before an upgrade.** When an upgrade
216
+ changed the store's format, the older version can't open it. This puts back the copy the
217
+ upgrade made first (the newest one, or `--to` names another), says how many memories would
218
+ be lost, and asks you to type a word. Nothing is deleted: the upgraded store and its cache
219
+ are set aside in a `rollback-aside-…` folder beside it. It refuses while a session, a
220
+ memory server or the dashboard has the store open, and says which. Until you install the
221
+ older version, the newer one leaves the store alone, and its sessions say why. `--undo`
222
+ puts the upgraded store back if nothing has written to the restored one, and
223
+ `--upgrade-again` lets this version upgrade it again from a fresh copy, so rolling back
224
+ twice on one day no longer reuses the first copy. `counterparts doctor` shows a Rollback
225
+ line while a rollback is in place. After a rollback, a later version leaves the store alone
226
+ too, until you run `counterparts rollback --upgrade-again` once on it.
227
+ - **A search cache from a newer build says so.** When only the search cache was written by a
228
+ newer Counterparts (after going back to an older version, say), the memory tools no longer
229
+ say "Counterparts was updated — run /mcp", which did not help. They say a newer build wrote
230
+ the search cache: if that build is installed, reconnect; if you went back to an older one,
231
+ delete `cache/cache.sqlite*` in the store (no memory is kept there; it is rebuilt) and then
232
+ reconnect. `counterparts doctor` says the same. A store from a newer build keeps its message.
233
+
234
+ At ten times today's size (#368, #373).
235
+
236
+ - **Recall counts the memories instead of listing them on every turn.** At ten times
237
+ today's size that list was about a sixth of a turn. A second speed-up, not looking up
238
+ words found in almost every memory, is built but off: it changed what recall showed on
239
+ small stores.
240
+ - **The sleep pass no longer reads forgotten memories to skip them.** The census, the
241
+ duplicate check and the fading pass ask the database for the rows they need instead of
242
+ reading every row, archived ones included. Their counts are unchanged.
243
+ - **The store reuses its prepared database statements.** It used to prepare each query
244
+ again on every read. A new day's sleep pass at ten times today's size went from about
245
+ 3.7 to 1.1 seconds.
246
+ - **A night's dream starts in about a second at ten times today's size, not half a
247
+ minute.** The cache keeps each memory's nearest memories from when it was written, so
248
+ the dream reads them instead of comparing every queued memory against every stored one.
249
+ A new memory's list is the older memories nearest it when it was written; one written
250
+ before the upgrade gets its list the first night it is dreamed. The cache's format goes
251
+ to v6 and fills itself in. An MCP server still running the previous build refuses its
252
+ tools until it is reconnected (`/mcp`), as after a store-format change.
253
+ - **New memories in a dream part Claude Code cut go back in the queue.** When the nightly
254
+ run's transcript shows a part of the dream was cut to a preview the run couldn't open
255
+ (and it wasn't fetched again whole), the new memories that part carried are dreamed on
256
+ another night instead of being marked as seen. Any the dream changed or looked up stay
257
+ done. The morning's line about the cut says how many went back.
258
+ - **A reader for which memories recall shows and the replies ignore.** `probeMemoryHits`
259
+ reads the ids the credit row already lists as shown and not used, and gives a hit rate
260
+ per memory and per lane (loud, footnote, pointer). It only measures. Nothing reads it
261
+ to change a memory's strength or how readily it comes to mind.
262
+
263
+ Fixes (#378, #382).
264
+
265
+ - **Two installs that meet a damaged claims file deliver the event once on Linux too.**
266
+ When one hook moved the damaged file aside, the other, still holding the old file, could
267
+ delete the new file's journal while the first hook was writing to it. That hook then
268
+ gave up on its claim, and the event went out twice (2 of 30 runs of the twins test under
269
+ load). Now a hook that finds its journal gone tries once more, and a claim that was
270
+ already saved when that happened counts as made.
271
+ - **Hook claims hold up in three more corners.** A claims file another hook holds is given up
272
+ on after one wait instead of three; a lock dated in the future after the clock steps back
273
+ is treated as a dead process's instead of waited on; and a hook whose own claim landed while
274
+ its write reported a failure delivers the event instead of standing down for itself.
275
+ - **A plugin's first run can't be held up from a shared /tmp.** Another user's directory at
276
+ the first-run lock's name made the first run wait 20 seconds and fail; it is passed over
277
+ now, and the install runs.
278
+ - **`counterparts self-page --write --short <file>` works.** The spaced form was refused;
279
+ only `--short=<file>` worked, though the help and the page's room note print the spaced
280
+ one. Both forms work now.
281
+
3
282
  ## 0.3.16 — 2026-10-10
4
283
 
5
284
  The self page is kept whole up to 16 KB, and when it doesn't fit, the wake steps down to
package/docs/ELI5.md CHANGED
@@ -52,7 +52,7 @@ never got to write.
52
52
  - **claude-code** — the hooks. Injects the wake at session start, runs recall on each
53
53
  prompt, captures each turn at Stop, asks for memories and the chapter, spawns the
54
54
  background worker.
55
- - **mcp** — the tools the AI calls on purpose: `note`, `recall`, `status`, `session_end`,
55
+ - **mcp** — the tools the AI calls on purpose: `remember` (was `note`), `recall`, `status`, `session_end`,
56
56
  and `chapter`.
57
57
  - **cli** — the owner's console. Status, backup, export, delete, and the one-off repairs.
58
58
  - **dashboard** — the owner's window into the brain. What it remembered, what faded,
@@ -132,7 +132,23 @@ counterparts install --force --embedder
132
132
 
133
133
  ### Going back to an earlier version
134
134
 
135
- Go back in this order. The other order breaks every hook, and the older version's
135
+ If the upgrade changed your memory's format, the older version won't open it until you
136
+ put the old one back. Close your Claude Code sessions, quit Claude Desktop and stop the
137
+ dashboard, then, while the newer version is still installed:
138
+
139
+ ```
140
+ counterparts rollback
141
+ ```
142
+
143
+ It puts back the copy the upgrade made first (they're kept 14 days), says how many
144
+ memories you would lose (everything remembered since the upgrade), and asks you to type a
145
+ word. Nothing is deleted: the upgraded memory is set aside next to it, in a
146
+ `rollback-aside-…` folder. Until you install the older version, the newer one leaves your
147
+ memory alone, and sessions on it say why. `counterparts rollback --undo` puts the
148
+ upgraded memory back if the older version hasn't used it yet;
149
+ `counterparts rollback --upgrade-again` lets the newer version upgrade it again.
150
+
151
+ Then go back in this order. The other order breaks every hook, and the older version's
136
152
  `doctor` still reads green.
137
153
 
138
154
  1. `counterparts disconnect`, while the newer version is still installed.
@@ -22,11 +22,11 @@ code and the `NOTES.md` / `INTERFACE-GAPS.md` next to it.*
22
22
  | `self/` | autobiographical self | Identity documents, episodes, the wake briefing (v0's briefing, grown up). Governed: frozen self-reinforcement rules. |
23
23
  | `prospective/` | prospective memory | Future intentions, cued by time or context; fire / suppress / reference telemetry. |
24
24
  | `handoff/` | working context for a place | The per-directory handoff: where the work here stands, written as a field on the end-of-session ask, shown as a two-line pointer at the next wake in that directory, expiring in lived days. **Never a memory** — out of recall, out of credit, out of consolidation, out of identity. **Added 2026-09-20 (E1, spec §6.4 / §15 item 6).** |
25
- | `coverage/` | rehearsal debt | What is not written up yet, read in one place: per session, the unwritten stretch since its last claim in `coverage.jsonl`. The pacer's third ask (pieces and time), the one rule for what a session owes (retention, the next-session write-up), lapse after two days of use, the handoff pointer's "how current", and one row per stretch per state. Changes nothing about how pieces are claimed. **Added 2026-09-30.** |
25
+ | `coverage/` | rehearsal debt | What is not written up yet, read in one place: per session, the unwritten stretch since its last claim in `coverage.jsonl`. The pacer's third ask (pieces and time), the one rule for what a session owes (retention, the next-session write-up), lapse after fourteen days of use (two until 2026-10-10), the handoff pointer's "how current", and one row per stretch per state. Changes nothing about how pieces are claimed. **Added 2026-09-30.** |
26
26
  | `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. |
27
27
  | `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. |
28
28
  | `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).** |
29
- | *(`contradictions.ts`)* | reconsolidation + interference | Two memories that disagree: flagged (a dream, today), noticed at write time (the nearest few live memories come back with a stored one), and SETTLED — `changed` (both true at their time: one strength cut, labelled earlier), `corrected` (archived, readable by id), or `open` (both kept, shown together) — by a new memory's `updates` + `how`, a `note` settle, a dream or reflection with a plain reason, or the owner's `counterparts settle`. Every settle is on a trail (who, how, why, when) and can be undone. A file beside `revision.ts`, whose ordinary-memory arm it is; its tables are the store's (schema v10), its labels recall's (`recall/standing.ts`). **Added 2026-09-29.** |
29
+ | *(`contradictions.ts`)* | reconsolidation + interference | Two memories that disagree: flagged (a dream, today), noticed at write time (the nearest few live memories come back with a stored one), and SETTLED — `changed` (both true at their time: one strength cut, labelled earlier), `corrected` (archived, readable by id), or `open` (both kept, shown together) — by a new memory's `updates` + `how`, a `remember` settle, a dream or reflection with a plain reason, or the owner's `counterparts settle`. Every settle is on a trail (who, how, why, when) and can be undone. A file beside `revision.ts`, whose ordinary-memory arm it is; its tables are the store's (schema v10), its labels recall's (`recall/standing.ts`). **Added 2026-09-29.** |
30
30
  | *(`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`).** |
31
31
  | *(`feelings-wheel.ts`)* | — (a vocabulary) | The feelings wheel as a typed list: seven cores (happy, warm, calm, curious, sad, uneasy, angry), the groups and their words, default valence and intensity on every entry, blends, aliases, and the rule that re-filed the first wheel's feelings (v11). Read by `store/` to validate the `feelings` table. **Added 2026-09-25; v2 2026-09-30.** |
32
32
  | *(`leaving.ts`)* | — (a table) | What counts as having left: every `archived_reason` the code writes, filed `replaced` (a live row carries it — a revision, a merge, a rebuilt journal copy), `let-go` or `removed`. The `status` census and the dashboard's archive words both read it, so they agree. **Added 2026-09-30.** |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "counterparts",
3
- "version": "0.3.16",
3
+ "version": "0.3.17",
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": {
@@ -387,6 +387,26 @@ row, saying which source answered, existed until the keys were removed — §1a.
387
387
  already passed, because the published bundle is one per store and read in every
388
388
  directory. With no live handoff nothing is passed through and nothing is spliced.
389
389
 
390
+ **AND THE HOST'S SESSIONS (2026-10-10).** `composeWake` also hands the core the
391
+ registry's sessions (`WakeHere.sessions`: directory, start, last boundary, live or
392
+ ended — host state, no content) for the wake's "Today, elsewhere" line, which names
393
+ the other directories worked in today that the scope setting lets this one name
394
+ (`chapterExports`): times, counts of memories, and a chapter's title only on the
395
+ "About me, from another directory" line's gate. Never this directory, this session,
396
+ or the nightly run's (the store's own directory). The wake itself is ASSEMBLED at
397
+ delivery from reads (self CONTRACT §5 G1): no model, no network, no state written.
398
+
399
+ **AND, AT A PROMPT, WHAT CHANGED SINCE (2026-10-11).** A session already open
400
+ never reads a wake again, so `userPromptSubmit` may add one "Since you started"
401
+ line for the model (`Lifecycle#sinceLine` → `Counterpart#sinceElsewhere`): another
402
+ directory's session started or ended, a chapter, new memories, since this session
403
+ last heard. The same gate as "Today, elsewhere" (`elsewhereGate`, one code path)
404
+ and the same registry hand-over (`elsewhereHere`). At most once an hour, never at
405
+ the first prompt after a wake; the state is the session record's `sinceSeen`
406
+ (host state, no store change). It takes only what recall left of its budget and,
407
+ with no room, waits a prompt. Reads only; nothing under observer or for the
408
+ nightly run.
409
+
390
410
  19. **[M] A directory set `off` gets NO OUTPUT AND NO WRITE — because nothing is
391
411
  constructed.** The scope registry (`adapters/scopes.ts`,
392
412
  `<config dir>/scopes.json`, longest-prefix, added 2026-09-10 for owner asks
@@ -2387,6 +2387,26 @@ INTERFACE-GAPS §15.
2387
2387
  test ("… AND a dead holder's set-aside lock", 300 rounds): macOS quiet 0 in 1,500, under 12
2388
2388
  busy loops 0 in 4,800 (and the fresh twins at 300 rounds 0 in 1,500); Linux, 2 CPUs and 2
2389
2389
  busy loops, 0 in 1,500.
2390
+ **Third reading: a journal a twin removed (Linux).** Master in `cp-ci-linux` (2 CPUs, 2
2391
+ busy loops) failed the stale-lock twins test in 2 runs of 8 with
2392
+ `SQLITE_IOERR_DELETE_NOENT`, and once on CI (16 rounds). Reproduced: 2 runs of 30, two
2393
+ copies at a time beside 2 busy loops. Pinned down by hand (`bun:sqlite`, Linux): a twin
2394
+ whose connection is still on the bad file a set-aside moved looks for a hot journal by
2395
+ NAME, finds the NEW file's `-journal` (a new file's first write, the header `PRAGMA
2396
+ journal_mode = WAL` sets, goes through a rollback journal), sees no lock on its own file,
2397
+ plays that journal back into the old one and deletes it. The commit that made the journal
2398
+ then fails with `SQLITE_IOERR_DELETE_NOENT`, its pages written: the rows were all there
2399
+ after. On macOS the stale connection says `SQLITE_IOERR_VNODE` and plays nothing back.
2400
+ Now (`claim.ts#sidecarGone`) a write that meets it before its own commit runs once more,
2401
+ once per write, and one whose commit met it has landed and counts as made; a try again
2402
+ would read its own claim as a twin's and deliver the event nowhere. (A WAL commit deletes
2403
+ nothing, so that can only be a connection a contended conversion left in the rollback
2404
+ journal.) Measured after, same container and load: 0 failures from it in 144 runs (43,200
2405
+ rounds; a traced run caught one met and retried, in a round that passed), and 0 in 10
2406
+ runs one at a time beside 2 busy loops. Three rounds still delivered twice: twice
2407
+ `SQLITE_BUSY` (one round index in two copies at once — a stall past `CLAIM_WAIT_MS`,
2408
+ the contention the claim gives up on by design) and once `SQLITE_IOERR_FSTAT`, not
2409
+ looked into.
2390
2410
  **A known limit, not fixed:** the holder checks the path still holds the file it met and
2391
2411
  then renames it, sidecars first, without looking again. A holder suspended between the two
2392
2412
  for more than `SET_ASIDE_STALE_MS` (a machine put to sleep at that instant) can have its
@@ -1076,7 +1076,7 @@ async function runHook(
1076
1076
  // The claim says it is done, so the next event that looks the same — one
1077
1077
  // that starts after this — is not taken for this one's twin (`../claim.ts`).
1078
1078
  if (claim.outcome === "won" && claimKey !== null && claim.at !== undefined) {
1079
- finishClaim(adapter.counterpart, claimKey, claim.at);
1079
+ finishClaim(adapter.counterpart, claimKey, claim.at, Date.now(), claim.token);
1080
1080
  }
1081
1081
  adapter.counterpart.close();
1082
1082
  }
@@ -408,9 +408,9 @@ export async function runOnce(input: {
408
408
  carriedRows: report.carried?.rows ?? 0,
409
409
  sweep: "next-session",
410
410
  });
411
- // 3a. THE WAKE CATCHES UP (2026-09-30): a page written or a write-up
412
- // landed since the last render re-renders it now, not at the next lived
413
- // day. After the cycle, whose own render already caught up to what was
411
+ // 3a. THE WAKE CATCHES UP (2026-09-30): a page written, a memory or a
412
+ // write-up accepted, or a handoff changed (2026-10-10) since the last
413
+ // render re-renders it now, not at the next lived day. After the cycle, whose own render already caught up to what was
414
414
  // marked before it; nothing marked, nothing rendered.
415
415
  // Its own try: a render that fails costs the refresh, and the mark stays.
416
416
  try {