counterparts 0.3.7 → 0.3.9
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 +272 -0
- package/docs/module-map.md +17 -5
- package/package.json +3 -1
- package/src/adapters/claude-code/CONTRACT.md +113 -65
- package/src/adapters/claude-code/INTERFACE-GAPS.md +20 -16
- package/src/adapters/claude-code/NOTES.md +150 -0
- package/src/adapters/claude-code/bin/hook.ts +96 -34
- package/src/adapters/claude-code/bin/nightly.ts +21 -2
- package/src/adapters/claude-code/bin/runner.ts +58 -47
- package/src/adapters/claude-code/child.ts +203 -0
- package/src/adapters/claude-code/doctor.ts +360 -71
- package/src/adapters/claude-code/embed-client.ts +1 -1
- package/src/adapters/claude-code/envelope.ts +38 -0
- package/src/adapters/claude-code/hooks.ts +258 -1358
- package/src/adapters/claude-code/index.ts +12 -25
- package/src/adapters/claude-code/night-run.ts +27 -14
- package/src/adapters/cli/CONTRACT.md +28 -1
- package/src/adapters/cli/commands.ts +385 -11
- package/src/adapters/cli/coverage.ts +114 -0
- package/src/adapters/cli/desktop.ts +181 -0
- package/src/adapters/cli/dream-core.ts +11 -0
- package/src/adapters/cli/help.ts +14 -0
- package/src/adapters/cli/install.ts +16 -10
- package/src/adapters/cli/mechanisms.ts +23 -6
- package/src/adapters/cli/report.ts +2 -0
- package/src/adapters/cli/self-page.ts +4 -4
- package/src/adapters/cli/settle.ts +63 -0
- package/src/adapters/cli/uninstall.ts +1 -1
- package/src/adapters/{claude-code/config.ts → config.ts} +92 -73
- package/src/adapters/dashboard/registries.ts +29 -1
- package/src/adapters/dashboard/web/README.md +41 -11
- package/src/adapters/dashboard/web/actions.ts +4 -0
- package/src/adapters/dashboard/web/flow.ts +12 -0
- package/src/adapters/dashboard/web/lanes.ts +11 -0
- package/src/adapters/dashboard/web/mechanisms/dreaming/panel.js +2 -1
- package/src/adapters/dashboard/web/mechanisms/emotional/panel.js +2 -2
- package/src/adapters/dashboard/web/mechanisms/episodic-semantic/panel.js +2 -1
- package/src/adapters/dashboard/web/mechanisms/index.js +2 -0
- package/src/adapters/dashboard/web/mechanisms/interference/index.js +8 -4
- package/src/adapters/dashboard/web/mechanisms/interference/panel.js +13 -0
- package/src/adapters/dashboard/web/mechanisms/prospective/panel.js +2 -1
- package/src/adapters/dashboard/web/narrate.ts +62 -4
- package/src/adapters/dashboard/web/pages/health/sections/cycle.js +2 -4
- package/src/adapters/dashboard/web/pages/memories/fold.js +6 -1
- package/src/adapters/dashboard/web/pages/memories/index.js +6 -1
- package/src/adapters/dashboard/web/pages/memories/memories.css +43 -26
- package/src/adapters/dashboard/web/pages/memories/row.js +52 -15
- package/src/adapters/dashboard/web/pages/memories/sections/hold.js +112 -24
- package/src/adapters/dashboard/web/pages/memories/sections/list.js +3 -3
- package/src/adapters/dashboard/web/pages/memories/sections/search.js +75 -15
- package/src/adapters/dashboard/web/pages/memories/state.js +3 -2
- package/src/adapters/dashboard/web/pages/self/sections/dreams.js +2 -2
- package/src/adapters/dashboard/web/pages/self/sections/journal.js +7 -11
- package/src/adapters/dashboard/web/pages/self/sections/page.js +47 -17
- package/src/adapters/dashboard/web/pages/self/sections/wake.js +16 -5
- package/src/adapters/dashboard/web/shared/dates.js +55 -0
- package/src/adapters/dashboard/web/shared/memory-marks.css +1 -0
- package/src/adapters/dashboard/web/shared/memory-marks.js +23 -12
- package/src/adapters/dashboard/web/shared/memory-modal.js +15 -11
- package/src/adapters/dashboard/web/shared/widgets/feel-radar.js +8 -5
- package/src/adapters/dashboard/web/views/archive-words.ts +36 -22
- package/src/adapters/dashboard/web/views/mechanism-panel.ts +39 -0
- package/src/adapters/dashboard/web/views/mechanisms.ts +9 -1
- package/src/adapters/dashboard/web/views/mind.ts +57 -17
- package/src/adapters/dashboard/web/views/search.ts +170 -58
- package/src/adapters/expansions.ts +4 -3
- package/src/adapters/fired.ts +33 -5
- package/src/adapters/hosts.ts +185 -0
- package/src/adapters/lifecycle.ts +1616 -0
- package/src/adapters/log/CONTRACT.md +70 -0
- package/src/adapters/log/INTERFACE-GAPS.md +15 -0
- package/src/adapters/log/NOTES.md +49 -0
- package/src/adapters/log/index.ts +420 -0
- package/src/adapters/mcp/CONTRACT.md +97 -9
- package/src/adapters/mcp/INTERFACE-GAPS.md +25 -10
- package/src/adapters/mcp/NOTES.md +143 -11
- package/src/adapters/mcp/bin/serve.ts +109 -4
- package/src/adapters/mcp/deliberate.ts +95 -6
- package/src/adapters/mcp/index.ts +26 -4
- package/src/adapters/mcp/server.ts +817 -110
- package/src/adapters/mcp/tools.ts +175 -22
- package/src/adapters/mcp/write-up.ts +76 -20
- package/src/adapters/mechanism-evidence.ts +28 -9
- package/src/adapters/scopes.ts +9 -1
- package/src/adapters/sessions.ts +458 -184
- package/src/adapters/snapshots.ts +1 -1
- package/src/adapters/{claude-code/spawn.ts → spawn.ts} +13 -3
- package/src/core/associate/pending.ts +1 -1
- package/src/core/contradictions.ts +607 -0
- package/src/core/counterpart.ts +285 -26
- package/src/core/coverage/CONTRACT.md +77 -0
- package/src/core/coverage/INTERFACE-GAPS.md +46 -0
- package/src/core/coverage/NOTES.md +100 -0
- package/src/core/coverage/index.ts +660 -0
- package/src/core/coverage/tunables.ts +29 -0
- package/src/core/dream/CONTRACT.md +14 -8
- package/src/core/dream/INTERFACE-GAPS.md +6 -0
- package/src/core/dream/NOTES.md +27 -0
- package/src/core/dream/index.ts +90 -29
- package/src/core/dream/mind.ts +14 -13
- package/src/core/dream/reflect.ts +29 -0
- package/src/core/dream/tunables.ts +3 -0
- package/src/core/feelings-wheel.ts +2 -0
- package/src/core/handoff/CONTRACT.md +8 -2
- package/src/core/handoff/NOTES.md +2 -0
- package/src/core/handoff/index.ts +100 -14
- package/src/core/leaving.ts +77 -0
- package/src/core/physics/CONTRACT.md +23 -1
- package/src/core/physics/NOTES.md +10 -0
- package/src/core/physics/index.ts +78 -1
- package/src/core/prospective/CONTRACT.md +4 -1
- package/src/core/prospective/NOTES.md +16 -1
- package/src/core/prospective/index.ts +21 -2
- package/src/core/recall/CONTRACT.md +49 -0
- package/src/core/recall/INTERFACE-GAPS.md +7 -0
- package/src/core/recall/NOTES.md +105 -0
- package/src/core/recall/activate.ts +250 -17
- package/src/core/recall/feeling-ask.ts +216 -0
- package/src/core/recall/gate.ts +15 -3
- package/src/core/recall/index.ts +94 -3
- package/src/core/recall/render.ts +15 -3
- package/src/core/recall/standing.ts +124 -0
- package/src/core/recall/tunables.ts +16 -0
- package/src/core/remember/CONTRACT.md +8 -8
- package/src/core/remember/NOTES.md +41 -0
- package/src/core/remember/index.ts +2 -5
- package/src/core/remember/owes.ts +80 -217
- package/src/core/remember/proposals.ts +31 -2
- package/src/core/revision.ts +60 -3
- package/src/core/schemas/CONTRACT.md +6 -3
- package/src/core/schemas/NOTES.md +15 -0
- package/src/core/self/CONTRACT.md +28 -13
- package/src/core/self/NOTES.md +96 -0
- package/src/core/self/behind.ts +89 -0
- package/src/core/self/briefing.ts +136 -5
- package/src/core/self/episodes.ts +43 -48
- package/src/core/self/identity.ts +42 -6
- package/src/core/self/index.ts +39 -2
- package/src/core/self/writer.ts +26 -26
- package/src/core/sleep/cycle.ts +8 -0
- package/src/core/store/CONTRACT.md +12 -0
- package/src/core/store/NOTES.md +52 -0
- package/src/core/store/cache.ts +1 -1
- package/src/core/store/errors.ts +6 -0
- package/src/core/store/index.ts +364 -0
- package/src/core/store/operational.ts +248 -3
- package/src/core/store/owner-op-seam.ts +65 -1
- package/src/core/time.ts +60 -3
- package/src/core/types.ts +25 -0
- package/src/adapters/claude-code/page-writer.ts +0 -516
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,277 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.9 — 2026-09-30
|
|
4
|
+
|
|
5
|
+
Counterparts now reaches Claude Desktop's chat: one command connects it, a chat wakes
|
|
6
|
+
with the same memory a Claude Code session does, and each call says which chat it
|
|
7
|
+
belongs to. Underneath, the host-neutral part of a session moved out of the Claude Code
|
|
8
|
+
adapter so a second host could use it; Claude Code behaves as it did, apart from two
|
|
9
|
+
small, deliberate changes. Recall can now answer a question about how something felt,
|
|
10
|
+
and a journal chapter and the memory made from it come back as one. **The store's format
|
|
11
|
+
does not change** (it stays v10), so nothing is copied or upgraded. The hooks run the
|
|
12
|
+
new code at once; a session left open keeps 0.3.8's memory server until it is restarted
|
|
13
|
+
or `/mcp` → Reconnect.
|
|
14
|
+
|
|
15
|
+
Claude Desktop chat.
|
|
16
|
+
|
|
17
|
+
- **`counterparts install --host claude-desktop`** connects Desktop's chat. Quit Claude
|
|
18
|
+
Desktop first: it rewrites its own config file while it runs, and can write over the
|
|
19
|
+
change. The command makes (or keeps) the store and configuration exactly as the
|
|
20
|
+
scripted install does, then merges one `counterparts` entry into Desktop's
|
|
21
|
+
`claude_desktop_config.json`, found under the home directory it was given. The file is
|
|
22
|
+
backed up first, every other server and setting in it is left exactly as it was, and
|
|
23
|
+
a second run changes nothing ("already connected"). The file is written back as
|
|
24
|
+
2-space JSON, the way Desktop writes it. If it replaces an entry that named a different
|
|
25
|
+
store, it names that store: the memory there is still there. Plain `install` is
|
|
26
|
+
unchanged and doesn't touch Desktop.
|
|
27
|
+
- **The `wake` tool** is Desktop's session start, and only Desktop is offered it. It
|
|
28
|
+
starts a new session (host `claude-desktop`, in the `claude-desktop:` place) and
|
|
29
|
+
returns what a Claude Code session start would: the wake, the clock, today's plain
|
|
30
|
+
reminders, the day's dream line when it is an ask, the update and doctor notices, and
|
|
31
|
+
the write-up pointer, sized for a tool result. It also starts the turn-end worker, as
|
|
32
|
+
the hook does. It doesn't ask the first-launch question and doesn't start the headless
|
|
33
|
+
nightly run. Desktop also lists one prompt, **"Start with Counterparts"**, which asks
|
|
34
|
+
the chat to call `wake` first and keep the session id it gets.
|
|
35
|
+
- **Each call binds to a session, and says when it guessed.** One server serves every
|
|
36
|
+
Desktop chat, and Desktop sends no chat id, so every Desktop tool takes an optional
|
|
37
|
+
`session`. A call that names a live Desktop session is filed under it. A call that
|
|
38
|
+
names none binds to the most recent live Desktop session and says so (`boundTo`,
|
|
39
|
+
`boundBy: "most-recent"`, and one line). A tool that needs a session (`session_end`,
|
|
40
|
+
`chapter`, `dream`, `reflect`) refuses a named id that is unknown or has gone quiet
|
|
41
|
+
(`session-unknown`, `session-not-live`), and never swaps in another; with no live
|
|
42
|
+
session at all it refuses and names `wake`. The other tools (`note`, `recall`,
|
|
43
|
+
`status`, `scope`, `self_page`) run unbound in those cases, as they always could. Only a call that names its session keeps that session alive
|
|
44
|
+
and counts toward its write-up ask; a guessed call moves nothing, because it may belong
|
|
45
|
+
to another chat.
|
|
46
|
+
- **The write-up ask.** After 3 named calls and 20 minutes since the later of the wake,
|
|
47
|
+
the last `session_end` or `chapter`, and the last ask, the next named result carries a
|
|
48
|
+
write-up ask. `session_end` can be called again in the same chat; later calls add to
|
|
49
|
+
what the first one wrote.
|
|
50
|
+
- **Desktop's own place.** `claude-desktop:` is a place, not a folder: `counterparts scope
|
|
51
|
+
claude-desktop: --on` and the other mode flags work on it, the off and paused refusals
|
|
52
|
+
are worded for Desktop, and observer is read on every call, so a change takes effect
|
|
53
|
+
at once. Desktop never takes on the observer setting of the folder the server was
|
|
54
|
+
started in.
|
|
55
|
+
- **Doctor has a Claude Desktop line.** It is quiet when Desktop has no entry, green with
|
|
56
|
+
the last wake and last session when it has one, and amber only when the entry names
|
|
57
|
+
another store.
|
|
58
|
+
- **`counterparts coverage` shows Desktop sessions as unmeasured**: "Claude Desktop: N
|
|
59
|
+
sessions that day — unmeasured: Desktop chat keeps no transcript, so what they did not
|
|
60
|
+
write up cannot be counted (not lost; what was written through the tools is kept)."
|
|
61
|
+
- **A Desktop session may write up a chat that went quiet, only when its launcher grants
|
|
62
|
+
it.** A session's record can carry `mayWriteUp`, the ended sessions it may write up.
|
|
63
|
+
Only a launcher writes it (`sessions.ts#grantWriteUps`); no tool can, and a
|
|
64
|
+
`mayWriteUp` argument is ignored. The subject must be listed, ended, and owed, and its
|
|
65
|
+
memories are filed where it was lived. Nothing in this release grants it yet.
|
|
66
|
+
- **How the server tells the hosts apart.** The client's name at `initialize` decides:
|
|
67
|
+
`claude-ai` (chat) or `local-agent-mode-*` (Cowork) makes it Desktop's. A process whose
|
|
68
|
+
environment carries Claude Code's markers (`CLAUDE_PROJECT_DIR`, `CLAUDECODE`,
|
|
69
|
+
`CLAUDE_CODE_ENTRYPOINT`) was started by Claude Code and stays Claude Code's whatever
|
|
70
|
+
its client says. Any other client gets the handshake, the nine tools and the refusals
|
|
71
|
+
it always got: `wake` is an unknown tool there.
|
|
72
|
+
|
|
73
|
+
Claude Code: two deliberate changes.
|
|
74
|
+
|
|
75
|
+
- **`status` explains `owner: false`.** When the server isn't the owner's,
|
|
76
|
+
`status.stance.ownerMeans` says in one phrase what that means: "owner: false is the
|
|
77
|
+
ordinary setting — confidential memories are left out of this server's answers;
|
|
78
|
+
nothing is wrong."
|
|
79
|
+
- **No scope question in Desktop's scratch folders.** The first-launch scope question is
|
|
80
|
+
skipped in a Code-tab "No folder" workspace
|
|
81
|
+
(`…/Library/Application Support/Claude/scratch-workspaces/…`).
|
|
82
|
+
|
|
83
|
+
The host seam (#292; no change in behaviour).
|
|
84
|
+
|
|
85
|
+
- **The host-neutral part of a session has its own module.** `src/adapters/lifecycle.ts`
|
|
86
|
+
(`HostLifecycle`, `Lifecycle`) holds what any host does at a session's start, turn
|
|
87
|
+
boundary and end: the registry record, the wake, recall and its record, capture, the
|
|
88
|
+
ask pacer, the write-up ask, the worker. The Claude Code adapter extends it, and each
|
|
89
|
+
hook runs the same steps in the same order. `src/adapters/hosts.ts` holds the wording
|
|
90
|
+
that differs by host; Claude Code's strings are byte-identical.
|
|
91
|
+
- `config.ts` and `spawn.ts` moved from `src/adapters/claude-code/` to `src/adapters/`.
|
|
92
|
+
The `./claude-code` export still re-exports everything that moved.
|
|
93
|
+
- **Registry records carry `host`.** A record written before this reads as `claude-code`.
|
|
94
|
+
- **New package exports**: `counterparts/lifecycle` and `counterparts/hosts`.
|
|
95
|
+
|
|
96
|
+
Recall and chapters.
|
|
97
|
+
|
|
98
|
+
- **Recall by feeling, for a deliberate question.** Asked "what have I felt most
|
|
99
|
+
strongly" or "what moved me", the `recall` tool (and `counterparts ask`) answers from
|
|
100
|
+
the feelings recorded on memories, strongest first. Stamps rank the answer only when
|
|
101
|
+
the question is really about a feeling: a feel-word (`feel`, `felt`, `feeling`,
|
|
102
|
+
`emotion`, `mood`), or a feeling word used about a person. Everyday phrasings don't
|
|
103
|
+
trigger it: "the happy path", "moved the parser", "I feel like…", "I moved it to src",
|
|
104
|
+
"is my build open" still work as ordinary words. "I" is whoever asks: the counterpart
|
|
105
|
+
in `recall`, you in `counterparts ask`. "afraid" is now an alias of scared. The
|
|
106
|
+
per-turn recall never opens this path.
|
|
107
|
+
- **A journal chapter and the memory made from it are one result**, and that memory now
|
|
108
|
+
keeps the chapter's title (the next time its chapter grows; nothing is backfilled).
|
|
109
|
+
The chapter is the row shown; credit reaches the copy only when recall showed the
|
|
110
|
+
chapter this session.
|
|
111
|
+
- **`status` counts `replaced` apart from `exited`.** `symmetry.exited` now means only
|
|
112
|
+
what left for good (let go, removed); a revision, a merge, a correction, or a journal
|
|
113
|
+
copy rebuilt when its chapter grew is counted under the new `symmetry.replaced`. A
|
|
114
|
+
store whose chapters keep growing used to read as losing its self-kind memories, so
|
|
115
|
+
**any note comparing `exited` across days sees a step on the day this is installed.**
|
|
116
|
+
- **The dashboard's Ask shows a chapter as its journal entry** (it used to show the
|
|
117
|
+
memory, with a "from chapter …" link), and the questions it rewrites into the
|
|
118
|
+
counterpart's voice ask as the counterpart (`--voiced`): there "I" means the
|
|
119
|
+
counterpart. An exact ask and a typed `counterparts ask` keep you as "I".
|
|
120
|
+
|
|
121
|
+
Not proven here.
|
|
122
|
+
|
|
123
|
+
- Desktop has never run against a real Claude Desktop app. The client names, the
|
|
124
|
+
prompt, the per-call binding and the write-up ask were checked over stdio with a
|
|
125
|
+
client that calls itself `claude-ai`.
|
|
126
|
+
- The Desktop Code tab's environment and client name were never measured live. A Code
|
|
127
|
+
tab session is expected to carry Claude Code's markers and stay Claude Code's.
|
|
128
|
+
- A process that Claude Code did not launch, started in a folder set to observer, opens
|
|
129
|
+
the store writable before `initialize` tells it which host it serves.
|
|
130
|
+
- A Desktop-only user on automatic dreaming gets no dream line: the wake leaves the
|
|
131
|
+
headless run for a Claude Code session to start.
|
|
132
|
+
|
|
133
|
+
## 0.3.8 — 2026-09-30
|
|
134
|
+
|
|
135
|
+
When two memories disagree, Claude can now say how: the fact changed, the old one was
|
|
136
|
+
wrong, or it's still open, with a trail and an undo. What hasn't been written up is
|
|
137
|
+
counted in one place, and a debt lapses after a few days of use instead of waiting
|
|
138
|
+
forever. The wake keeps up with the day, a process log records what the hooks, the
|
|
139
|
+
worker, the nightly run and the memory server did, and the dashboard takes the 09-30
|
|
140
|
+
feedback. **The store's format changes (v9 → v10).**
|
|
141
|
+
|
|
142
|
+
**The format change, and why every session must be closed.** The first Claude Code
|
|
143
|
+
session after installing copies the store (as every upgrade since 0.3.1 has) and
|
|
144
|
+
upgrades it: two new tables for contradictions and their trail, and one new column on
|
|
145
|
+
every memory (`fade`, 1 unless a memory was settled as changed). Every contradiction a
|
|
146
|
+
dream flagged and nobody settled is carried onto the new table, with its "already
|
|
147
|
+
raised" mark. Nothing else changes, and all memories come through. Until that first
|
|
148
|
+
session, `counterparts doctor` and the dashboard can't read the store yet (a v9 store is
|
|
149
|
+
older than they read) and say so; the next session's hook does the upgrade. **Close
|
|
150
|
+
every Claude Code session before installing.** A v10 store can't be opened by 0.3.7:
|
|
151
|
+
anything of 0.3.7's that opens it afterwards refuses at once (`SCHEMA_AHEAD`), and its
|
|
152
|
+
hooks stand down. But a session that was already open when you installed keeps its own
|
|
153
|
+
memory server, still running 0.3.7's code with the store already open, and that open was
|
|
154
|
+
the one place the check ran. Its memory tools re-read the format on every call and
|
|
155
|
+
refuse ("Counterparts was updated and this server is still running the old version, so
|
|
156
|
+
this tool did nothing. Run /mcp and Reconnect to load it."), so in a session opened
|
|
157
|
+
before the install, don't rely on the memory tools: quit it and start a new one, or run
|
|
158
|
+
`/mcp` → Reconnect. The hooks are fresh processes at every event, so they run the new
|
|
159
|
+
code at once and are fine. To go back to 0.3.7 you reinstall it and put back the copy
|
|
160
|
+
the upgrade took; anything remembered since is lost.
|
|
161
|
+
|
|
162
|
+
Contradictions.
|
|
163
|
+
|
|
164
|
+
- **Three ways a disagreement is settled, each with its own outcome.** When Claude
|
|
165
|
+
writes a memory that `updates` an older one, it says `how` (`changed` is the default):
|
|
166
|
+
- **changed** — true then, not now. The older memory takes one strength cut (half) and
|
|
167
|
+
stays recallable, labelled `Earlier (now [id])`. A later use resets its fading as
|
|
168
|
+
always but doesn't lift the cut.
|
|
169
|
+
- **corrected** — the older one was wrong. It is put away (archived): it leaves recall
|
|
170
|
+
and stays readable by its own id, `Corrected by [id]`. Nothing is deleted.
|
|
171
|
+
- **open** — both stand, and recall shows each with `(disagrees with [id])`.
|
|
172
|
+
- Beliefs, the core, current-state and protected memories keep their own paths; a `how`
|
|
173
|
+
sent at one of those is not applied, and the answer says which path ran.
|
|
174
|
+
- **Claude notices at write time.** A `note` or `session_end` memory comes back with up to
|
|
175
|
+
three of its nearest live memories and one line inviting a settle, if one of them
|
|
176
|
+
disagrees. No model call.
|
|
177
|
+
- **Settling a pair that already exists**, from anywhere: `note` with `settle` (no new
|
|
178
|
+
memory needed), the dream's new `settle` action (a reason is required), the
|
|
179
|
+
reflection's `settle` phase (only on memories it was shown), and yours:
|
|
180
|
+
**`counterparts settle`** lists what's unsettled and what was settled lately, settles
|
|
181
|
+
one (`--pair … --holds … --how … --why "…"`), or undoes one (`--undo`). Settling an
|
|
182
|
+
existing pair rewrites no memory.
|
|
183
|
+
- **Every settle and every undo leaves a trail row**: who (a session, a dream, the
|
|
184
|
+
reflection, you), how, why, which memories, and when. An undo puts back exactly what
|
|
185
|
+
the settle did: the strength, the archive, the flags it closed. Removing the memory
|
|
186
|
+
that settled a pair puts the other one back.
|
|
187
|
+
- **Unsettled pairs are labelled.** The older memory of a pair nobody has settled reads
|
|
188
|
+
`Unsettled — may be out of date, see [id]`, in recall and in the wake's lanes. Dream
|
|
189
|
+
flags are raised once awake, as before, now naming the pair and the `note` settle.
|
|
190
|
+
- **A replaced memory is readable by its own id**, with `replaced by [id]`; `counterparts
|
|
191
|
+
ask` prints a memory's standing above its words.
|
|
192
|
+
- Doctor has a **Contradictions** line (the last 7 days: flagged, settled by kind and by
|
|
193
|
+
whom, undone, still open or unsettled) and an **Upgrade to v10** line.
|
|
194
|
+
`counterparts mechanisms` counts reconsolidation as built and interference as partly
|
|
195
|
+
built.
|
|
196
|
+
|
|
197
|
+
What is written up, and what is owed.
|
|
198
|
+
|
|
199
|
+
- **One place says what hasn't been written up yet.** A piece of conversation counts as
|
|
200
|
+
written up only when something claims it: a memory from it, a write-up answered
|
|
201
|
+
"nothing new" (`memories: []`), or a chapter. A handoff alone doesn't. Each claim is
|
|
202
|
+
for the project it was made in.
|
|
203
|
+
- **One rule for what a session owes**: at least 3 unwritten pieces spanning 15 minutes
|
|
204
|
+
or more, in a session that has ended or captured nothing since the date changed. It
|
|
205
|
+
replaces the old asked/answered rule and the 12-hour silence window. Short sessions
|
|
206
|
+
(1–2 pieces, or 3 or more inside 15 minutes) owe nothing. A small debt (under 6 pieces)
|
|
207
|
+
gets the same pointer with one more sentence: "It was a short session: one line is
|
|
208
|
+
enough, or memories: [] if nothing in it is worth keeping." The next session's pointer
|
|
209
|
+
and caps are unchanged: two pointers a day across the store, this project only.
|
|
210
|
+
- **A debt lapses instead of waiting forever.** An owed stretch has two more days of use
|
|
211
|
+
(days with a turn end) after the day of its latest piece; at the first turn end of the
|
|
212
|
+
third, it lapses. Nothing is deleted: the session stops owing, and its text goes on the
|
|
213
|
+
ordinary 7-day retention. On a store with old unwritten stretches, the first pass
|
|
214
|
+
lapses them, one record each.
|
|
215
|
+
- **The in-session ask has a third reason**: three pieces not yet written up, half an
|
|
216
|
+
hour after the later of the first of them and the last ask (`due-unwritten`). The
|
|
217
|
+
day's cap on asks is unchanged, and an unanswered ask isn't repeated without new
|
|
218
|
+
pieces.
|
|
219
|
+
- **The handoff pointer says how current it is**: `Where I left off in this directory
|
|
220
|
+
(written 09-29 12:47): …`, and when work here ran after it, `(written 09-29 12:47; work
|
|
221
|
+
here 13:02–15:41 since, not yet written up)` or `…, written up since`. The excerpt is
|
|
222
|
+
the first real sentence, without a leading list marker.
|
|
223
|
+
- **`counterparts coverage [--date YYYY-MM-DD]`** says, in plain words, what was written
|
|
224
|
+
up and what is not yet, for a day. Doctor's **Crash write-up** line is now **Write-ups**:
|
|
225
|
+
yesterday's state, amber when a stretch the pointer can offer is still owed from
|
|
226
|
+
yesterday or earlier, small debts it never offers named apart as "left to lapse", and
|
|
227
|
+
the week's lapses. The 3-day wait is gone.
|
|
228
|
+
|
|
229
|
+
The wake.
|
|
230
|
+
|
|
231
|
+
- **The wake keeps up with the day.** It used to be written once, at the day's first
|
|
232
|
+
turn end, so a self page written later, a write-up that landed, or the nightly run's
|
|
233
|
+
page reached no session until the next day. Now each of those marks the wake behind,
|
|
234
|
+
and the next turn end re-renders it; the nightly run re-renders it when it finishes.
|
|
235
|
+
Re-renders on the same day are stable: the same Nearby memories, the identity lane
|
|
236
|
+
rotating once a day.
|
|
237
|
+
- **The wake says what it trimmed.** A lane that lost memories to its cap or to the size
|
|
238
|
+
budget gets one quiet line, like `(3 more still open; recall ids: mem_…, mem_…, mem_…)`,
|
|
239
|
+
up to five ids that recall reads whole. Most wakes will carry a "(N more nearby…)"
|
|
240
|
+
line.
|
|
241
|
+
- **A plain reminder, once told, leaves "Arriving"** for the rest of its grace week.
|
|
242
|
+
Recall still finds it.
|
|
243
|
+
- **One size budget per hook message** (10,000 bytes; 9,500 for the JSON form). When a
|
|
244
|
+
session start or a prompt is crowded, parts give way in a stated order and wait for a
|
|
245
|
+
later turn; nothing is cut, and nothing is marked told that wasn't shown. The
|
|
246
|
+
first-launch question is now measured against this budget, so it can fit beside a full
|
|
247
|
+
wake.
|
|
248
|
+
|
|
249
|
+
The log.
|
|
250
|
+
|
|
251
|
+
- **A process log**: one line per event from the hooks, the turn-end worker, the nightly
|
|
252
|
+
run and the memory server, in `sessions/log/<date>.log` inside the store (kept 7
|
|
253
|
+
days). Ids, counts and codes, no conversation text. **`counterparts log [--date
|
|
254
|
+
YYYY-MM-DD]`** prints a day, oldest first. Doctor has a green **Log** line (where it
|
|
255
|
+
is, how many days it holds, today's failures).
|
|
256
|
+
- Two failures now leave a durable record: capture failing to write, and a write-up
|
|
257
|
+
failing.
|
|
258
|
+
|
|
259
|
+
Cleanup.
|
|
260
|
+
|
|
261
|
+
- **The page writer's host mode is removed** (the windowless `claude -p` the worker
|
|
262
|
+
started for the self page alone, off by default since the nightly run). A config that
|
|
263
|
+
still says `pageWriter.mode: "host"` loads, reads as `session`, and doctor's "Old
|
|
264
|
+
settings" line names what it ignores.
|
|
265
|
+
|
|
266
|
+
The dashboard.
|
|
267
|
+
|
|
268
|
+
- **Dates** in one style ("Sep 30th", with the year when it isn't this year). **Self**:
|
|
269
|
+
the day-by-day note reads as a sentence, and Arriving items are titles that open the
|
|
270
|
+
memory. **Memories**: a "by word | by meaning" switch beside the search box, matched
|
|
271
|
+
words highlighted, close matches for typos, readable line lengths, and a row no longer
|
|
272
|
+
repeats its own date. **Feelings**: "disgust" reads "dislike". **How well I remember**:
|
|
273
|
+
one square per memory, scaling as memories grow.
|
|
274
|
+
|
|
3
275
|
## 0.3.7 — 2026-09-29
|
|
4
276
|
|
|
5
277
|
Dreaming asks where you can see it, and "on its own" now means a separate background
|
package/docs/module-map.md
CHANGED
|
@@ -15,18 +15,21 @@ code and the `NOTES.md` / `INTERFACE-GAPS.md` next to it.*
|
|
|
15
15
|
| `encode/` | attention + amygdala tagging | What gets in: gates (secrets, precision), salience tagged at write time, novelty as prediction error. |
|
|
16
16
|
| `remember/` | hippocampal encoding | The authorship contract: the experiencer's end-of-session dump (content, salience tags, `updates:` marks), in-the-moment jots, crash-fallback ingestion. |
|
|
17
17
|
| `store/` | the substrate | Two boxes since the floor (schema v6, 2026-09-20): one small canonical transactional SQLite (`counterparts.sqlite` — the memories' words, their archived versions, and every structured field), one rebuildable cache (embeddings/FTS, never backed up). The third box — one markdown file per memory — is gone. Markdown is an export (`render.ts`), plus a derived, write-only file copy of the journal under `journal/` — classified in the layout, deliberately NOT in the backup set, regenerated from its rows if deleted. |
|
|
18
|
-
| `recall/` | retrieval + priming | Cues → activation → surfacing gate → bounded injection; footnote tier; reinforcement on real use. |
|
|
18
|
+
| `recall/` | retrieval + priming | Cues → activation → surfacing gate → bounded injection; footnote tier; reinforcement on real use. Since 2026-09-29 a memory's standing in a contradiction is a label in front of it (earlier, unsettled, corrected) or after it (disagrees with). |
|
|
19
19
|
| `embed/` | — (a gist, not a reading) | Text in, vector out, on this machine, for nothing: the static embedding table (`static.ts`, potion-base-8M) that gives recall's semantic channel a source with no key. Zero code dependencies; its weights ship as the data-only package `counterparts-model-potion`, the one runtime dependency. The only embedder since 2026-09-24, when the paid Voyage seat was removed. **Added 2026-09-23 (roadmap C1).** |
|
|
20
20
|
| `associate/` | Hebbian linking | Co-activation strengthens links; spreading activation at recall. **RESOLVED (owner, 2026-08-25): stays a module** — edge-level arithmetic keeps `physics/` one page; Hebbian plasticity/contiguity is its own mechanism in the field guide. |
|
|
21
21
|
| `schemas/` | semantic memory | Entities and beliefs; birth by mention, death by decay; strength-weighted revision with row history. |
|
|
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
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. |
|
|
26
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. |
|
|
27
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.** |
|
|
28
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`).** |
|
|
29
31
|
| *(`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.** |
|
|
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.** |
|
|
30
33
|
| *(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`. |
|
|
31
34
|
|
|
32
35
|
**Third open question (check-in): the `remember`/`encode` boundary.** With the
|
|
@@ -37,13 +40,22 @@ input — does `encode` shrink to gates-and-tagging inside `remember`'s pipeline
|
|
|
37
40
|
|
|
38
41
|
| adapter | job |
|
|
39
42
|
|---|---|
|
|
40
|
-
| `claude-code/` | Hooks: wake
|
|
41
|
-
| `mcp/` | Deliberate tools: note, recall, status — plus the Stop ask's two return channels, `session_end` (memories) and `chapter` (the episode's own journal, **added 2026-09-04**, because the ask named a door no adapter had built) —
|
|
42
|
-
| `cli/` | `counterparts` command
|
|
43
|
+
| `claude-code/` | Hooks: Claude Code's five events driving the host lifecycle (`lifecycle.ts`, below) — its payload translation, JSON envelope and the room it measures, transcript reader and wake-arrival check, the Stop ask's words, the first-launch question, the update and doctor notices, the dream line, and the headless nightly run (`night-run.ts`, `claude -p`, **2026-09-29**). The launch adapter. |
|
|
44
|
+
| `mcp/` | Deliberate tools, nine: note, recall, status — plus the Stop ask's two return channels, `session_end` (memories, and the next-session write-up's door) and `chapter` (the episode's own journal, **added 2026-09-04**, because the ask named a door no adapter had built) — `scope` (this directory's setting, **2026-09-15**), `self_page` (the page the wake opens with, **2026-09-18**), `dream`, the dreamer's phases (**added 2026-09-26**), and `reflect`, the waking self's (**added 2026-09-27**). A result's words about the host come from `hosts.ts`. For a Claude Desktop client (by its name at `initialize`, **2026-09-30**) a tenth, `wake` — Desktop's session start, since it has no hooks — plus per-call binding to the most recent live Desktop session, the write-up ask on a tool result, and a "Start with Counterparts" prompt; a Claude Code client sees none of it. |
|
|
45
|
+
| `cli/` | `counterparts` command — the full list is `COMMANDS` in `cli/commands.ts`: status, install, connect / disconnect (the host's two files), `install --host claude-desktop` (Desktop's config entry, **2026-09-30**), uninstall, start-fresh, init, owner operations (note, ask, export, backup, remove, verify, repairs, rebrief), the readings (doctor, mechanisms, log, coverage, version, help), scope, self-page, dream, core, settle, and dashboard. |
|
|
43
46
|
| `dashboard/` | The owner's window (constitution line 16): brain-view, revision stories, band/protected lists. Observer-mode by construction; minimal version ships DURING the parallel run. **Added 2026-08-25 (owner elevation).** |
|
|
44
|
-
| `sessions.ts` | Not an adapter — a leaf both may import: the live-session registry a host's hooks write (`<dataDir>/sessions/`) and its tools read, so a tool launched without a session can bind to one that is real, live and in its project. Adapters stay leaves; this is the sibling they share instead of importing each other. **Added 2026-09-04**, because this host's MCP servers are launched from a static config and cannot be told which session they serve. |
|
|
47
|
+
| `sessions.ts` | Not an adapter — a leaf both may import: the live-session registry a host's hooks write (`<dataDir>/sessions/`) and its tools read, so a tool launched without a session can bind to one that is real, live and in its project. Adapters stay leaves; this is the sibling they share instead of importing each other. **Added 2026-09-04**, because this host's MCP servers are launched from a static config and cannot be told which session they serve. Since **2026-09-30** Claude Desktop's MCP server writes its own records here (its `wake`), refreshed per call, and a runner's record can list the ended sessions a launcher granted it to write up (`mayWriteUp`). |
|
|
45
48
|
| `expansions.ts` | The same shape, for the other direction: the handle-resolution log the MCP `recall` tool writes (`<dataDir>/sessions/expansions.jsonl` — a per-store SALTED hash of the handle (G58), the id it reached or `null` for a refusal, a timestamp, the project) and the boundary's credit pass reads, so an expansion by TITLE credits the memory it actually reached, and a refusal shadows it. **Added 2026-09-15** (LAUNCH-STATUS G50): `recall/reference.ts` credits literal `mem_…` addresses and resolves nothing, so until this the most deliberate act a session had — naming a memory and reading it — earned no credit at all. |
|
|
46
49
|
| `scopes.ts` | The third shared leaf: the per-directory scope registry (`scopes.json` BESIDE the config, never inside the store, because the hook decides `off` before anything opens) — `on` / `observer` / `off` / `paused`, longest prefix wins, absent-or-unreadable meaning `unset` meaning on. Written by the `counterparts scope` console and the MCP `scope` tool, read by every hook. **Added 2026-09-15** (PR #92, G19): the hooks are registered globally, so until this the only way to say *not here* was a second config file and two environment variables. |
|
|
50
|
+
| `lifecycle.ts` | The host seam (**2026-09-30**): `HostLifecycle`, the interface a host adapter drives, and `Lifecycle`, its one implementation — what a session is to this memory whatever the host: the wake's composition and the registry's expectation of it, plain reminders, recall for a turn, the boundary (capture, the retroactive-capture seal, credit, the orphan tail), the ask's pacing (not its words), the next-session write-up pointer, every registry write, and the worker spawn with its counters. `claude-code/`'s `ClaudeCodeAdapter` extends it. Imports no adapter. |
|
|
51
|
+
| `hosts.ts` | Which host a session lives in (`claude-code` is the default, and what a registry record with no `host` reads as) and the few sentences that depend on it — how to reconnect after an update, what switching the scope does — plus Claude Desktop's: the host name, its pseudo-scope `claude-desktop:` (a name, never resolved as a path), which MCP clients are Desktop, and the Code tab's scratch workspaces. **Added 2026-09-30.** |
|
|
52
|
+
| `config.ts` | The host configuration's shape and reader (`AdapterConfig`, `loadConfig`, `TUNABLES`, capabilities) — read by the hooks, the worker, the console and the MCP server. Moved out of `claude-code/` on **2026-09-30**. |
|
|
53
|
+
| `config-path.ts` | Where every entry point looks for that configuration: `--config`, else `COUNTERPARTS_CONFIG`, else `~/.counterparts/claude-code.json`; a named configuration that cannot be honoured refuses rather than falling back. |
|
|
54
|
+
| `spawn.ts` | The detached worker's plan and start (`planSpawn`, `spawnDetached`): watchdog checked against the staleness window, environment pinned last. Moved out of `claude-code/` on **2026-09-30** so any host's adapter can start the same worker. |
|
|
55
|
+
| `fired.ts` | Which mechanisms have fired and which have gone quiet, read only from the store's rows — `counterparts mechanisms`, the dashboard's panel. Each entry names the module that does the work. |
|
|
56
|
+
| `snapshots.ts` | The daily rotating snapshot and its rotation — the one place this package deletes a copy of the memory, and only what it can prove is a snapshot. |
|
|
57
|
+
| `stance-env.ts` | `COUNTERPARTS_OBSERVER` / `COUNTERPARTS_OWNER`, read the way the explicit-dir guard is, each failing toward less power. |
|
|
58
|
+
| `log/` | A shared leaf with its own CONTRACT: the process log — one line per allowlisted event (failures, stand-downs, turn ends, write-ups, the night, the wake) from the hook, the worker, the nightly run and the MCP server, to `<dataDir>/sessions/log/<date>.log`, ids and codes only, kept 7 days. Read by `counterparts log` and one doctor line. **Added 2026-09-30**: none of the four processes wired its `onEvent`, so ~270 event names died with their process. |
|
|
47
59
|
|
|
48
60
|
## Tools (`tools/`)
|
|
49
61
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "counterparts",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
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": {
|
|
@@ -39,6 +39,8 @@
|
|
|
39
39
|
"./dashboard": "./src/adapters/dashboard/index.ts",
|
|
40
40
|
"./sessions": "./src/adapters/sessions.ts",
|
|
41
41
|
"./scopes": "./src/adapters/scopes.ts",
|
|
42
|
+
"./lifecycle": "./src/adapters/lifecycle.ts",
|
|
43
|
+
"./hosts": "./src/adapters/hosts.ts",
|
|
42
44
|
"./package.json": "./package.json"
|
|
43
45
|
},
|
|
44
46
|
"files": [
|