counterparts 0.3.47 → 0.3.48

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.48 — 2026-11-06
4
+
5
+ **A lighter tool list for claude.ai, hosted pages that look like counterparts.ai, and a README that explains itself.** On claude.ai the tool list a chat loads is about a third smaller; Claude Code and Claude Desktop get exactly the tool list 0.3.47 gave them. The hosted sign-in, Allow, account, delete and error pages take counterparts.ai's look, light or dark as your device is set. The README's first screen, which is also the npm page, says what Counterparts is and what the first run does. 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.47 needs no store restore: `counterparts disconnect`, 0.3.47's install, then `counterparts connect`.
6
+
7
+ - **The README opens by saying what it is: long-term memory for Claude Code, written by
8
+ Claude itself.** Its first screen, which is also the npm page, now leads the install with
9
+ npm (bun on the next line), says what the first run asks and changes, and has a short
10
+ "What it remembers, and where it lives" section, with a link to counterparts.ai's guide to
11
+ Claude Code's own memory. The npm description and keywords name Claude Code too.
12
+ - **claude.ai's tool list is about a third smaller.** The list a claude.ai chat loads went from
13
+ about 92 KB to 65 KB (roughly 10k fewer tokens on every turn once memory is in use). The
14
+ field descriptions are shorter, and the guarantees that change nothing about how Claude calls
15
+ a tool are no longer spelled out there, though they are still enforced. Words that weren't
16
+ true on claude.ai are gone: a terminal, folders, the end-of-session ask, the dashboard.
17
+ Claude Code and Claude Desktop get the same tool list as before.
18
+ - **Hosted pages look like counterparts.ai.** The sign-in, Allow, account, pending-delete,
19
+ error and done pages share one inline style in the site's look: its light face by default,
20
+ its dark one when the device is set to dark. No page's words, fields or routes changed, and
21
+ the content security policy is the same.
22
+
3
23
  ## 0.3.47 — 2026-11-04
4
24
 
5
25
  **Folded reminders, honest folders, refused calls kept out of your wake, compacted sessions remembered, and delete one memory from chat (hosted).** With the wake's shape on, a reminder a session started today already showed you folds into one line in later wakes that day. A dream files work under the folder it came from, another folder's dated work is counted rather than listed as due today, and other folders go by their names, not their paths. A memory about a refused tool call or a declined permission prompt stays out of the wake and the footnotes, and a morning share no longer asks for a tool call to mark it told. What you say after a conversation compacts is written up at night. "Delete the memory about X" works in chat, on hosted and locally, with 24 hours to undo it. Also: a hosted download opens in a local install and answers straight away, the redactor keeps tokenizer code readable and catches more secret names, and uninstall names the right remover. Existing stores' starter notes about deleting change once, only where they are still exactly as they started. 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.46 needs no store restore: `counterparts disconnect`, 0.3.46's install, then `counterparts connect`.
package/README.md CHANGED
@@ -1,42 +1,83 @@
1
1
  # Counterparts
2
2
 
3
- **Agents are great. What you're missing is a counterpart.**
3
+ **Long-term memory for Claude Code, written by Claude itself.**
4
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).
5
+ Agents are great. What you're missing is a counterpart.
8
6
 
