counterparts 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,19 +3,68 @@
3
3
  **An AI that keeps its own memory of working with you — written in its own words, kept on
4
4
  your machine, and allowed to forget.**
5
5
 
6
- Every model you talk to is frozen. The only learning it does is what fits in its context
7
- window, and memory is what decides what goes in there. Most memory tools answer that by
8
- storing the transcript. Counterparts does not: the AI writes down what it *learned* at the
9
- end of a stretch of work, in the first person, and that interpretation is what gets kept.
10
- Unused memories fade the way human memories do. What survives is a small, structured
11
- account of your work together — plus a "who I have been" the AI reads at the start of
12
- every session. It runs entirely on your machine, in one small SQLite database you can read,
13
- back up or export to Markdown whenever you want, and no data leaves it unless you turn
14
- something on that sends it.
15
-
16
- *Built 2026-08-25, and the author's own daily memory under Claude Code since 2026-09-03.
17
- Node is untested — the [Status](#status-honestly) section is specific about what has been
18
- verified and what has not.*
6
+ Counterparts gives Claude Code a memory of you and your work. At the end of a stretch of
7
+ work the assistant writes down what it *learned*, in the first person, and that
8
+ interpretation is what gets kept. It all stays on your machine, in one small SQLite
9
+ database you can read, back up, or export as Markdown whenever you want.
10
+
11
+ ## Install
12
+
13
+ ```
14
+ curl -fsSL https://bun.sh/install | bash # only if you don't have bun
15
+ bun add -g counterparts
16
+ counterparts
17
+ ```
18
+
19
+ Check the middle line landed first: `counterparts --version` prints `counterparts 0.2.0`.
20
+ Then the bare command, with nothing set up, offers to do the rest — *No memory here yet.
21
+ Set it up now? [Y/n]*. `counterparts install` asks for the same conversation by name and is
22
+ also the repair: it is safe to run again. Nothing in it is compulsory:
23
+
24
+ - **your name** — what the memory calls you; Enter skips it;
25
+ - **Claude Code, connected for you.** It keeps a backup of your `~/.claude/settings.json`
26
+ and says so, adds five hooks **beside** any hooks belonging to other tools, and registers
27
+ the memory server. `counterparts disconnect` takes all of that back out and names the
28
+ backup file; `--no-connect` means don't; no Claude Code on the machine is one line and
29
+ the install carries on;
30
+ - **two optional API keys**, one at a time. Each is a `[y/N]` question with one line on
31
+ what it buys — Enter is no — and only a yes shows the link and takes the key, typed
32
+ hidden. **Skipping both is a supported way to run** — what you give up is written down,
33
+ not glossed over.
34
+
35
+ Then **restart Claude Code** (the memory tools arrive when a session starts) and check that
36
+ it *works*:
37
+
38
+ ```
39
+ counterparts doctor
40
+ ```
41
+
42
+ Two checks, two moments: `--version` says the program is there, `doctor` says it is
43
+ running. Green is fine. **OFF** is one of the two optional things you never turned on — a
44
+ dim line, not a fault. Amber is worth a look; red is a part that is not running, and the
45
+ only grade that makes it exit non-zero.
46
+
47
+ **To remove it:**
48
+
49
+ ```
50
+ counterparts uninstall
51
+ ```
52
+
53
+ That disconnects Claude Code, **keeps your memory**, and names the one line that removes
54
+ the package itself. `--park` sets the whole `~/.counterparts` folder aside under a dated
55
+ name in one rename — and `counterparts install` finds it there and offers to bring it
56
+ back. `--delete-memories` destroys it instead, after listing every path with its size and
57
+ asking you to type `DELETE MEMORIES`; Esc, Enter or `cancel` at that prompt stops and says
58
+ nothing was deleted. Neither happens unless you ask for it.
59
+
60
+ The whole install path, with every flag and every reason:
61
+ [`docs/QUICKSTART.md`](docs/QUICKSTART.md) — §1 to §5 is all of it, and everything below
62
+ its "Reference" line is detail.
63
+
64
+ **You need [bun](https://bun.sh) 1.3 or newer**, and nothing else. Counterparts ships as
65
+ TypeScript sources and runs them directly — no build step, no `dist/`. **Node is
66
+ untested**; the [Status](#status-honestly) section is specific about what has been verified
67
+ and what has not.
19
68
 
20
69
  <!-- Images are produced by the dashboard workstream and land under docs/images/.
21
70
  The URLs are absolute so this file reads correctly from the npm tarball as
@@ -32,23 +81,14 @@ verified and what has not.*
32
81
 
33
82
  ---
34
83
 
35
- ## Install
36
-
37
- **[`docs/QUICKSTART.md`](docs/QUICKSTART.md) is the one canonical install path** and this
38
- is the summary of it. That page is kept honest mechanically: `tools/install-loop/run.sh`
39
- runs the page's console commands verbatim — each one is grepped out of the page before it
40
- is executed, so a doc edit that changes one fails the loop — in a throwaway home directory
41
- with no copy of this repository on the PATH. It packs the tarball itself and feeds the
42
- hook its own payload. It cannot reach the npm registry, and it cannot run `git clone`,
43
- `claude mcp add` or Claude Code; QUICKSTART §10 lists what that leaves unverified.
44
-
45
- **You need [bun](https://bun.sh) 1.3 or newer.** Counterparts ships as TypeScript sources
46
- and runs them directly — there is no build step and no `dist/`. **Node is untested.** The
47
- store uses Node's built-in `node:sqlite`, which needs Node 22.5+ behind a flag and 23.4+
48
- by default; nobody has run this package under any Node, so it claims nothing there.
84
+ ## Why
49
85
 
50
- That is the only prerequisite. (Installing from source also needs `npm`, for `npm pack`;
51
- QUICKSTART §1 and §2 cover that road.)
86
+ Every model you talk to is frozen. The only learning it does is what fits in its context
87
+ window, and memory is what decides what goes in there. Most memory tools answer that by
88
+ storing the transcript; this one stores the interpretation instead, and lets it fade —
89
+ unused memories decay the way human memories do. What survives is a small, structured
90
+ account of your work together, plus a "who I have been" the AI reads at the start of
91
+ every session.
52
92
 
53
93
  **No API keys are required.** With none, two things are off. Recall runs on its text
54
94
  channel alone rather than also matching by meaning; an embedding key buys the other half —
@@ -58,60 +98,27 @@ environment variable switches on. And the crash-recovery path — the one that r
58
98
  a session that ended before the AI could write it up — cannot run; when it does run, it
59
99
  sends that captured conversation to a model provider. Both are the only two ways anything
60
100
  here leaves your machine, and both are yours to turn on. `counterparts doctor` grades a
61
- store that has never had a key **amber**, not red, and says on the line what works without
62
- one — so a fresh keyless install is a clean bill of health and not an alarm.
101
+ store that has never had a key **OFF** — dim, optional, never turned on — rather than red
102
+ or amber, and says on the line what works without one, so a fresh keyless install reads as
103
+ a clean bill of health and not as an alarm.
63
104
 
64
- ```
65
- bun add -g counterparts
66
- ```
67
-
68
- (Contributors, and anyone sent a tarball: QUICKSTART §2 has the from-source road.)
69
-
70
- That installs four executables — `counterparts` (your console), `counterparts-hook`,
71
- `counterparts-mcp` and `counterparts-dashboard` — into bun's global bin directory. Check
72
- that directory is on your PATH before going on: run `counterparts --help`, and if it says
73
- *command not found*, QUICKSTART §2 has the one-line fix. A fresh bun install does not
74
- always do this for you. Then create the store:
105
+ **It works with no host at all.** `$HOME/.counterparts/store` is the default data dir, so
106
+ this works with nothing set:
75
107
 
76
108
  ```
77
- counterparts install --budget 9000 --name "Your Name"
109
+ counterparts note "The espresso machine in the kitchen is a Rancilio Silvia."
110
+ counterparts ask "what espresso machine is in the kitchen?"
78
111
  ```
79
112
 
80
- `--budget` is the size ceiling, in bytes, for the briefing injected at the start of each
81
- session; 9,000 is the number the author's host runs on, and the package has no default for
82
- one. This writes a store, a configuration file, and a 0600 credentials file holding only
83
- comments that name the two keys, all under
84
- `~/.counterparts/`, and then **prints — without applying** — the two things that belong to
85
- Claude Code: a block of hooks to merge into its settings, and one `claude mcp add` command
86
- to run. It never edits your Claude Code configuration for you. Apply both, restart Claude
87
- Code, and you are running. QUICKSTART §4 has them, and the reasons every path in them must
88
- be absolute.
89
-
90
- The hooks are registered once, globally, so every directory you open a session in is
113
+ That works on the very first memory — a store holding one memory answers the question
114
+ about it — and the install loop checks that case on every run.
115
+
116
+ **The hooks are registered once, globally**, so every directory you open a session in is
91
117
  remembered by default. `counterparts scope . --off` says otherwise for one directory —
92
118
  `--observer` for reads-only, `--pause` for an afternoon, `--resume` to put it back — and
93
119
  the first session in a directory nobody has answered for asks you which you want.
94
120
  QUICKSTART §8 has the rest.
95
121
 
96
- `install` owns `~/.counterparts/` and is the cold start — run it once. For a second store,
97
- a scratch store, or a store you will only reach from the console, use
98
- `counterparts init --dir <path> --name "Your Name"`: just a store, anywhere, with no host
99
- config and no credentials file. QUICKSTART §3 has the difference.
100
-
101
- You can also use it with no host at all. `$HOME/.counterparts/store` is the default data
102
- dir, so this works with nothing set; the `export` is there for anyone whose store lives
103
- elsewhere or who would rather be explicit than rely on a default.
104
-
105
- ```
106
- export COUNTERPARTS_DATA_DIR="$HOME/.counterparts/store"
107
- counterparts note "The espresso machine in the kitchen is a Rancilio Silvia."
108
- counterparts recall "what espresso machine is in the kitchen?"
109
- ```
110
-
111
- That works on the very first memory — a store holding one memory answers the question
112
- about it, whether or not `--name` put an identity core beside it — and the install loop
113
- checks that case on every run.
114
-
115
122
  **Starting over is one command.** If you want a blank memory — to see what a new user
116
123
  sees, or because the first few days of a store are mostly you learning what it does —
117
124
  close every Claude Code session and run:
@@ -176,51 +183,96 @@ generated from a list of stated privileges, each naming the file that enforces i
176
183
  | `session_end` | Hand back what this session taught, as memories, in the AI's own words. |
177
184
  | `chapter` | Write this stretch of the session into the AI's own first-person journal, at any length. |
178
185
 
179
- **Your console** — `counterparts <command>`. Read-only: `status`, `recall`, `doctor` (is
180
- the background half alive? — the one troubleshooting command, QUICKSTART §12), `fired`
181
- (which mechanisms have actually fired, and which have not), and `probe-oq4` (the
182
- footnote-header probe, recall CONTRACT §7). `verify` is
183
- a census of the search cache against the real state, and `--rebuild` is what rebuilds it —
184
- which is why `verify` counts as a write and refuses under `--observer` even without the
185
- flag. `export` is a read too: it copies the store — as one SQLite file, or, with `--markdown`,
186
- as a readable tree of one file per memory plus the journal and the self page — encrypted
187
- under a passphrase or explicitly `--plaintext`, because it refuses to choose for you.
188
- `--markdown` omits confidential memories unless you pass `--include-confidential`, and says
189
- how many it left out. The rest write: `install`, `init`, `note`, `backup`, `remove` (a dry run
190
- unless you pass `--confirm`, and it asks a human before it acts), `backfill-claims`,
191
- `repair-merged-beliefs` (a dry run unless you pass `--apply`), and `rebrief`. Pass `--observer` to any of them and the console stands down: everything is
192
- read-only, and the commands that would write refuse instead.
193
-
194
- **The dashboard** — `counterparts-dashboard`, read-only, writing nothing, ever. Five views
195
- in your terminal: `status` (the brain at a glance), `browse` (memories by strength),
196
- `stories` (per contested belief, the pressure log as a story), `identity`, and `activity`.
197
- And a local **web** dashboard: `counterparts-dashboard serve --dir <store> [--port <n>]`,
198
- bound to 127.0.0.1 only, default port 4747 — an overview, memories, mind, flow and health,
199
- plus a `/brain` view. The screenshots above come from it. `--dir` is not optional:
200
- without it, `serve` refuses rather than opening the default store, and names the store
201
- it would have opened. Pass `--default-store` if you meant the default.
186
+ **Your console** — `counterparts <command>`. `counterparts --help` is fourteen commands in
187
+ three groups (Everyday, Setup, Your data), one line each; `counterparts help <command>` is
188
+ the detail for one; `counterparts help advanced` is the maintenance and developer half —
189
+ `note`, `fired`, `init`, `start-fresh`, `verify`, `rebrief`, the repairs, `probe-oq4`, and
190
+ the three flags that work everywhere. `counterparts --version` opens nothing.
191
+ Read-only: `ask` (the listed spelling of what the MCP tool still calls `recall`), `status`,
192
+ `doctor` (the one troubleshooting command, QUICKSTART §12), `fired`, `self-page` and
193
+ `probe-oq4` (the footnote-header probe, recall CONTRACT §7). `verify` is a census of the
194
+ search cache against the real state, and `--rebuild` is what rebuilds it — which is why
195
+ `verify` counts as a write and refuses under `--observer` even without the flag. `export`
196
+ is a read too: it copies the store — as one SQLite file, or, with `--markdown`, as a
197
+ readable tree of one file per memory plus the journal and the self page — encrypted under a
198
+ passphrase or explicitly `--plaintext`, because it refuses to choose for you. `--markdown`
199
+ omits confidential memories unless you pass `--include-confidential`, and says how many it
200
+ left out. The rest write: `install`, `init`, `connect`, `disconnect`, `uninstall`,
201
+ `credentials set`, `note`, `backup`, `start-fresh`, `backfill-claims`,
202
+ `repair-merged-beliefs` (a dry run unless you pass `--apply`), `rebrief`, and `remove` —
203
+ which at a terminal asks for an id or for words, numbers what it finds, lets you pick one
204
+ or several, shows the plan and asks once; `--confirm` is the scripted door, and anywhere
205
+ nobody can be asked it prints the plan and changes nothing. Pass
206
+ `--observer` to any of them and the console stands down: everything is read-only, and the
207
+ commands that would write refuse instead.
208
+
209
+ **The dashboard** — read-only, writing nothing, ever. `counterparts dashboard` starts the
210
+ local **web** dashboard on the store your configuration names — no `--dir` to get right —
211
+ prints `http://127.0.0.1:4747`, opens your browser, and stops on Ctrl-C. Bound to 127.0.0.1
212
+ only, it is where the screenshots above come from: an overview, memories, mind, flow and
213
+ health, plus a `/brain` view. The `counterparts-dashboard` binary is still there for the
214
+ five terminal views — `status` (the brain at a glance), `browse` (memories by strength),
215
+ `stories` (per contested belief, the pressure log as a story), `identity` and `activity` —
216
+ and for `serve --dir <store> [--port <n>]`, where `--dir` is not optional: without it,
217
+ `serve` refuses rather than opening the default store, names the store it would have
218
+ opened, and `--default-store` is how you say you meant it.
202
219
 
203
220
  ---
204
221
 
205
222
  ## Status, honestly
206
223
 
207
- **Feature-complete 2026-08-25.** Since **2026-09-03** it has been the author's primary
208
- memory under Claude Code, running beside its predecessor so the two can be compared. On
209
- 2026-09-04 that store held 13,751 memories. The living record of what is true right now is
210
- [`docs/PARALLEL-RUN-STATUS.md`](https://github.com/mlapeter/counterparts/blob/master/docs/PARALLEL-RUN-STATUS.md),
211
- and the launch scoreboard — including the bugs found this week — is
212
- [`docs/LAUNCH-STATUS.md`](https://github.com/mlapeter/counterparts/blob/master/docs/LAUNCH-STATUS.md).
213
-
214
- **The test suite, measured 2026-09-04 on commit `b29034c` under bun 1.3.10:** `bun test` →
215
- **1,572 pass, 0 fail, nothing skipped**, over 20,800 assertions across 26 files, about
216
- 19 s. (Three consecutive runs on that commit gave 20,813 / 20,836 / 20,832 assertions — a
217
- few tests assert once per row of data they generate — while the pass and fail counts did
218
- not move.)
224
+ **First published on npm on 2026-09-21, as `counterparts@0.1.0`.** This is **0.2.0** — one
225
+ round of polish after the author installed that first release the way a stranger would,
226
+ and wrote down everything that was rough about it.
227
+
228
+ **It is the author's own daily memory under Claude Code.** Feature-complete 2026-08-25;
229
+ running beside him every day since 2026-09-03. On 2026-09-21 he parked the store that had
230
+ grown over those weeks, installed the published package from npm, and started again on a
231
+ blank memory — so the *store* he is running is new and the *code* is what has been
232
+ exercised daily for a month.
233
+
234
+ **2026-09-22 — the trial, and the round it produced.** The author took 0.2.0 as a tarball
235
+ into a plain terminal, with no Claude Code session and no help: swap the package, `--help`,
236
+ `doctor`, `uninstall --delete-memories` with the wrong phrase typed on purpose (refused,
237
+ nothing changed), `uninstall --park`, then `install` again. Every step did what the sheet
238
+ in front of him said it would, so what came back was not bugs but **words** — eleven of
239
+ them, written down as findings 17–27 in the repository's new-user-findings page and
240
+ answered one at a time. Six pull requests followed the same day (#170–#175), two of them
241
+ adversarially reviewed by a second agent first — the reviews are comments on PRs #170 and
242
+ #173, not files in this repository — and each review found a blocker: `remove` had been
243
+ deciding "is anybody there" from stdin alone, so a redirected stdout turned a dry run into
244
+ a live deletion; and `install --force` at a terminal silently replaced `claude-code.json`,
245
+ which on the new path could throw away a configuration a park had just handed back. Both
246
+ were fixed before merge.
247
+
248
+ **The test suite, measured 2026-09-22 on this branch under bun 1.3.10:** `bun test` →
249
+ **3,182 pass, 0 fail, nothing skipped**, around 41,000 assertions across 51 files, 80
250
+ seconds. The install loop runs 58/58. (The assertion count moves by a few hundred between
251
+ runs — a few tests assert once per row of data they generate — while the pass and fail
252
+ counts do not.)
219
253
  No test touches a real store, and that is mechanized rather than promised:
220
254
  `test/preload.ts` runs before every test file, redirects `homedir()` to a fresh temporary
221
255
  directory for the whole run, clears `COUNTERPARTS_DATA_DIR`, and removes the directory on
222
256
  exit — so for the length of a test run there is no real home to reach.
223
257
 
258
+ **The install loop, and what it cannot settle.** `tools/install-loop/run.sh` installs this
259
+ package the way a stranger would — from a tarball it packs itself, into a throwaway home
260
+ directory with no copy of this repository on its PATH — and runs 58 checks in about five
261
+ seconds: the store, the config, the credentials file, the hook fed a real payload, a note
262
+ and an `ask` on the console and again through the MCP server, the lazy session bind, the
263
+ scope switch, and the host's own files (`connect` merging beside another tool's hooks,
264
+ `disconnect` taking only ours back out, `uninstall` leaving the memory alone). It also runs
265
+ every console command on the QUICKSTART page verbatim, grepping each one out of the page
266
+ first, so a doc edit that changes a command fails the loop.
267
+ **What it cannot do**: reach the npm registry (it installs from disk), run `git clone`,
268
+ launch Claude Code, or run the real `claude mcp add` — a stub answers. And it runs
269
+ non-interactively, so the install conversation above is covered by unit tests and one run
270
+ on a real pty, not by the loop.
271
+
272
+ **Node is untested.** The store binds `bun:sqlite` under bun and `node:sqlite` under Node
273
+ (22.5+ behind a flag, 23.4+ by default), but nobody has run this package under any Node,
274
+ so it claims nothing there. `package.json` names bun and does not claim Node.
275
+
224
276
  **Verified inside real Claude Code sessions**, on the author's machine: the hooks fire on
225
277
  all five events, the MCP server registers and its tools are used daily, the briefing
226
278
  reaches the model, and both `backup` and — in September 2026, with a one-shot tool this
@@ -231,8 +283,8 @@ blank, and what comes over from an earlier generation is its own later conversat
231
283
  end (which is also where the residue in rough edge 4 was found, and where the chase that
232
284
  closed it is asserted — note, remove, grep the whole store, back it up and grep that), and
233
285
  the console's and dashboard's behaviour on a missing store. **Not verified at
234
- all**: anything under Node, and — until you do it — a stranger installing from the
235
- documentation on a machine with no copy of this repository.
286
+ all**: anything under Node, and — until you do it — a stranger installing from this
287
+ documentation on a machine that is not the author's.
236
288
 
237
289
  **Known rough edges.** QUICKSTART §11 carries the install-facing ones — 1 as its §11.3, 2
238
290
  as its §11.4, and 4 as its §11.6 with a reproduction (and in §7, where `remove` is run). 3 lives in QUICKSTART §6,
@@ -259,9 +311,14 @@ where the embedder knob is set, and 5 in §1 with the runtime requirements:
259
311
  2. **The vector cache stores embeddings as JSON text.** On the author's migrated store
260
312
  that is 177.5 MB for about 13,900 vectors, and a nearest-neighbour scan of 0.6–1.0 s.
261
313
  Irrelevant to a fresh store; a named debt.
262
- 3. **An embedding key alone does nothing.** You must also turn the knob on, deliberately —
263
- `--embedder` at install, or `"embedder": { "enabled": true }` in the configuration.
264
- Absent that, no client is built and no connection opens whatever keys are lying around.
314
+ 3. **An embedding key alone does nothing.** You must also turn the knob on, deliberately.
315
+ Since 2026-09-22 that is a command rather than a JSON edit: `counterparts credentials
316
+ set VOYAGE_API_KEY`, typed at a terminal, saves the key and then asks whether to turn
317
+ recall-by-meaning on with it (`--embedder` at install does the same, and
318
+ `"embedder": { "enabled": true }` in the configuration is still what both of them
319
+ write). Absent that, no client is built and no connection opens whatever keys are lying
320
+ around — which is the point: a pipe, `--from-env` and CI are asked nothing and turn on
321
+ nothing.
265
322
  4. **Removal reaches every surface but one, and names the one.** `remove` chases a memory
266
323
  out of the database that holds its words and its earlier versions, out of the links, out
267
324
  of the search cache, out of the journal's markdown copy — and, since 2026-09-05, out of
@@ -323,8 +380,8 @@ used in earnest before the next was written.
323
380
  - **engram**, the production ancestor, which contributed the first eight hard-won failure
324
381
  cases that this repository carries as acceptance criteria.
325
382
  - **v1 — bansai**, the full system this one distills: its behavioral specification, its
326
- earned mechanisms, its test spine and twenty more of those failure cases. It keeps
327
- running until Counterparts has finished proving itself beside it.
383
+ earned mechanisms, its test spine and twenty more of those failure cases. It ran as the
384
+ author's live memory until Counterparts took over.
328
385
 
329
386
  The rule across all three generations is one of the constitution's own: **"port the scars,
330
387
  not the code."** A lesson travels forward as a test that has to pass, never as copy-paste.
@@ -337,8 +394,8 @@ not the code."** A lesson travels forward as a test that has to pass, never as c
337
394
 
338
395
  **Not open to contributions yet.** There is no contributor agreement and no process, and
339
396
  it would be dishonest to invite pull requests into a codebase that is still changing
340
- underneath a live parallel run. Issues and questions are welcome. When contributions open,
341
- this section will say so.
397
+ week to week. Issues and questions are welcome. When contributions open, this section will
398
+ say so.
342
399
 
343
400
  ## Read next
344
401