counterparts 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +87 -367
  3. package/docs/QUICKSTART.md +83 -1584
  4. package/docs/README.md +86 -0
  5. package/docs/module-map.md +1 -0
  6. package/package.json +6 -2
  7. package/src/adapters/claude-code/CONTRACT.md +153 -19
  8. package/src/adapters/claude-code/INTERFACE-GAPS.md +138 -2
  9. package/src/adapters/claude-code/NOTES.md +508 -0
  10. package/src/adapters/claude-code/bin/hook.ts +223 -49
  11. package/src/adapters/claude-code/bin/runner.ts +221 -101
  12. package/src/adapters/claude-code/config.ts +202 -279
  13. package/src/adapters/claude-code/doctor.ts +822 -427
  14. package/src/adapters/claude-code/embed-client.ts +165 -557
  15. package/src/adapters/claude-code/hooks.ts +414 -116
  16. package/src/adapters/claude-code/index.ts +8 -59
  17. package/src/adapters/claude-code/page-writer.ts +24 -4
  18. package/src/adapters/claude-code/spawn.ts +6 -7
  19. package/src/adapters/claude-code/standdown.ts +12 -1
  20. package/src/adapters/claude-code/transcript.ts +282 -15
  21. package/src/adapters/claude-code/vectors.ts +108 -24
  22. package/src/adapters/cli/CONTRACT.md +123 -3
  23. package/src/adapters/cli/INTERFACE-GAPS.md +49 -2
  24. package/src/adapters/cli/NOTES.md +265 -1
  25. package/src/adapters/cli/bin/counterparts.ts +9 -9
  26. package/src/adapters/cli/commands.ts +525 -438
  27. package/src/adapters/cli/help.ts +22 -27
  28. package/src/adapters/cli/index.ts +0 -2
  29. package/src/adapters/cli/install.ts +102 -89
  30. package/src/adapters/cli/removal.ts +1 -1
  31. package/src/adapters/cli/report.ts +25 -2
  32. package/src/adapters/cli/snapshot.ts +4 -27
  33. package/src/adapters/cli/uninstall.ts +182 -34
  34. package/src/adapters/cli/wire.ts +232 -35
  35. package/src/adapters/dashboard/INTERFACE-GAPS.md +18 -2
  36. package/src/adapters/dashboard/activity.ts +4 -1
  37. package/src/adapters/dashboard/bin/dashboard.ts +1 -1
  38. package/src/adapters/dashboard/registries.ts +16 -1
  39. package/src/adapters/dashboard/resolve.ts +4 -4
  40. package/src/adapters/dashboard/source.ts +8 -2
  41. package/src/adapters/dashboard/web/flow.ts +6 -0
  42. package/src/adapters/dashboard/web/narrate.ts +66 -14
  43. package/src/adapters/dashboard/web/reveal.ts +6 -6
  44. package/src/adapters/dashboard/web/views.ts +12 -4
  45. package/src/adapters/fired.ts +130 -19
  46. package/src/adapters/mcp/CONTRACT.md +73 -1
  47. package/src/adapters/mcp/INTERFACE-GAPS.md +54 -1
  48. package/src/adapters/mcp/NOTES.md +389 -0
  49. package/src/adapters/mcp/bin/serve.ts +28 -35
  50. package/src/adapters/mcp/deliberate.ts +22 -0
  51. package/src/adapters/mcp/index.ts +30 -2
  52. package/src/adapters/mcp/server.ts +429 -49
  53. package/src/adapters/mcp/tools.ts +32 -7
  54. package/src/adapters/mcp/write-up.ts +454 -0
  55. package/src/adapters/sessions.ts +1370 -0
  56. package/src/adapters/snapshots.ts +71 -39
  57. package/src/core/associate/INTERFACE-GAPS.md +8 -0
  58. package/src/core/counterpart.ts +88 -14
  59. package/src/core/embed/CONTRACT.md +85 -0
  60. package/src/core/embed/NOTES.md +93 -0
  61. package/src/core/embed/static.ts +622 -0
  62. package/src/core/encode/INTERFACE-GAPS.md +29 -0
  63. package/src/core/encode/NOTES.md +78 -0
  64. package/src/core/encode/secrets.ts +309 -9
  65. package/src/core/handoff/INTERFACE-GAPS.md +15 -1
  66. package/src/core/prospective/INTERFACE-GAPS.md +4 -0
  67. package/src/core/recall/CONTRACT.md +15 -3
  68. package/src/core/recall/INTERFACE-GAPS.md +100 -0
  69. package/src/core/recall/NOTES.md +49 -0
  70. package/src/core/recall/activate.ts +37 -3
  71. package/src/core/recall/index.ts +22 -1
  72. package/src/core/recall/session.ts +32 -0
  73. package/src/core/recall/tunables.ts +99 -2
  74. package/src/core/remember/CONTRACT.md +51 -7
  75. package/src/core/remember/INTERFACE-GAPS.md +121 -1
  76. package/src/core/remember/NOTES.md +221 -1
  77. package/src/core/remember/index.ts +28 -0
  78. package/src/core/remember/owes.ts +532 -0
  79. package/src/core/remember/owner-strike-seam.ts +34 -2
  80. package/src/core/remember/proposals.ts +25 -6
  81. package/src/core/remember/retention.ts +154 -0
  82. package/src/core/remember/spans.ts +53 -12
  83. package/src/core/remember/tunables.ts +8 -0
  84. package/src/core/remember/write-up-seam.ts +104 -0
  85. package/src/core/schemas/INTERFACE-GAPS.md +8 -0
  86. package/src/core/schemas/NOTES.md +118 -1
  87. package/src/core/schemas/index.ts +330 -40
  88. package/src/core/schemas/tunables.ts +23 -0
  89. package/src/core/schemas/types.ts +64 -1
  90. package/src/core/self/CONTRACT.md +19 -13
  91. package/src/core/self/INTERFACE-GAPS.md +18 -1
  92. package/src/core/self/NOTES.md +137 -1
  93. package/src/core/self/calendar.ts +81 -0
  94. package/src/core/self/episodes.ts +201 -38
  95. package/src/core/self/identity.ts +2 -2
  96. package/src/core/self/index.ts +96 -21
  97. package/src/core/self/tunables.ts +18 -46
  98. package/src/core/self/writer.ts +58 -9
  99. package/src/core/sleep/NOTES.md +36 -0
  100. package/src/core/sleep/cycle.ts +30 -1
  101. package/src/core/sleep/fade.ts +76 -0
  102. package/src/core/sleep/index.ts +4 -1
  103. package/src/core/sleep/prune.ts +8 -1
  104. package/src/core/sleep/tunables.ts +5 -0
  105. package/src/core/sleep/types.ts +24 -0
  106. package/src/core/store/CONTRACT.md +26 -1
  107. package/src/core/store/NOTES.md +348 -0
  108. package/src/core/store/cache.ts +585 -27
  109. package/src/core/store/db.ts +97 -0
  110. package/src/core/store/errors.ts +7 -0
  111. package/src/core/store/index.ts +612 -13
  112. package/src/core/store/operational.ts +107 -11
  113. package/src/core/store/paths.ts +15 -1
  114. package/src/core/store/pre-migration.ts +256 -0
  115. package/tools/install-loop/run.sh +52 -71
  116. package/src/adapters/claude-code/credentials.ts +0 -199
  117. package/src/adapters/claude-code/interpret-client.ts +0 -395
  118. package/src/adapters/cli/keys.ts +0 -503
@@ -1,1657 +1,156 @@
1
- # Counterparts — install
1
+ # Quickstart
2
2
 
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.
3
+ ## Install
6
4
 
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.
11
-
12
- ---
13
-
14
- ## 1. What you need
15
-
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.
31
-
32
- ---
33
-
34
- ## 2. Install
5
+ You need [bun](https://bun.sh) 1.3 or newer. Counterparts runs on bun only; Node is
6
+ untested.
35
7
 
36
8
  ```
9
+ curl -fsSL https://bun.sh/install | bash # if you don't have bun
37
10
  bun add -g counterparts
38
- ```
39
-
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:
42
-
43
- | | |
44
- |---|---|
45
- | `counterparts` | your console — ask, status, doctor, install, backup, export, removal |
46
- | `counterparts-hook` | the Claude Code hook entry point; one executable, five events |
47
- | `counterparts-mcp` | the MCP server — `note`, `recall`, `status`, `session_end`, `chapter` |
48
- | `counterparts-dashboard` | read-only views of what is in the store |
49
-
50
- **Check that directory is on your PATH before going on:**
51
-
52
- ```
53
11
  counterparts --version
54
12
  ```
55
13
 
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
62
- (`warn: To run "counterparts", add the global bin folder to $PATH`) and the fix is
63
- `export PATH="$HOME/.bun/bin:$PATH"` in your shell profile. A fresh bun install does not
64
- always do this for you.
14
+ If `counterparts --version` says `command not found`, add bun's bin folder to your PATH:
15
+ `export PATH="$HOME/.bun/bin:$PATH"` in your shell profile.
65
16
 
66
- Installing from a clone, or from a tarball somebody sent you: §2a.
67
-
68
- ---
69
-
70
- ## 3. Set it up
17
+ ## Set it up
71
18
 
72
19
  ```
73
20
  counterparts
74
21
  ```
75
22
 
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.
23
+ With nothing set up yet, this offers to set it up. `counterparts install` does the same
24
+ thing and is safe to run again. It asks two things, and you can skip either of them:
80
25
 
81
- It is short, nothing in it is compulsory, and **Esc gets you out of any question**:
26
+ - **Your name**, so the memory knows what to call you.
27
+ - **Whether to connect Claude Code.** This adds five hooks to `~/.claude/settings.json`
28
+ (it keeps a backup first) and registers the memory tools. Hooks from other tools are
29
+ left alone.
82
30
 
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.
31
+ There are no API keys. Search by meaning is turned on for you and runs on your machine;
32
+ nothing leaves it except through Claude Code itself.
103
33
 
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`.
34
+ Your memory lives in `~/.counterparts/`.
106
35
 
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:
36
+ To set it up from a script, with no questions:
111
37
 
112
38
  ```
113
39
  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
- ```
167
-
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
209
-
210
- For contributors, for a version that is not published yet, or for a tarball
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
215
- `npm pack` there. Were you sent a tarball? Skip to `bun add -g`.** Run the clone
216
- somewhere that does not already hold a directory named `counterparts` — `git
217
- clone` refuses, harmlessly, if one is there.
218
-
219
- ```
220
- git clone https://github.com/mlapeter/counterparts.git
221
- cd counterparts
222
- npm pack
223
- ```
224
-
225
- `npm pack` writes `counterparts-<version>.tgz` into the current directory and
226
- prints its name. Install that file, by absolute path:
227
-
228
- ```
229
- bun add -g "$PWD"/counterparts-*.tgz
230
- ```
231
-
232
- Two things about that line, both learned the hard way:
233
-
234
- - **The path must be absolute.** bun 1.3.10 fails a relative tarball path with
235
- `error: ENOENT extracting tarball from ./x.tgz`.
236
- - **The same error means "no file by that name."** If you typed a filename that
237
- does not exist, you get the identical message. Check `ls *.tgz` first.
238
-
239
- What lands is the same package the registry serves, in the same place. The clone
240
- is only where the tarball was made: nothing reads it again, and you can delete it.
241
-
242
- **Running from the clone instead of installing.** `bun install` in the clone, then
243
- every `counterparts …` below becomes `bun run src/adapters/cli/bin/counterparts.ts …`,
244
- `counterparts-hook` becomes `bun run <repo>/src/adapters/claude-code/bin/hook.ts`,
245
- and `counterparts-mcp` becomes `bun run <repo>/src/adapters/mcp/bin/serve.ts`.
246
- Those four paths are stable; the live host has pointed at them since 2026-09-03.
247
-
248
- ---
249
-
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:
253
-
254
- ```
255
- counterparts install --budget 9000 --name "Your Name"
256
- ```
257
-
258
- ### `install` or `init` — which one
259
-
260
- ```
261
- counterparts init --dir /somewhere/else/store --name "Your Name"
262
- ```
263
-
264
- `init` makes **just a store**: a data dir, an identity core if you name one, and
265
- a printout of the same install steps. It writes nothing under `~/.counterparts/`,
266
- no configuration and no credentials file, and it touches no host settings.
267
-
268
- Use `install` for your first, real memory — it is the cold start, it owns
269
- `~/.counterparts/`, and it is the only one that produces a config the hooks will
270
- read. Use `init` for a second store, a scratch store, or a store on another disk
271
- that you only want to reach from the console and the dashboard. A store made by
272
- `init` has no host wiring at all: the hooks will not see it, because they read one
273
- configuration — the default one, unless something names another (`--config`,
274
- below) — and `init` writes none.
275
-
276
- Both take `--name`, and both mean the same thing by it: the identity core is
277
- minted then and there, by the same door, so a store made either way has it as its
278
- first live row. `counterparts status` on a directory with no store points you at
279
- `init`, which is the right answer for the case you are usually in when you see
280
- that message.
281
-
282
- ### What `install` writes
283
-
284
- Replace `Your Name` with yours. It seeds the identity core — the thing the memory
285
- is *about* — and there is no default for it anywhere.
286
-
287
- Nothing is composed for you to read at that instant: a fresh store has lived no
288
- boundary, so `SessionStart` prints the honest bootstrap line until one exists
289
- (§7). The first wake that *is* composed — at the end of your first real session,
290
- or right now with `counterparts rebrief` (§7) — opens with your name:
291
-
292
- ```
293
- Who I am:
294
- This memory is for Your Name. No identity has formed here yet — identity is earned at the boundary that ends a session, from what recurs across distinct days.
295
- ```
296
-
297
- That is the whole of it on day 0, and it is deliberately the whole of it: the
298
- wake states what the store knows and never invents a first belief about you. The
299
- line stays until an identity element is earned — reinforcement on several
300
- distinct days, decided at a boundary — and disappears the moment one is. Without
301
- `--name` there is no core, and no such line.
302
-
303
- This command writes three things that are **yours**:
304
-
305
- ```
306
- ~/.counterparts/
307
- ├── claude-code.json the adapter's configuration
308
- ├── credentials.env 0600, holding only comments that name the two keys
309
- └── store/ the memory itself — the default data dir
310
- ├── counterparts.sqlite the memories, their prior versions, everything
311
- └── cache/ rebuildable index; losing it costs a re-index
312
- ```
313
-
314
- **One file holds your memory.** The bodies, their revision history and every
315
- structured field are rows in `counterparts.sqlite`, so a backup is a file copy
316
- and a memory can never disagree with its own bookkeeping. You read your memories
317
- through the dashboard, `counterparts ask`, or by asking — and
318
- **`counterparts export --out <dir> --markdown --plaintext` writes everything out
319
- as one readable tree of Markdown files** (confidential memories are left out,
320
- and the export says how many; `--include-confidential` takes them too). (SQLite
321
- keeps two sidecars beside it, `-wal` and `-shm`; they belong to the database and
322
- are copied with it.)
323
-
324
- **Your journal is already readable, without exporting anything.** Every chapter
325
- the counterpart writes is copied to `store/journal/<year>/<date>-<id>.md` as it
326
- lands — open one in any editor. It is a copy: the database is the original, and
327
- deleting `journal/` loses nothing (the next chapter writes it again, and the
328
- background worker refills anything still missing, a few files per run). Because
329
- it is a copy, **`backup` and the daily snapshot deliberately leave it out** and
330
- a restored store writes the files again from its rows — which also means a
331
- memory you removed does not go on living as plain markdown inside fourteen old
332
- snapshots.
333
-
334
- Three more directories appear under `store/` the first time they are needed and
335
- not before: `spans/` (lived experience awaiting encoding, written by the hooks
336
- and by `counterparts note`), `journal/` (the counterpart's diary, also written
337
- as Markdown files as each chapter lands) and `sessions/` (the live-session
338
- registry, §5a). A fresh store has none of them, and `counterparts status` lists
339
- them either way.
340
-
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.
348
-
349
- Re-running it is safe: an existing config or credentials file is kept and
350
- reported, never merged and never rewritten. `--force` is the only way past that.
351
-
352
- Flags: `--budget <bytes>` (below), `--name <owner>`, `--embedder` (§6),
353
- `--dir <store>` (below), `--force`, `--no-connect`, `--yes`.
354
-
355
- ### Why the store is `~/.counterparts/store` and the config is one level up
356
-
357
- The store classifies every top-level entry of its data directory and refuses to
358
- open on one it does not recognise (`src/core/store/paths.ts`, `LAYOUT` +
359
- `assertLayoutClassified`) — and `claude-code.json` is not one of them. A data dir
360
- with the config inside is a store that will not open.
361
-
362
- So the shape is: `~/.counterparts/` holds the configuration and the credentials,
363
- and the store is `~/.counterparts/store` beneath it. That is also the default data
364
- dir, so `COUNTERPARTS_DATA_DIR` and `--dir` are conveniences, not requirements.
365
- `install` writes the resolved `dataDir` into the config anyway — a configuration
366
- that names its store is clearer than one relying on a default.
367
-
368
- ### `--dir` moves the STORE, and only the store
369
-
370
- You can put the memory itself anywhere — another disk, an encrypted volume:
371
-
372
- ```
373
- counterparts install --budget 9000 --name "Your Name" --dir /Volumes/vault/counterparts-store
374
- ```
375
-
376
- **The configuration does not follow it.** `~/.counterparts/claude-code.json` is the
377
- path every entry point reads when nothing names another one, so a config written
378
- somewhere else with nothing pointing at it is an ambient half that never fires,
379
- and no hook will tell you: a hook that stands down says so on stderr and exits 0
380
- (§5a has the one exception). The hook falls back to `COUNTERPARTS_DATA_DIR` only
381
- when the config it read names no `dataDir` at all, and `install` always writes
382
- one — so a hand-written config with no `dataDir` is the one shape that can still
383
- land on the default store.
384
-
385
- `install` keeps the config where the hooks look, points its `dataDir` at wherever
386
- you sent the store, and says so in its output when you use `--dir`.
387
-
388
- The one `--dir` it refuses is `~/.counterparts` itself, which would put the config
389
- inside the data dir. It says so instead of creating a store that will not open.
390
-
391
- ### `--config` moves the CONFIGURATION — one rule, every entry point
392
-
393
- ```
394
- counterparts install --budget 9000 --name "Your Name" --config /opt/counterparts/claude-code.json
395
- ```
396
-
397
- **One sentence, and it is the same for all four entry points:** `--config
398
- <absolute path>` if the command line carries one, else `COUNTERPARTS_CONFIG` if
399
- the environment does, else the default — `~/.counterparts/claude-code.json` for
400
- `counterparts-hook`, its worker and `counterparts-mcp`; for the console, the
401
- config beside the store (`<dir>/../claude-code.json`) and then that same home
402
- path (§7).
403
-
404
- The environment variable is the flag's equivalent, for hosts that launch a
405
- process from a static registration and have no command line to write into —
406
- which is exactly how Claude Code launches an MCP server (§4a).
407
-
408
- A path you named and this cannot use is **refused**, at every entry point that
409
- reads a configuration, and nothing falls back to the default: naming a
410
- configuration is how you say which memory you mean, and quietly using another one
411
- is how a scratch run writes into a live store. Three shapes refuse — a relative
412
- path, an absolute path to a file that is not there, and a file that is not a JSON
413
- object. **The mistyped path is the one that matters**: before 2026-09-05 it was
414
- honoured silently, read as "no configuration", and the store then fell back to
415
- the default one. An absent *default* is still ordinary, because a fresh machine
416
- has none and the hook must still start.
417
-
418
- The hook refuses by standing down — one line on stderr, exit 0, nothing injected
419
- — because a hook never fails the host. The MCP server refuses by not starting
420
- (exit 1). `counterparts install` is the exception to all of this: `--config`
421
- names the file it is about to *write*, so a path that does not exist yet is the
422
- ordinary case there.
423
-
424
- `--config` on `install` moves the whole base: the configuration goes where you
425
- said, `credentials.env` goes beside it, and the store defaults to `store/`
426
- beneath it (`--dir` still overrides the store). Everything is then printed with
427
- the flag filled in, so the hooks block and the `claude mcp add` line point at the
428
- configuration you chose. Without it, nothing is printed with a flag — the default
429
- path is the rule, and a hooks block that spells it out is one that breaks the day
430
- you move a home directory.
431
-
432
- **Every entry point says which file it used.** The console prints it (`rebrief`'s
433
- `budget … from <path>` line, §7); the MCP server and the worker write one line to
434
- stderr at launch; the hook, which has no channel to you — its stdout is the
435
- model's context — records it as the `config` field of
436
- `<dataDir>/sessions/<id>.json`.
437
-
438
- ### The `injectionBudgetBytes` number
439
-
440
- `--budget 9000` is the number the live host runs on, measured on Claude Code on
441
- 2026-09-03: a wake of 8,859 bytes was delivered under it. It is **your host's**
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.
458
-
459
- ---
460
-
461
- ## 4a. Connecting Claude Code by hand
462
-
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.
466
-
467
- **The hooks.** Merge into `~/.claude/settings.json` — one script, five events.
468
- `counterparts install` prints this with your own absolute paths filled in; the
469
- shape is:
470
-
471
- ```json
472
- {
473
- "hooks": {
474
- "SessionStart": [{ "hooks": [{ "type": "command",
475
- "command": "\"/abs/path/to/bun\" run \"/abs/path/to/counterparts/src/adapters/claude-code/bin/hook.ts\"" }] }],
476
- "UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "<the same string>" }] }],
477
- "Stop": [{ "hooks": [{ "type": "command", "command": "<the same string>" }] }],
478
- "SessionEnd": [{ "hooks": [{ "type": "command", "command": "<the same string>" }] }],
479
- "PreCompact": [{ "hooks": [{ "type": "command", "command": "<the same string>" }] }]
480
- }
481
- }
482
- ```
483
-
484
- **Both paths are absolute, and that is not cosmetic.** `counterparts-hook` is a
485
- shim whose first line is `#!/usr/bin/env bun`, so it only runs if bun is on the
486
- PATH of whatever launched it — and a host's process environment is not your login
487
- shell's. This package measured exactly that on day 0 of its parallel run: both
488
- API keys were exported in `~/.zshrc` and neither reached a single hook process.
489
- A `PATH` without `~/.bun/bin` turns every hook into "command not found", which
490
- looks from the outside like a memory that simply never happens.
491
-
492
- If you already have hooks on those events, add this one beside them — hooks on
493
- one event run in parallel. The hook reads `~/.counterparts/claude-code.json` for
494
- everything else, so the hooks block passes it no arguments and sets no environment
495
- variable — **that default is the rule** (§3), and `counterparts install` prints
496
- the block without a flag unless you moved the configuration with `--config`, in
497
- which case the same block carries `--config "<your path>"` on every event. (The
498
- hook still reads its own process environment: the two API keys come from there
499
- first, §6, and the store falls back to `COUNTERPARTS_DATA_DIR` if the config it
500
- read names none.)
501
-
502
- **The MCP server.** Run the line `counterparts install` printed; its shape is:
503
-
504
- ```
505
- claude mcp add counterparts -s user -e COUNTERPARTS_DATA_DIR="$HOME/.counterparts/store" -- "/abs/path/to/bun" run "/abs/path/to/counterparts/src/adapters/mcp/bin/serve.ts"
506
- ```
507
-
508
- **Keep `COUNTERPARTS_DATA_DIR` in that line, and keep it absolute.** It is how the
509
- server finds a store that is not at the default; `install` prints it even for the
510
- default store, because Claude Code launches MCP servers from a static
511
- configuration with no per-session substitution — the server gets no session id and
512
- no working directory it can trust, so the one thing it should not also have to
513
- guess is where the memory is. (Absent it, the server falls back to the same
514
- default the console uses. That is a fallback, not a plan.)
515
-
516
- That same static registration is why `COUNTERPARTS_CONFIG` exists: a server
517
- launched from it has no command line you can put `--config` on, so a non-default
518
- configuration travels as a second `-e` — `-e COUNTERPARTS_CONFIG="/your/path"` —
519
- and `counterparts install --config` prints exactly that. The two answer different
520
- questions: `COUNTERPARTS_DATA_DIR` says which store, `COUNTERPARTS_CONFIG` says
521
- whose keys and whose embedder knob (§6, §11.3). The server prints the
522
- configuration it read on stderr at launch, before any protocol.
523
-
524
- Then **restart Claude Code**. Hooks are read at session start; MCP servers are
525
- launched at session start.
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
40
  counterparts connect
535
41
  ```
536
42
 
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
-
561
- ---
562
-
563
- ## 5a. What the pieces do
564
-
565
- **The hooks** are the ambient half. `SessionStart` injects the wake — what the
566
- last boundary published, plus a preface naming the system, the day and the
567
- store's size. `UserPromptSubmit` recalls against the turn. `Stop`, `SessionEnd`
568
- and `PreCompact` are boundaries: they capture the conversation into `spans/` and,
569
- at most once in a while, ask you a question through the model. No hook ever fails
570
- your session — that is the one failure mode this adapter does not have. Every hook
571
- exits 0, with one deliberate exception: a Stop that has a question to ask exits 2
572
- and writes the ask to stderr, because on this host that is the channel the model
573
- actually reads (`hook.ts#hostDelivery`, measured; §10). That 2 is the feedback channel,
574
- not a failure.
575
-
576
- **The MCP server** is the deliberate half: `note` (remember this), `recall` (ask
577
- memory a question), `status`, `session_end` (write the session's memories),
578
- `chapter` (write the episode). A chapter of the journal can come back from `recall`
579
- — it is a first-person account and may rightly come to mind — and every result that
580
- is one says so: `journal: true` on the tool's row, `[journal]` in the console, and
581
- `Journal:` in front of the line the hook injects. An account is not a memory.
582
-
583
- **`sessions/`** is how those two halves find each other. The hooks know the
584
- session id — the host hands it to every hook — and the MCP server does not. So
585
- the hooks leave a small record at `<dataDir>/sessions/<id>.json` (an id, a scope,
586
- three timestamps, no content) and the server binds to a live one lazily. Deleting
587
- the directory costs a lazy bind and nothing else; it is deliberately not backed
588
- up.
589
-
590
- **After an upgrade, restart your sessions.** An MCP server keeps the code it was
591
- launched with for the life of the session. A session open across an upgrade goes
592
- on serving the old server until it restarts.
593
-
594
- ---
595
-
596
- ## 6. Keys, and what happens without them
597
-
598
- `~/.counterparts/credentials.env` is the one file Counterparts reads keys from,
599
- and only because `claude-code.json`'s `credentialsFile` names it. It exists
600
- because a hook's process environment is not your login shell's: on the live host,
601
- both keys were exported in `~/.zshrc` and neither reached a single hook process.
602
- A value already present in the environment always wins; the file only fills gaps.
603
-
604
- Format is `KEY=value` per line (`export KEY=value`, quotes and CRLF tolerated,
605
- `#` comments skipped). Exactly two names are honored; anything else is ignored
606
- and counted. Keep it 0600 — a group- or world-readable file is warned about on
607
- stderr, never refused.
608
-
609
- | key | what it buys | without it |
610
- |---|---|---|
611
- | `ANTHROPIC_API_KEY` | the crash-recovery sweep's one model call | the worker still runs the day — the clock, the flush, the semantic cue, the embedding backfill, the sleep cycle and the briefing — and SKIPS the sweep, writing `sweep.gate` with `reason: "no-credential"` so the skip is on the record. A crashed session's captured spans stay uninterpreted. Nothing else changes — this is *not* the ordinary write path. |
612
- | `VOYAGE_API_KEY` | embeddings | recall runs on the lexical channel alone (see below) |
613
-
614
- **No embed key is a supported mode, and the code says so, by name.** An embedding
615
- is an input the caller supplies, and "its absence degrades to lexical-only rather
616
- than failing" — the same sentence, verbatim, in `src/core/recall/cues.ts:26` and
617
- `src/core/recall/index.ts:27`. The encoder's preselect records
618
- `channelRecord("skipped", "no-chunk-vector")` rather than dropping silently
619
- (`src/core/encode/preselect.ts:126`); novelty comes back
620
- `{ novelty: null, reason: "no-chunk-vector", blind: true }`
621
- (`src/core/encode/salience.ts:60`). You get recall — cue-based and temporal — and a
622
- countable record of what you are not getting.
623
-
624
- It also says so on the wire. Every `recall` answer carries a `semantic` field
625
- naming how the semantic channel got its input on that ask — this is a real result
626
- from the install loop, on a store with no key and no embedder:
627
-
628
- ```json
629
- { "path": "question", "reason": "answered", "semantic": "embedder-off",
630
- "considered": 2, "consideredCap": 24, "storeSize": 4, "returned": 2, ... }
631
- ```
632
-
633
- The values, and exactly what each one means
634
- (`src/adapters/mcp/server.ts#embedQuestion`, `deliberate.ts#answerQuestion`):
635
-
636
- | `semantic` | meaning |
637
- |---|---|
638
- | `embedder-off` | **no embedder was built**, because `embedder.enabled` is not `true` (or the server stood down as an observer). This is the no-key mode *with the knob off* — the state you are in after a plain `counterparts install`, and the state the console is always in. |
639
- | `embed-failed` | an embedder was built and the call did not return a vector. **This is what a knob turned on with no `VOYAGE_API_KEY` looks like** — the client exists, the call raises `NO_API_KEY`, and lexical answers. Also a network failure or an empty vector. |
640
- | `in-line` | the question WAS embedded and the semantic channel ran. Key present, knob on. |
641
- | `none` | the `handle` and `ids` paths — an exact address does no scoring at all. |
642
-
643
- If you have no key and see `in-line`, something is supplying one: the MCP server
644
- reads `~/.counterparts/claude-code.json` for the embedder knob and the credentials
645
- file it names, whatever `--dir` or `COUNTERPARTS_DATA_DIR` say about the store.
646
- That is a real trap — the cold-stranger review of 2026-09-04 hit it, running a
647
- scratch store against an existing config — and it is worth knowing that the store
648
- you point at and the credentials you use are chosen by two different files. The
649
- lever, since 2026-09-05, is `--config` / `COUNTERPARTS_CONFIG` (§3a): point the
650
- second file somewhere too, and the server names the file it read on stderr at
651
- launch.
652
-
653
- **The embed key alone is not enough.** Embedding means sending memory text to a
654
- third party, so it is a decision, not a capability a stray environment variable
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.
664
-
665
- ---
666
-
667
- ## 7. Look at the memory yourself, from the console
668
-
669
- `$HOME/.counterparts/store` is the default data dir, so the commands below work
670
- with nothing set. If your store is somewhere else — or you would rather be
671
- explicit than rely on a default — say so once for this shell:
672
-
673
- ```
674
- export COUNTERPARTS_DATA_DIR="$HOME/.counterparts/store"
675
- ```
676
-
677
- Every command in this section takes `--dir <store>` instead if you prefer; the
678
- console and the dashboard read one or the other. The console reads
679
- `claude-code.json` for exactly one thing — `rebrief` without `--budget` takes
680
- `injectionBudgetBytes` from the config named by `--config` /
681
- `COUNTERPARTS_CONFIG` if one was named, else from `<store>/../claude-code.json`,
682
- else from `~/.counterparts/claude-code.json`, and prints which — and never for the
683
- store, the keys or the embedder.
684
-
685
- The default can also be **turned off**. In a shell that must never reach
686
- `~/.counterparts` by accident — a scratch store beside a real install, a CI job,
687
- an agent's terminal — export `COUNTERPARTS_REQUIRE_EXPLICIT_DIR=1`. Then any
688
- command, hook, server or library call that names no store (no `--dir`, no
689
- `COUNTERPARTS_DATA_DIR`) refuses before it opens anything, naming the guard, the
690
- directory it would have opened, and the two ways to name one; the same variable
691
- makes the hook, the worker, the MCP server and `install` refuse an unnamed
692
- configuration, because `~/.counterparts/claude-code.json` names a store too. It
693
- arms on `1`, `true` or `on`, and stands down on `0`, `false` or `off` — case and
694
- surrounding whitespace ignored, blank the same as absent — so `=0` turns it off
695
- rather than tripping it. **Any other value is refused, not read as off**: `=yes`
696
- gets a sentence naming the value, the three words that arm it and the three that
697
- turn it off, because a safety guard that cannot read its own switch fails closed.
698
- Unset — which is every installed host — nothing changes. It is a guard for shells, not
699
- a setting: the store it protects is the one you would have reached without it.
700
-
701
- One refusal near that door needs no variable at all, because it answers a real
702
- accident rather than a shape: **`install` will not write the default
703
- `~/.counterparts/claude-code.json` with a `dataDir` under the system temp
704
- directory.** That file is what the hook, the worker and the MCP server read when
705
- nothing names another, so a throwaway store written into it becomes the machine's
706
- live memory until the OS deletes it — which is how three days went unrecorded on
707
- this project's own machine on 2026-09-04. Point a scratch install somewhere of its own instead: `--config
708
- <absolute path outside ~/.counterparts>` moves the configuration, the credentials
709
- and the store together. A clean room whose whole `$HOME` is temporary (the install
710
- loop's, the test suite's) is not this case and is not refused.
711
-
712
- ### Store some memories and ask for one back
713
-
714
- This is the product. Three commands, no host, no keys:
715
-
716
- ```
717
- counterparts note "The espresso machine in the kitchen is a Rancilio Silvia."
718
- counterparts note "Postgres in dev listens on port 5433, not 5432."
719
- counterparts ask "which port does postgres use in dev?"
720
- ```
721
-
722
- `note` prints the store it wrote to, then `Remembered mem_… — minted.` `ask`
723
- prints the same `Store:` line first, then a header line, the memories it found,
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):
726
-
727
- ```
728
- Store: /Users/<you>/.counterparts/store
729
- question · answered · semantic embedder-off · considered 1 of 3 live rows · returned 1
730
-
731
- mem_30fbdaa753c5 [quiet] fact
732
- Postgres in dev listens on port 5433, not 5432.
733
-
734
- quiet = quietly available; the ambient path would have footnoted it, not said it
735
- Nothing here came back vividly, so treat these as leads rather than answers.
736
- ```
737
-
738
- (A real capture, on a store made the way §3a says — `--name`, either door — and
739
- then those two notes. **Three** live rows for two memories: the identity core
740
- `--name` seeded is the third, because `live rows` counts every unarchived row and
741
- not only the memories. That is why this number and the wake preface's
742
- `N memories` are two different numbers about one store, and `counterparts status`
743
- prints the split. One question, one answer out of two candidate memories: that is
744
- recall discriminating, not a store too small to have a choice.)
745
-
746
- These are the same two doors the MCP tools use — `note` captures the words into
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_…>`
750
- asks for one memory in full instead of asking a question; `--json` prints the
751
- tool's own payload.
752
-
753
- **Read the tier, not the word `answered`.** `answered` means the question reached
754
- something; it is not a claim that the something is right. The tiers are the only
755
- confidence signal in the output, and the line under the results says what the
756
- ones you got mean. Asked something this store genuinely does not know — *"what
757
- colour is the sky on Mars?"* — the same store returns the espresso machine at
758
- `[quiet]`, with the same "treat these as leads" line (captured, same run). A cue-based
759
- channel with no embedder answers with the nearest thing it has; a `[quiet]` or
760
- `[dim]` result is the system saying *this is what I would have murmured*, not
761
- *this is your answer*.
762
-
763
- It also works on the very first memory: a store holding one memory answers the
764
- question about it. On the store §3a makes that reads `considered 1 of 2 live rows`
765
- — the memory, and the identity core beside it; on a store made by a bare `init`,
766
- with no `--name` and so no core, `1 of 1`. The install loop checks the bare case
767
- on every run, because it is the first thing anyone does and it is invisible to
768
- any test that seeds two rows.
769
-
770
- ### Look at the store
771
-
772
- ```
773
- counterparts status --dir "$HOME/.counterparts/store"
774
- ```
775
-
776
- A census of what is held, what left, and what was removed. Read-only, and it
777
- opens the store in observer stance so looking at your memory cannot change it.
778
-
779
- The first line names four populations because they are four different things,
780
- and adding them together is how one store came to report three different sizes:
781
- **`Memories:`** is what the AI learned, and it is the number the wake preface
782
- states back to the model at every session start; **`Beliefs and entities:`** is
783
- what it believes about people and things, which decay and are revised under their
784
- own rules; **`Journal:`** is episodes, the source a memory was made from, which
785
- never decay; **`Archived:`** and **`Superseded:`** are what has left. The `by
786
- kind` and `by band` lines below are over memories and beliefs together, and the
787
- band is computed from each row's physics today rather than read from the column
788
- it was born with — which is why it matches the dashboard's.
789
-
790
- Under them, two lines of the day's own facts: how many memories were born today,
791
- what lived day the store is on, when it was last active, when the last boundary
792
- was, whether a self page has been written, how old the newest snapshot is, and
793
- which journal mode the database is in. `counterparts doctor` grades all of that;
794
- this command only counts it.
795
-
796
- `--layout` adds a block naming the directories the store keeps and which of them
797
- a backup carries. It is written for whoever maintains a store rather than for
798
- whoever owns one, which is why it is behind a flag.
799
-
800
- ```
801
- counterparts-dashboard status --dir "$HOME/.counterparts/store"
802
- ```
803
-
804
- The same store, rendered. `browse`, `stories` and the other views take `--id`,
805
- `--limit`, `--band`, `--kind`.
806
-
807
- Pointed with `--dir` at a directory with no store in it, both consoles say `No
808
- store at <dir>. Run 'counterparts init --dir <dir>' to create one.` and exit 1 — a
809
- census of nothing at all is not a success, and a script wrapping `counterparts
810
- status` should hear about a mistyped `--dir` rather than sail past it. Neither
811
- one creates the store by looking for it.
812
-
813
- Every command has its own help: `counterparts <command> --help` prints what
814
- that command does and every flag it takes, and opens nothing.
815
-
816
- ### Remove a memory, and read what removal does not reach
817
-
818
- ```
819
- counterparts remove mem_b77c9e0e9808 --dir "$HOME/.counterparts/store"
820
- ```
821
-
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.
43
+ A script setup doesn't change Claude Code's settings (it prints the hooks instead);
44
+ `counterparts connect` is the step that does. Keep `--budget 9000`: only the questions
45
+ fill in that size limit for you. Search by meaning is on for a script setup too; add
46
+ `--no-embedder` to leave it off.
833
47
 
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
839
- anything moves. There is no `--force`: removal is the one owner operation with a
840
- human in the loop.
48
+ ## Check it
841
49
 
842
- Read the `spans` line before you confirm. On a memory that was taken as a note it
843
- says this — one line in the terminal, wrapped here:
50
+ Restart Claude Code, then run:
844
51
 
845
52
  ```
846
- chase spans: 1
847
- chased — spans/be4b7f492c17/jots.jsonl — the raw capture buffer holds this
848
- memory's words (matched by the span hash its mint recorded);
849
- the removal strikes them out of it.
850
- ```
851
-
852
- The parenthesis is not decoration. There are two ways this command can find your
853
- words, and they are not equally strong: `matched by the span hash its mint
854
- recorded` is identity, and `matched by content` is a jot whose whole text is this
855
- memory's body. Read which one you are about to run before you confirm.
856
-
857
- That directory name is a 12-hex key derived from the project the note was taken
858
- in, not the project's path; the command prints your real one.
859
-
860
- A note is captured verbatim into the span buffer before it is minted, and until
861
- 2026-09-05 `remove` reached the database, the links and the cache but
862
- not that file — so a removed note's words survived there, and a backup taken
863
- afterwards copied them. They do not now: the buffer is a chased surface like
864
- every other. The line the doomed span rode on is rewritten out of every file that
865
- held it (the live streams, any claim a worker is mid-arc on, the quarantine), its
866
- hash is kept in the buffer's own `consumed.jsonl` so nothing re-captures the same
867
- words, and the id goes dark on the deny-list so nothing can quietly resurrect the
868
- memory. Take a backup afterwards and grep it: the note's own capture is gone.
869
-
870
- **What it deliberately does not take, and says so.** If you asked for the note in
871
- conversation, the turn you said it in is also in the buffer — a conversation span
872
- is many turns joined together, it belongs to no single memory, and striking it
873
- because one memory quotes it would destroy material you never named. So it is
874
- left, on its own line, which is neither `chased` nor `unchased`:
875
-
876
- ```
877
- LEFT on purpose — spans echo: 1 line of conversation quoting these words —
878
- transcript, not this memory's capture. Left on purpose. Nothing prunes the
879
- buffer today, so it stays there.
880
- ```
881
-
882
- Read that last clause literally. **Nothing prunes `buffer.jsonl` for a session
883
- that ended normally** — the crash-fallback sweep only claims sessions that went
884
- silent without a session-end boundary — so a conversation turn quoting a removed
885
- memory stays on disk indefinitely, and a `grep` of the whole store will keep
886
- answering. The memory is gone; the transcript of having said it is not, and
887
- nothing today will take it. (Filed as `src/core/remember/INTERFACE-GAPS.md` §10.)
888
-
889
- **The one chase this command refuses to make on its own.** A memory whose
890
- provenance recorded no scope — every row the owner's one-off v1 import wrote
891
- looked like this — can only be found in the buffer by matching its text, and
892
- matching text with no scope means visiting every project on the machine. So it
893
- does not. It tells you what it would have matched, by file and count, and stops:
894
-
895
- ```
896
- NOT chased — spans/ — this memory's provenance records no scope and no span
897
- hash, so a chase by content would have to visit EVERY project on this machine.
898
- NOT done: 1 jot line whose whole text is this memory's body would have
899
- matched, in spans/8c1e4a90b21f/jots.jsonl (1). Look, then re-run with
900
- --strike-by-content-across-scopes if they are yours to remove …
901
- ```
902
-
903
- Look at the file it names before you pass that flag. Even with it, only a jot
904
- whose **whole text** is the memory's body is taken — a longer note that merely
905
- mentions the same words is somebody else's memory and is never touched.
906
-
907
- On a memory that never rode the buffer the same `spans` line reads `spans: not
908
- applicable`, which is stated rather than omitted — a surface that goes silent
909
- when it is empty is how the residue stayed invisible in the first place. One
910
- state is still `NOT chased`, and it is the honest one: a memory whose words are
911
- already gone from its row AND whose mint never recorded a span hash cannot be
912
- addressed in the buffer at all. The command says which way it is blind, and counts itself
913
- `unchased: 1`.
914
-
915
- ### Prove the hook works without opening Claude Code
916
-
917
- ```
918
- echo '{"hook_event_name":"SessionStart","session_id":"smoke","cwd":"'"$PWD"'"}' | counterparts-hook
53
+ counterparts doctor
919
54
  ```
920
55
 
921
- On a store that has never lived a boundary this prints the honest bootstrap line
922
- — *"No briefing has been composed yet — this store has not lived a boundary."* —
923
- and exits 0. That is the wake path working, with nothing yet to say.
924
-
925
- **With no arguments this reads `~/.counterparts/claude-code.json`.** It takes no
926
- `--dir`, so it acts on whatever store that file names — falling back to
927
- `COUNTERPARTS_DATA_DIR` only if the file names no `dataDir` at all — which is the
928
- point of §3a's rule that the config stays where the hooks look.
56
+ Green means working. **OFF** means an optional feature you haven't turned on, which is
57
+ fine. Amber is worth a look. Red means something isn't running; the line under it says
58
+ what to run to fix it.
929
59
 
930
- To try it against a scratch install without touching the one you use, name the
931
- configuration:
60
+ A session that was already open picks up the hooks on its next message, but it only gets
61
+ the memory tools after a restart.
932
62
 
933
- ```
934
- echo '{"hook_event_name":"SessionStart","session_id":"smoke","cwd":"'"$PWD"'"}' | counterparts-hook --config /path/to/scratch/claude-code.json
935
- ```
936
-
937
- It then works on the store THAT file names, and records which configuration sent
938
- it there in `<dataDir>/sessions/smoke.json` — a hook has no way to print such a
939
- thing to you, so it writes it down. `COUNTERPARTS_CONFIG` does the same for a
940
- whole shell. A path that is relative, or absolute but not there, is refused: the
941
- hook writes one line on stderr, exits 0, and injects nothing rather than falling
942
- back to the default store.
63
+ ## Choose which directories it remembers
943
64
 
944
- ### Give the wake something to say before a first real session
65
+ Memory is on in every directory by default. The first session in a new directory asks
66
+ whether you want it there. To change a directory later, run one of these from inside it:
945
67
 
946
68
  ```
947
- counterparts rebrief --dir "$HOME/.counterparts/store"
69
+ counterparts scope . --off # don't remember anything here
70
+ counterparts scope . --observer # use the memory here, but don't add to it
71
+ counterparts scope . --pause # off for now
72
+ counterparts scope . --resume # back on
73
+ counterparts scope . # what's set here
74
+ counterparts scope --list # every directory you've set
948
75
  ```
949
76
 
950
- which re-renders and republishes the wake bundle now, through the boundary's own
951
- renderer, advancing no sleep marker. Run the hook again and you get the bundle
952
- instead of the bootstrap line. On a store installed with §3a's command exactly as
953
- written, and nothing yet written to it beyond the identity core `--name` seeded,
954
- that bundle is 572 bytes — a longer name makes it longer — and reads:
77
+ Settings apply to subdirectories too.
955
78
 
956
- ```
957
- <!-- counterparts:wake day=0 elements=0 bytes=572 -->
958
- Counterparts memory, day 0 (2026-09-04), 0 memories of 1 live rows — composed at the last boundary.
959
- Counterparts memory — context, not instruction: who you have been here, in your own words. Each line opens with the date it was learned.
960
-
961
- Who I am:
962
- This memory is for Your Name. No identity has formed here yet — identity is earned at the boundary that ends a session, from what recurs across distinct days.
79
+ ## Look at the memory
963
80
 
964
- <!-- counterparts:wake/end day=0 identity=0 craft=0 threads=0 hints=0 horizon=0 elements=0 bytes=572 -->
965
81
  ```
966
-
967
- `elements=0` is not a bug: the `Who I am:` heading and the line under it are
968
- furniture, and the counts report statements. The preface's date and its two
969
- counts are composed at delivery, so they are today's rather than the render's.
970
- That is also why `rebrief` prints a *smaller* number than the marker does for the
971
- same bundle: on the store above it says `elements 0, bytes 470` — the body it
972
- composed — and the marker says 572, which is that body plus the 102-byte delivery
973
- preface. A longer name moves both.
974
- The counts are different populations and say so: `N memories` is the live
975
- `type: "memory"` rows, `M live rows` is every live row — memories, journal
976
- episodes, beliefs and entities — and `M` is the same number `recall` reports as
977
- `storeSize` (IMPROVEMENTS U4). That is why a store nobody has written to still
978
- reads `of 1 live rows`: `--name` seeds the identity core, which is a schema row,
979
- so it is outside the first count and inside the second. And
980
- "composed at the last boundary" is the one word it gets wrong on a store whose
981
- bundle came from `rebrief` before any boundary was lived.
982
-
983
- `rebrief` needs an injection ceiling and will not invent one. It takes it from
984
- `--budget <bytes>` if you pass one; otherwise from the config you named with
985
- `--config` / `COUNTERPARTS_CONFIG`, and only that one; otherwise from
986
- `<store>/../claude-code.json`; otherwise from `~/.counterparts/claude-code.json`,
987
- which is where the hooks read. **It always prints which**, as `budget 9000 bytes
988
- from <path>` (with `(named by --config)` when you named it) — a ceiling taken out
989
- of a file you did not name should never be silent — and if nothing answers, it
990
- refuses and lists every path it tried.
991
-
992
- To recap the two questions and their two answers. **Which store**: the console and
993
- the dashboard take `--dir` or `COUNTERPARTS_DATA_DIR` — with one exception, the
994
- console's bulk repairs (`migrate-cache --apply`, `repair-dates --apply`,
995
- `backfill-claims --apply`, `repair-merged-beliefs --apply`, and `verify` with
996
- `--rebuild`, `--prune-index`, `--retry-skipped` or `--drop-vectors`), which rewrite a whole store at
997
- once and take `--dir` alone, refusing a store named only by the variable; the MCP server takes
998
- `--dir` or `COUNTERPARTS_DATA_DIR`; the hook and its worker take neither and use
999
- the `dataDir` in the configuration they read, falling back to
1000
- `COUNTERPARTS_DATA_DIR` only if it names no store. **Which configuration**: one
1001
- rule for all four — `--config <absolute path>`, else `COUNTERPARTS_CONFIG`, else
1002
- the default (`~/.counterparts/claude-code.json`; for the console,
1003
- `<dir>/../claude-code.json` first). The console reads that file only for
1004
- `rebrief`'s ceiling; the store, the keys and the embedder knob in it are the
1005
- hooks' and the MCP server's.
1006
-
1007
- ---
1008
-
1009
- ## 8. Which directories it remembers
1010
-
1011
- The hooks are registered once, globally, so a session in ANY directory is
1012
- remembered by default. `counterparts scope` is where you say otherwise, one
1013
- directory at a time. It writes the host's own registry — `scopes.json`, beside
1014
- `claude-code.json`, so `--config` moves the two together — and it opens no
1015
- store: it takes no `--dir` and works on a machine that has none yet.
1016
-
1017
- From inside the directory you mean:
1018
-
1019
- ```
1020
- counterparts scope . --off
82
+ counterparts dashboard # opens the dashboard in your browser (read-only)
83
+ counterparts ask "..." # ask the memory a question
84
+ counterparts status # how much it holds
85
+ counterparts self-page # who it thinks it is, and who you are
86
+ counterparts remove # delete one memory for good
87
+ counterparts export # a copy of everything, encrypted by default
88
+ counterparts --help # everything else
1021
89
  ```
1022
90
 
1023
- and nothing there is recorded or read again: the hooks produce no output and
1024
- write nothing at all, and every MCP tool refuses by name (`scope-off`). The
1025
- other three modes:
91
+ `counterparts help <command>` explains any command in full.
1026
92
 
1027
- - `--on` — the default: capture, deposit, wake and recall, as everywhere else.
1028
- - `--observer` — reads only. The wake and recall are delivered; nothing is
1029
- captured or deposited, and `note`, `session_end` and `chapter` stand down.
1030
- This is the same stance §6's observer configuration produces, said in one word.
1031
- - `--pause` — off for now, remembering what to go back to.
93
+ ## Upgrade
1032
94
 
1033
- `--resume` undoes a pause, and turns an `--off` directory back on:
1034
-
1035
- ```
1036
- counterparts scope . --resume
1037
- ```
1038
-
1039
- To see what one directory resolves to and which entry decided it — a
1040
- subdirectory inherits its nearest ancestor, so turning a project off turns off
1041
- every worktree under it:
1042
-
1043
- ```
1044
- counterparts scope .
1045
- ```
1046
-
1047
- and for the whole registry, with the file it came from:
1048
-
1049
- ```
1050
- counterparts scope --list
1051
- ```
1052
-
1053
- Two more things worth knowing. **Nothing set means on**: a directory nobody has
1054
- answered for behaves exactly as it did before any of this existed — which is why
1055
- the first session in an unset directory asks you, once, which of the three you
1056
- want, and records your answer with the command above. And `--note "<text>"`
1057
- keeps the reason beside the entry, for the version of you that reads the list in
1058
- six months.
1059
-
1060
- ---
1061
-
1062
- ## 9. Upgrading
95
+ Close your Claude Code sessions, then:
1063
96
 
1064
97
  ```
1065
98
  bun add -g counterparts@latest
1066
99
  ```
1067
100
 
1068
- (From source: `git pull && npm pack` in the clone, then the tarball line from §2a.)
101
+ Your memory isn't changed by an upgrade. Open sessions keep running the old version until
102
+ they restart.
1069
103
 
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.
1078
-
1079
- ---
1080
-
1081
- ## 9a. Starting over
1082
-
1083
- You may want a blank memory — to see what a new user sees, or because the first
1084
- few days of a store are mostly you learning what it does. One command:
104
+ If you set it up before search by meaning was built in, it turns on by itself after the
105
+ upgrade. An older setup that used a Voyage or Anthropic key keeps working without it:
106
+ those settings are ignored now, and `counterparts doctor --all` lists them as old
107
+ settings you can delete (along with `~/.counterparts/credentials.env`, if you have one).
108
+ To turn search by meaning on after switching it off (your name and other settings are
109
+ kept):
1085
110
 
1086
111
  ```
1087
- counterparts start-fresh --config ~/.counterparts/claude-code.json
112
+ counterparts install --force --embedder
1088
113
  ```
1089
114
 
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.
115
+ ## Start over
1094
116
 
1095
- **Close every Claude Code session and every dashboard first.** A running session's
1096
- hooks and its MCP server hold the store open by a file handle, and a handle does
1097
- not follow a rename — until they restart, they go on writing into the directory
1098
- that was just parked. **Nothing in the command can check this for you**: a session
1099
- sitting idle writes nothing, so it leaves no record and no timestamp. What you can
1100
- do, in another terminal:
117
+ To set your memory aside and start with a blank one, close every Claude Code session and
118
+ dashboard, then run this from a plain terminal:
1101
119
 
1102
120
  ```
1103
- pgrep -fl counterparts
121
+ counterparts start-fresh
1104
122
  ```
1105
123
 
1106
- Look for lines running one of **ours**: `serve.ts` (an MCP server), `dashboard.ts`,
1107
- `hook.ts`, `runner.ts` (the worker). Each of those is holding the store open.
1108
- **Ignore anything that merely has the word in a path** — `pgrep -f` matches the
1109
- whole command line, so an editor, a `tail`, a dev server in a directory with this
1110
- name in it will all show up and none of them matters. This command will be in the
1111
- list too, while it waits for you.
1112
-
1113
- A dashboard and an MCP server leave **no live-session record at all**, so the
1114
- command cannot see them however hard it looks. That is why it asks you to type the
1115
- name, and why `--yes` on a store with anything in it is refused unless you also
1116
- pass `--nothing-is-open` — which is you saying the sentence `--yes` does not.
1117
-
1118
- **Run it from a plain terminal, not from inside Claude Code.** Your own session's
1119
- record is one the check refuses on, so it will turn you away — correctly — and you
1120
- will have closed the session anyway by the time you can answer.
1121
-
1122
- The command asks you to type the parked directory's name back before it does
1123
- anything.
1124
-
1125
- What it does, in order:
1126
-
1127
- 1. Renames `~/.counterparts/snapshots` to `snapshots.parked-<today>`, and then
1128
- `~/.counterparts/store` to `store.parked-<today>` (with a shared `-2` if you
1129
- have done this already today — both directories always wear the same suffix). **One atomic rename each. It never copies, never
1130
- deletes, and never opens the old store — not even read-only.**
1131
- 2. Creates a blank store back at `~/.counterparts/store`, by running `install`.
1132
- It builds it **beside** your memory first and moves it into place with one
1133
- rename, so there is never a stretch where the configuration points at nothing
1134
- and a stray hook could mint a store there.
1135
- 3. Leaves `claude-code.json`, `credentials.env` and `scopes.json` exactly as they
1136
- were, byte for byte. Your keys, your ceiling and your per-directory settings are
1137
- host wiring, not memory — and leaving `scopes.json` alone is the point: a
1138
- directory you turned **off** stays off on the new store, rather than quietly
1139
- starting to record again.
1140
-
1141
- The date in the parked name is **UTC**, like every other date this system writes,
1142
- so an evening run west of Greenwich parks under tomorrow's date. It is a label,
1143
- not a claim about your clock.
1144
-
1145
- Then **restart Claude Code**. There is almost certainly nothing to re-register: if
1146
- you registered the MCP server the way `install` prints it
1147
- (`-e COUNTERPARTS_DATA_DIR=<your store>`), that path has not moved and the blank
1148
- store is sitting at it. The command cannot read your host's files to check — it
1149
- never touches them — so if you want to be sure, `claude mcp get counterparts` says
1150
- what it was actually registered with.
124
+ It renames your current memory aside rather than deleting it. `counterparts start-fresh
125
+ --undo` puts it back.
1151
126
 
1152
- **`--dry-run` prints every rename and every file it would write and changes
1153
- nothing.** Run that first if you want to see it.
1154
-
1155
- **Going back is one command:**
1156
-
1157
- ```
1158
- counterparts start-fresh --undo
1159
- ```
1160
-
1161
- It parks the blank store, puts your memory back, puts the snapshots back — one
1162
- rename each, nothing deleted, nothing opened, and it refuses rather than moving
1163
- one directory inside another. It runs **exactly the same refusals as the forward
1164
- direction** — the same forbidden roots, the same symlink and absolute-path rules,
1165
- the same live-session check, the same `--yes` rule — and it will not act on a
1166
- recorded path that is not a parked directory of this store, because that record
1167
- is a row in a database. Restart Claude Code again afterwards.
1168
-
1169
- There is **no undo of an undo**: the store it displaces is parked under a
1170
- `blank-<date>` name, which nothing reads as a parked store. A successful undo
1171
- prints the two guarded lines that bring that one back.
1172
-
1173
- The same three moves are also **printed as shell lines**, before anything moves
1174
- and again afterwards, so the way back is on your screen even if this is
1175
- interrupted. Each printed line is guarded:
1176
-
1177
- ```
1178
- if [ -e "<destination>" ]; then echo "REFUSING: … already exists" >&2; false; else mv "<source>" "<destination>"; fi
1179
- ```
1180
-
1181
- That guard is not decoration. A bare `mv a b` where `b` is an existing directory
1182
- does not refuse and does not overwrite — it moves `a` **inside** `b`, and reports
1183
- success. The refusal exits non-zero, so a pasted block stops rather than carrying
1184
- on past it. The blank store is *parked* by the first line, not removed: nothing in
1185
- this command deletes anything, including an undo.
1186
-
1187
- Two more things it will not do:
1188
-
1189
- - It refuses `--dir`. The store it parks is the one your **configuration** names,
1190
- because that is the one your hooks and your MCP server open; a second answer on
1191
- the command line is how the wrong store would get moved. Use `--config` to name
1192
- a different configuration.
1193
- - It refuses by name to touch anything under `~/.bansai` or `~/.claude-engram`.
1194
- - It parks the snapshots folder only when that folder is the one this layout owns
1195
- (`~/.counterparts/snapshots`). A `snapshots.dir` or `snapshots.mirror` you pointed
1196
- somewhere of your own is **left alone** — it is your directory — and the command
1197
- says so. The new store's rotation then shares that folder with whatever is already
1198
- in it: copies of a store on the old floor are recognised there and never deleted
1199
- or counted, but copies this floor wrote do count toward `keep`, so the new store's
1200
- oldest copy could rotate out sooner than you expect.
1201
-
1202
- **On cut-over day, deploy first.** If you are moving from an older build, update
1203
- the checkout *before* you run this, not after: the older build does not have this
1204
- command at all, and in the gap between a fresh start and a deploy any session that
1205
- starts would run the old build against the new store and write half a memory into
1206
- each of them. The new build's hooks stand down cleanly and harmlessly against an
1207
- old store, so deploy-first costs nothing. Close everything, back up with the old
1208
- build (the new one cannot open an old store), deploy, then run this.
1209
-
1210
- If the store being parked was written **before this build's floor** — that same
1211
- case — the command says so, names the files it recognised, and carries on. It has nothing to open, so the
1212
- floor is not its problem: a rename does not care what is inside a directory. That
1213
- is also why the store you park stays readable by the build that wrote it
1214
- (`floor/v5-last`), exactly as it was.
1215
-
1216
- `counterparts status` on the new store will say what day it began on and where the
1217
- previous one is parked.
1218
-
1219
- ---
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:
127
+ ## Uninstall
1232
128
 
1233
129
  ```
130
+ counterparts uninstall
1234
131
  bun remove -g counterparts
1235
132
  ```
1236
133
 
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
-
1310
- ## 10. What is actually verified, and what is not
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
-
1317
- The install loop (`tools/install-loop/run.sh`) runs in a throwaway HOME with no
1318
- repo on its PATH and checks, every time:
1319
-
1320
- - `npm pack` produces a tarball, and it carries every relative file this page and
1321
- the README link to — no dead links inside the package;
1322
- - the tarball installs globally under bun and puts four working executables on
1323
- PATH, and the package's own `exports` map imports;
1324
- - `counterparts install` produces a store that opens, a config at
1325
- `~/.counterparts/claude-code.json`, and a 0600 credentials file, and writes no
1326
- host configuration;
1327
- - the printed hook command runs on a PATH with **no bun on it** — the one failure
1328
- a real host is likeliest to hit and the rest of the loop is blind to;
1329
- - the `SessionStart` hook, fed a real payload on stdin, returns a wake block and
1330
- exits 0, and registers the session under `<dataDir>/sessions/`;
1331
- - `counterparts note` then `counterparts ask` round-trips on the console, and
1332
- a `note` then `recall` round trip through `counterparts-mcp` over stdio
1333
- JSON-RPC returns the note;
1334
- - **and the one-memory case** (§7): one note in a fresh store, recalled by
1335
- question, comes back. It is its own step because a bug at store size one is
1336
- invisible to every check that seeds two rows — which is how one survived to a
1337
- stranger's first minute on 2026-09-04;
1338
- - a `session_end` through a separate `counterparts-mcp` process **binds lazily** to
1339
- the session the hook registered, and mints the memory — the deliberate write
1340
- path a real session uses, without a real session;
1341
- - the **one config rule** (§3a) at the two entry points that could not be checked
1342
- before it existed: `counterparts-hook --config <a second config>` works on the
1343
- store that file names, records it in the session file, and leaves the default
1344
- store untouched; `COUNTERPARTS_CONFIG` launches `counterparts-mcp` on a named
1345
- configuration; and a path that is named but unusable — relative, or absolute and
1346
- not there — refuses at both, the hook by standing down at exit 0, the server by
1347
- not starting;
1348
- - `rebrief` names the file its injection ceiling came from, falls back to the
1349
- hooks' config for a store that has none beside it, and refuses — listing every
1350
- path it tried — when nothing supplies one;
1351
- - `rebrief` renders a bundle and the next `SessionStart` injects it;
1352
- - the dashboard opens the same store.
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
-
1388
- **The loop cannot reach the npm registry.** It installs the tarball it packed,
1389
- from disk. `bun add -g counterparts` (§2) and `bun add -g counterparts@latest`
1390
- (§9) deliver that same package by another road, and that road is *unverified by
1391
- the loop*: only a real machine with a network can settle it.
1392
-
1393
- **The loop cannot launch Claude Code.** So these are *unverified by it* and only a
1394
- real session can settle them: that Claude Code reads the hooks block from
1395
- `settings.json` and runs `counterparts-hook` on all five events; that the wake
1396
- text actually reaches the model's context; that the Stop ask arrives (it is
1397
- delivered on stderr with exit 2, the one channel measured to work on this host);
1398
- and that `claude mcp add` registers a server the client then launches. **All four**
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.
1401
-
1402
- The fifth host behaviour — `session_end` binding to a live session **through the
1403
- registry**, since the server is never told a session id — the loop now does
1404
- exercise, end to end: the hook writes `sessions/<id>.json`, a separate
1405
- `counterparts-mcp` process is given only the data dir and the scope, and its
1406
- `session_end` binds to that record and mints the memory (loop step 34; the
1407
- refusals `session-unknown`, `scope-mismatch` and `session-required` are what the
1408
- step fails on). What is still unverified is the same thing as above: that this
1409
- happens inside a real Claude Code session, where the id comes from the host
1410
- rather than from a script.
1411
-
1412
- ---
1413
-
1414
- ## 11. Known rough edges
1415
-
1416
- 1. **Four entry points, two questions — and two deliberate exceptions.** WHICH
1417
- STORE: `counterparts` and `counterparts-dashboard`'s **views** read `--dir` or
1418
- `COUNTERPARTS_DATA_DIR`; `counterparts-mcp` reads `--dir` or
1419
- `COUNTERPARTS_DATA_DIR`; `counterparts-hook` and its worker take neither and
1420
- use the `dataDir` in the configuration they read, falling back to
1421
- `COUNTERPARTS_DATA_DIR` only when it names no store. The first exception is
1422
- the console's BULK REPAIRS — `migrate-cache --apply`, `repair-dates --apply`,
1423
- `backfill-claims --apply`, `repair-merged-beliefs --apply`, and `verify` with
1424
- `--rebuild`, `--prune-index`, `--retry-skipped` or `--drop-vectors`. Each rewrites a whole store
1425
- in one go, so each takes `--dir` and **refuses** a store named only by the
1426
- variable: an exported path is a shell's memory of where a store lives, not a
1427
- sentence you typed about this rewrite. `--yes`, where a command has one, skips
1428
- the typed confirmation and never stands in for `--dir`. The dry runs — every
1429
- one of these without its writing flag — read the variable as usual. The second
1430
- is `counterparts-dashboard serve`: it takes `--dir` and **refuses** to take the
1431
- store from `COUNTERPARTS_DATA_DIR` alone, because §7 tells you to export that
1432
- variable with the live store's path in it and `serve` puts a whole memory on a
1433
- socket in a browser — that choice is made in the command or not at all.
1434
- `--default-store` means the default (and reads the variable) if you want it.
1435
- WHICH CONFIGURATION: one rule for all four — `--config <absolute path>`, else
1436
- `COUNTERPARTS_CONFIG`, else the default. The asymmetry that is left is the
1437
- hook's: it is the one entry point with no `--dir`, so pointing it at another
1438
- store means pointing it at another configuration (§3a, §7). Both defaults can
1439
- be refused wholesale with `COUNTERPARTS_REQUIRE_EXPLICIT_DIR=1` (§7): with it
1440
- set, an unnamed store or an unnamed configuration is a refusal, not a fallback
1441
- — the one exception being `rebrief`'s ceiling, a number read from the default
1442
- config for a store you already named, which stays readable.
1443
- 2. **`bun add -g` needs an absolute tarball path — and the same error means "no
1444
- such file".** On bun 1.3.10 a relative path fails with
1445
- `error: ENOENT extracting tarball from ./x.tgz`, and so does an absolute path
1446
- naming a file that does not exist. Check `ls *.tgz`. Hence
1447
- `"$PWD"/counterparts-*.tgz` in §2a.
1448
- 3. **The store you point at and the host settings you get come from two different
1449
- files** — and you now have to move both. `--dir` / `COUNTERPARTS_DATA_DIR`
1450
- choose the store; the configuration supplies host settings — the embedder knob
1451
- and the credentials file for the MCP server and the hooks, and, as a last
1452
- resort, the injection ceiling for `counterparts rebrief` (§7). Running a
1453
- scratch store on a machine that already has a configured install will use that
1454
- install's keys unless you also pass `--config` / `COUNTERPARTS_CONFIG` (§3a),
1455
- and can compose a briefing under that install's ceiling. §6 says how to tell
1456
- from the `semantic` field; `rebrief` names the file it read, and the server
1457
- names it on stderr at launch.
1458
- 4. **The vector cache stores embeddings as JSON text.** On the owner's migrated
1459
- store that is 177 MB at 13.9K vectors, with a nearest-neighbour scan of
1460
- 0.6–1.0 s. Irrelevant to a fresh store; a named debt.
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.
1465
- 6. **Removal reaches the span buffer — with two things it names rather than
1466
- takes.** A note is captured verbatim into `spans/<12-hex key>/jots.jsonl`
1467
- before it is minted. Until 2026-09-05 `remove` chased the database,
1468
- the links and the cache and not that file, so a removed note's words survived
1469
- there and a backup taken afterwards copied them. The buffer is chased now
1470
- (§7). **Check it in three lines** — the marker text is only there so `grep`
1471
- has something to find:
1472
-
1473
- ```
1474
- counterparts note "ZQPROBE the culvert gate key is under the third fence post." --dir "$HOME/.counterparts/store"
1475
- counterparts remove <the mem_… it printed> --confirm --dir "$HOME/.counterparts/store"
1476
- grep -rl ZQPROBE "$HOME/.counterparts/store"
1477
- ```
1478
-
1479
- Nothing answers. Run the same three lines with the note taken through the MCP
1480
- tool mid-conversation and one file can still answer — `buffer.jsonl`, holding
1481
- the turn in which you SAID it. That is transcript, not the memory, and it is
1482
- left on purpose; `remove` counts it on a `spans echo` line rather than
1483
- passing over it. The other thing it names: a memory whose words are already
1484
- gone from its row AND whose mint recorded no span hash — an old row, or one
1485
- edited in the database by hand — cannot be addressed in the buffer at all, and
1486
- `remove` says which way it is blind on its `NOT chased` line and counts it
1487
- `unchased: 1` rather than reporting `nothing`.
1488
- 7. **The package ships the modules' own `CONTRACT.md`, `NOTES.md` and
1489
- `INTERFACE-GAPS.md`** — 40 files, 0.45 MB, in a 2.2 MB package (measured
1490
- 2026-09-04 on `npm pack --dry-run`, 742.2 kB packed over 168 files, plus the
1491
- tarball's own listing; the TypeScript sources are the bulk of the rest, and
1492
- the Markdown grows as the modules record what they learned). Deliberate: those files are what
1493
- `src/` is documented by, and this page points at them. Delete `src/**/*.md`
1494
- from your install if you would rather not carry them.
1495
- 8. **A configuration the hooks cannot read is a silent session with no memory.**
1496
- A named configuration that is missing, unreadable or not JSON is refused (§3a),
1497
- and the refusal happens before anything opens, so a stood-down hook leaves no
1498
- ring event, no session record, nothing durable — the right choice (it will not
1499
- write into a store it was not told about) with an unhelpful symptom: nothing
1500
- happens, and nothing says why. Two lines diagnose it:
1501
-
1502
- ```
1503
- echo '{"hook_event_name":"SessionStart","session_id":"smoke","cwd":"'"$PWD"'"}' | counterparts-hook
1504
- env | grep COUNTERPARTS_CONFIG
1505
- ```
1506
-
1507
- The first prints the stand-down reason on stderr; the second finds a stale
1508
- `COUNTERPARTS_CONFIG` exported into the environment Claude Code was launched
1509
- from, which is the likeliest cause and the hardest to see.
1510
-
1511
- ---
1512
-
1513
- ## 12. If the terminal says something at session start
1514
-
1515
- Claude Code prints one line of its own when a session starts and Counterparts has
1516
- found something RED. **On a fresh install there is nothing red, so there is no
1517
- line** — a store that has never had an API key is a supported way to run (§6),
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:
1521
-
1522
- ```
1523
- SessionStart:startup says: counterparts: Credentials — …/credentials.env holds no key:
1524
- ANTHROPIC_API_KEY is missing, so the worker will run without an interpreter; nothing is
1525
- encoded. Run: counterparts credentials set ANTHROPIC_API_KEY …
1526
- run: counterparts doctor
1527
- ```
1528
-
1529
- It is not an error and it blocks nothing: the wake still goes out on the same
1530
- turn, unchanged. **Red only** — the notice fires for the things that mean part of
1531
- the system is not running, never for the merely imperfect. Nothing red, and the
1532
- hook prints exactly what it always printed.
134
+ `uninstall` disconnects Claude Code and keeps your memory. Two options change what
135
+ happens to the memory:
1533
136
 
