counterparts 0.1.0 → 0.3.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 +93 -316
- package/docs/QUICKSTART.md +87 -1189
- package/docs/README.md +86 -0
- package/docs/module-map.md +1 -0
- package/package.json +5 -2
- package/src/adapters/claude-code/CONTRACT.md +151 -18
- package/src/adapters/claude-code/INTERFACE-GAPS.md +138 -2
- package/src/adapters/claude-code/NOTES.md +452 -0
- package/src/adapters/claude-code/bin/hook.ts +221 -49
- package/src/adapters/claude-code/bin/runner.ts +220 -101
- package/src/adapters/claude-code/config.ts +202 -279
- package/src/adapters/claude-code/doctor.ts +1115 -416
- package/src/adapters/claude-code/embed-client.ts +165 -557
- package/src/adapters/claude-code/hooks.ts +409 -116
- package/src/adapters/claude-code/index.ts +7 -59
- package/src/adapters/claude-code/page-writer.ts +24 -4
- package/src/adapters/claude-code/spawn.ts +6 -7
- package/src/adapters/claude-code/transcript.ts +204 -10
- package/src/adapters/claude-code/vectors.ts +108 -24
- package/src/adapters/cli/CONTRACT.md +360 -8
- package/src/adapters/cli/INTERFACE-GAPS.md +45 -2
- package/src/adapters/cli/NOTES.md +916 -1
- package/src/adapters/cli/bin/counterparts.ts +63 -20
- package/src/adapters/cli/commands.ts +2769 -656
- package/src/adapters/cli/help.ts +467 -0
- package/src/adapters/cli/index.ts +36 -3
- package/src/adapters/cli/install.ts +446 -89
- package/src/adapters/cli/removal.ts +52 -23
- package/src/adapters/cli/report.ts +336 -0
- package/src/adapters/cli/ui.ts +917 -0
- package/src/adapters/cli/uninstall.ts +1380 -0
- package/src/adapters/cli/wire.ts +1699 -0
- package/src/adapters/dashboard/INTERFACE-GAPS.md +14 -2
- package/src/adapters/dashboard/activity.ts +4 -1
- package/src/adapters/dashboard/bin/dashboard.ts +1 -1
- package/src/adapters/dashboard/registries.ts +16 -1
- package/src/adapters/dashboard/resolve.ts +4 -4
- package/src/adapters/dashboard/source.ts +8 -2
- package/src/adapters/dashboard/web/flow.ts +6 -0
- package/src/adapters/dashboard/web/narrate.ts +66 -14
- package/src/adapters/dashboard/web/reveal.ts +6 -6
- package/src/adapters/dashboard/web/views.ts +12 -4
- package/src/adapters/fired.ts +20 -5
- package/src/adapters/mcp/CONTRACT.md +77 -2
- package/src/adapters/mcp/INTERFACE-GAPS.md +51 -1
- package/src/adapters/mcp/NOTES.md +416 -0
- package/src/adapters/mcp/bin/serve.ts +24 -35
- package/src/adapters/mcp/deliberate.ts +22 -0
- package/src/adapters/mcp/index.ts +26 -2
- package/src/adapters/mcp/server.ts +460 -43
- package/src/adapters/mcp/tools.ts +35 -5
- package/src/adapters/mcp/write-up.ts +454 -0
- package/src/adapters/sessions.ts +1353 -0
- package/src/core/counterpart.ts +32 -8
- package/src/core/embed/CONTRACT.md +85 -0
- package/src/core/embed/NOTES.md +93 -0
- package/src/core/embed/static.ts +622 -0
- package/src/core/encode/INTERFACE-GAPS.md +17 -0
- package/src/core/encode/NOTES.md +78 -0
- package/src/core/encode/secrets.ts +309 -9
- package/src/core/handoff/INTERFACE-GAPS.md +13 -1
- package/src/core/recall/CONTRACT.md +15 -3
- package/src/core/recall/INTERFACE-GAPS.md +94 -0
- package/src/core/recall/NOTES.md +49 -0
- package/src/core/recall/activate.ts +37 -3
- package/src/core/recall/index.ts +22 -1
- package/src/core/recall/session.ts +32 -0
- package/src/core/recall/tunables.ts +99 -2
- package/src/core/remember/CONTRACT.md +51 -7
- package/src/core/remember/INTERFACE-GAPS.md +111 -1
- package/src/core/remember/NOTES.md +221 -1
- package/src/core/remember/index.ts +28 -0
- package/src/core/remember/owes.ts +532 -0
- package/src/core/remember/owner-strike-seam.ts +34 -2
- package/src/core/remember/proposals.ts +25 -6
- package/src/core/remember/retention.ts +154 -0
- package/src/core/remember/spans.ts +53 -12
- package/src/core/remember/tunables.ts +8 -0
- package/src/core/remember/write-up-seam.ts +104 -0
- package/src/core/self/CONTRACT.md +16 -13
- package/src/core/self/INTERFACE-GAPS.md +8 -1
- package/src/core/self/NOTES.md +123 -1
- package/src/core/self/calendar.ts +81 -0
- package/src/core/self/episodes.ts +158 -36
- package/src/core/self/identity.ts +2 -2
- package/src/core/self/index.ts +88 -20
- package/src/core/self/tunables.ts +18 -46
- package/src/core/self/writer.ts +58 -9
- package/src/core/store/CONTRACT.md +16 -1
- package/src/core/store/NOTES.md +317 -0
- package/src/core/store/cache.ts +585 -27
- package/src/core/store/db.ts +97 -0
- package/src/core/store/index.ts +607 -13
- package/tools/install-loop/run.sh +229 -71
- package/src/adapters/claude-code/credentials.ts +0 -199
- package/src/adapters/claude-code/interpret-client.ts +0 -395
package/README.md
CHANGED
|
@@ -1,348 +1,125 @@
|
|
|
1
1
|
# Counterparts
|
|
2
2
|
|
|
3
|
-
**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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.*
|
|
19
|
-
|
|
20
|
-
<!-- Images are produced by the dashboard workstream and land under docs/images/.
|
|
21
|
-
The URLs are absolute so this file reads correctly from the npm tarball as
|
|
22
|
-
well as from GitHub, and so the install loop's link check does not demand a
|
|
23
|
-
file that does not exist yet. -->
|
|
24
|
-

|
|
25
|
-
*Overview (a synthetic demo store — no real memory appears in any screenshot here).*
|
|
26
|
-
|
|
27
|
-

|
|
28
|
-
*Flow — the architecture, alive. A memory just typed at the console is arriving through the authored door, and only a real event ever moves anything here; the panel holds one mechanism (sleep, here), its brain analogy, and where that analogy deliberately breaks (the same synthetic store).*
|
|
29
|
-
|
|
30
|
-

|
|
31
|
-
*Brain view — the same machinery mapped to a rough anatomy; regions flash on real events (same synthetic store).*
|
|
32
|
-
|
|
33
|
-
---
|
|
3
|
+
**Agents are great. What you're missing is a counterpart.**
|
|
4
|
+
|
|
5
|
+
Counterparts gives your AI assistant its own memory, modeled on human memory. It writes
|
|
6
|
+
its memories itself, and they fade and grow the way yours do. It runs today with
|
|
7
|
+
[Claude Code](https://claude.com/claude-code).
|
|
8
|
+
|
|
9
|
+
[counterparts.ai](https://counterparts.ai)
|
|
34
10
|
|
|
35
11
|
## Install
|
|
36
12
|
|
|
37
|
-
|
|
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.
|
|
49
|
-
|
|
50
|
-
That is the only prerequisite. (Installing from source also needs `npm`, for `npm pack`;
|
|
51
|
-
QUICKSTART §1 and §2 cover that road.)
|
|
52
|
-
|
|
53
|
-
**No API keys are required.** With none, two things are off. Recall runs on its text
|
|
54
|
-
channel alone rather than also matching by meaning; an embedding key buys the other half —
|
|
55
|
-
and it stays off by default even when a key is present, because embedding means sending
|
|
56
|
-
memory text to a third party, which should be a decision rather than something a stray
|
|
57
|
-
environment variable switches on. And the crash-recovery path — the one that reconstructs
|
|
58
|
-
a session that ended before the AI could write it up — cannot run; when it does run, it
|
|
59
|
-
sends that captured conversation to a model provider. Both are the only two ways anything
|
|
60
|
-
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.
|
|
13
|
+
You need [bun](https://bun.sh) 1.3 or newer (`npm install` won't work; it needs bun).
|
|
63
14
|
|
|
64
15
|
```
|
|
16
|
+
curl -fsSL https://bun.sh/install | bash # if you don't have bun
|
|
65
17
|
bun add -g counterparts
|
|
18
|
+
counterparts
|
|
66
19
|
```
|
|
67
20
|
|
|
68
|
-
|
|
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:
|
|
21
|
+
`counterparts` walks you through setup: your name and connecting Claude Code. No API
|
|
22
|
+
keys. Then restart Claude Code and check it:
|
|
75
23
|
|
|
76
24
|
```
|
|
77
|
-
counterparts
|
|
25
|
+
counterparts doctor
|
|
78
26
|
```
|
|
79
27
|
|
|
80
|
-
|
|
81
|
-
|
|
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
|
|
91
|
-
remembered by default. `counterparts scope . --off` says otherwise for one directory —
|
|
92
|
-
`--observer` for reads-only, `--pause` for an afternoon, `--resume` to put it back — and
|
|
93
|
-
the first session in a directory nobody has answered for asks you which you want.
|
|
94
|
-
QUICKSTART §8 has the rest.
|
|
95
|
-
|
|
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.
|
|
28
|
+
To remove it, run `counterparts uninstall`. Your memory is kept unless you ask for it
|
|
29
|
+
to be deleted. The full walkthrough is in [`docs/QUICKSTART.md`](docs/QUICKSTART.md).
|
|
104
30
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
## What it does
|
|
34
|
+
|
|
35
|
+
- **It writes its own memories.** At the end of a session it writes down what it
|
|
36
|
+
learned, in its own words. Notes, not transcripts.
|
|
37
|
+
- **It forgets on purpose.** Memories fade unless they come up again. What matters
|
|
38
|
+
sticks; the rest lets go.
|
|
39
|
+
- **It knows who it has been.** Every session opens with a short "who I am, who you are,
|
|
40
|
+
where we left off" that it wrote itself.
|
|
41
|
+
- **It keeps a journal.** Each session becomes a chapter in a first-person account of
|
|
42
|
+
your time together.
|
|
43
|
+
- **It changes its mind slowly.** What it believes about you shifts only under real
|
|
44
|
+
evidence, and it keeps the history of what it used to think.
|
|
45
|
+
- **Things come to mind.** As you talk, related memories surface quietly, the way one
|
|
46
|
+
thing reminds you of another.
|
|
47
|
+
- **It's yours.** Everything lives on your machine in one SQLite file you can read,
|
|
48
|
+
export or delete. No API keys, no accounts, nothing sent anywhere.
|
|
49
|
+
|
|
50
|
+
## Who it's for
|
|
51
|
+
|
|
52
|
+
People interested in giving an AI its own sense of self and building a relationship
|
|
53
|
+
with it over time. Tinkerers, researchers, writers, and anyone who talks to an assistant
|
|
54
|
+
every day and wishes it remembered.
|
|
55
|
+
|
|
56
|
+
## What it's not
|
|
57
|
+
|
|
58
|
+
It's not a work memory. It doesn't track your tasks, code conventions or project docs.
|
|
59
|
+
Plenty of tools do that, including the memory built into ChatGPT and Claude.
|
|
110
60
|
|
|
111
|
-
|
|
112
|
-
about it, whether or not `--name` put an identity core beside it — and the install loop
|
|
113
|
-
checks that case on every run.
|
|
61
|
+
## Where it's going
|
|
114
62
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
63
|
+
Today's models are frozen, so memory is the only learning they do. Once a real memory
|
|
64
|
+
works on top of a frozen model, the plan is to pair it with an open-weight model whose
|
|
65
|
+
weights can change, so the AI can learn and grow, not just remember.
|
|
66
|
+
|
|
67
|
+
## Using it
|
|
68
|
+
|
|
69
|
+
Once installed it runs on its own. A few commands are worth knowing:
|
|
118
70
|
|
|
119
71
|
```
|
|
120
|
-
counterparts
|
|
72
|
+
counterparts dashboard # look at the memory in your browser
|
|
73
|
+
counterparts ask "..." # ask the memory a question
|
|
74
|
+
counterparts scope . --off # don't remember this directory
|
|
75
|
+
counterparts export # a copy of everything, encrypted by default
|
|
76
|
+
counterparts --help # the rest
|
|
121
77
|
```
|
|
122
78
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
same path. **It never copies, never deletes, and never opens the old store — not even
|
|
126
|
-
read-only.** Your configuration and your credentials are kept byte for byte, so there is
|
|
127
|
-
nothing to re-register; restart Claude Code and you are a new user. `--dry-run` prints
|
|
128
|
-
every rename and changes nothing, `counterparts start-fresh --undo` puts it all back, and
|
|
129
|
-
the same three moves are printed as guarded shell lines before anything moves.
|
|
130
|
-
QUICKSTART §9a has the whole of it.
|
|
131
|
-
|
|
132
|
-
---
|
|
79
|
+
Memory is on for every directory by default. The first session in a new directory asks
|
|
80
|
+
whether you want it there.
|
|
133
81
|
|
|
134
82
|
## How it works
|
|
135
83
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
84
|
+
Two pieces connect it to Claude Code. Hooks load a briefing at the start of each session
|
|
85
|
+
and bring up related memories as you talk. A small MCP server gives the AI tools to save
|
|
86
|
+
what it learned, write a journal entry, and look things up.
|
|
87
|
+
|
|
88
|
+
The core doesn't depend on Claude Code. Each part is its own module, with a
|
|
89
|
+
`CONTRACT.md` describing what it does:
|
|
139
90
|
|
|
140
91
|
| module | what it does |
|
|
141
92
|
|---|---|
|
|
142
|
-
|
|
|
143
|
-
|
|
|
144
|
-
|
|
|
145
|
-
|
|
|
146
|
-
|
|
|
147
|
-
|
|
|
148
|
-
|
|
|
149
|
-
|
|
|
150
|
-
|
|
|
151
|
-
|
|
|
152
|
-
|
|
153
|
-
**The AI is the author.** The constitution puts it plainly: everyone stores the
|
|
154
|
-
transcripts, and the signal is somewhere else. So the writing is done by the model that
|
|
155
|
-
lived the conversation, not by a summarizer reading it afterwards. There are two halves on
|
|
156
|
-
the host. The *ambient* half is a set of hook scripts Claude Code runs at five
|
|
157
|
-
points in a session: it injects the briefing at the start, runs recall against each of
|
|
158
|
-
your prompts, and captures the conversation at the boundaries. The *deliberate* half is a
|
|
159
|
-
Model Context Protocol (MCP) server — tools the AI calls on purpose, including the two it
|
|
160
|
-
uses to hand back what a session taught. A transcript sweep exists as well, but it is the
|
|
161
|
-
**crash fallback only**: it runs for a session that ended without the AI ever getting the
|
|
162
|
-
pen, and not otherwise.
|
|
163
|
-
|
|
164
|
-
---
|
|
165
|
-
|
|
166
|
-
## What you get on the host
|
|
167
|
-
|
|
168
|
-
**Five tools the AI can call** (`src/adapters/mcp/tools.ts` — each tool's description is
|
|
169
|
-
generated from a list of stated privileges, each naming the file that enforces it):
|
|
170
|
-
|
|
171
|
-
| tool | its job |
|
|
172
|
-
|---|---|
|
|
173
|
-
| `note` | Remember this deliberately — the exception, for the thing you would otherwise hope the sweep noticed. |
|
|
174
|
-
| `recall` | Deliberate retrieval: expand one memory by its handle, ask a question and get excerpts, or pull a few results back in full. |
|
|
175
|
-
| `status` | The census: how much is held, of what kinds, how much has left, how much was removed. Counts and dates only. |
|
|
176
|
-
| `session_end` | Hand back what this session taught, as memories, in the AI's own words. |
|
|
177
|
-
| `chapter` | Write this stretch of the session into the AI's own first-person journal, at any length. |
|
|
178
|
-
|
|
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.
|
|
202
|
-
|
|
203
|
-
---
|
|
204
|
-
|
|
205
|
-
## Status, honestly
|
|
206
|
-
|
|
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.)
|
|
219
|
-
No test touches a real store, and that is mechanized rather than promised:
|
|
220
|
-
`test/preload.ts` runs before every test file, redirects `homedir()` to a fresh temporary
|
|
221
|
-
directory for the whole run, clears `COUNTERPARTS_DATA_DIR`, and removes the directory on
|
|
222
|
-
exit — so for the length of a test run there is no real home to reach.
|
|
223
|
-
|
|
224
|
-
**Verified inside real Claude Code sessions**, on the author's machine: the hooks fire on
|
|
225
|
-
all five events, the MCP server registers and its tools are used daily, the briefing
|
|
226
|
-
reaches the model, and both `backup` and — in September 2026, with a one-shot tool this
|
|
227
|
-
repository no longer carries — the import of the author's previous-generation memory ran
|
|
228
|
-
against the real store. **There is no bulk import today.** A store this build writes starts
|
|
229
|
-
blank, and what comes over from an earlier generation is its own later conversation.
|
|
230
|
-
**Verified only against temporary stores**: `export` in all three modes, `remove` end to
|
|
231
|
-
end (which is also where the residue in rough edge 4 was found, and where the chase that
|
|
232
|
-
closed it is asserted — note, remove, grep the whole store, back it up and grep that), and
|
|
233
|
-
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.
|
|
236
|
-
|
|
237
|
-
**Known rough edges.** QUICKSTART §11 carries the install-facing ones — 1 as its §11.3, 2
|
|
238
|
-
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,
|
|
239
|
-
where the embedder knob is set, and 5 in §1 with the runtime requirements:
|
|
240
|
-
|
|
241
|
-
1. **The store you point at and the host settings you get come from two different files —
|
|
242
|
-
so you have to move both.** Your console, the dashboard and the MCP server take `--dir`
|
|
243
|
-
or `COUNTERPARTS_DATA_DIR` to choose the store; the keys, the embedding setting and the
|
|
244
|
-
injection ceiling come from a configuration file, and moving one does not move the
|
|
245
|
-
other. A scratch store on a configured machine uses that machine's keys unless you say
|
|
246
|
-
otherwise. Saying otherwise is one rule at every entry point — the console, the hook,
|
|
247
|
-
its worker and the MCP server: `--config <absolute path>`, else `COUNTERPARTS_CONFIG`,
|
|
248
|
-
else the default `~/.counterparts/claude-code.json` (the console looks beside the store
|
|
249
|
-
first). A named path this cannot use — relative, or absolute and not there — is
|
|
250
|
-
refused rather than quietly replaced by the default, and each entry point says
|
|
251
|
-
which file it used: the console prints it, the server and the
|
|
252
|
-
worker write a line to stderr, and the hook — whose only output channel belongs to the
|
|
253
|
-
model — records it in the session file it writes under the store. The hooks keep the
|
|
254
|
-
one asymmetry that is left: they have no `--dir`, so they take the store from the
|
|
255
|
-
`dataDir` in whichever configuration they read, and fall back to
|
|
256
|
-
`COUNTERPARTS_DATA_DIR` only when it names no store. (The two API keys are the other
|
|
257
|
-
way round everywhere: the environment answers first and the credentials file only fills
|
|
258
|
-
the gaps.)
|
|
259
|
-
2. **The vector cache stores embeddings as JSON text.** On the author's migrated store
|
|
260
|
-
that is 177.5 MB for about 13,900 vectors, and a nearest-neighbour scan of 0.6–1.0 s.
|
|
261
|
-
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.
|
|
265
|
-
4. **Removal reaches every surface but one, and names the one.** `remove` chases a memory
|
|
266
|
-
out of the database that holds its words and its earlier versions, out of the links, out
|
|
267
|
-
of the search cache, out of the journal's markdown copy — and, since 2026-09-05, out of
|
|
268
|
-
the raw-capture buffer under `spans/` (a 12-hex key per project, not the path), where a
|
|
269
|
-
note's verbatim words wait to be interpreted. That last one was a real residue: found
|
|
270
|
-
2026-09-04, a removed note's words stayed on disk and a later backup copied them.
|
|
271
|
-
The buffer is a chased surface now, counted in the plan and in the report, and the
|
|
272
|
-
struck span's hash is kept in the buffer's own ledger so the same words cannot be
|
|
273
|
-
re-captured. Three things it names rather than takes, each on its own line: a
|
|
274
|
-
conversation turn that merely QUOTES the note (transcript, many turns joined,
|
|
275
|
-
belonging to no single memory — and **nothing prunes the buffer today**, so a `grep`
|
|
276
|
-
of the store can still answer while the memory itself is gone); a memory whose words
|
|
277
|
-
are already gone AND whose mint recorded no span hash, which has nothing left to
|
|
278
|
-
address the buffer with; and a memory whose provenance records no scope — every row
|
|
279
|
-
imported from a previous generation — where a chase by text would have to visit every
|
|
280
|
-
project on the machine, so the command lists what it would have matched and stops
|
|
281
|
-
unless you pass `--strike-by-content-across-scopes`.
|
|
282
|
-
5. **Node.** See above. `package.json` names bun and does not claim Node.
|
|
283
|
-
|
|
284
|
-
Nothing here is benchmarked against other memory systems. There is no benchmark score and
|
|
285
|
-
no comparison table, because nobody has run one, and a number nobody ran is the thing this
|
|
286
|
-
project is least willing to print.
|
|
287
|
-
|
|
288
|
-
---
|
|
289
|
-
|
|
290
|
-
## Design principles
|
|
291
|
-
|
|
292
|
-
Condensed from `CONSTITUTION.md`, which is the only document in this repository with
|
|
293
|
-
standing authority. Everything else, including decisions made during the build, is a
|
|
294
|
-
working default that can be revised when it fights that page.
|
|
295
|
-
|
|
296
|
-
- **Memory is how a frozen model learns.** Everyone stores the transcripts; the signal is
|
|
297
|
-
in the structure of experience — what recurred, what carried feeling, what got revised.
|
|
298
|
-
- **Interpret, don't transcribe.** Store what was learned, not what was said, encoded as
|
|
299
|
-
close to the lived experience as the host allows.
|
|
300
|
-
- **Forgetting is part of learning.** Forget the trials, keep the lesson. Decay and
|
|
301
|
-
consolidation are features, never apologized for.
|
|
302
|
-
- **The self is first-class.** Identity, episodes, a persistent "who am I becoming" —
|
|
303
|
-
governed and visible to you, not a configuration field.
|
|
304
|
-
- **You own the data.** Local-first, one portable file, every memory viewable — in the
|
|
305
|
-
console, in the dashboard, or as Markdown you ask for. Data leaves the machine only by
|
|
306
|
-
your explicit choice.
|
|
307
|
-
- **A layer, not a portal.** The memory is yours and travels across tools and models; the
|
|
308
|
-
core knows nothing about any particular one.
|
|
309
|
-
- **Evidence over ceremony.** Mechanisms earn their place by firing in real use. Verified
|
|
310
|
-
live, not merged. Tests are hermetic. And the system shows its workings — if you cannot
|
|
311
|
-
see what it remembered and what faded, it isn't trustworthy.
|
|
312
|
-
|
|
313
|
-
---
|
|
314
|
-
|
|
315
|
-
## Lineage
|
|
316
|
-
|
|
317
|
-
Counterparts is the third generation of one continuous project, and each generation was
|
|
318
|
-
used in earnest before the next was written.
|
|
319
|
-
|
|
320
|
-
- **v0 — claude-engram**, a single React artifact. It had the authorship shape right: the
|
|
321
|
-
model that lived the conversation wrote the memory, and a one-line formula did the
|
|
322
|
-
filing.
|
|
323
|
-
- **engram**, the production ancestor, which contributed the first eight hard-won failure
|
|
324
|
-
cases that this repository carries as acceptance criteria.
|
|
325
|
-
- **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.
|
|
328
|
-
|
|
329
|
-
The rule across all three generations is one of the constitution's own: **"port the scars,
|
|
330
|
-
not the code."** A lesson travels forward as a test that has to pass, never as copy-paste.
|
|
331
|
-
|
|
332
|
-
---
|
|
93
|
+
| store | One SQLite database, plus a rebuildable search cache and daily snapshots |
|
|
94
|
+
| encode | Filters what comes in: strips credentials, drops junk, scores what's new |
|
|
95
|
+
| remember | Takes what the AI writes during and at the end of a session |
|
|
96
|
+
| recall | Finds related memories as you talk |
|
|
97
|
+
| associate | Links memories that come up together |
|
|
98
|
+
| schemas | Beliefs about people and things, revised slowly |
|
|
99
|
+
| self | Identity, the journal, and the start-of-session briefing |
|
|
100
|
+
| prospective | Reminders for later, triggered by a date or a topic |
|
|
101
|
+
| sleep | Nightly housekeeping: fading, pruning, merging, promoting |
|
|
102
|
+
| physics | The math for strength and decay |
|
|
333
103
|
|
|
334
|
-
|
|
104
|
+
More: [`docs/ELI5.md`](docs/ELI5.md) (the whole system in plain words) and
|
|
105
|
+
[`docs/module-map.md`](docs/module-map.md).
|
|
106
|
+
|
|
107
|
+
## Status
|
|
108
|
+
|
|
109
|
+
Early. It's been the author's daily memory since September 2026. It runs on bun only;
|
|
110
|
+
Node is untested. Expect rough edges, and please
|
|
111
|
+
[open an issue](https://github.com/mlapeter/counterparts/issues) when you hit one.
|
|
335
112
|
|
|
336
|
-
|
|
113
|
+
There are no API keys, and nothing leaves your machine except through Claude Code
|
|
114
|
+
itself. Search by meaning runs on a small model on your machine, and a session that ends
|
|
115
|
+
before it's written up is written up by the next session in that project.
|
|
337
116
|
|
|
338
|
-
|
|
339
|
-
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.
|
|
117
|
+
## Background
|
|
342
118
|
|
|
343
|
-
|
|
119
|
+
Counterparts is the third version of a memory project. The earlier ones (claude-engram,
|
|
120
|
+
engram, and bansai) were each used daily before the next was written.
|
|
121
|
+
[`CONSTITUTION.md`](CONSTITUTION.md) holds the principles.
|
|
122
|
+
|
|
123
|
+
## License and contributing
|
|
344
124
|
|
|
345
|
-
|
|
346
|
-
- [`docs/ELI5.md`](docs/ELI5.md) — the whole system in plain words, in one page.
|
|
347
|
-
- [`CONSTITUTION.md`](CONSTITUTION.md) — the only page with standing authority.
|
|
348
|
-
- [`docs/module-map.md`](docs/module-map.md) — the technical map, module by module.
|
|
125
|
+
MIT. Contributions are welcome; see [`CONTRIBUTING.md`](CONTRIBUTING.md).
|