counterparts 0.1.0 → 0.2.0
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/README.md +174 -117
- package/docs/QUICKSTART.md +512 -113
- package/package.json +1 -1
- package/src/adapters/claude-code/doctor.ts +557 -150
- package/src/adapters/cli/CONTRACT.md +240 -8
- package/src/adapters/cli/NOTES.md +652 -1
- package/src/adapters/cli/bin/counterparts.ts +59 -16
- package/src/adapters/cli/commands.ts +2460 -405
- package/src/adapters/cli/help.ts +472 -0
- package/src/adapters/cli/index.ts +36 -1
- package/src/adapters/cli/install.ts +347 -3
- package/src/adapters/cli/keys.ts +503 -0
- package/src/adapters/cli/removal.ts +51 -22
- package/src/adapters/cli/report.ts +313 -0
- package/src/adapters/cli/ui.ts +917 -0
- package/src/adapters/cli/uninstall.ts +1232 -0
- package/src/adapters/cli/wire.ts +1502 -0
- package/src/adapters/mcp/CONTRACT.md +4 -1
- package/src/adapters/mcp/NOTES.md +27 -0
- package/src/adapters/mcp/server.ts +43 -2
- package/src/adapters/mcp/tools.ts +5 -0
- package/src/core/store/NOTES.md +24 -0
- package/src/core/store/index.ts +37 -0
- package/tools/install-loop/run.sh +184 -7
package/docs/QUICKSTART.md
CHANGED
|
@@ -1,39 +1,33 @@
|
|
|
1
1
|
# Counterparts — install
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
it
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
No API key required. The scripted version of this page — install, configure,
|
|
12
|
-
hook, note, recall, the MCP round trip, the removal plan, the session write and the
|
|
13
|
-
scope switch — is
|
|
14
|
-
52 checks and runs end to end in two to three seconds; the part that takes you time is
|
|
15
|
-
§4, pasting two blocks into Claude Code's own configuration.
|
|
3
|
+
**Sections 1 to 5 are the whole install: three commands, a few questions, no API keys.**
|
|
4
|
+
Everything under **Reference**, further down, is detail — other ways to install, the host
|
|
5
|
+
files by hand, the console, what is verified, the rough edges. Read it when you want it.
|
|
6
|
+
|
|
7
|
+
This page is kept honest mechanically: `tools/install-loop/run.sh` runs the console
|
|
8
|
+
commands on it verbatim, in a throwaway home directory with no copy of this repository on
|
|
9
|
+
its PATH. Each command is grepped out of this page before it is run, so an edit that
|
|
10
|
+
changes one fails the loop. §10 says what that proves and what it leaves unproven.
|
|
16
11
|
|
|
17
12
|
---
|
|
18
13
|
|
|
19
14
|
## 1. What you need
|
|
20
15
|
|
|
21
|
-
- **[bun](https://bun.sh) 1.3 or newer.** Counterparts ships as TypeScript
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
- **[Claude Code](https://claude.com/claude-code)**, if you want the
|
|
29
|
-
|
|
30
|
-
- **No API keys.** Counterparts runs with none
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Node
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
target is ever added, it will need one.
|
|
16
|
+
- **[bun](https://bun.sh) 1.3 or newer.** Counterparts ships as TypeScript and runs it
|
|
17
|
+
directly; bun is the runtime. If you do not have it, one line installs it:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
curl -fsSL https://bun.sh/install | bash
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- **[Claude Code](https://claude.com/claude-code)**, if you want the memory to happen by
|
|
24
|
+
itself. The store, the console and the dashboard work without it.
|
|
25
|
+
- **No API keys.** Counterparts runs with none, and that is a supported way to run. §6
|
|
26
|
+
says exactly what you give up.
|
|
27
|
+
|
|
28
|
+
**Node is not verified.** The core targets the built-in `node:sqlite`, which needs Node
|
|
29
|
+
22.5+ behind a flag and 23.4+ by default. Everything on this page was run under bun 1.3.10
|
|
30
|
+
on macOS. Nobody has run Counterparts under Node, so nothing here claims it works there.
|
|
37
31
|
|
|
38
32
|
---
|
|
39
33
|
|
|
@@ -43,13 +37,12 @@ target is ever added, it will need one.
|
|
|
43
37
|
bun add -g counterparts
|
|
44
38
|
```
|
|
45
39
|
|
|
46
|
-
That is the whole install. It copies the package into bun's own global folder;
|
|
47
|
-
|
|
48
|
-
made. It puts four executables into bun's global bin directory:
|
|
40
|
+
That is the whole install. It copies the package into bun's own global folder; nothing
|
|
41
|
+
else on your machine is read or changed. Four commands land in bun's global bin directory:
|
|
49
42
|
|
|
50
43
|
| | |
|
|
51
44
|
|---|---|
|
|
52
|
-
| `counterparts` |
|
|
45
|
+
| `counterparts` | your console — ask, status, doctor, install, backup, export, removal |
|
|
53
46
|
| `counterparts-hook` | the Claude Code hook entry point; one executable, five events |
|
|
54
47
|
| `counterparts-mcp` | the MCP server — `note`, `recall`, `status`, `session_end`, `chapter` |
|
|
55
48
|
| `counterparts-dashboard` | read-only views of what is in the store |
|
|
@@ -57,18 +50,168 @@ made. It puts four executables into bun's global bin directory:
|
|
|
57
50
|
**Check that directory is on your PATH before going on:**
|
|
58
51
|
|
|
59
52
|
```
|
|
60
|
-
counterparts --
|
|
53
|
+
counterparts --version
|
|
61
54
|
```
|
|
62
55
|
|
|
63
|
-
|
|
56
|
+
It should print `counterparts 0.2.0`. That is the whole check at this point: it
|
|
57
|
+
opens no store and reads no configuration, so it answers "is the program here
|
|
58
|
+
and runnable" and nothing else. `counterparts doctor`, after §3 and a restart of
|
|
59
|
+
Claude Code, is the one that says whether it WORKS.
|
|
60
|
+
|
|
61
|
+
If that says `command not found`, bun said so during the install
|
|
64
62
|
(`warn: To run "counterparts", add the global bin folder to $PATH`) and the fix is
|
|
65
|
-
`export PATH="$HOME/.bun/bin:$PATH"` in your shell profile. A fresh bun install
|
|
66
|
-
|
|
63
|
+
`export PATH="$HOME/.bun/bin:$PATH"` in your shell profile. A fresh bun install does not
|
|
64
|
+
always do this for you.
|
|
65
|
+
|
|
66
|
+
Installing from a clone, or from a tarball somebody sent you: §2a.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 3. Set it up
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
counterparts
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
That is the second step. On a terminal with nothing set up yet, the bare command
|
|
77
|
+
offers to do it — *No memory here yet. Set it up now? [Y/n]* — and a yes runs the
|
|
78
|
+
setup. `counterparts install` asks for the same conversation by name; it is also
|
|
79
|
+
the repair, so running it again is safe and it says `Welcome back` instead.
|
|
80
|
+
|
|
81
|
+
It is short, nothing in it is compulsory, and **Esc gets you out of any question**:
|
|
82
|
+
|
|
83
|
+
- **Your name.** What the memory calls you, and the one thing it is told before it
|
|
84
|
+
has learned anything. Enter skips it, and then there is no identity core.
|
|
85
|
+
- **Your store.** No question, and since 2026-09-22 no receipts either — it creates
|
|
86
|
+
`~/.counterparts/`: the store itself, a configuration file, and an empty
|
|
87
|
+
credentials file only you can read. Anything already there is kept and never
|
|
88
|
+
overwritten. (If `~/.counterparts` is gone and a parked folder is sitting beside
|
|
89
|
+
it, that is asked **first**, before your name — §9b.)
|
|
90
|
+
- **Claude Code, connected for you.** `Connecting Claude Code…`, then one `ok` line:
|
|
91
|
+
five hooks added to `~/.claude/settings.json` **(backup kept)**, memory tools
|
|
92
|
+
registered. The five go **beside** any hooks belonging to other tools, and the
|
|
93
|
+
memory server is registered through `claude mcp add`. `counterparts disconnect`
|
|
94
|
+
takes all of it back out and names the backup file as it goes; `--no-connect`
|
|
95
|
+
means don't; a machine with no Claude Code on it gets one line and the setup
|
|
96
|
+
carries on. §4a is the same two things applied by hand.
|
|
97
|
+
- **Keys.** Two optional API keys, one at a time, and each starts as a `[y/N]`
|
|
98
|
+
question with one line on what it buys — *Add an Anthropic key? Optional — …* —
|
|
99
|
+
where Enter is no. Only a yes prints the link and then takes the key, typed
|
|
100
|
+
hidden. **Skipping both is fine**: §6 is the whole of what you give up, and
|
|
101
|
+
`counterparts doctor` grades a store that has never had a key `OFF` — optional,
|
|
102
|
+
never turned on — rather than red or amber.
|
|
103
|
+
|
|
104
|
+
It ends on two lines: where your memory lives, and the one thing left to do —
|
|
105
|
+
restart Claude Code, then run `counterparts doctor`.
|
|
106
|
+
|
|
107
|
+
**Not at a terminal, it asks nothing.** A pipe, a script or a CI job gets the old
|
|
108
|
+
behaviour: the hooks block and the registration line are printed and nothing of the host's
|
|
109
|
+
is touched. `--no-connect` gets you that at a terminal too. Scripted, the whole
|
|
110
|
+
thing is one line:
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
counterparts install --budget 9000 --name "Your Name"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`--budget` is the size ceiling in bytes for the briefing injected at the start of each
|
|
117
|
+
session (§3a); the conversation writes 9,000 into a configuration it is creating when you
|
|
118
|
+
do not pass one, and `counterparts help install` is where that is said. `--yes` is kept so
|
|
119
|
+
a scripted caller need not change, and it answers none of the questions above: a name, two
|
|
120
|
+
keys and a parked memory are things only a person can answer.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 4. Restart Claude Code, then check it
|
|
125
|
+
|
|
126
|
+
Restart Claude Code. Then:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
counterparts doctor
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
It reads the store your hooks read, writes nothing, and prints one line per finding: a
|
|
133
|
+
grade word, a short line of facts, and — where there is anything to do — a fix under it
|
|
134
|
+
that is always a command, never a JSON edit. It exits 1 if anything is red and 0 otherwise.
|
|
135
|
+
|
|
136
|
+
**Nothing red means it is running.** On a fresh install with no API key you should expect
|
|
137
|
+
exactly two dim **OFF** lines — `Recall by meaning` and `Crash write-up`, the two optional
|
|
138
|
+
things you never turned on. OFF is not a fault and there is nothing to repair; amber is
|
|
139
|
+
"worth a look"; only red moves the exit code. On a terminal the worker's internal lines
|
|
140
|
+
fold into one `GREEN Background` line while they are all green, so the screen is seven
|
|
141
|
+
findings long; one red or amber among them unfolds the lot, in place, with its fix.
|
|
142
|
+
`counterparts doctor --all` prints every line whatever the grades are, and `--json` is
|
|
143
|
+
always complete and never folded. §12 is the longer reading of `doctor`.
|
|
144
|
+
|
|
145
|
+
Three things about sessions that were already open, because they surprise everybody:
|
|
146
|
+
|
|
147
|
+
- **Hooks take effect on the next turn** of a session that is already open. You do not
|
|
148
|
+
have to restart for those.
|
|
149
|
+
- **The memory tools appear only after a restart.** Claude Code launches an MCP server
|
|
150
|
+
when a session starts, so a session that was open when you installed has no `note`,
|
|
151
|
+
`recall` or `session_end` until it is restarted.
|
|
152
|
+
- **After an upgrade, an open session keeps serving the old code** until it restarts —
|
|
153
|
+
the server it launched is the one it keeps.
|
|
154
|
+
|
|
155
|
+
If the terminal says something at session start, or `doctor` shows something red, §12 is
|
|
156
|
+
the page for it.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## 5. Removing it, and upgrading
|
|
161
|
+
|
|
162
|
+
**Upgrading** is one line, and then a restart of every open session:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
bun add -g counterparts@latest
|
|
166
|
+
```
|
|
67
167
|
|
|
68
|
-
|
|
168
|
+
Your store is untouched by an upgrade: `counterparts install` never rewrites a
|
|
169
|
+
configuration or a credentials file that is already there. §9 has the detail.
|
|
170
|
+
|
|
171
|
+
**Leaving** is one command:
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
counterparts uninstall
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
It disconnects Claude Code — the five hooks and the MCP registration, and only ever the
|
|
178
|
+
entries that are ours — then tells you where your memory still is, how much is in it, and
|
|
179
|
+
the one line that removes the package itself (`bun remove -g counterparts`; a program does
|
|
180
|
+
not delete itself while it is running). **Your memory is kept** unless you say otherwise:
|
|
181
|
+
|
|
182
|
+
- **`--park`** renames the whole of `~/.counterparts` aside to
|
|
183
|
+
`~/.counterparts.parked-<date>` — one rename, nothing copied, nothing deleted, the store
|
|
184
|
+
never opened. **The way back is `counterparts install`**: with the folder gone and a
|
|
185
|
+
parked one beside it, it names that folder's date and size and asks whether to bring it
|
|
186
|
+
back or start blank.
|
|
187
|
+
- **`--delete-memories`** destroys it, after listing every path that is about to go with
|
|
188
|
+
its size and what it is, and asking you to type `DELETE MEMORIES` exactly. Esc, Enter or
|
|
189
|
+
`cancel` stops it — *Cancelled. Nothing was deleted.*
|
|
190
|
+
|
|
191
|
+
§9b has all three.
|
|
192
|
+
|
|
193
|
+
An open Claude Code session keeps its hooks until its next turn, and keeps its memory
|
|
194
|
+
server until you close it.
|
|
195
|
+
|
|
196
|
+
Want a blank memory instead of no memory? That is `counterparts start-fresh`, §9a — a
|
|
197
|
+
maintenance command now, listed under `counterparts help advanced` rather than on the
|
|
198
|
+
main help page.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
# Reference
|
|
203
|
+
|
|
204
|
+
Everything below is detail. Nothing here is needed for an ordinary install.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 2a. Installing from source
|
|
69
209
|
|
|
70
210
|
For contributors, for a version that is not published yet, or for a tarball
|
|
71
|
-
somebody sent you. **
|
|
211
|
+
somebody sent you. This road also needs **npm**, for `npm pack` — it comes with
|
|
212
|
+
Node, and a machine set up by §1's bun line may not have it. (`bun pm pack`
|
|
213
|
+
exists but is not what this was tested with, so this page does not tell you to
|
|
214
|
+
use it.) **Already have the repository? Skip the clone and run
|
|
72
215
|
`npm pack` there. Were you sent a tarball? Skip to `bun add -g`.** Run the clone
|
|
73
216
|
somewhere that does not already hold a directory named `counterparts` — `git
|
|
74
217
|
clone` refuses, harmlessly, if one is there.
|
|
@@ -104,15 +247,14 @@ Those four paths are stable; the live host has pointed at them since 2026-09-03.
|
|
|
104
247
|
|
|
105
248
|
---
|
|
106
249
|
|
|
107
|
-
##
|
|
250
|
+
## 3a. `install` or `init`, and where the store and the config live
|
|
251
|
+
|
|
252
|
+
The scripted form of §3, and the one the install loop runs:
|
|
108
253
|
|
|
109
254
|
```
|
|
110
255
|
counterparts install --budget 9000 --name "Your Name"
|
|
111
256
|
```
|
|
112
257
|
|
|
113
|
-
That is the command you want the first time. Before you run it, one paragraph on
|
|
114
|
-
the other one, because the difference is not recoverable by guessing.
|
|
115
|
-
|
|
116
258
|
### `install` or `init` — which one
|
|
117
259
|
|
|
118
260
|
```
|
|
@@ -172,7 +314,7 @@ This command writes three things that are **yours**:
|
|
|
172
314
|
**One file holds your memory.** The bodies, their revision history and every
|
|
173
315
|
structured field are rows in `counterparts.sqlite`, so a backup is a file copy
|
|
174
316
|
and a memory can never disagree with its own bookkeeping. You read your memories
|
|
175
|
-
through the dashboard, `counterparts
|
|
317
|
+
through the dashboard, `counterparts ask`, or by asking — and
|
|
176
318
|
**`counterparts export --out <dir> --markdown --plaintext` writes everything out
|
|
177
319
|
as one readable tree of Markdown files** (confidential memories are left out,
|
|
178
320
|
and the export says how many; `--include-confidential` takes them too). (SQLite
|
|
@@ -193,18 +335,22 @@ Three more directories appear under `store/` the first time they are needed and
|
|
|
193
335
|
not before: `spans/` (lived experience awaiting encoding, written by the hooks
|
|
194
336
|
and by `counterparts note`), `journal/` (the counterpart's diary, also written
|
|
195
337
|
as Markdown files as each chapter lands) and `sessions/` (the live-session
|
|
196
|
-
registry, §
|
|
338
|
+
registry, §5a). A fresh store has none of them, and `counterparts status` lists
|
|
197
339
|
them either way.
|
|
198
340
|
|
|
199
|
-
…and
|
|
200
|
-
|
|
201
|
-
|
|
341
|
+
…and then it comes to the two things that belong to Claude Code: the hooks block
|
|
342
|
+
and the MCP registration. **At a terminal it does them for you** (§3), without
|
|
343
|
+
asking, because connecting is what setting it up means now — `counterparts
|
|
344
|
+
disconnect` is the undo and `--no-connect` is the opt-out. Anywhere else — a pipe,
|
|
345
|
+
a script, a CI job — and with `--no-connect`, it **prints** them without applying,
|
|
346
|
+
exactly as it always did, and opens no file of the host's. §4a is what it prints,
|
|
347
|
+
and how to apply it by hand.
|
|
202
348
|
|
|
203
349
|
Re-running it is safe: an existing config or credentials file is kept and
|
|
204
350
|
reported, never merged and never rewritten. `--force` is the only way past that.
|
|
205
351
|
|
|
206
|
-
Flags: `--budget <bytes>` (
|
|
207
|
-
`--dir <store>` (below), `--force`.
|
|
352
|
+
Flags: `--budget <bytes>` (below), `--name <owner>`, `--embedder` (§6),
|
|
353
|
+
`--dir <store>` (below), `--force`, `--no-connect`, `--yes`.
|
|
208
354
|
|
|
209
355
|
### Why the store is `~/.counterparts/store` and the config is one level up
|
|
210
356
|
|
|
@@ -231,7 +377,7 @@ counterparts install --budget 9000 --name "Your Name" --dir /Volumes/vault/count
|
|
|
231
377
|
path every entry point reads when nothing names another one, so a config written
|
|
232
378
|
somewhere else with nothing pointing at it is an ambient half that never fires,
|
|
233
379
|
and no hook will tell you: a hook that stands down says so on stderr and exits 0
|
|
234
|
-
(§
|
|
380
|
+
(§5a has the one exception). The hook falls back to `COUNTERPARTS_DATA_DIR` only
|
|
235
381
|
when the config it read names no `dataDir` at all, and `install` always writes
|
|
236
382
|
one — so a hand-written config with no `dataDir` is the one shape that can still
|
|
237
383
|
land on the default store.
|
|
@@ -257,7 +403,7 @@ path (§7).
|
|
|
257
403
|
|
|
258
404
|
The environment variable is the flag's equivalent, for hosts that launch a
|
|
259
405
|
process from a static registration and have no command line to write into —
|
|
260
|
-
which is exactly how Claude Code launches an MCP server (§
|
|
406
|
+
which is exactly how Claude Code launches an MCP server (§4a).
|
|
261
407
|
|
|
262
408
|
A path you named and this cannot use is **refused**, at every entry point that
|
|
263
409
|
reads a configuration, and nothing falls back to the default: naming a
|
|
@@ -293,16 +439,30 @@ model's context — records it as the `config` field of
|
|
|
293
439
|
|
|
294
440
|
`--budget 9000` is the number the live host runs on, measured on Claude Code on
|
|
295
441
|
2026-09-03: a wake of 8,859 bytes was delivered under it. It is **your host's**
|
|
296
|
-
ceiling
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
442
|
+
ceiling rather than a Counterparts constant, and a briefing refuses to render
|
|
443
|
+
rather than compose to a number nobody chose.
|
|
444
|
+
|
|
445
|
+
There are two answers to "what if I do not pass one", and which you get depends
|
|
446
|
+
on whether there is a person to tell:
|
|
447
|
+
|
|
448
|
+
- **The conversation of §3 writes 9,000** when you give no `--budget` — but only
|
|
449
|
+
into a configuration it is creating, so a forced re-install cannot rewrite a
|
|
450
|
+
ceiling you chose. It no longer says so on the screen (2026-09-22: a number
|
|
451
|
+
that works is worth more to a stranger than a paragraph of homework); the
|
|
452
|
+
sentence, and the file to change when you know your host's real number, are in
|
|
453
|
+
`counterparts help install`. It is a working default for somebody installing
|
|
454
|
+
for the first time, not a constant the system believes in.
|
|
455
|
+
- **Scripted — a pipe, a script, `--no-connect`, CI — nothing is written.** The key
|
|
456
|
+
is left out of the config, the wake is injected unbounded, and an
|
|
457
|
+
`adapter.budget.unreported` event says so.
|
|
300
458
|
|
|
301
459
|
---
|
|
302
460
|
|
|
303
|
-
##
|
|
461
|
+
## 4a. Connecting Claude Code by hand
|
|
304
462
|
|
|
305
|
-
|
|
463
|
+
For a person who used `--no-connect`, whose machine had no Claude Code on it at
|
|
464
|
+
the time, or who would rather see what is being added. `counterparts install` and
|
|
465
|
+
`counterparts connect` print both of these, filled in.
|
|
306
466
|
|
|
307
467
|
**The hooks.** Merge into `~/.claude/settings.json` — one script, five events.
|
|
308
468
|
`counterparts install` prints this with your own absolute paths filled in; the
|
|
@@ -364,9 +524,43 @@ configuration it read on stderr at launch, before any protocol.
|
|
|
364
524
|
Then **restart Claude Code**. Hooks are read at session start; MCP servers are
|
|
365
525
|
launched at session start.
|
|
366
526
|
|
|
527
|
+
### Or have it done for you
|
|
528
|
+
|
|
529
|
+
At a terminal, `counterparts install` does this for you (§3). The same thing, on
|
|
530
|
+
its own, at any time — to repair a connection, or because you used
|
|
531
|
+
`--no-connect`:
|
|
532
|
+
|
|
533
|
+
```
|
|
534
|
+
counterparts connect
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
It backs `~/.claude/settings.json` up first and says so, adds the five
|
|
538
|
+
hooks **beside** anything already on those events, replaces an entry of its own
|
|
539
|
+
that names a path that has moved, and registers the MCP server by running
|
|
540
|
+
`claude mcp add` — it never writes `~/.claude.json` itself, because Claude Code
|
|
541
|
+
owns that file. A settings file it cannot parse is a refusal: it changes nothing
|
|
542
|
+
and prints the block for you to merge by hand. It does not ask first — typing
|
|
543
|
+
the verb is the yes — and `--dry-run` says what would change without changing
|
|
544
|
+
it. Claude Code is the one host it knows today, so `counterparts connect
|
|
545
|
+
claude-code` is the same command and any other name is refused.
|
|
546
|
+
|
|
547
|
+
To take it all back out again — only the entries it recognises as its own,
|
|
548
|
+
never another tool's:
|
|
549
|
+
|
|
550
|
+
```
|
|
551
|
+
counterparts disconnect
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
(`counterparts uninstall` does this as its first step, and then tells you where
|
|
555
|
+
your memory is — §9b.)
|
|
556
|
+
|
|
557
|
+
Hooks start with your next turn in any open session; the memory tools appear
|
|
558
|
+
after you restart Claude Code. An open session keeps its memory server until you
|
|
559
|
+
close it, connected or not.
|
|
560
|
+
|
|
367
561
|
---
|
|
368
562
|
|
|
369
|
-
##
|
|
563
|
+
## 5a. What the pieces do
|
|
370
564
|
|
|
371
565
|
**The hooks** are the ambient half. `SessionStart` injects the wake — what the
|
|
372
566
|
last boundary published, plus a preface naming the system, the day and the
|
|
@@ -452,19 +646,25 @@ file it names, whatever `--dir` or `COUNTERPARTS_DATA_DIR` say about the store.
|
|
|
452
646
|
That is a real trap — the cold-stranger review of 2026-09-04 hit it, running a
|
|
453
647
|
scratch store against an existing config — and it is worth knowing that the store
|
|
454
648
|
you point at and the credentials you use are chosen by two different files. The
|
|
455
|
-
lever, since 2026-09-05, is `--config` / `COUNTERPARTS_CONFIG` (§
|
|
649
|
+
lever, since 2026-09-05, is `--config` / `COUNTERPARTS_CONFIG` (§3a): point the
|
|
456
650
|
second file somewhere too, and the server names the file it read on stderr at
|
|
457
651
|
launch.
|
|
458
652
|
|
|
459
653
|
**The embed key alone is not enough.** Embedding means sending memory text to a
|
|
460
654
|
third party, so it is a decision, not a capability a stray environment variable
|
|
461
|
-
switches on.
|
|
462
|
-
|
|
463
|
-
|
|
655
|
+
switches on. Since 2026-09-22 the decision is a command rather than a JSON edit:
|
|
656
|
+
`counterparts credentials set VOYAGE_API_KEY`, typed at a terminal, saves the key
|
|
657
|
+
and then asks *Turn on recall by meaning now?* — that is the same question
|
|
658
|
+
`counterparts install` puts, and it is what `doctor`'s fix line points at. A pipe,
|
|
659
|
+
`--from-env`, `--stdin` and CI are asked nothing and turn on nothing: an egress is
|
|
660
|
+
not switched on for a script that did not mention it. `--embedder` at install does
|
|
661
|
+
it too, and `"embedder": { "enabled": true }` in `claude-code.json` is what all
|
|
662
|
+
three write. Absent, no client is built and no socket opens whatever keys are
|
|
663
|
+
lying around.
|
|
464
664
|
|
|
465
665
|
---
|
|
466
666
|
|
|
467
|
-
## 7.
|
|
667
|
+
## 7. Look at the memory yourself, from the console
|
|
468
668
|
|
|
469
669
|
`$HOME/.counterparts/store` is the default data dir, so the commands below work
|
|
470
670
|
with nothing set. If your store is somewhere else — or you would rather be
|
|
@@ -516,12 +716,13 @@ This is the product. Three commands, no host, no keys:
|
|
|
516
716
|
```
|
|
517
717
|
counterparts note "The espresso machine in the kitchen is a Rancilio Silvia."
|
|
518
718
|
counterparts note "Postgres in dev listens on port 5433, not 5432."
|
|
519
|
-
counterparts
|
|
719
|
+
counterparts ask "which port does postgres use in dev?"
|
|
520
720
|
```
|
|
521
721
|
|
|
522
|
-
`note` prints the store it wrote to, then `Remembered mem_… — minted.` `
|
|
722
|
+
`note` prints the store it wrote to, then `Remembered mem_… — minted.` `ask`
|
|
523
723
|
prints the same `Store:` line first, then a header line, the memories it found,
|
|
524
|
-
and what the tier on each one means
|
|
724
|
+
and what the tier on each one means (`counterparts recall` is the same command
|
|
725
|
+
under its older name, still dispatched but no longer on the help page):
|
|
525
726
|
|
|
526
727
|
```
|
|
527
728
|
Store: /Users/<you>/.counterparts/store
|
|
@@ -534,7 +735,7 @@ question · answered · semantic embedder-off · considered 1 of 3 live rows ·
|
|
|
534
735
|
Nothing here came back vividly, so treat these as leads rather than answers.
|
|
535
736
|
```
|
|
536
737
|
|
|
537
|
-
(A real capture, on a store made the way §
|
|
738
|
+
(A real capture, on a store made the way §3a says — `--name`, either door — and
|
|
538
739
|
then those two notes. **Three** live rows for two memories: the identity core
|
|
539
740
|
`--name` seeded is the third, because `live rows` counts every unarchived row and
|
|
540
741
|
not only the memories. That is why this number and the wake preface's
|
|
@@ -543,9 +744,9 @@ prints the split. One question, one answer out of two candidate memories: that i
|
|
|
543
744
|
recall discriminating, not a store too small to have a choice.)
|
|
544
745
|
|
|
545
746
|
These are the same two doors the MCP tools use — `note` captures the words into
|
|
546
|
-
the span buffer and then deposits a draft that claims that span by hash; `
|
|
547
|
-
calls the same deliberate-recall dispatcher
|
|
548
|
-
Code will see. `--kind`, `--title` and `--salience` shape a note; `--id <mem_…>`
|
|
747
|
+
the span buffer and then deposits a draft that claims that span by hash; `ask`
|
|
748
|
+
calls the same deliberate-recall dispatcher the `recall` tool does — so what you
|
|
749
|
+
see here is what Claude Code will see. `--kind`, `--title` and `--salience` shape a note; `--id <mem_…>`
|
|
549
750
|
asks for one memory in full instead of asking a question; `--json` prints the
|
|
550
751
|
tool's own payload.
|
|
551
752
|
|
|
@@ -560,7 +761,7 @@ channel with no embedder answers with the nearest thing it has; a `[quiet]` or
|
|
|
560
761
|
*this is your answer*.
|
|
561
762
|
|
|
562
763
|
It also works on the very first memory: a store holding one memory answers the
|
|
563
|
-
question about it. On the store §
|
|
764
|
+
question about it. On the store §3a makes that reads `considered 1 of 2 live rows`
|
|
564
765
|
— the memory, and the identity core beside it; on a store made by a bare `init`,
|
|
565
766
|
with no `--name` and so no core, `1 of 1`. The install loop checks the bare case
|
|
566
767
|
on every run, because it is the first thing anyone does and it is invisible to
|
|
@@ -618,10 +819,23 @@ that command does and every flag it takes, and opens nothing.
|
|
|
618
819
|
counterparts remove mem_b77c9e0e9808 --dir "$HOME/.counterparts/store"
|
|
619
820
|
```
|
|
620
821
|
|
|
621
|
-
**
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
822
|
+
**At a terminal it asks** (2026-09-22). With nothing after it, it wants a target:
|
|
823
|
+
`Memory id, or words to search for:`. Words are searched for; the hits are
|
|
824
|
+
numbered, with their kind, their title and their date (a chapter of the journal is
|
|
825
|
+
marked `[journal]`, and a confidential memory shows no words at all); you pick one
|
|
826
|
+
or several — `3`, or `1,3` — and a pick that is not wholly on the list is refused
|
|
827
|
+
whole and asked once more. The chosen memories are listed back, the plan below is
|
|
828
|
+
printed for each, and then one question: `Delete these 2 memories for good? [y/N]`.
|
|
829
|
+
An id on the command line skips the search; a wrong id is told so rather than
|
|
830
|
+
quietly turned into a search. Every way out that is not a removal says `Cancelled.
|
|
831
|
+
Nothing was deleted.` and exits non-zero, so no wrapper reads a cancel as a
|
|
832
|
+
removal.
|
|
833
|
+
|
|
834
|
+
**Anywhere nobody can be asked it is a dry run** — a pipe, a redirected stdout, a
|
|
835
|
+
CI job. It prints the plan — every surface it would chase, with counts; the ids
|
|
836
|
+
(never the text) of other memories whose words overlap; and one line for the raw
|
|
837
|
+
capture buffer — then says `Dry run. Nothing has changed.` `--confirm` is the
|
|
838
|
+
scripted door: that exact id, and the command asks you to type the id back before
|
|
625
839
|
anything moves. There is no `--force`: removal is the one owner operation with a
|
|
626
840
|
human in the loop.
|
|
627
841
|
|
|
@@ -711,7 +925,7 @@ and exits 0. That is the wake path working, with nothing yet to say.
|
|
|
711
925
|
**With no arguments this reads `~/.counterparts/claude-code.json`.** It takes no
|
|
712
926
|
`--dir`, so it acts on whatever store that file names — falling back to
|
|
713
927
|
`COUNTERPARTS_DATA_DIR` only if the file names no `dataDir` at all — which is the
|
|
714
|
-
point of §
|
|
928
|
+
point of §3a's rule that the config stays where the hooks look.
|
|
715
929
|
|
|
716
930
|
To try it against a scratch install without touching the one you use, name the
|
|
717
931
|
configuration:
|
|
@@ -735,7 +949,7 @@ counterparts rebrief --dir "$HOME/.counterparts/store"
|
|
|
735
949
|
|
|
736
950
|
which re-renders and republishes the wake bundle now, through the boundary's own
|
|
737
951
|
renderer, advancing no sleep marker. Run the hook again and you get the bundle
|
|
738
|
-
instead of the bootstrap line. On a store installed with §
|
|
952
|
+
instead of the bootstrap line. On a store installed with §3a's command exactly as
|
|
739
953
|
written, and nothing yet written to it beyond the identity core `--name` seeded,
|
|
740
954
|
that bundle is 572 bytes — a longer name makes it longer — and reads:
|
|
741
955
|
|
|
@@ -851,10 +1065,16 @@ six months.
|
|
|
851
1065
|
bun add -g counterparts@latest
|
|
852
1066
|
```
|
|
853
1067
|
|
|
854
|
-
(From source: `git pull && npm pack` in the clone, then the tarball line from §
|
|
1068
|
+
(From source: `git pull && npm pack` in the clone, then the tarball line from §2a.)
|
|
855
1069
|
|
|
856
|
-
Then restart every open Claude Code session (§
|
|
857
|
-
|
|
1070
|
+
Then restart every open Claude Code session (§5a). **An open session keeps
|
|
1071
|
+
serving the old code until it restarts** — the memory server it launched is the
|
|
1072
|
+
one it keeps for its whole life, so an upgrade reaches it only on the other side
|
|
1073
|
+
of a restart. The hooks are different: each is a fresh process, so an open
|
|
1074
|
+
session runs the new hooks on its next turn.
|
|
1075
|
+
|
|
1076
|
+
Your store is untouched: `counterparts install` never rewrites an existing config
|
|
1077
|
+
or credentials file. Nothing about your memory changes when the package does.
|
|
858
1078
|
|
|
859
1079
|
---
|
|
860
1080
|
|
|
@@ -867,6 +1087,11 @@ few days of a store are mostly you learning what it does. One command:
|
|
|
867
1087
|
counterparts start-fresh --config ~/.counterparts/claude-code.json
|
|
868
1088
|
```
|
|
869
1089
|
|
|
1090
|
+
Since 2026-09-22 this is **maintenance-shelf material**: it is not on
|
|
1091
|
+
`counterparts --help`, and `counterparts help advanced` is where it is listed
|
|
1092
|
+
("Set this memory aside and start blank; --undo brings it back"). It is still the
|
|
1093
|
+
same command, and `counterparts help start-fresh` still prints the whole of it.
|
|
1094
|
+
|
|
870
1095
|
**Close every Claude Code session and every dashboard first.** A running session's
|
|
871
1096
|
hooks and its MCP server hold the store open by a file handle, and a handle does
|
|
872
1097
|
not follow a rename — until they restart, they go on writing into the directory
|
|
@@ -993,8 +1218,102 @@ previous one is parked.
|
|
|
993
1218
|
|
|
994
1219
|
---
|
|
995
1220
|
|
|
1221
|
+
## 9b. Leaving
|
|
1222
|
+
|
|
1223
|
+
```
|
|
1224
|
+
counterparts uninstall --yes
|
|
1225
|
+
```
|
|
1226
|
+
|
|
1227
|
+
(Without `--yes` it shows what it is about to do and asks once.)
|
|
1228
|
+
|
|
1229
|
+
Disconnects Claude Code — the hooks and the MCP registration — and then tells you
|
|
1230
|
+
where your memory still is, how many memories are in it, and the one command that
|
|
1231
|
+
removes the package itself:
|
|
1232
|
+
|
|
1233
|
+
```
|
|
1234
|
+
bun remove -g counterparts
|
|
1235
|
+
```
|
|
1236
|
+
|
|
1237
|
+
(A program does not delete itself while it is running.) **Your memory is not
|
|
1238
|
+
touched.** `~/.counterparts` stays exactly where it is, and `counterparts connect`
|
|
1239
|
+
puts the connection back whenever you want it.
|
|
1240
|
+
|
|
1241
|
+
If you do want the directory gone, say which:
|
|
1242
|
+
|
|
1243
|
+
```
|
|
1244
|
+
counterparts uninstall --park --yes
|
|
1245
|
+
```
|
|
1246
|
+
|
|
1247
|
+
moves the whole of `~/.counterparts` aside to `~/.counterparts.parked-<date>` —
|
|
1248
|
+
one rename, nothing copied, nothing deleted, and the store is never opened. It
|
|
1249
|
+
names that destination **before** it asks, and reports the name it actually used
|
|
1250
|
+
afterwards, so a `-2` from a second park on the same day is visible rather than
|
|
1251
|
+
assumed. The last two lines of the screen are the two things left to know:
|
|
1252
|
+
|
|
1253
|
+
```
|
|
1254
|
+
To bring it back later: counterparts install — it finds this folder and asks.
|
|
1255
|
+
To remove the program too: bun remove -g counterparts
|
|
1256
|
+
```
|
|
1257
|
+
|
|
1258
|
+
**The way back is a command, not a pasted shell line** (2026-09-22, finding #22).
|
|
1259
|
+
Run `counterparts install` with `~/.counterparts` missing and one or more
|
|
1260
|
+
`~/.counterparts.parked-<date>` beside it, and before anything else it asks:
|
|
1261
|
+
*Found memory set aside on 2026-09-22 (7.6 MB). Bring it back, or start blank?*
|
|
1262
|
+
Several are listed newest first and picked by number. It never opens the parked
|
|
1263
|
+
folder — the date comes from its name and the size from a walk of the filesystem,
|
|
1264
|
+
which is why there is no memory count in that question — and it refuses, by name
|
|
1265
|
+
and with the reason, a folder that is a symlink, one whose `store/` is a symlink,
|
|
1266
|
+
one resolving outside your home, one holding a store on an older floor, and one
|
|
1267
|
+
with no `store/` in it at all. Nothing moves until you answer: Enter is not "start
|
|
1268
|
+
blank". One caveat worth knowing: `--no-connect` makes the whole console
|
|
1269
|
+
non-interactive one level up, so it suppresses this question too — bring a parked
|
|
1270
|
+
memory back with a plain `counterparts install`.
|
|
1271
|
+
|
|
1272
|
+
By hand it is one rename, guarded so it cannot nest one folder inside another —
|
|
1273
|
+
`counterparts help uninstall` prints it, and it is the same shape `start-fresh`
|
|
1274
|
+
uses (§9a):
|
|
1275
|
+
|
|
1276
|
+
```
|
|
1277
|
+
if [ -e ~/.counterparts ]; then echo "REFUSING: ~/.counterparts exists"; \
|
|
1278
|
+
else mv ~/.counterparts.parked-<date> ~/.counterparts; fi
|
|
1279
|
+
```
|
|
1280
|
+
|
|
1281
|
+
`counterparts uninstall --delete-memories` destroys it instead. It lists every
|
|
1282
|
+
path with its size and what it is — the count of memories rides on the store's own
|
|
1283
|
+
line — then prints a plain red `WARNING: nothing can bring these back afterwards.`
|
|
1284
|
+
with the `--park` alternative under it, and asks you to type `DELETE MEMORIES`
|
|
1285
|
+
exactly. Esc, Enter or `cancel` stops it (*Cancelled. Nothing was deleted.*, exit
|
|
1286
|
+
0); anything else is *That was not DELETE MEMORIES. Nothing was deleted.* and a
|
|
1287
|
+
refusal. There is no `--yes` for that one, and it cannot be run from a script.
|
|
1288
|
+
|
|
1289
|
+
Both of those refuse while a Counterparts MCP server, worker or dashboard is
|
|
1290
|
+
still running — close your Claude Code sessions first — and both name what they
|
|
1291
|
+
found.
|
|
1292
|
+
|
|
1293
|
+
**Both act only on what Counterparts itself wrote** — the configuration, the credentials
|
|
1294
|
+
file, `scopes.json`, `snapshots/` and the store, wherever the store lives — and print every
|
|
1295
|
+
path with its size before they ask. If the directory holds anything else, those things are
|
|
1296
|
+
named and left exactly where they are, and the directory stays. Both refuse outright for
|
|
1297
|
+
`~/.claude`, your home directory, or a directory with a `.git` in it; both refuse if the
|
|
1298
|
+
memory server could not be deregistered first, and say the one line to run; and if the
|
|
1299
|
+
check for running processes itself fails they refuse too (`--nothing-is-open` says you
|
|
1300
|
+
have checked).
|
|
1301
|
+
|
|
1302
|
+
**What an open session does after an uninstall.** It keeps its hooks until its
|
|
1303
|
+
next turn, and keeps its memory server until you close it. So a session you had
|
|
1304
|
+
open goes on remembering for one more turn, and goes on offering the memory tools
|
|
1305
|
+
until it ends. Nothing you do here reaches into a session that is already
|
|
1306
|
+
running; that is why `--park` and `--delete-memories` refuse while one is.
|
|
1307
|
+
|
|
1308
|
+
---
|
|
1309
|
+
|
|
996
1310
|
## 10. What is actually verified, and what is not
|
|
997
1311
|
|
|
1312
|
+
The scripted version of this page — install, configure, hook, note, ask, the
|
|
1313
|
+
MCP round trip, the removal plan, the session write, the scope switch, connecting
|
|
1314
|
+
and leaving again — is
|
|
1315
|
+
58 checks and runs end to end in two to three seconds.
|
|
1316
|
+
|
|
998
1317
|
The install loop (`tools/install-loop/run.sh`) runs in a throwaway HOME with no
|
|
999
1318
|
repo on its PATH and checks, every time:
|
|
1000
1319
|
|
|
@@ -1009,7 +1328,7 @@ repo on its PATH and checks, every time:
|
|
|
1009
1328
|
a real host is likeliest to hit and the rest of the loop is blind to;
|
|
1010
1329
|
- the `SessionStart` hook, fed a real payload on stdin, returns a wake block and
|
|
1011
1330
|
exits 0, and registers the session under `<dataDir>/sessions/`;
|
|
1012
|
-
- `counterparts note` then `counterparts
|
|
1331
|
+
- `counterparts note` then `counterparts ask` round-trips on the console, and
|
|
1013
1332
|
a `note` then `recall` round trip through `counterparts-mcp` over stdio
|
|
1014
1333
|
JSON-RPC returns the note;
|
|
1015
1334
|
- **and the one-memory case** (§7): one note in a fresh store, recalled by
|
|
@@ -1019,7 +1338,7 @@ repo on its PATH and checks, every time:
|
|
|
1019
1338
|
- a `session_end` through a separate `counterparts-mcp` process **binds lazily** to
|
|
1020
1339
|
the session the hook registered, and mints the memory — the deliberate write
|
|
1021
1340
|
path a real session uses, without a real session;
|
|
1022
|
-
- the **one config rule** (§
|
|
1341
|
+
- the **one config rule** (§3a) at the two entry points that could not be checked
|
|
1023
1342
|
before it existed: `counterparts-hook --config <a second config>` works on the
|
|
1024
1343
|
store that file names, records it in the session file, and leaves the default
|
|
1025
1344
|
store untouched; `COUNTERPARTS_CONFIG` launches `counterparts-mcp` on a named
|
|
@@ -1032,6 +1351,40 @@ repo on its PATH and checks, every time:
|
|
|
1032
1351
|
- `rebrief` renders a bundle and the next `SessionStart` injects it;
|
|
1033
1352
|
- the dashboard opens the same store.
|
|
1034
1353
|
|
|
1354
|
+
**And, since 2026-09-21, the host's own files (steps 53–58).** These run last,
|
|
1355
|
+
because the last of them renames the directory every other step resolves its
|
|
1356
|
+
paths from. A settings file is seeded with **another tool's hook** first, and
|
|
1357
|
+
`claude` on the loop's PATH is a stub that records what it was called with — the
|
|
1358
|
+
real binary would edit the machine's own `~/.claude.json`, which this loop never
|
|
1359
|
+
touches. What they establish:
|
|
1360
|
+
|
|
1361
|
+
- `counterparts connect` writes five hook entries **beside** the other tool's,
|
|
1362
|
+
leaves that hook and every other key in the file exactly as they were, takes
|
|
1363
|
+
exactly one backup, and sends the registration out through `claude mcp add`;
|
|
1364
|
+
- connecting a second time changes not one byte and takes no second backup;
|
|
1365
|
+
- `counterparts disconnect` removes only ours — the other tool's hook survives
|
|
1366
|
+
— and the deregistration goes out through `claude mcp remove`;
|
|
1367
|
+
- `counterparts uninstall --yes` leaves the store where it is, removes the hooks,
|
|
1368
|
+
and names `bun remove -g counterparts` as the one thing left to run;
|
|
1369
|
+
- `counterparts uninstall --park --yes` either renames the whole directory aside
|
|
1370
|
+
and names `counterparts install` as the way back, or refuses because something of
|
|
1371
|
+
ours is running on that machine and says what. Both are correct, and which one
|
|
1372
|
+
happens is a fact about the machine rather than about the package.
|
|
1373
|
+
|
|
1374
|
+
**What the loop does not check about any of that**, so that it is said plainly:
|
|
1375
|
+
it never runs the real `claude mcp add` — the stub answers, so "Claude Code
|
|
1376
|
+
accepted the registration" is not a thing this loop can tell you. And it runs
|
|
1377
|
+
non-interactively, so **the install conversation of §3 is not exercised here at
|
|
1378
|
+
all**: the questions, the hidden key prompts and the skipping are held by unit
|
|
1379
|
+
tests, plus runs on a real pty on 2026-09-21: install answered both ways (connected, and
|
|
1380
|
+
`n` with nothing of the host's touched), a name skipped, both keys skipped, the re-run,
|
|
1381
|
+
`connect` again, `doctor`, `uninstall`, and `--delete-memories` refusing while a memory
|
|
1382
|
+
server was running. On 2026-09-22 the reader was driven on a real pty again, on its own —
|
|
1383
|
+
raw mode really on, backspace, a whole paste, an arrow key leaving nothing behind, a bare
|
|
1384
|
+
Esc coming back as a cancel, Ctrl-C rejecting, and the terminal restored on every ending.
|
|
1385
|
+
A real terminal, on a machine that is not the author's, is still the thing nobody
|
|
1386
|
+
has watched.
|
|
1387
|
+
|
|
1035
1388
|
**The loop cannot reach the npm registry.** It installs the tarball it packed,
|
|
1036
1389
|
from disk. `bun add -g counterparts` (§2) and `bun add -g counterparts@latest`
|
|
1037
1390
|
(§9) deliver that same package by another road, and that road is *unverified by
|
|
@@ -1043,9 +1396,8 @@ real session can settle them: that Claude Code reads the hooks block from
|
|
|
1043
1396
|
text actually reaches the model's context; that the Stop ask arrives (it is
|
|
1044
1397
|
delivered on stderr with exit 2, the one channel measured to work on this host);
|
|
1045
1398
|
and that `claude mcp add` registers a server the client then launches. **All four**
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
in the repository), not by this loop.
|
|
1399
|
+
have been seen working on the author's machine, in real Claude Code sessions,
|
|
1400
|
+
every day since 2026-09-03 — but by him watching them, not by this loop.
|
|
1049
1401
|
|
|
1050
1402
|
The fifth host behaviour — `session_end` binding to a live session **through the
|
|
1051
1403
|
registry**, since the server is never told a session id — the loop now does
|
|
@@ -1083,7 +1435,7 @@ rather than from a script.
|
|
|
1083
1435
|
WHICH CONFIGURATION: one rule for all four — `--config <absolute path>`, else
|
|
1084
1436
|
`COUNTERPARTS_CONFIG`, else the default. The asymmetry that is left is the
|
|
1085
1437
|
hook's: it is the one entry point with no `--dir`, so pointing it at another
|
|
1086
|
-
store means pointing it at another configuration (§
|
|
1438
|
+
store means pointing it at another configuration (§3a, §7). Both defaults can
|
|
1087
1439
|
be refused wholesale with `COUNTERPARTS_REQUIRE_EXPLICIT_DIR=1` (§7): with it
|
|
1088
1440
|
set, an unnamed store or an unnamed configuration is a refusal, not a fallback
|
|
1089
1441
|
— the one exception being `rebrief`'s ceiling, a number read from the default
|
|
@@ -1092,23 +1444,24 @@ rather than from a script.
|
|
|
1092
1444
|
such file".** On bun 1.3.10 a relative path fails with
|
|
1093
1445
|
`error: ENOENT extracting tarball from ./x.tgz`, and so does an absolute path
|
|
1094
1446
|
naming a file that does not exist. Check `ls *.tgz`. Hence
|
|
1095
|
-
`"$PWD"/counterparts-*.tgz` in §
|
|
1447
|
+
`"$PWD"/counterparts-*.tgz` in §2a.
|
|
1096
1448
|
3. **The store you point at and the host settings you get come from two different
|
|
1097
1449
|
files** — and you now have to move both. `--dir` / `COUNTERPARTS_DATA_DIR`
|
|
1098
1450
|
choose the store; the configuration supplies host settings — the embedder knob
|
|
1099
1451
|
and the credentials file for the MCP server and the hooks, and, as a last
|
|
1100
1452
|
resort, the injection ceiling for `counterparts rebrief` (§7). Running a
|
|
1101
1453
|
scratch store on a machine that already has a configured install will use that
|
|
1102
|
-
install's keys unless you also pass `--config` / `COUNTERPARTS_CONFIG` (§
|
|
1454
|
+
install's keys unless you also pass `--config` / `COUNTERPARTS_CONFIG` (§3a),
|
|
1103
1455
|
and can compose a briefing under that install's ceiling. §6 says how to tell
|
|
1104
1456
|
from the `semantic` field; `rebrief` names the file it read, and the server
|
|
1105
1457
|
names it on stderr at launch.
|
|
1106
1458
|
4. **The vector cache stores embeddings as JSON text.** On the owner's migrated
|
|
1107
1459
|
store that is 177 MB at 13.9K vectors, with a nearest-neighbour scan of
|
|
1108
1460
|
0.6–1.0 s. Irrelevant to a fresh store; a named debt.
|
|
1109
|
-
5. **`parallel: { enabled: true }`**
|
|
1110
|
-
|
|
1111
|
-
it may speak.
|
|
1461
|
+
5. **`parallel: { enabled: true }`** appeared in the author's own config while
|
|
1462
|
+
this ran beside its predecessor. It is the parallel-run knob and makes
|
|
1463
|
+
Counterparts stand down unless another file says it may speak. If you see it
|
|
1464
|
+
in a configuration somebody copied to you, take it out.
|
|
1112
1465
|
6. **Removal reaches the span buffer — with two things it names rather than
|
|
1113
1466
|
takes.** A note is captured verbatim into `spans/<12-hex key>/jots.jsonl`
|
|
1114
1467
|
before it is minted. Until 2026-09-05 `remove` chased the database,
|
|
@@ -1140,7 +1493,7 @@ rather than from a script.
|
|
|
1140
1493
|
`src/` is documented by, and this page points at them. Delete `src/**/*.md`
|
|
1141
1494
|
from your install if you would rather not carry them.
|
|
1142
1495
|
8. **A configuration the hooks cannot read is a silent session with no memory.**
|
|
1143
|
-
A named configuration that is missing, unreadable or not JSON is refused (§
|
|
1496
|
+
A named configuration that is missing, unreadable or not JSON is refused (§3a),
|
|
1144
1497
|
and the refusal happens before anything opens, so a stood-down hook leaves no
|
|
1145
1498
|
ring event, no session record, nothing durable — the right choice (it will not
|
|
1146
1499
|
write into a store it was not told about) with an unhelpful symptom: nothing
|
|
@@ -1162,9 +1515,9 @@ rather than from a script.
|
|
|
1162
1515
|
Claude Code prints one line of its own when a session starts and Counterparts has
|
|
1163
1516
|
found something RED. **On a fresh install there is nothing red, so there is no
|
|
1164
1517
|
line** — a store that has never had an API key is a supported way to run (§6),
|
|
1165
|
-
and as of 2026-09-
|
|
1166
|
-
below is a store that HAD a key and lost it, which is the case the
|
|
1167
|
-
built for:
|
|
1518
|
+
and as of 2026-09-22 `doctor` grades that `OFF`, which is neither red nor amber.
|
|
1519
|
+
The example below is a store that HAD a key and lost it, which is the case the
|
|
1520
|
+
notice was built for, and which is still RED:
|
|
1168
1521
|
|
|
1169
1522
|
```
|
|
1170
1523
|
SessionStart:startup says: counterparts: Credentials — …/credentials.env holds no key:
|
|
@@ -1192,24 +1545,52 @@ observer stance, writes nothing, and never prints a credential value:
|
|
|
1192
1545
|
|
|
1193
1546
|
```
|
|
1194
1547
|
counterparts doctor
|
|
1548
|
+
counterparts doctor --all # every line, folding nothing
|
|
1195
1549
|
counterparts doctor --json # the findings as JSON: ids, counts, severities
|
|
1196
1550
|
```
|
|
1197
1551
|
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1552
|
+
**Four grade words, and the order is red, amber, `OFF`, green.** Red is a part of
|
|
1553
|
+
the system that is not running; amber is worth a look; **`OFF` (dim) is an optional
|
|
1554
|
+
feature that was never turned on**, which is not a problem and has no fix, only a
|
|
1555
|
+
`Turn on:` line; green is fine. Every fix is a command — since 2026-09-22 none of
|
|
1556
|
+
them tells you to edit JSON by hand, with two named exceptions below. Exit code
|
|
1557
|
+
**1** if anything is red, 0 otherwise, so a script can branch on `$?`; an `OFF`
|
|
1558
|
+
line never moves it.
|
|
1559
|
+
|
|
1560
|
+
**The screen folds.** On a terminal, while every worker-internal finding is green,
|
|
1561
|
+
they collapse into one line — `GREEN Background the nightly worker ran today;
|
|
1562
|
+
nothing failed`, and that sentence is read rather than assumed (with no run today
|
|
1563
|
+
it says so instead). What stays on the screen whatever happens is six headline
|
|
1564
|
+
findings: `Recall by meaning`, `Crash write-up`, `Memory`, `Claude Code`,
|
|
1565
|
+
`Snapshots`, `Self page`. **One red or amber among the internals unfolds all of
|
|
1566
|
+
them**, each in its usual place with its fix, and the `--all` invitation
|
|
1567
|
+
disappears because nothing was hidden. A pipe was never folded and still is not,
|
|
1568
|
+
and `--json` is always complete, unfolded and in worst-first order. The summary
|
|
1569
|
+
line is always the counts — `0 red, 0 amber, 2 off, 5 green.` — followed, when
|
|
1570
|
+
something was folded, by `Every line: counterparts doctor --all`.
|
|
1571
|
+
|
|
1572
|
+
What it reads:
|
|
1573
|
+
|
|
1574
|
+
| finding | grade |
|
|
1202
1575
|
|---|---|
|
|
1203
|
-
|
|
|
1204
|
-
|
|
|
1205
|
-
|
|
|
1206
|
-
|
|
|
1207
|
-
|
|
|
1576
|
+
| Recall by meaning | `OFF` on a store that never turned it on — *optional. Recall works on words; a Voyage key lets it match meaning too.* Amber, not OFF, in the two states where something is actually wrong: the knob on with no `VOYAGE_API_KEY`, and the knob off on a store that HAS embedded |
|
|
1577
|
+
| Crash write-up | `OFF` with no `ANTHROPIC_API_KEY` — *optional. An Anthropic key lets a session that ended too soon get written up anyway.* **Red** if a working key was here and is gone, which is the case §12's session-start notice was built for |
|
|
1578
|
+
| Memory | red when there is no store where the config points; the line carries the memory count `status` calls Memories |
|
|
1579
|
+
| Claude Code | amber when no hook of ours is connected, or the memory server is not registered; the fix is `counterparts connect` |
|
|
1580
|
+
| Config | red when the file the hooks read is missing or will not parse |
|
|
1581
|
+
| Mode | green `remembering`; amber under `observer` |
|
|
1582
|
+
| Credentials | a factual line — the file, its mode, which names are saved. The two keys are graded on their own lines above |
|
|
1208
1583
|
| Checkout | the checkout the hooks run is not an ancestor of `origin/master`, or has tracked modifications (amber when it is merely behind) |
|
|
1209
|
-
| Clock |
|
|
1210
|
-
| Sweep / Sleep / Backfill / Credit | the newest `sleep.cycle` did not run, or the backfill embedded nothing twice running |
|
|
1211
|
-
| Spawn | the worker has been refused as many times in a row as the escalation threshold |
|
|
1212
|
-
|
|
|
1584
|
+
| Clock | amber when `lastActiveDate` is older than the newest boundary: sessions are ending and the worker is not running |
|
|
1585
|
+
| Sweep / Sleep / Backfill / Credit | red when the newest `sleep.cycle` did not run, or the backfill embedded nothing twice running |
|
|
1586
|
+
| Spawn | red when the worker has been refused as many times in a row as the escalation threshold |
|
|
1587
|
+
| Snapshots / Self page / Authorship / Journal mode / Page writer / Fired | facts about the store; the last four fold into `Background` while they are green |
|
|
1588
|
+
| Vectors | amber while live memories have no vector — and **no finding at all** while recall-by-meaning is off, because there is nothing to embed and its coverage is not a reading |
|
|
1589
|
+
|
|
1590
|
+
The two fix lines that still name a configuration edit are the ones with no
|
|
1591
|
+
command behind them: a `snapshots.dir` for a store that is not inside a base
|
|
1592
|
+
directory, and taking `"observer"` back out of the config. A fix line naming a
|
|
1593
|
+
command that does not exist would be worse.
|
|
1213
1594
|
|
|
1214
1595
|
Two things it does differently from every other command, and both matter. It
|
|
1215
1596
|
reads the store the **configuration** names (`--dir` overrides it), because the
|
|
@@ -1228,13 +1609,31 @@ counterparts credentials set VOYAGE_API_KEY --from-env MY_VOYAGE_KEY
|
|
|
1228
1609
|
counterparts credentials list
|
|
1229
1610
|
```
|
|
1230
1611
|
|
|
1231
|
-
The value comes from stdin
|
|
1232
|
-
|
|
1233
|
-
|
|
1612
|
+
The value comes from stdin, from one named environment variable, or — since
|
|
1613
|
+
2026-09-21 — from you, typed at the terminal: run it with no pipe and it asks
|
|
1614
|
+
for the key and reads it back without echoing it, and Enter on its own skips and
|
|
1615
|
+
writes nothing. It never comes from the command line, and it is never echoed or
|
|
1616
|
+
logged: the command prints `set ANTHROPIC_API_KEY in /…/credentials.env` and
|
|
1617
|
+
nothing else. A pipe, a CI job and a script behave exactly as they always did —
|
|
1618
|
+
the prompt appears only when both ends are a terminal and `CI` is unset. It writes the file
|
|
1234
1619
|
the configuration names, creating it 0600 or putting it back to 0600, replaces
|
|
1235
1620
|
that name's line (the template's commented placeholder included) and keeps every
|
|
1236
1621
|
other line and comment. `credentials list` says which of the two names the file
|
|
1237
|
-
holds — names only
|
|
1622
|
+
holds — names only, and since 2026-09-22 a bare `counterparts credentials` says the
|
|
1623
|
+
same thing rather than refusing with a usage error:
|
|
1624
|
+
|
|
1625
|
+
```
|
|
1626
|
+
credentials: /…/credentials.env
|
|
1627
|
+
ANTHROPIC_API_KEY missing
|
|
1628
|
+
VOYAGE_API_KEY missing
|
|
1629
|
+
|
|
1630
|
+
Add or change one: counterparts credentials set <NAME>
|
|
1631
|
+
```
|
|
1632
|
+
|
|
1633
|
+
Setting the Voyage key at a terminal also asks *Turn on recall by meaning now?* —
|
|
1634
|
+
the same question `install` puts, and the reason `doctor`'s fix line can name a
|
|
1635
|
+
command instead of a JSON edit (§6). A pipe, `--from-env`, `--stdin` and CI are
|
|
1636
|
+
asked nothing and turn on nothing.
|
|
1238
1637
|
|
|
1239
1638
|
Restarting is not required for the hooks: each is a fresh process and picks the
|
|
1240
1639
|
file up at the next event. The MCP server reads it once, at launch, so a running
|