1534
- This exists because of a week in September 2026 when it did not. The credentials
1535
- file had been rewritten to its template by a forced install; every detached
1536
- worker was refused at every boundary; the lived-day clock froze, no sleep cycle
1537
- ran, nothing was embedded, and every ask was capped against a day that never
1538
- rolled over. Every visible surface — the wake, recall, capture, `verify`, the
1539
- daily record — read healthy the whole time.
137
+ - `--park` renames `~/.counterparts` aside. `counterparts install` offers to bring it back.
138
+ - `--delete-memories` deletes it, after asking you to type `DELETE MEMORIES`.
1540
139
 
1541
- ### `counterparts doctor`
140
+ Both show your memory's size first. Part of that can be a database log that shrinks on its
141
+ own; nothing is lost when it does.
1542
142
 
1543
- The same reading, in full, on demand, and read-only. It opens the store in
1544
- observer stance, writes nothing, and never prints a credential value:
143
+ To disconnect Claude Code without uninstalling, run `counterparts disconnect`.
144
+ `counterparts connect` reconnects it.
1545
145
 
1546
- ```
1547
- counterparts doctor
1548
- counterparts doctor --all # every line, folding nothing
1549
- counterparts doctor --json # the findings as JSON: ids, counts, severities
1550
- ```
1551
-
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 |
1575
- |---|---|
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 |
1583
- | Checkout | the checkout the hooks run is not an ancestor of `origin/master`, or has tracked modifications (amber when it is merely behind) |
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.
1594
-
1595
- Two things it does differently from every other command, and both matter. It
1596
- reads the store the **configuration** names (`--dir` overrides it), because the
1597
- question is whether the store the hooks open is healthy. And it reads the
1598
- credentials from the **file**, against an empty environment — a doctor that
1599
- counted your own shell would read green on a machine whose `~/.zshrc` exports
1600
- both keys while every hook process, which inherits neither, stayed blind.
1601
-
1602
- ### `counterparts credentials set <NAME>`
1603
-
1604
- The repair, in one command, with the value never touching your shell history:
1605
-
1606
- ```
1607
- printf '%s' "$KEY" | counterparts credentials set ANTHROPIC_API_KEY
1608
- counterparts credentials set VOYAGE_API_KEY --from-env MY_VOYAGE_KEY
1609
- counterparts credentials list
1610
- ```
1611
-
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
1619
- the configuration names, creating it 0600 or putting it back to 0600, replaces
1620
- that name's line (the template's commented placeholder included) and keeps every
1621
- other line and comment. `credentials list` says which of the two names the file
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:
146
+ ## Install from source
1624
147
 
1625
148
  ```
1626
- credentials: /…/credentials.env
1627
- ANTHROPIC_API_KEY missing
1628
- VOYAGE_API_KEY missing
1629
-
1630
- Add or change one: counterparts credentials set <NAME>
149
+ git clone https://github.com/mlapeter/counterparts.git
150
+ cd counterparts
151
+ npm pack
152
+ bun add -g "$PWD"/counterparts-*.tgz
1631
153
  ```
1632
154
 
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.
1637
-
1638
- Restarting is not required for the hooks: each is a fresh process and picks the
1639
- file up at the next event. The MCP server reads it once, at launch, so a running
1640
- session's `recall` keeps whatever it started with until the session restarts.
1641
-
1642
- ### Two things to know about both
1643
-
1644
- **`doctor` will not open a store nobody named when the guard is armed.** In a
1645
- shell exporting `COUNTERPARTS_REQUIRE_EXPLICIT_DIR=1` — this repo's own sessions
1646
- do — `counterparts doctor` refuses unless you name a configuration
1647
- (`--config <path>`, or `COUNTERPARTS_CONFIG`) or a store (`--dir <path>`). A
1648
- configuration found at the default path names the live store, and the guard is
1649
- armed precisely so that nothing nobody named gets opened. Without the guard set,
1650
- nothing changes: plain `counterparts doctor` reads the default configuration.
1651
-
1652
- **On a red day with a very long wake, the terminal may say nothing.** The host
1653
- caps a hook's output at 10,000 characters, and past that it replaces the text
1654
- with a preview — which would cost the session its whole wake. So when the wake
1655
- plus the notice would not fit, the hook prints the wake alone and drops the
1656
- notice (it leaves an `adapter.notice.dropped` row behind). `counterparts doctor`
1657
- still prints the finding in full.
155
+ The tarball path must be absolute. To work on the code instead, see
156
+ [`CONTRIBUTING.md`](../CONTRIBUTING.md).