9
- [counterparts.ai](https://counterparts.ai)
7
+ Each Claude Code session starts over, apart from your CLAUDE.md files and Claude's short
8
+ MEMORY.md notes. With Counterparts, Claude writes down what it learned as it works and at
9
+ the end of each session, in its own words. What matters sticks and the rest fades unless it
10
+ comes up again. After the first few sessions, each one opens with a short note Claude wrote
11
+ itself: who it is, where the work stands, what's coming up and how yesterday went, so you
12
+ stop re-explaining your projects and how you like to work.
10
13
 
11
- Found a bug? [Open an issue](https://github.com/mlapeter/counterparts/issues). For anything
12
- else, write to mike@resonantventures.com.
14
+ It's for anyone who works with Claude Code every day and wishes it remembered, and for people
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.
13
17
 
14
18
  ## Install
15
19
 
16
- You need [bun](https://bun.sh) 1.3 or newer, or [Node](https://nodejs.org) 22.15 or newer.
17
- macOS and Linux; Windows not yet supported.
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.
18
23
 
19
24
  ```
20
- curl -fsSL https://bun.sh/install | bash # if you don't have bun
21
- # then open a new terminal
22
- bun add -g counterparts
25
+ npm install -g counterparts@latest
23
26
  counterparts
24
27
  ```
25
28
 
26
- With Node instead: `npm install -g counterparts@latest`, then `counterparts`. Whichever runtime
27
- runs the setup is the one Claude Code's hooks and memory tools are wired to.
29
+ With bun instead: `bun add -g counterparts`, then `counterparts`. Whichever runtime runs the
30
+ setup is the one Claude Code's hooks and memory tools are wired to. Or install it as a Claude
31
+ Code plugin: `/plugin marketplace add mlapeter/counterparts`, then
32
+ `/plugin install counterparts@counterparts`, then restart Claude Code.
28
33
 
29
- `counterparts` walks you through setup: your name and connecting Claude Code. No API
30
- keys. Then restart Claude Code and check it:
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:
31
40
 
32
41
  ```
33
42
  counterparts doctor
34
43
  ```
35
44
 
36
- To remove it, run `counterparts uninstall`. Your memory is kept unless you ask for it
37
- to be deleted. The full walkthrough is in [`docs/QUICKSTART.md`](docs/QUICKSTART.md).
45
+ For Claude Desktop on macOS (since 0.3.9), run `counterparts install --host claude-desktop`,
46
+ then set the counterparts tools to **Always allow** in Claude Desktop, so a chat can wake on
47
+ its own.
48
+
49
+ The first session in a new folder asks whether you want memory there. To remove it, run
50
+ `counterparts uninstall`; your memory is kept unless you ask for it to be deleted. The full
51
+ walkthrough is in [`docs/QUICKSTART.md`](docs/QUICKSTART.md).
52
+
53
+ ## What it remembers, and where it lives
54
+
55
+ - Who you are, how you like to work, what you decided together, what's in progress and
56
+ where you left off. Claude writes these as notes in its own words, not transcripts.
57
+ - What it knows about you reaches every folder. Notes about a project's work show up in that
58
+ project.
59
+ - The memories live in one SQLite file under `~/.counterparts`, readable by your account
60
+ only. You can read, export or delete them. Search by meaning runs on a small model on your
61
+ machine, about 30 MB.
62
+ - Your memory leaves your machine only through Claude Code (or Claude Desktop) itself.
63
+ Counterparts' one request of its own (since 0.3.39) is a daily check with npm for the
64
+ newest version number. It sends nothing about you, and you can turn it off (see
65
+ [Status](#status)).
66
+ - The text of a conversation is kept only until it's written up: since 0.3.21 it is deleted
67
+ 3 days after that, or about two weeks after the conversation goes quiet, whichever comes
68
+ first, the next time Counterparts runs. It is never in a backup.
69
+ - It doesn't read or change your CLAUDE.md files or Claude Code's own auto memory
70
+ (MEMORY.md), so they run side by side. A committed CLAUDE.md stays the place for rules
71
+ your team shares through git.
72
+
73
+ How Claude Code's own memory works, and where Counterparts fits:
74
+ [counterparts.ai/guides/claude-code-memory](https://counterparts.ai/guides/claude-code-memory/).
75
+ More at [counterparts.ai](https://counterparts.ai). A hosted version for claude.ai is coming
76
+ soon, in beta; [sign up on the home page](https://counterparts.ai/#waitlist) to hear when it
77
+ opens.
38
78
 
39
- ![The dashboard](https://raw.githubusercontent.com/mlapeter/counterparts/master/docs/images/dashboard-overview.png)
79
+ Found a bug? [Open an issue](https://github.com/mlapeter/counterparts/issues). For anything
80
+ else, write to mike@resonantventures.com.
40
81
 
41
82
  ## What it does
42
83
 
@@ -44,31 +85,16 @@ to be deleted. The full walkthrough is in [`docs/QUICKSTART.md`](docs/QUICKSTART
44
85
  learned, in its own words. Notes, not transcripts.
45
86
  - **It forgets on purpose.** Memories fade unless they come up again. What matters
46
87
  sticks; the rest lets go.
47
- - **It knows who it has been.** After the first few sessions, every session opens with a short "who I am, who you
48
- are, where we left off" that it wrote itself.
88
+ - **It knows who it has been.** After the first few sessions, every session opens with a short
89
+ note it wrote itself: who it is, where the work stands, what's coming up.
49
90
  - **It keeps a journal.** Each session becomes a chapter in a first-person account of
50
91
  your time together.
51
92
  - **It changes its mind slowly.** What it believes about you shifts only under real
52
93
  evidence, and it keeps the history of what it used to think.
53
94
  - **Things come to mind.** As you talk, related memories surface quietly, the way one
54
95
  thing reminds you of another.
55
- - **It's yours.** Everything lives on your machine in one SQLite file you can read,
56
- export or delete. No API keys, no accounts, and nothing about you is sent anywhere; its
57
- one request of its own is a daily version check (see [Status](#status)). The text of your
58
- conversations is kept only until it's written up: deleted 3 days after that, or at most
59
- about two weeks after the conversation goes quiet, whichever comes first, once Counterparts
60
- next runs, and never in a backup. You can delete the conversation text,
61
- the backups or the activity log on their own at any time (`counterparts delete`).
62
-
63
- ## Who it's for
64
-
65
- People interested in giving an AI its own sense of self and building a relationship
66
- with it over time. Tinkerers, researchers, writers, and anyone who talks to an assistant
67
- every day and wishes it remembered.
68
-
69
- This is the AI's own memory of you and your work together, in its own words, keeping what
70
- matters across every project. A committed CLAUDE.md stays the place for team-wide rules
71
- shared through git.
96
+ - **It's yours.** It lives on your machine, and you can read, export or delete it; see
97
+ [What it remembers, and where it lives](#what-it-remembers-and-where-it-lives).
72
98
 
73
99
  ## Where it's going
74
100
 
@@ -95,6 +121,8 @@ AES-256-GCM), so it can be opened by hand.
95
121
  Memory is on for every directory by default. The first session in a new directory asks
96
122
  whether you want it there.
97
123
 
124
+ ![The dashboard](https://raw.githubusercontent.com/mlapeter/counterparts/master/docs/images/dashboard-overview.png)
125
+
98
126
  ## How it works
99
127
 
100
128
  Two pieces connect it to Claude Code. Hooks load a briefing at the start of each session
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "counterparts",
3
- "version": "0.3.47",
3
+ "version": "0.3.48",
4
4
  "license": "MIT",
5
- "description": "Memory that turns AI tools into counterparts - a local-first, human-memory-modeled memory layer for AI.",
5
+ "description": "Long-term memory for Claude Code, written by Claude itself. Local MCP server and hooks; remembers you across sessions.",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/mlapeter/counterparts.git"
9
9
  },
10
- "homepage": "https://counterparts.ai",
10
+ "homepage": "https://counterparts.ai/?r=npm",
11
11
  "bugs": {
12
12
  "url": "https://github.com/mlapeter/counterparts/issues"
13
13
  },
@@ -21,7 +21,14 @@
21
21
  "mcp-server",
22
22
  "model-context-protocol",
23
23
  "long-term-memory",
24
- "agent-memory"
24
+ "agent-memory",
25
+ "claude-code-memory",
26
+ "ai-memory",
27
+ "persistent-memory",
28
+ "claude-desktop",
29
+ "claude-code-hooks",
30
+ "anthropic",
31
+ "sqlite"
25
32
  ],
26
33
  "mcpName": "ai.counterparts/memory",
27
34
  "type": "module",
@@ -190,6 +190,13 @@ actually wrote (chapter), the written self page or the version a write to it pro
190
190
  `drewOn`'s credit.
191
191
  Most are also guarantees elsewhere in this section (1, 4–6, 12, 16, 6b–6f) or in the
192
192
  module that enforces them; the registry row is the claim's exact wording.
193
+ **One host can serve fewer (2026-11-04, TT1).** claude.ai's list goes through
194
+ `tools.ts#CLAUDE_AI_TRIM`: it renders a named subset of each trimmed tool's claims, and
195
+ the rest are its engine rows there — the same row objects, so the audit above still
196
+ holds every one; it also serves shorter field descriptions and leaves out two fields
197
+ (`traits` on a write-up entry, the legacy `other_word`). Claude Code's and Desktop's
198
+ lists are untouched. `test/claude-ai-surface.test.ts` holds served ⊆ base and served +
199
+ engine = the base's rows.
193
200
  3. **[M] Every tool carries an admission test and at least one named negative example** in
194
201
  its description, plus an engine-side check wherever the rule is safety-relevant
195
202
  (scar §2.16 — v1's `thread.open` shipped with no criteria and produced 33 opens and zero
@@ -21,7 +21,7 @@ export const SERVER_NAME = "counterparts";
21
21
  * host decides whether to trust what follows. Read from a constant rather than
22
22
  * from disk so the server opens no file to answer its first message.
23
23
  */
24
- export const SERVER_VERSION = "0.3.47";
24
+ export const SERVER_VERSION = "0.3.48";
25
25
 
26
26
  /**
27
27
  * THE ONE LINE EVERY TOOL ANSWERS WITH when the store on disk is a schema AHEAD
@@ -2280,8 +2280,7 @@ export const CLAUDE_AI_WAKE: ToolSpec = {
2280
2280
  /** The `session` a claude.ai conversation names: Desktop's, without the Code tab. */
2281
2281
  const CLAUDE_AI_SESSION_PROPERTY = {
2282
2282
  type: "string",
2283
- description:
2284
- "This conversation's session id from the wake tool. Pass it on every call, so the call is filed under this conversation's session and not the most recent one.",
2283
+ description: "This conversation's session id from wake. Pass it on every call.",
2285
2284
  };
2286
2285
 
2287
2286
  function withClaudeAiSession(spec: ToolSpec): ToolSpec {
@@ -2316,6 +2315,12 @@ function withClaudeAiSession(spec: ToolSpec): ToolSpec {
2316
2315
  * routine's own prompt. A replaced negative still says "Do NOT", and the
2317
2316
  * list is chosen by the server's host (`toolListFor`), never a client's name.
2318
2317
  */
2318
+ /** `text` with `from` replaced once; throws when `from` is not there (a reworded base fails loudly). */
2319
+ function replacedOnce(text: string, from: string, to: string): string {
2320
+ if (!text.includes(from)) throw new Error(`claude.ai words: "${from}" is no longer in the base text`);
2321
+ return text.replace(from, to);
2322
+ }
2323
+
2319
2324
  export const CLAUDE_AI_WORDS: Readonly<
2320
2325
  Partial<Record<ToolName, { readonly summary?: string; readonly admission?: string; readonly negativeExamples?: readonly string[] }>>
2321
2326
  > = {
@@ -2324,6 +2329,8 @@ export const CLAUDE_AI_WORDS: Readonly<
2324
2329
  "Save to long-term memory, in the moment: something about the person, a decision, how they like to work, a plan or promise with its date, how the conversation felt, a line that struck you and why. Memory forms only from what you write here and in chapters — nothing reads the conversation afterwards, so what you don't write is not kept. One idea per call; keep the exact words when the words matter.",
2325
2330
  admission:
2326
2331
  "When something would be worth having back, however small — as it comes up, rather than saving it for the end: nothing on claude.ai asks at the end of a conversation. Err toward too many: weak memories fade on their own within days unless they are used, so a routine one costs little. Leave salience unset for routine things; set it when something mattered.",
2332
+ // TT1 (2026-11-04): the `feelingsNow` negative moves to its field, which says it.
2333
+ negativeExamples: REMEMBER.negativeExamples.filter((n) => !n.includes("`feelingsNow`")),
2327
2334
  },
2328
2335
  recall: {
2329
2336
  summary:
@@ -2338,6 +2345,17 @@ export const CLAUDE_AI_WORDS: Readonly<
2338
2345
  "Save several memories at once: the memories half of the write-up ask a tool result carries once a conversation has gone on a while — hand back what caught your attention since you last wrote, one idea per entry, in your own words. With `remember`, this is the only road from conversation to memory. The other half is `chapter`.",
2339
2346
  admission:
2340
2347
  "When a tool result carries the write-up ask, with one entry per thing you noticed: what they said, what happened, what was decided, what you learned, a line that struck you and why. Err toward too many. Add one that `updates` anything dated or open now done.",
2348
+ // TT1 (2026-11-04): every host's second negative names "the end-of-session
2349
+ // ask", which claude.ai never makes; the chat's says where the id comes from.
2350
+ negativeExamples: SESSION_END.negativeExamples.map((n) =>
2351
+ n.includes("end-of-session ask") ? "Do NOT pass another conversation's session id, or one you guessed at: pass this conversation's, from wake." : n,
2352
+ ),
2353
+ },
2354
+ // TT1 (2026-11-04): hosted claude.ai keeps the page on a server, not "this machine".
2355
+ self_page: {
2356
+ // TT1 review: "a longer page is kept whole" read as any length; the cap is said where the length is.
2357
+ summary: replacedOnce(SELF_PAGE.summary, "a longer page is kept whole,", "a longer page is kept whole (past 16,384 bytes it is refused, never trimmed),"),
2358
+ negativeExamples: SELF_PAGE.negativeExamples.map((n) => n.replace("the most durable text on this machine", "the most durable text in this memory")),
2341
2359
  },
2342
2360
  chapter: {
2343
2361
  summary:
@@ -2449,6 +2467,262 @@ function withClaudeAiDreamValue(spec: ToolSpec): ToolSpec {
2449
2467
  return { ...spec, inputSchema: { ...spec.inputSchema, properties: { ...schema.properties, value: { ...value, description: CLAUDE_AI_DREAM_VALUE } } } };
2450
2468
  }
2451
2469
 
2470
+ /**
2471
+ * CLAUDE.AI'S TRIMMED TOOL LIST (TT1, 2026-11-04; Mike's yes via ROADMAP, from
2472
+ * T's draft in the 11-04 checks). claude.ai's `tools/list` was 92.3 KB (0.3.47's words), and a
2473
+ * chat that wakes carries all of it from then on. Most of it was field
2474
+ * descriptions, and some of their words were false here: a terminal, folders,
2475
+ * "THIS directory", the end-of-session ask, the hooks' registry, the dashboard.
2476
+ * This layer, for claude.ai only, takes those out and says the rest shorter.
2477
+ * Claude Code's and Desktop's lists are untouched, byte for byte.
2478
+ *
2479
+ * - `served`: the claims claude.ai's description renders, each named by how it
2480
+ * begins (as `description-cut.test.ts`'s LEADS name them). Every other row
2481
+ * of the base's `privileges` becomes an `engine` row here: still mechanized,
2482
+ * still audited (`mcp.test.ts` walks the base specs), not rendered — the
2483
+ * context-trims lane's rule (CONTRACT §5 G2), applied to one host.
2484
+ * - `fields`: field descriptions by path (`feelings[].emotion` is the
2485
+ * `emotion` of each `feelings` item; `settle.pair` a nested property). A
2486
+ * string replaces the description; a function rewrites it from the base's;
2487
+ * `null` leaves the field undescribed (its enum or name says it).
2488
+ * - `drop`: properties claude.ai is not offered. The server reads the
2489
+ * arguments it knows and never checks them against the served schema, so a
2490
+ * call that still sends one is served as before.
2491
+ *
2492
+ * Every path and every `served` prefix must match the base exactly once, or
2493
+ * building the list throws: a rename in the every-host words fails loudly
2494
+ * here, never silently serves the long words. Lightly held: the before and
2495
+ * after are in the PR (TT1), with every dropped sentence and its reason.
2496
+ */
2497
+ interface ClaudeAiTrim {
2498
+ readonly served?: readonly string[];
2499
+ readonly fields?: Readonly<Record<string, string | null | ((was: string) => string)>>;
2500
+ readonly drop?: readonly string[];
2501
+ }
2502
+
2503
+ const CLAUDE_AI_SESSION_TEXT = CLAUDE_AI_SESSION_PROPERTY.description;
2504
+
2505
+ /** The seven cores' gloss, said once per door on claude.ai (the enum names them). */
2506
+ const CLAUDE_AI_CORE_TEXT = "One of seven, kept as you name it; leave it out to use the word's own core.";
2507
+ /** `emotion`, without the core note (`core` says it) — the wheel kept whole. */
2508
+ const CLAUDE_AI_EMOTION_TEXT =
2509
+ "ONE word, from the wheel (happy: hopeful, eager, amused, proud; warm: grateful, fond, trusted, moved, tender; calm: steadied, relieved, settled, content; curious: interested, recognized, clarified, amazed, confused; sad: wistful, rueful, disappointed, lonely; uneasy: sheepish, caught out, guilty, unsettled, wary, worried, afraid; angry: frustrated, hurt, critical, disgusted) or your own word. Never a phrase: the nuance goes in carried_by.";
2510
+ const CLAUDE_AI_TRAITS_TEXT =
2511
+ "Optional and rare: a nudge on one of seven axes, when this memory really shows how you acted. No nudge beats a guessed one.";
2512
+ const TRAIT_ITEM_UNDESCRIBED = { "[].axis": null, "[].toward": null, "[].strength": null, "[].carried_by": null } as const;
2513
+
2514
+ /** One memory's fields, as `remember` and each `session_end` entry share them. */
2515
+ const CLAUDE_AI_ENTRY_FIELDS: Readonly<Record<string, string | null>> = {
2516
+ updates:
2517
+ 'The id or handle of a memory this revises: a field, never written into the memory\'s words. To close a dated or open one: its id with `eventDate: null` or `unresolved: false`. A repeating reminder done this time: its id with `status: "done"` and no eventDate (`eventDate: null` ends the repeat). Its date, remind, recurring, about, tags, occurredOn, saidBy and status carry over unless you send your own, and settlesWhen does too when the revision keeps `unresolved: true`.',
2518
+ how: 'With `updates`: `changed` (the default: both were true at their time; the old one is shown as earlier), `corrected` (the old one was wrong; it leaves recall), `open` (a real disagreement: both stay). For changed or corrected, say the journey in your own words ("I used to think X, now Y"). If the memory looks unrelated, nothing is settled and you are shown it: settle it yourself if you meant it.',
2519
+ salience:
2520
+ "Optional, 0-1: how much this caught your attention. Leave it unset for routine things. 0.3 something only skimmed; 0.5 a lesson or decision; 0.7 something they told you about their life, a moment that moved you; 0.9 rare. Their rulings, preferences and corrections stay high.",
2521
+ relevance: "Optional 0-1: how much this bears on them, on you, or on the two of you.",
2522
+ title: "Optional, and asked for: one line saying what this memory is. An index shows it, and recall can expand a memory by its exact title.",
2523
+ eventDate:
2524
+ 'Optional: a FUTURE date this memory is about, so it comes back then (a past one is occurredOn). One of: a day "2026-10-15", a month "2026-10", a range "2026-10-20..2026-10-31", a year "2026". A date written only in the text is never read; an unreadable one is refused and nothing is stored. With `updates`, null drops the date.',
2525
+ remind:
2526
+ 'Optional, with eventDate: "plain" when it matters for remembering to DO something, or the person says it matters: said plainly once, on the day. Otherwise "quiet" (the default): it may surface around the date.',
2527
+ recurring: "Optional, with a day eventDate: it comes back every time from that day (a birthday: yearly). null on a revision stops the repeat.",
2528
+ occurredOn: 'Optional: when it happened, in eventDate\'s shapes. Resolve "yesterday" or "last week" to a real date now; leave it out when you don\'t know.',
2529
+ saidBy: 'Optional: "owner" (they told you), "self" (you said or decided it), "inferred" (your own reading).',
2530
+ status: 'Optional: "done" (it happened), "planned" (decided, not done), "proposed" (not decided), "asked" (a question or request still open).',
2531
+ tags: "Optional: 3-5 short lowercase tags: a topic, person, project or place. Not a date or a feeling.",
2532
+ feelings: "Optional: the feelings in this moment, one object each; yours and the owner's side by side. The strongest holds the memory higher and slows its fading.",
2533
+ "feelings[].whose": null,
2534
+ "feelings[].core": CLAUDE_AI_CORE_TEXT,
2535
+ "feelings[].emotion": CLAUDE_AI_EMOTION_TEXT,
2536
+ "feelings[].strength": "0-1; leave it out for the word's default.",
2537
+ "feelings[].valence": "Optional, -1 to 1, when the word alone would mislead.",
2538
+ "feelings[].carried_by": "What carried the feeling, in your own words.",
2539
+ "feelings[].beneath": "The index of a feeling in this list this one sits on top of (angry over afraid).",
2540
+ about:
2541
+ "What this is about: me (who I am), us (the owner and me), owner (the owner, as a person), work (a project's own), world (anything else). Mark anything personal owner or us; unmarked, a fact counts as work. Only me and us can become part of who I am, never a plan. Kept on a revision.",
2542
+ unresolved:
2543
+ 'Optional: true only when someone owes an answer: a question, a check, a promise. A bug, a design note or a fact is not open. It shows under "Still open" until closed: `updates` its id with `unresolved: false`.',
2544
+ settlesWhen:
2545
+ "Optional, with unresolved: true: what would settle it, in a short phrase. The night can close the item once a memory shows it happened. A date goes in eventDate.",
2546
+ };
2547
+
2548
+ /** The sentence of `text` that begins with `opening`; throws when there is none (a reworded base fails loudly). */
2549
+ function sentenceOf(text: string, opening: string): string {
2550
+ const at = text.indexOf(opening);
2551
+ const end = text.indexOf(".", at);
2552
+ if (at < 0 || end < 0) throw new Error(`CLAUDE_AI_TRIM: no sentence begins "${opening}"`);
2553
+ return text.slice(at, end + 1);
2554
+ }
2555
+
2556
+ function under(prefix: string, words: Readonly<Record<string, string | null>>): Record<string, string | null> {
2557
+ return Object.fromEntries(Object.entries(words).map(([path, text]) => [`${prefix}${path}`, text]));
2558
+ }
2559
+
2560
+ export const CLAUDE_AI_TRIM: Readonly<Partial<Record<ToolName, ClaudeAiTrim>>> = {
2561
+ remember: {
2562
+ served: ["`updates` is a FIELD", "`eventDate` is a FIELD", "A salience you claim is a FLOOR", "A stored memory comes back"],
2563
+ fields: {
2564
+ // The "Required unless" sentence and TC1's plumbing rule are the base's own, so a change there fails loudly here.
2565
+ text: (was) =>
2566
+ `One thing to remember, in your own words, with the exact quote, number or name when the words matter. A list, table or pasted text whose specifics matter: word for word, with the words someone would search for in the title and first line. ${sentenceOf(was, "Required unless ")} ${sentenceOf(was, OWN_PLUMBING_RULE)}`,
2567
+ ...CLAUDE_AI_ENTRY_FIELDS,
2568
+ settle:
2569
+ "Settle two memories that already exist (a pair a dream flagged, or two a write showed you) without writing a new one: `pair` (its ctr_ id), or `holds` (holds now) and `over`; `how` as for `updates`, and `why` in a short line.",
2570
+ "settle.holds": null,
2571
+ "settle.over": null,
2572
+ "settle.why": null,
2573
+ belief:
2574
+ "Rare: one short claim about me or us that this memory plainly shows (the owner's words, my real choice, or a strongly felt moment). Most memories carry none.",
2575
+ traits: CLAUDE_AI_TRAITS_TEXT,
2576
+ ...under("traits", TRAIT_ITEM_UNDESCRIBED),
2577
+ feelingsNow:
2578
+ "Optional: when a memory shown to you this conversation feels DIFFERENT now, how it feels now (the first stays). Not for a new moment (that is `feelings`), nor to restate the old feeling. At most 5, and once a day per memory; `text` may be left out.",
2579
+ "feelingsNow[].id": "The memory's id.",
2580
+ "feelingsNow[].whose": "Yours (the default), or the owner's.",
2581
+ "feelingsNow[].core": CLAUDE_AI_CORE_TEXT,
2582
+ "feelingsNow[].emotion": "ONE word, as in `feelings`.",
2583
+ "feelingsNow[].strength": "0-1; leave it out for the word's default.",
2584
+ "feelingsNow[].valence": "Optional, -1 to 1.",
2585
+ "feelingsNow[].carried_by": "What changed, in your own words.",
2586
+ remark: "Optional: {id, about, why}: re-mark what a memory shown this conversation is about, when its mark is wrong.",
2587
+ core: 'Optional: {id, decision: "keep" | "retire", why}: the answer to a core memory the wake lists as being reconsidered; retire sends it back to ordinary fading.',
2588
+ // HD1: delete from chat is the point on claude.ai; kept whole in substance, said shorter.
2589
+ remove: `Optional: delete one memory the person asks you to delete: {id}, one shown this conversation, after saying which it is (if more than one could be meant, ask first). It is hidden at once and erased after 24 hours; tell them what the result says. {id, undo: true} brings it back before then; recall "${DELETED_HANDLE}" lists what waits.`,
2590
+ },
2591
+ drop: ["feelings[].other_word"],
2592
+ },
2593
+ recall: {
2594
+ served: ["A question needs mode", "A handle expands exactly that memory", "Pass ids to read those memories whole", "In facts mode a faded match", "A time in the question filters"],
2595
+ fields: {
2596
+ // Moved here from the meaning-arc claim, which claude.ai does not render: how to ask about a feeling.
2597
+ question: (was) =>
2598
+ `${was} In a question about feeling, "I" and "me" mean you, the counterpart, and "you" means the owner: to ask about the owner's feelings, say "the owner" or their name.`,
2599
+ page: `With a question, or the handle "${STILL_OPEN_HANDLE}": which page of the answer (1 is the first). The answer says how many there are.`,
2600
+ handle: `A memory id or exact title, read whole (never a search; takes no mode). Also: a dream's id (drm_…) or a reflection's (rfl_…); "last dream" (or "last night"): the newest dream and the reflection after it; "${STILL_OPEN_HANDLE}": everything the wake's Still open carries, paged (see page); "coming up": what's due; "handoffs": the live handoffs, to expand or retire; "${DELETED_HANDLE}": memories deleted in chat that wait to be erased, to undo one; "${MANUAL_HANDLE}": how Counterparts works, as sections — "${MANUAL_HANDLE} <section>" opens one.`,
2601
+ },
2602
+ },
2603
+ session_end: {
2604
+ // The fields claim stays (TC1, review of #751): `saidBy: owner` is the plumbing gate's exemption, on every host.
2605
+ served: ["`updates` is a FIELD on an entry", "`occurredOn`, `saidBy` and `status` are FIELDS", "A salience you claim is a floor", "A stored memory comes back"],
2606
+ fields: {
2607
+ session: CLAUDE_AI_SESSION_TEXT,
2608
+ memories:
2609
+ "One entry per thing, one idea each: a quote, a fact and a decision are three. `[]` only when nothing happened since you last wrote. A refused entry does not fail the others.",
2610
+ "memories[].content": (was) => `One thing, in your own words, with the exact quote, number or name when the words matter. ${sentenceOf(was, OWN_PLUMBING_RULE)}`,
2611
+ ...under("memories[].", CLAUDE_AI_ENTRY_FIELDS),
2612
+ handoff:
2613
+ 'Optional, and not a memory: where open work stands and what the next conversation should pick up, leading with "next: X (waiting on Y)". Setting it again replaces this conversation\'s earlier one; "" retires it. Not needed when a chapter already says it.',
2614
+ retireHandoff: "Optional: ids of finished handoffs to retire (`sch_…`), whoever wrote them.",
2615
+ // Kept, short: claude.ai's wake can carry the write-up pointer (`lifecycle.ts#deliverWriteUpAsk`), whose own words say the steps.
2616
+ writeUp: "Only when a wake named an ended session to write up: its id, as that line says.",
2617
+ part: "With `writeUp` and `memories`: the part number the fetch returned.",
2618
+ nothing: "With `writeUp` and `memories: []`: one line on why nothing is worth keeping.",
2619
+ drewOn: "Optional: up to 3 ids of memories shown to you this conversation that changed what you did or said. Not one you only saw.",
2620
+ rated:
2621
+ "Optional: rate memories shown to you since you last wrote, and every id in `drewOn`: 0 noise, 1 on topic but not needed, 2 useful background, 3 changed what I did or said. Rate honestly: a score counts as use.",
2622
+ "rated[].id": null,
2623
+ "rated[].score": null,
2624
+ },
2625
+ drop: ["memories[].traits", "memories[].feelings[].other_word"],
2626
+ },
2627
+ chapter: {
2628
+ // The first claim is Claude Code's ("the hooks' own live-session registry"); the last names directories.
2629
+ served: ["The chapter number comes back", "A second call inside the same chapter", "Each chapter has ONE summary memory"],
2630
+ fields: {
2631
+ session: CLAUDE_AI_SESSION_TEXT,
2632
+ about:
2633
+ "What this conversation was about, by meaning: me, us, owner, work or world, as for a memory. Please set it: it goes to the chapter's summary. One about people, feelings or life outside the work is owner or us.",
2634
+ },
2635
+ },
2636
+ self_page: {
2637
+ // "This tool cannot unwrite the page" names the owner's console, which hosted has none of: an engine row here.
2638
+ served: ["It writes ONE row, kept with its versions", "Pass `ifVersion`"],
2639
+ fields: {
2640
+ short: `A SHORT VERSION, for a page past ${String(PAGE_ROOM_BYTES)} bytes: under ${String(PAGE_ROOM_BYTES)} bytes, first person, the whole of who you are condensed. Beside \`body\`, or alone (with \`ifVersion\`) to add one to the page as it stands.`,
2641
+ },
2642
+ },
2643
+ dream: {
2644
+ // Its `begin` prompt states the rest a dreamer needs.
2645
+ served: ["At most one dream a calendar day", "Each dream has limits"],
2646
+ fields: {
2647
+ session: CLAUDE_AI_SESSION_TEXT,
2648
+ "changes[].emotion": `\`feeling-now\`: ${CLAUDE_AI_EMOTION_TEXT}`,
2649
+ "changes[].core": `\`feeling-now\`: ${CLAUDE_AI_CORE_TEXT}`,
2650
+ },
2651
+ },
2652
+ reflect: {
2653
+ served: ["It is bound to ONE session as `dream` is", "It is shown only what could surface", "`settle` settles two memories it was shown"],
2654
+ fields: {
2655
+ session: CLAUDE_AI_SESSION_TEXT,
2656
+ traits: `\`finish\`, optional: trait nudges on memories you were shown. ${CLAUDE_AI_TRAITS_TEXT}`,
2657
+ "feelings[].emotion": CLAUDE_AI_EMOTION_TEXT,
2658
+ "feelings[].core": CLAUDE_AI_CORE_TEXT,
2659
+ },
2660
+ },
2661
+ };
2662
+
2663
+ /** The property a path names, and the object that holds it; throws when the path does not resolve. */
2664
+ function propertyAt(schema: Record<string, unknown>, path: string, tool: string): { holder: Record<string, unknown>; key: string; property: Record<string, unknown> } {
2665
+ let node = schema;
2666
+ const steps = path.split(".");
2667
+ for (let i = 0; i < steps.length; i += 1) {
2668
+ const step = steps[i] as string;
2669
+ const items = step.endsWith("[]");
2670
+ const key = items ? step.slice(0, -2) : step;
2671
+ const holder = (node["properties"] ?? {}) as Record<string, unknown>;
2672
+ const property = holder[key] as Record<string, unknown> | undefined;
2673
+ if (property === undefined) throw new Error(`CLAUDE_AI_TRIM: ${tool} has no field "${path}"`);
2674
+ if (i === steps.length - 1 && !items) return { holder, key, property };
2675
+ node = items ? (property["items"] as Record<string, unknown>) : property;
2676
+ if (node === undefined) throw new Error(`CLAUDE_AI_TRIM: ${tool}'s "${path}" has no items`);
2677
+ }
2678
+ throw new Error(`CLAUDE_AI_TRIM: ${tool}'s "${path}" names no property`);
2679
+ }
2680
+
2681
+ function trimSchema(base: Record<string, unknown>, trim: ClaudeAiTrim, tool: string): Record<string, unknown> {
2682
+ const schema = structuredClone(base);
2683
+ for (const [path, words] of Object.entries(trim.fields ?? {})) {
2684
+ const { property } = propertyAt(schema, path, tool);
2685
+ if (words === null) {
2686
+ if (!("description" in property)) throw new Error(`CLAUDE_AI_TRIM: ${tool}'s "${path}" has no description to leave out`);
2687
+ delete property["description"];
2688
+ } else {
2689
+ const was = property["description"];
2690
+ if (typeof was !== "string") throw new Error(`CLAUDE_AI_TRIM: ${tool}'s "${path}" has no description to replace`);
2691
+ property["description"] = typeof words === "function" ? words(was) : words;
2692
+ }
2693
+ }
2694
+ for (const path of trim.drop ?? []) {
2695
+ const { holder, key } = propertyAt(schema, path, tool);
2696
+ // The object that lists `key` among its properties: the schema, a nested object, or an array's item.
2697
+ const up = path.includes(".") ? path.slice(0, path.lastIndexOf(".")) : "";
2698
+ const parent = up === "" ? schema : up.endsWith("[]") ? (propertyAt(schema, up.slice(0, -2), tool).property["items"] as Record<string, unknown>) : propertyAt(schema, up, tool).property;
2699
+ const required = parent["required"];
2700
+ if (Array.isArray(required) && required.includes(key)) throw new Error(`CLAUDE_AI_TRIM: ${tool}'s "${path}" is required; it cannot be left out`);
2701
+ delete holder[key];
2702
+ }
2703
+ return schema;
2704
+ }
2705
+
2706
+ /** claude.ai's copy of a tool, through `CLAUDE_AI_TRIM`: fewer claims rendered (the rest are the engine's), shorter field words. */
2707
+ function withClaudeAiTrim(spec: ToolSpec): ToolSpec {
2708
+ const trim = CLAUDE_AI_TRIM[spec.name];
2709
+ if (trim === undefined) return spec;
2710
+ let { privileges, engine } = spec;
2711
+ if (trim.served !== undefined) {
2712
+ const kept = new Set(
2713
+ trim.served.map((lead) => {
2714
+ const matches = spec.privileges.filter((p) => p.claim.startsWith(lead));
2715
+ if (matches.length !== 1) throw new Error(`CLAUDE_AI_TRIM: ${String(matches.length)} of ${spec.name}'s claims begin "${lead}"`);
2716
+ return matches[0] as Privilege;
2717
+ }),
2718
+ );
2719
+ privileges = spec.privileges.filter((p) => kept.has(p));
2720
+ engine = [...(spec.engine ?? []), ...spec.privileges.filter((p) => !kept.has(p))];
2721
+ }
2722
+ const inputSchema = trim.fields === undefined && trim.drop === undefined ? spec.inputSchema : trimSchema(spec.inputSchema, trim, spec.name);
2723
+ return { ...spec, privileges, ...(engine === undefined ? {} : { engine }), inputSchema };
2724
+ }
2725
+
2452
2726
  function withClaudeAiWords(spec: ToolSpec): ToolSpec {
2453
2727
  const words = CLAUDE_AI_WORDS[spec.name as ToolName];
2454
2728
  return words === undefined ? spec : { ...spec, ...words };
@@ -2458,7 +2732,7 @@ function withClaudeAiWords(spec: ToolSpec): ToolSpec {
2458
2732
  * able to name its session, in the chat's words where those differ. */
2459
2733
  export const CLAUDE_AI_TOOLS: readonly ToolSpec[] = [
2460
2734
  CLAUDE_AI_WAKE,
2461
- ...TOOLS.map((t) => withClaudeAiSession(t.name === "scope" ? CLAUDE_AI_SCOPE : withClaudeAiDreamValue(withClaudeAiWords(t)))),
2735
+ ...TOOLS.map((t) => withClaudeAiSession(t.name === "scope" ? CLAUDE_AI_SCOPE : withClaudeAiDreamValue(withClaudeAiTrim(withClaudeAiWords(t))))),
2462
2736
  ];
2463
2737
 
2464
2738
  /**
@@ -63,7 +63,7 @@ import { PLUGIN_UPDATE_COMMUNITY, PLUGIN_UPDATE_STEP, PLUGIN_UPDATE_SYNCED, npmU
63
63
  * 30 days old from this alone, with nothing fetched. `test/update-check.test.ts`
64
64
  * holds it to CHANGELOG's heading for `SERVER_VERSION` once there is one.
65
65
  */
66
- export const RELEASE_DATE = "2026-11-04";
66
+ export const RELEASE_DATE = "2026-11-06";
67
67
 
68
68
  export const UPDATE_CHECK_ENV = "COUNTERPARTS_UPDATE_CHECK";
69
69
  export const NONESSENTIAL_TRAFFIC_ENV = "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC";