counterparts 0.3.49 → 0.3.52

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 (95) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/README.md +18 -10
  3. package/docs/QUICKSTART.md +46 -12
  4. package/docs/manual.md +2 -1
  5. package/docs/module-map.md +3 -0
  6. package/package.json +3 -2
  7. package/src/adapters/claude-code/NOTES.md +43 -0
  8. package/src/adapters/claude-code/child.ts +23 -2
  9. package/src/adapters/claude-code/doctor-growth.ts +269 -0
  10. package/src/adapters/claude-code/doctor-host.ts +19 -1
  11. package/src/adapters/claude-code/doctor-recall-steps.ts +84 -0
  12. package/src/adapters/claude-code/doctor.ts +26 -3
  13. package/src/adapters/claude-code/hooks.ts +7 -1
  14. package/src/adapters/cli/INTERFACE-GAPS.md +18 -0
  15. package/src/adapters/cli/NOTES.md +24 -0
  16. package/src/adapters/cli/commands-dashboard.ts +9 -1
  17. package/src/adapters/cli/commands-project.ts +2 -1
  18. package/src/adapters/cli/commands-readings.ts +19 -8
  19. package/src/adapters/cli/commands-verify.ts +1 -1
  20. package/src/adapters/cli/commands.ts +4 -2
  21. package/src/adapters/cli/export.ts +2 -1
  22. package/src/adapters/cli/install.ts +14 -6
  23. package/src/adapters/cli/mechanisms.ts +1 -1
  24. package/src/adapters/cli/wire.ts +22 -6
  25. package/src/adapters/dashboard/activity.ts +6 -3
  26. package/src/adapters/dashboard/registries.ts +11 -0
  27. package/src/adapters/dashboard/web/flow.ts +3 -0
  28. package/src/adapters/dashboard/web/lanes.ts +4 -0
  29. package/src/adapters/dashboard/web/narrate.ts +23 -0
  30. package/src/adapters/dashboard/web/views/activity.ts +4 -2
  31. package/src/adapters/dashboard/web/views/flow-view.ts +6 -0
  32. package/src/adapters/dashboard/web/views/memory.ts +13 -0
  33. package/src/adapters/dashboard/web/views/shared.ts +2 -1
  34. package/src/adapters/fired.ts +113 -11
  35. package/src/adapters/host-wiring.ts +3 -1
  36. package/src/adapters/lifecycle.ts +36 -9
  37. package/src/adapters/mcp/CONTRACT.md +22 -1
  38. package/src/adapters/mcp/server-args.ts +51 -0
  39. package/src/adapters/mcp/server-session-end.ts +8 -2
  40. package/src/adapters/mcp/server-words.ts +14 -1
  41. package/src/adapters/mcp/server.ts +117 -7
  42. package/src/adapters/mcp/tools.ts +4 -3
  43. package/src/adapters/plugin.ts +1 -0
  44. package/src/adapters/presence.ts +74 -0
  45. package/src/adapters/runtime.ts +258 -8
  46. package/src/adapters/scopes.ts +3 -2
  47. package/src/adapters/spawn.ts +3 -0
  48. package/src/adapters/update-check.ts +1 -1
  49. package/src/adapters/windows-shims.mjs +102 -0
  50. package/src/core/close-hint.ts +297 -0
  51. package/src/core/counterpart-boundary.ts +15 -0
  52. package/src/core/counterpart-deposit.ts +24 -3
  53. package/src/core/counterpart-events.ts +14 -0
  54. package/src/core/counterpart-types.ts +6 -0
  55. package/src/core/counterpart-wake-shape.ts +88 -19
  56. package/src/core/counterpart.ts +143 -7
  57. package/src/core/dream/index.ts +1 -1
  58. package/src/core/dream/reflect.ts +54 -34
  59. package/src/core/encode/NOTES.md +55 -0
  60. package/src/core/encode/secrets.ts +477 -3
  61. package/src/core/event-rollup.ts +175 -0
  62. package/src/core/handoff/CONTRACT.md +7 -0
  63. package/src/core/interference.ts +496 -0
  64. package/src/core/open-close.ts +583 -0
  65. package/src/core/prospective/CONTRACT.md +24 -0
  66. package/src/core/prospective/derive.ts +22 -1
  67. package/src/core/prospective/index.ts +115 -1
  68. package/src/core/recall/CONTRACT.md +9 -2
  69. package/src/core/recall/NOTES.md +99 -0
  70. package/src/core/recall/activate.ts +83 -6
  71. package/src/core/recall/index.ts +75 -5
  72. package/src/core/recall/probe.ts +134 -0
  73. package/src/core/recall/steps.ts +84 -0
  74. package/src/core/recall/tunables.ts +11 -0
  75. package/src/core/reconsolidation.ts +14 -4
  76. package/src/core/remember/CONTRACT.md +2 -1
  77. package/src/core/remember/NOTES.md +15 -0
  78. package/src/core/remember/spans.ts +44 -6
  79. package/src/core/self/NOTES.md +21 -0
  80. package/src/core/self/work.ts +9 -5
  81. package/src/core/sleep/CONTRACT.md +36 -2
  82. package/src/core/sleep/NOTES.md +35 -0
  83. package/src/core/sleep/close.ts +77 -0
  84. package/src/core/sleep/cycle.ts +44 -0
  85. package/src/core/sleep/index.ts +4 -0
  86. package/src/core/sleep/interfere.ts +73 -0
  87. package/src/core/sleep/log.ts +27 -2
  88. package/src/core/sleep/tunables.ts +19 -0
  89. package/src/core/sleep/types.ts +20 -0
  90. package/src/core/store/index.ts +157 -10
  91. package/src/core/store/operational.ts +22 -0
  92. package/src/core/store/owner-op-seam.ts +16 -0
  93. package/src/core/store/reads-history.ts +173 -7
  94. package/src/core/store/reads-memories.ts +253 -4
  95. package/src/core/store/shapes.ts +8 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,101 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.52 — 2026-11-09
4
+
5
+ **Counterparts now runs on Windows (new: tell us how it goes), and a password said in a sentence is no longer kept.** It also brings memory that fades on purpose as it grows: old per-turn records roll up, older release notes give way to newer ones, finished things stop being overdue, and the night closes items itself. What you'll notice: the morning's "Last night" can say in one line which open items the night closed; doctor has new Growth lines saying what is filling up and whether it leaves as fast, and a Recall steps line saying where recall's time goes; fewer overdue and still-open items at wake. One thing goes for good: the per-turn recall records (`recall.decision`, `recall.credit`, `recall.rated`) are now kept 30 lived days instead of 90, and on the first night after updating, the ones older than that are rolled up into one summary row per day (counts, the memories credited, the sessions) and deleted. If you want them, copy your store before updating. No store-format change (store v15, cache v7), no migration. Nothing to run after upgrading beyond the usual restart of the dashboard and every Claude Code session. Going back to 0.3.50 needs no store restore: `counterparts disconnect`, 0.3.50's install, then `counterparts connect` (the rows already rolled up stay gone).
6
+
7
+ 0.3.51 was packed but never published; everything it held is in this entry.
8
+
9
+ - **Doctor says where recall's time goes.** Each recall now records how long each of its steps took (finding words,
10
+ this turn's meaning, the link walk, ranking, the gate, settled pairs, habituation, the render, and the rest), and
11
+ `counterparts doctor` has a `Recall steps` line with the last week's median for each, largest first. It only
12
+ measures: what recall shows is unchanged, byte for byte.
13
+ - **A password said in a sentence isn't kept.** "My wifi password is …", "the PIN is …", "pw for the router
14
+ is …": the value is replaced with `[REDACTED:password]` and the sentence stays, so the memory still says there is
15
+ one. Ordinary sentences about passwords ("I forgot my password", "the password field is empty") are left alone.
16
+ - **The raw conversation text gets the same stripping.** What's kept of a conversation until it's written up now
17
+ goes through the same check as a memory before it's saved, on your machine and on hosted. Text saved before this
18
+ version isn't rewritten; it's deleted on its usual schedule. Not every secret has a shape: don't paste things you
19
+ wouldn't want kept.
20
+ - **Counterparts runs on Windows.** Install it with npm (`npm install -g counterparts@latest`) and Node 22.15 or newer,
21
+ then `counterparts` and `counterparts connect` as on macOS and Linux, from cmd, Git Bash or PowerShell (where
22
+ Windows' default policy refuses npm's scripts, `counterparts.cmd` works). The hooks `connect` writes run whether
23
+ Claude Code uses Git Bash or PowerShell for them, and the memory tools register with Claude Code installed either
24
+ way (its installer or npm). It's new and has few users yet: tell us how it goes. Under WSL it works as on Linux.
25
+ QUICKSTART's "On Windows" says what differs.
26
+ - **Old routine work notes fade faster once a newer one moves on.** When a newer work memory in the same folder
27
+ says a later version in the same series was released or published ("0.3.50 released"), the night fades the
28
+ older status note ("0.3.46 ready to publish", "0.3.47 after-publish steps") the way a revision does: it
29
+ stays findable by id and in facts (folded under the newer one), labelled earlier, drops out of the wake's
30
+ lines, and can be undone. Only routine notes nobody used: anything the owner said,
31
+ anything felt, anything about the owner, us or me, and open items keep their slow fade.
32
+ - **A done memory is never overdue.** A memory marked `status: done` whose date is today
33
+ or already passed now reads that date as when it happened: it leaves Coming up (due
34
+ today included), the overdue count and the plain-reminder line, older memories
35
+ included. Writing one through `remember` or `session_end` stores the date as
36
+ `occurredOn` and says so beside the memory. A repeating reminder is unchanged: a done
37
+ there still closes only this time.
38
+ - **Old chapters stop turning up as footnotes.** A journal chapter whose last entry is two weeks
39
+ (14 lived days) old or more is no longer offered beside a prompt, so its slot goes to another
40
+ memory. It's all still kept: asking (facts or meaning), opening it by id, the wake and the
41
+ night read it as before.
42
+ - **Doctor says what is growing and whether it leaves as fast.** Five new lines, `Growth:
43
+ memories`, `event log`, `cue pairs` and `dream queue`, plus new and swept edges on the
44
+ `Association` line: how full each is, what came in and what left over the last 7 lived
45
+ days, and which is faster. The memories line also says how many nights the prune takes to
46
+ get round the store, and counts the kinds it never takes (the journal, chapter copies,
47
+ handoffs, cards) apart.
48
+ - **The per-turn event rows are kept 30 lived days, not 90.** `recall.decision`,
49
+ `recall.credit` and `recall.rated` make up most of the event log. Each day of them is
50
+ summed into one kept row before it goes. The all-time numbers read those sums beside
51
+ the rows still kept, so they don't shrink: the dashboard's counts, `counterparts
52
+ mechanisms`, `probe-oq4`, a memory's days used and the sessions seen. Everything else in
53
+ the log keeps 90 lived days. The table of what each recall turn showed goes after 30 too.
54
+ - **The night closes done release steps itself, and stops asking.** When a work memory in a folder says a release
55
+ happened ("0.3.50 released"), the night closes the open items in that folder that were earlier steps of the same
56
+ series ("0.3.46 ready to publish", "0.3.47 after-publish steps", "0.3.48 cut"). Each close is recorded with its
57
+ reason and the memory that showed it, and the next wake says what closed in one line under "Last night". A
58
+ question to the owner is never closed this way. What only might be done (a pinned build whose series moved on, a
59
+ PR a later memory says merged, or what the night's reflection wasn't sure of) is no longer asked about in the
60
+ morning share: `recall "still open"` marks it `mayBeDone`. Say one isn't done and it reopens (the reflect tool's
61
+ `reopen`, or a write that updates it and says it's still open).
62
+ - **A reminder to do something in one folder is said in that folder.** A plain reminder written as another folder's
63
+ work no longer shows whole in this folder's wake, above it, or in the terminal line: it waits for its own folder
64
+ (and any folder joined to it as one project), whose first wake that day says it whole, even when another folder
65
+ woke first. Elsewhere, "in other folders" names it by folder and title (up to two, when there's room) and
66
+ `recall "coming up"` lists it. Reminders about you, us or me still show in every folder, once, then fold to
67
+ "shown earlier". A claude.ai chat, which has no folder, is told only those personal ones.
68
+ - **A deadline in a folder you didn't open still reaches you.** A folder's reminder that went unsaid because no
69
+ session ran there is said once, two days you used Counterparts after its day, in whatever session you're in,
70
+ with its folder named ("garden: send the invoice, due Wed 4 Nov 2026"). It never interrupts a prompt, and
71
+ checks you set for yourself wait for their folder.
72
+ - **Doctor tells a quiet folder from a missed reminder.** A reminder due while its folder had no session is an info
73
+ line, not a warning; it's a warning only if it still wasn't said after that one crossing.
74
+ - **An open thread marked "world" stays in its folder.** Something the world owes (a reply, a dated check) is in the
75
+ Still open of the folder it was written in, not every folder's. So is a dated item marked world.
76
+ - **A write names the open items it looks like it settles, from any folder.** When a
77
+ memory you write through `remember` or `session_end` says something was done ("0.3.47
78
+ published", "#760 merged"), the result lists up to three open items whose subject it
79
+ matches, wherever they were written, with their folder, and asks you to close any that
80
+ really are settled (`updates` + `unresolved: false`). Nothing is closed on its own. An
81
+ item that was a question to the owner says that only their answer closes it.
82
+ - **The remember tool no longer promises mood-matched recall.** Its feelings text said a
83
+ memory's mood would help find it again; mood has carried no weight in recall since October,
84
+ so the promise is gone.
85
+ - **Hosted: a command-line step exits only after its output is written.** Under bun, the
86
+ operator's commands (`migrate-keys` and the rest) could exit before what they printed
87
+ reached a pipe, a Railway log included; they now wait for it (five seconds at most).
88
+
89
+ ## 0.3.50 — 2026-11-06
90
+
91
+ **Write-only backups for hosted: a leaked environment can no longer open a backup.** This release changes only hosted Counterparts (app.counterparts.ai). Its backup keys used to be openable with a key kept in the server's environment; now the server keeps that key on its own disk and puts each backup key in the bucket sealed to a recovery key whose private half is kept offline, so the server can write those keys and never read them back. For every store made from now on, the environment and a copy of the bucket together open nothing. The stores that already existed before the operator's one-time migration keep their keys, so a copy of the bucket taken before it, together with the old environment key, still opens their backups; that is accepted for those stores only, and is why the migration runs before anyone outside the family is invited. The npm package, Claude Code and Claude Desktop behave exactly as in 0.3.49. No store-format change (store v15, cache v7), no migration on your machine. Nothing to run after upgrading beyond the usual restart of the dashboard and every Claude Code session. Going back to 0.3.49 needs no store restore: `counterparts disconnect`, 0.3.49's install, then `counterparts connect`.
92
+
93
+ - **Hosted: backups are write-only.** Each store's backup key, and the key for the account
94
+ and sign-in databases, is put in the bucket sealed to an offline recovery key: the server
95
+ can write it and never read it back. The key the server uses day to day lives on its own
96
+ disk, never in its environment and never in a backup. Restoring after a lost disk takes the
97
+ recovery key, typed in by the operator for that one step.
98
+
3
99
  ## 0.3.49 — 2026-11-06
4
100
 
5
101
  **The hosted beta note, and the app's front door no longer 404s.** This release changes only hosted Counterparts (app.counterparts.ai): the account page now says what the beta keeps and how to delete or download it, and the bare address opens your account instead of answering "Not found". The npm package, Claude Code and Claude Desktop behave exactly as in 0.3.48. No store-format change (store v15, cache v7), no migration. Nothing to run after upgrading beyond the usual restart of the dashboard and every Claude Code session. Going back to 0.3.48 needs no store restore: `counterparts disconnect`, 0.3.48's install, then `counterparts connect`.
package/README.md CHANGED
@@ -13,13 +13,15 @@ stop re-explaining your projects and how you like to work.
13
13
 
14
14
  It's for anyone who works with Claude Code every day and wishes it remembered, and for people
15
15
  interested in an AI that builds a relationship with them over time. It runs on your machine,
16
- with Claude Code on macOS and Linux, and with Claude Desktop on macOS.
16
+ with Claude Code on macOS, Linux and Windows, and with Claude Desktop on macOS.
17
17
 
18
18
  ## Install
19
19
 
20
20
  You need [Node](https://nodejs.org) 22.15 or newer, or [bun](https://bun.sh) 1.3 or newer,
21
- on macOS or Linux. Windows isn't supported yet. Bun on macOS is the setup in daily use; Node
22
- and Linux (since 0.3.11) pass a smoke test and an install run but have no daily user yet.
21
+ on macOS, Linux and Windows (Windows is new: tell us how it goes). Bun on macOS is the setup
22
+ in daily use; Node and Linux (since 0.3.11) pass a smoke test and an install run but have no
23
+ daily user yet. On Windows, install with npm, from PowerShell, cmd or Git Bash; what differs
24
+ there is in [QUICKSTART](docs/QUICKSTART.md#on-windows). Under WSL it works as on Linux.
23
25
 
24
26
  ```
25
27
  npm install -g counterparts@latest
@@ -29,14 +31,15 @@ counterparts
29
31
  With bun instead: `bun add -g counterparts`, then `counterparts`. Whichever runtime runs the
30
32
  setup is the one Claude Code's hooks and memory tools are wired to. Or install it as a Claude
31
33
  Code plugin: `/plugin marketplace add mlapeter/counterparts`, then
32
- `/plugin install counterparts@counterparts`, then restart Claude Code.
34
+ `/plugin install counterparts@counterparts`, then restart Claude Code. The plugin sets
35
+ itself up on its first session, with no terminal step; `/counterparts:doctor` checks it.
33
36
 
34
- The first run asks two things, and you can skip either: your name, and whether to connect
35
- Claude Code. Connecting adds hooks to `~/.claude/settings.json` (it backs the file up first),
36
- registers the memory tools, and adds one `deniedMcpServers` entry there so the hosted
37
- Counterparts Online connector never loads into Claude Code as a second memory. Hooks and
38
- settings from other tools are left alone. No API keys and no
39
- account. Then restart Claude Code and check it:
37
+ With npm or bun, the first run asks two things, and you can skip either: your name, and
38
+ whether to connect Claude Code. Connecting adds hooks to `~/.claude/settings.json` (it backs
39
+ the file up first), registers the memory tools, and adds one `deniedMcpServers` entry there
40
+ so the hosted Counterparts Online connector never loads into Claude Code as a second memory.
41
+ Hooks and settings from other tools are left alone. No API keys and no account. Then restart
42
+ Claude Code and check it:
40
43
 
41
44
  ```
42
45
  counterparts doctor
@@ -66,6 +69,11 @@ walkthrough is in [`docs/QUICKSTART.md`](docs/QUICKSTART.md).
66
69
  - The text of a conversation is kept only until it's written up: since 0.3.21 it is deleted
67
70
  3 days after that, or about two weeks after the conversation goes quiet, whichever comes
68
71
  first, the next time Counterparts runs. It is never in a backup.
72
+ - What's stripped before anything is kept, in the memories and in that conversation text:
73
+ credentials in recognisable shapes (API keys, tokens, private keys, passwords in URLs, a
74
+ value after a name like `password=` or `api_key:`), and passwords named in a sentence
75
+ ("my wifi password is …", "the PIN is …"): the value goes, the sentence stays. Not every
76
+ secret has a shape, so don't paste things you wouldn't want kept.
69
77
  - It doesn't read or change your CLAUDE.md files or Claude Code's own auto memory
70
78
  (MEMORY.md), so they run side by side. A committed CLAUDE.md stays the place for rules
71
79
  your team shares through git.
@@ -2,20 +2,54 @@
2
2
 
3
3
  ## Install
4
4
 
5
- You need [bun](https://bun.sh) 1.3 or newer, or [Node](https://nodejs.org) 22.15 or newer,
6
- on macOS or Linux; Windows not yet supported. Bun on macOS is the setup in daily use; Node
7
- and Linux pass a smoke test and an install run but have no daily user yet. With Node, install with `npm install -g counterparts@latest` instead of the
8
- `bun add` line below; the rest is the same.
5
+ You need [Node](https://nodejs.org) 22.15 or newer, or [bun](https://bun.sh) 1.3 or newer,
6
+ on macOS, Linux and Windows (Windows is new: tell us how it goes). Bun on macOS is the setup
7
+ in daily use; Node, Linux and Windows pass a smoke test and an install run but have no daily
8
+ user yet. On Windows, read [On Windows](#on-windows) below first.
9
9
 
10
10
  ```
11
- curl -fsSL https://bun.sh/install | bash # if you don't have bun
12
- # then open a new terminal
13
- bun add -g counterparts
11
+ npm install -g counterparts@latest
14
12
  counterparts --version
15
13
  ```
16
14
 
17
- If `counterparts --version` says `command not found`, add bun's bin folder to your PATH:
18
- `export PATH="$HOME/.bun/bin:$PATH"` in your shell profile.
15
+ Keep the `@latest`: a bare `npm install` can fetch an older version. With bun instead:
16
+ `bun add -g counterparts`; the rest is the same. Whichever runtime runs the setup is the one
17
+ Claude Code's hooks and memory tools are wired to.
18
+
19
+ If `counterparts --version` says `command not found`, your global bin folder isn't on your
20
+ PATH: for npm, add the folder `npm prefix -g` prints, plus `/bin`; for bun, add
21
+ `export PATH="$HOME/.bun/bin:$PATH"` to your shell profile.
22
+
23
+ Or install it as a Claude Code plugin: `/plugin marketplace add mlapeter/counterparts`, then
24
+ `/plugin install counterparts@counterparts`, then restart Claude Code. The plugin sets
25
+ itself up on its first session and puts no `counterparts` command on your PATH:
26
+ `/counterparts:doctor` checks it, and the rest of this page is for the npm or bun install.
27
+
28
+ ### On Windows
29
+
30
+ Windows is new, and has few users yet: if something here goes wrong, tell us
31
+ ([issues](https://github.com/mlapeter/counterparts/issues)). What differs from macOS and Linux:
32
+
33
+ - Install with **npm and Node** 22.15 or newer, from PowerShell, cmd or Git Bash. The commands on
34
+ this page are the same in all three.
35
+ - Your memory lives in `%USERPROFILE%\.counterparts\`, and `counterparts connect` writes to
36
+ `%USERPROFILE%\.claude\settings.json` and `%USERPROFILE%\.claude.json`, where Claude Code
37
+ keeps them on Windows.
38
+ - Claude Code runs the hooks in Git Bash when Git for Windows is installed, and in PowerShell
39
+ when it isn't. Both work. The hooks name `node` by name, so keep the Node you installed
40
+ with on your PATH; run `counterparts connect` again after moving to another Node.
41
+ - If PowerShell says running scripts is disabled on this system (Windows' default, and it
42
+ says the same for `npm`), type `counterparts.cmd` in place of `counterparts`, use cmd or
43
+ Git Bash, or allow scripts for your account once:
44
+ `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`. The hooks don't need this: they
45
+ start `node` itself.
46
+ - npm makes `counterparts` work in PowerShell and cmd with a small step that runs after the
47
+ install. If you install with `--ignore-scripts`, that step doesn't run, and the command
48
+ works only from Git Bash: run `npm install -g counterparts@latest` again without it.
49
+ - `counterparts uninstall` and `start-fresh` can't see which Counterparts processes are still
50
+ running on Windows: quit Claude Code first.
51
+ - In WSL, Counterparts works as it does on Linux: install it inside WSL, and run Claude Code
52
+ there too.
19
53
 
20
54
  ## Set it up
21
55
 
@@ -114,11 +148,11 @@ command opens an encrypted export yet: the README written beside it gives the fo
114
148
  Close your Claude Code sessions, then:
115
149
 
116
150
  ```
117
- bun add -g counterparts@latest
151
+ npm install -g counterparts@latest
118
152
  ```
119
153
 
120
- With Node, the same step is `npm install -g counterparts@latest`. Keep the `@latest`: a
121
- bare `npm install` can fetch an older version.
154
+ With bun, the same step is `bun add -g counterparts@latest`. Keep the `@latest`: a bare
155
+ `npm install` can fetch an older version.
122
156
 
123
157
  Your memory isn't changed by an upgrade. Open sessions keep running the old version until
124
158
  they restart.
package/docs/manual.md CHANGED
@@ -13,6 +13,7 @@ A memory for an AI, in its own words, not a transcript: it writes with `remember
13
13
  - Each session opens with a wake: who I am (the self page), where the work stands, what's coming up and still open, how yesterday went.
14
14
  - In Claude Code, related memories come up as footnotes as the conversation goes. `recall` is the deliberate look, everywhere.
15
15
  - It's theirs to see, export and delete. [local] It is one SQLite file on their computer, and Counterparts sends nothing about them anywhere (the details are on counterparts.ai/privacy). [hosted] It lives on Counterparts' server, one store per account; backups that leave the server are encrypted with a key for their account.
16
+ - What's stripped before anything is kept, in memories and in the raw conversation text: credentials in recognisable shapes (keys, tokens, private keys, passwords in URLs, a value written after a name like password= or api_key:), and passwords named in a sentence ("my wifi password is …", "the PIN is …"), the value only. Not every secret has a shape: don't paste things you wouldn't want kept.
16
17
  - A new memory may start with a few starter notes, titled "Told: …". They were given, not lived: they start weak, come after lived memories that match as well, are never part of the self, and can be corrected or let go like any memory.
17
18
 
18
19
  ## Everyday phrases
@@ -99,7 +100,7 @@ If something seems off (no wake, no night), check before guessing: `status`, and
99
100
  - The `status` tool gives the census: how much is held, of what kinds, how much has left. Ask it when the person asks "what's your status?".
100
101
  - [local] `counterparts doctor` checks everything and says what to fix. Show its lines as they are. `counterparts status` counts memories and recent activity; `counterparts log` shows today's events in order; `counterparts mechanisms` shows which parts of memory have been working.
101
102
  - [local] After an update, start a new Claude Code session so the new version's tools load. To update: `npm install -g counterparts@latest` (or `bun add -g counterparts@latest`), or for the plugin, /plugin → Marketplaces → counterparts → Update marketplace.
102
- - [local] It runs on macOS and Linux; Windows not yet supported. Bun on macOS is the setup in daily use; Node (22.15+) and Linux pass a smoke test but have no daily user yet.
103
+ - [local] It runs on macOS, Linux and Windows (Windows is new: tell us how it goes). Bun on macOS is the setup in daily use; Node (22.15+), Linux and Windows pass a smoke test but have no daily user yet. On Windows it's installed with npm and Node; memory lives in the .counterparts folder in your user folder; Claude Code runs the hooks in Git Bash when Git for Windows is installed and in PowerShell when it isn't, and both work; quit Claude Code before uninstalling or starting fresh, which can't see running processes there. In WSL it works as on Linux. The sidebar mod hasn't been tried on Windows yet.
103
104
  - [local] A plugin install has no counterparts command in the terminal: the person uses /counterparts:doctor, /counterparts:dashboard and /counterparts:uninstall instead.
104
105
  - [local] `counterparts install --host claude-desktop` connects Claude Desktop's chat to the same memory. Desktop's chat has no hooks: the `wake` tool starts each chat, there are no footnotes, and the write-up is asked on a tool result once a chat has gone on a while.
105
106
  - [hosted] The account page lists the connected AIs, with when each was last used, and disconnects one.
@@ -27,6 +27,9 @@ code and the `NOTES.md` / `INTERFACE-GAPS.md` next to it.*
27
27
  | `dream/` | sleep replay + REM | Dreaming: once a day, if the owner says yes, a background agent (the same model) replays what was lived since the last dream beside what it resembles — merges, links, replays, a pattern, a flagged contradiction, a softened feeling, a core nomination — each recorded for undo, with a dream journal kept apart from lived memory — never a memory row, but since 2026-10-27 (D1) recalled by what it was about, labelled `[dream]`; an ordinary question stops reaching it unless it is recalled or retold (`recalled.ts`). The module holds the bookkeeping and the rules; the dreamer is the model. **Added 2026-09-26.** Since 2026-09-27 it also holds REFLECTION (`reflect.ts`), the waking self: usually right after a dream, lived, with its own record — an entry, the self page rewritten from the core, a morning share, feelings recorded later, and what a memory is about. |
28
28
  | `fit/` | working memory's pointers | Fitting what a mechanism has into the room it has: a line for everything, the whole text for the most important, ids and a named lookup for the rest, a count of what waits. Plus `lineOf`, `derivedFrom`, parts, and the lookup ledger that measures whether receivers use the lookup. First users: the dream and the reflection. **Added 2026-09-28 (build B).** |
29
29
  | *(`reconsolidation.ts`)* | reconsolidation + interference | Two memories that disagree: flagged (a dream, today), noticed at write time (the nearest few live memories come back with a stored one), and SETTLED — `changed` (both true at their time: one strength cut, labelled earlier), `corrected` (archived, readable by id), or `open` (both kept, shown together) — by a new memory's `updates` + `how`, a `remember` settle, a dream or reflection with a plain reason, or the owner's `counterparts settle`. Every settle is on a trail (who, how, why, when) and can be undone. A file beside `revision.ts`, whose ordinary-memory arm it is; its tables are the store's (schema v10), its labels recall's (`recall/standing.ts`). **Added 2026-09-29** as `contradictions.ts`; **renamed 2026-10-11** (Group 2: noticing and updating are one process; the tables keep their names). |
30
+ | *(`interference.ts`)* | interference (retroactive, for routine work) | A newer routine work event fades the older one on the same subject: each night (the cycle's `interfere` phase) an unsalient, never-used `about: work` status note naming a version in its headline is settled `changed` (×0.5) under the nearest later state in the same folder, through `reconsolidation.ts#supersede` (source `interference`, reason `superseded-by-newer`). Nothing the owner said, nothing felt, nothing open. Counted beside the prune on the `sleep.cycle` row. **Added 2026-11-07** (FD1 step 3). |
31
+ | *(`close-hint.ts`)* | — (a write's hint, not a mechanism) | When a stored `remember` or `session_end` entry says something was done, the open items from any folder whose subject it matches (the same version series, the same PR, or what their `settlesWhen` names) are listed in its result, at most three, for the writing model to close or leave. Nothing closes here. Counted as `open.close-hint.shown` / `open.close-hint.closed`. **Added 2026-11-07** (SO1 step 1b). |
32
+ | *(`open-close.ts`)* | — (closing what is done) | The night closes an open item a later release shows done: each night (the cycle's `close` phase) an open release step ("0.3.46 ready") in a folder closes when a later memory there says a higher patch of the series was released — `closeThread`'s write with `threadClosedBy` and a `thread.night.closed` row. Never a question to the owner, a check, or one the owner reopened. What might be done is listed `mayBeDone` under `recall "still open"`; the reflect tool's `reopen` puts one back. **Added 2026-11-07** (SO1 step 1). |
30
33
  | *(`time.ts`)* | — (a clock, not a memory) | The one module that converts: a moment (UTC ms from `store.now()`) to a person's local date or clock line, "today" in a zone, and calendar dates as said (day, month, year, range). A file, not a module; a test keeps hand-built dates out of `src/`. **Added 2026-09-25 (`docs/time.md`).** |
31
34
  | *(`feelings-wheel.ts`)* | — (a vocabulary) | The feelings wheel as a typed list: seven cores (happy, warm, calm, curious, sad, uneasy, angry), the groups and their words, default valence and intensity on every entry, blends, aliases, and the rule that re-filed the first wheel's feelings (v11). Read by `store/` to validate the `feelings` table. **Added 2026-09-25; v2 2026-09-30.** |
32
35
  | *(`leaving.ts`)* | — (a table) | What counts as having left: every `archived_reason` the code writes, filed `replaced` (a live row carries it — a revision, a merge, a rebuilt journal copy), `let-go` or `removed`. The `status` census and the dashboard's archive words both read it, so they agree. **Added 2026-09-30.** |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "counterparts",
3
- "version": "0.3.49",
3
+ "version": "0.3.52",
4
4
  "license": "MIT",
5
5
  "description": "Long-term memory for Claude Code, written by Claude itself. Local MCP server and hooks; remembers you across sessions.",
6
6
  "repository": {
@@ -88,6 +88,7 @@
88
88
  "scripts": {
89
89
  "test": "bun test",
90
90
  "typecheck": "tsc --noEmit",
91
- "test:node": "node --import ./src/adapters/node-hooks.mjs --test test/node-smoke.ts"
91
+ "test:node": "node --import ./src/adapters/node-hooks.mjs --test test/node-smoke.ts",
92
+ "postinstall": "node src/adapters/windows-shims.mjs || exit 0"
92
93
  }
93
94
  }
@@ -2996,3 +2996,46 @@ So the night reads the list (`passesOnNight`), and only the told lines read `ATT
2996
2996
  none under `auto`, as it already got none under `ask`. An app a person really talks to through the Agent SDK reads as
2997
2997
  headless too, unless the host says `ATTENDED=1`. Doctor's `night-headless` line says so after two days without a night; nothing
2998
2998
  more was built.
2999
+
3000
+ ## 2026-11-09 — Windows: how Claude Code runs our hooks and server there (Windows W1)
3001
+
3002
+ Step 0 of the Windows port, from Claude Code's own docs (code.claude.com/docs/en/hooks, /settings, /mcp-quickstart,
3003
+ /setup, /env-vars, /troubleshoot-install, read 2026-11-09). This is what decides what `connect` writes on win32.
3004
+
3005
+ - **Hooks (shell form, `command` with no `args`)**: "passed to a shell: `sh -c` on macOS and Linux, Git Bash on
3006
+ Windows, or PowerShell when Git Bash isn't installed." Git Bash is found at `C:\Program Files\Git` (or `(x86)`), then
3007
+ `git` on PATH, or named by `CLAUDE_CODE_GIT_BASH_PATH`. A hook may pin `"shell": "bash" | "powershell"`. Exec form
3008
+ (`command` + `args`) spawns with no shell and needs a real `.exe` (npm's `.cmd` shims can't be spawned that way).
3009
+ Git for Windows is OPTIONAL for Claude Code now; without it the Bash tool is PowerShell and so is every hook.
3010
+ - **MCP stdio servers**: started from `command` + `args` in `~/.claude.json`; the docs don't say whether through a shell
3011
+ (they no longer carry the old `cmd /c npx` advice). A real executable with arguments works either way.
3012
+ - **Where the files are**: `~/.claude` is `%USERPROFILE%\.claude`, `~/.claude.json` is `%USERPROFILE%\.claude.json`;
3013
+ `CLAUDE_CONFIG_DIR` moves both, as on macOS.
3014
+ - **`npm install -g`** puts three launchers per bin in `%APPDATA%\npm`: `x.cmd`, `x.ps1` and an extensionless sh script
3015
+ for Git Bash. npm writes them from the bin's FIRST LINE (`cmd-shim`), which for ours is `#!/bin/sh`, so the `.cmd` and
3016
+ `.ps1` ran `/bin/sh`, which cmd and PowerShell can't find (`src/adapters/windows-shims.mjs` now rewrites them to
3017
+ `node`; see `cli/NOTES.md`). The sh script works in Git Bash.
3018
+
3019
+ So the hook line has to run in BOTH Git Bash and PowerShell, and must not depend on our npm shims. What `connect` writes
3020
+ on win32 (`runtime.ts#hostInvocation`): `node --import "file:///C:/…/node-hooks.mjs" "C:/…/claude-code/bin/hook.ts"`.
3021
+
3022
+ - `node` BY NAME, when `node` on PATH resolves (links followed) to the very node running `connect`. The default Node
3023
+ is in `C:\Program Files\nodejs`, which needs quotes, and PowerShell needs `&` before a quoted first word, which bash
3024
+ refuses. Scar §2.18 (the host's PATH isn't the login shell's) is a macOS hazard; on Windows the host inherits the
3025
+ account's PATH. When `node` is another file (Volta's or nvm-windows' shim, another Node; W1 review), the path is
3026
+ written for the shell present (`runtime.ts#windowsHookWord`): unquoted when it has no space (both shells run it),
3027
+ quoted with Git Bash present, `& "…"` without it (`shellTokens` reads the `&` away). The last two run in that one
3028
+ shell only, so `connect` warns and doctor's Runtime line is amber: installing or removing Git for Windows later
3029
+ stops every hook until `connect` runs again.
3030
+ - `--import` as a `file:` URL: Node reads `C:\…\node-hooks.mjs` as a URL whose scheme is `c:`.
3031
+ - `/` in every path: no backslash for either shell to read as an escape, and Windows takes them.
3032
+ - The MCP registration is the same words as `command` + `args`: `node`, `--import`, the URL, `C:/…/serve.ts`.
3033
+ - POSIX lines are byte-for-byte what they were (`test/windows-port.test.ts` holds both).
3034
+
3035
+ Also on Windows: a detached child gets its own console window unless `windowsHide` (the worker, the night, its `claude
3036
+ -p`, the dashboard's opener, the plugin's first run); there are no process groups, so the night's watchdog ends its
3037
+ child with `taskkill /T /F`; and the night's `claude` may be npm's `claude.cmd`, which `runtime.ts#windowsLaunch` reads
3038
+ for its target (an `.exe`, or a `.js` given to `node`) rather than running it through cmd with the night's JSON and
3039
+ prompt as arguments. Proven in CI by `.github/workflows/windows.yml` (`tools/door/npm-door.mjs`), which installs Claude
3040
+ Code from npm so `claude` is the `.cmd`; a full night needs a Claude login a runner doesn't have, so the door checks the
3041
+ night starts and reaches `claude -p`.
@@ -14,9 +14,10 @@
14
14
  * and never in `argv`, and the child's environment is the caller's to scrub
15
15
  * (`night-run.ts#planNightChild`).
16
16
  */
17
- import { spawn } from "node:child_process";
17
+ import { spawn, spawnSync } from "node:child_process";
18
18
 
19
19
  import { withHostUmask } from "../private-umask.js";
20
+ import { windowsLaunch } from "../runtime.js";
20
21
  import { armAwake } from "./awake.js";
21
22
  import type { AwakeOptions } from "./awake.js";
22
23
 
@@ -132,13 +133,23 @@ export async function startChild(plan: ChildPlan, abort?: AbortSignal, awake?: A
132
133
  try {
133
134
  // Under the umask this process was started with (`private-umask.ts`):
134
135
  // the child is another program, writing its own files.
135
- child = withHostUmask(() => spawn(plan.command, [...plan.args], {
136
+ // On Windows the host CLI may be npm's `claude.cmd`, which Node will not
137
+ // start without a shell: its target is read out of it (`runtime.ts#
138
+ // windowsLaunch`, W1). A name that does not resolve is spawned as given
139
+ // and fails as it always would have, by `error`.
140
+ const how =
141
+ process.platform === "win32"
142
+ ? (windowsLaunch(plan.command, plan.args, plan.env) ?? { file: plan.command, args: [...plan.args] })
143
+ : { file: plan.command, args: [...plan.args] };
144
+ child = withHostUmask(() => spawn(how.file, how.args, {
136
145
  // DETACHED ONLY SO THERE IS A PROCESS GROUP TO KILL. The caller still
137
146
  // awaits this child — `unref` is deliberately not called — so a child
138
147
  // whose outcome nobody can record is still impossible. What `detached`
139
148
  // buys is that a host CLI which spawned helpers of its own cannot
140
149
  // survive in them after the watchdog fires.
141
150
  detached: true,
151
+ // No console window of its own on Windows (W1).
152
+ windowsHide: true,
142
153
  // THE PROMPT GOES ON STDIN, not in `argv`: what a child is handed in a
143
154
  // command line is readable by every process on the machine through
144
155
  // `ps` (S2 review, NIT-2). `claude -p` with no positional prompt reads
@@ -260,6 +271,16 @@ function arm(fn: () => void, ms: number): ReturnType<typeof setTimeout> {
260
271
  * otherwise survive in them.
261
272
  */
262
273
  function signal(child: { pid?: number | undefined; kill: (s: NodeJS.Signals) => boolean }, sig: NodeJS.Signals): void {
274
+ // Windows has no process groups and no signals: `taskkill /T /F` ends the
275
+ // child and every process it started, which is what the group kill is for
276
+ // (W1). Both steps end it there; the second finds it gone.
277
+ if (process.platform === "win32" && child.pid !== undefined) {
278
+ try {
279
+ spawnSync("taskkill", ["/pid", String(child.pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
280
+ } catch {
281
+ /* no taskkill — the child alone, below */
282
+ }
283
+ }
263
284
  try {
264
285
  if (child.pid !== undefined) process.kill(-child.pid, sig);
265
286
  } catch {