counterparts 0.3.19 → 0.3.21

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 (108) hide show
  1. package/CHANGELOG.md +119 -0
  2. package/README.md +12 -4
  3. package/docs/module-map.md +6 -0
  4. package/package.json +1 -1
  5. package/src/adapters/claude-code/CONTRACT.md +14 -13
  6. package/src/adapters/claude-code/NOTES.md +29 -0
  7. package/src/adapters/claude-code/bin/hook.ts +12 -4
  8. package/src/adapters/claude-code/bin/runner.ts +41 -20
  9. package/src/adapters/claude-code/doctor.ts +123 -30
  10. package/src/adapters/claude-code/hooks.ts +70 -86
  11. package/src/adapters/claude-code/index.ts +0 -3
  12. package/src/adapters/cli/NOTES.md +8 -0
  13. package/src/adapters/cli/commands-delete.ts +273 -0
  14. package/src/adapters/cli/commands-install.ts +29 -10
  15. package/src/adapters/cli/commands-note.ts +1 -1
  16. package/src/adapters/cli/commands-readings.ts +4 -2
  17. package/src/adapters/cli/commands-scope.ts +25 -4
  18. package/src/adapters/cli/commands-self.ts +4 -1
  19. package/src/adapters/cli/commands-start-fresh.ts +1 -1
  20. package/src/adapters/cli/commands.ts +22 -3
  21. package/src/adapters/cli/help.ts +7 -7
  22. package/src/adapters/cli/install.ts +4 -2
  23. package/src/adapters/cli/mechanisms.ts +2 -2
  24. package/src/adapters/cli/removal.ts +1 -1
  25. package/src/adapters/config.ts +112 -30
  26. package/src/adapters/dashboard/CONTRACT.md +14 -0
  27. package/src/adapters/dashboard/NOTES.md +15 -0
  28. package/src/adapters/dashboard/activity.ts +1 -1
  29. package/src/adapters/dashboard/bin/dashboard.ts +3 -3
  30. package/src/adapters/dashboard/browse.ts +1 -1
  31. package/src/adapters/dashboard/identity.ts +1 -1
  32. package/src/adapters/dashboard/registries.ts +14 -14
  33. package/src/adapters/dashboard/resolve.ts +1 -1
  34. package/src/adapters/dashboard/status.ts +5 -2
  35. package/src/adapters/dashboard/web/actions.ts +21 -2
  36. package/src/adapters/dashboard/web/app.html +1 -1
  37. package/src/adapters/dashboard/web/flow.ts +1 -1
  38. package/src/adapters/dashboard/web/mechanisms/consolidation/index.js +2 -2
  39. package/src/adapters/dashboard/web/mechanisms/consolidation/panel.js +1 -1
  40. package/src/adapters/dashboard/web/mechanisms/decay/index.js +1 -1
  41. package/src/adapters/dashboard/web/mechanisms/reconsolidation/index.js +2 -2
  42. package/src/adapters/dashboard/web/mechanisms/retrieval/panel.js +3 -3
  43. package/src/adapters/dashboard/web/mechanisms/salience/panel.js +2 -2
  44. package/src/adapters/dashboard/web/narrate.ts +11 -11
  45. package/src/adapters/dashboard/web/pages/flow/sections/heatmap.js +1 -1
  46. package/src/adapters/dashboard/web/pages/health/sections/checks.js +3 -2
  47. package/src/adapters/dashboard/web/pages/health/sections/cycle.js +5 -5
  48. package/src/adapters/dashboard/web/pages/health/sections/mechanisms.js +1 -1
  49. package/src/adapters/dashboard/web/pages/health/sections/wake.js +2 -2
  50. package/src/adapters/dashboard/web/pages/memories/sections/tools.js +73 -3
  51. package/src/adapters/dashboard/web/pages/self/sections/dreams.js +2 -2
  52. package/src/adapters/dashboard/web/pages/self/sections/journal.js +5 -5
  53. package/src/adapters/dashboard/web/pages/self/sections/page.js +13 -13
  54. package/src/adapters/dashboard/web/pages/self/sections/settling.js +1 -1
  55. package/src/adapters/dashboard/web/pages/self/sections/wake.js +7 -7
  56. package/src/adapters/dashboard/web/server.ts +9 -1
  57. package/src/adapters/dashboard/web/shared/event-modal.js +1 -1
  58. package/src/adapters/dashboard/web/shared/memory-card-words.js +1 -1
  59. package/src/adapters/dashboard/web/shared/memory-modal.js +5 -5
  60. package/src/adapters/dashboard/web/views/activity.ts +1 -1
  61. package/src/adapters/dashboard/web/views/dreams.ts +1 -1
  62. package/src/adapters/dashboard/web/views/health.ts +1 -1
  63. package/src/adapters/dashboard/web/views/mechanisms.ts +6 -6
  64. package/src/adapters/dashboard/web/views/mind.ts +21 -9
  65. package/src/adapters/dashboard/web/views/overview.ts +3 -3
  66. package/src/adapters/expansions.ts +14 -1
  67. package/src/adapters/fired.ts +1 -1
  68. package/src/adapters/lifecycle.ts +25 -4
  69. package/src/adapters/log/index.ts +21 -0
  70. package/src/adapters/mcp/CONTRACT.md +1 -1
  71. package/src/adapters/mcp/server-self-tools.ts +25 -1
  72. package/src/adapters/mcp/server-words.ts +3 -2
  73. package/src/adapters/mcp/server.ts +45 -9
  74. package/src/adapters/mcp/tools.ts +4 -3
  75. package/src/adapters/plugin.ts +44 -8
  76. package/src/adapters/sessions.ts +5 -2
  77. package/src/adapters/snapshots.ts +90 -1
  78. package/src/adapters/store-id.ts +58 -0
  79. package/src/core/counterpart-boundary.ts +9 -0
  80. package/src/core/counterpart.ts +19 -6
  81. package/src/core/dream/CONTRACT.md +8 -0
  82. package/src/core/dream/index.ts +15 -2
  83. package/src/core/handoff/last-here.ts +24 -12
  84. package/src/core/onboarding.ts +231 -62
  85. package/src/core/prospective/CONTRACT.md +4 -1
  86. package/src/core/prospective/index.ts +23 -5
  87. package/src/core/recall/CONTRACT.md +3 -1
  88. package/src/core/recall/INTERFACE-GAPS.md +1 -1
  89. package/src/core/recall/NOTES.md +14 -0
  90. package/src/core/recall/session.ts +40 -1
  91. package/src/core/reconsolidation.ts +1 -1
  92. package/src/core/remember/CONTRACT.md +14 -8
  93. package/src/core/remember/owes.ts +68 -28
  94. package/src/core/remember/owner-strike-seam.ts +6 -3
  95. package/src/core/remember/spans.ts +3 -2
  96. package/src/core/remember/tunables.ts +18 -5
  97. package/src/core/remember/write-up-seam.ts +2 -1
  98. package/src/core/self/CONTRACT.md +25 -9
  99. package/src/core/self/NOTES.md +6 -0
  100. package/src/core/self/briefing-delivery.ts +349 -0
  101. package/src/core/self/briefing-page.ts +315 -0
  102. package/src/core/self/briefing-room.ts +563 -0
  103. package/src/core/self/briefing.ts +304 -1156
  104. package/src/core/self/index.ts +28 -6
  105. package/src/core/store/NOTES.md +6 -5
  106. package/src/core/store/index.ts +39 -0
  107. package/src/core/store/paths.ts +9 -2
  108. package/src/adapters/claude-code/primacy.ts +0 -162
@@ -0,0 +1,273 @@
1
+ /**
2
+ * `delete <kind>` — DELETE ONE KIND OF DATA, AND NOTHING ELSE (Mike, 2026-10-13).
3
+ *
4
+ * Three kinds, each one sentence of the policy:
5
+ *
6
+ * - `conversation-text` — every word of conversation the store still holds
7
+ * (the span buffer: conversation, the assistant's turns, jots, quarantine,
8
+ * claims in flight), through `remember/`'s own strike — the one door that
9
+ * destroys a span. Sessions still owed a write-up are counted first and
10
+ * said out loud: their text is lost with the rest.
11
+ * - `backups` — every daily snapshot and every pre-migration copy this
12
+ * package wrote, in the snapshots directory and its mirror, taken apart by
13
+ * name (`snapshots.ts#deleteAllCopies`). Rollback has nothing to go back to
14
+ * afterwards, and the console says so before it asks.
15
+ * - `activity-log` — the process log's dated files (`sessions/log/`).
16
+ *
17
+ * Memories have `start-fresh`, and are not a kind here; nor are the dream
18
+ * journal and the self page (lightly held: not unless asked).
19
+ *
20
+ * **One shape for all three.** No `--yes`: the plan, in counts, and "Nothing has
21
+ * changed". A terminal is then asked once; anything that cannot ask (a pipe, a
22
+ * script, the dashboard, which asks in the browser first) passes `--yes`. Each
23
+ * delete that ran leaves one `owner.deleted` row — the kind and counts, never a
24
+ * word, a hash or a path. Under observer it refuses (`OWNER_OPS`).
25
+ */
26
+ import { existsSync, readFileSync } from "node:fs";
27
+ import { join } from "node:path";
28
+
29
+ import { SpanBuffer } from "../../core/remember/index.js";
30
+ // The buffer's destruction seam — this directory may import it, and
31
+ // `test/cli.test.ts` pins that nothing outside it does.
32
+ import { strikeSpans } from "../../core/remember/owner-strike-seam.js";
33
+ import type { Store } from "../../core/store/index.js";
34
+ import { loadConfig } from "../config.js";
35
+ import type { AdapterConfig } from "../config.js";
36
+ import { clearLog, logDates } from "../log/index.js";
37
+ import { writeUpPlan } from "../sessions.js";
38
+ import { deleteAllCopies, readSnapshotsDir, resolveSnapshotsDir } from "../snapshots.js";
39
+
40
+ import { EXIT, openStoreAt } from "./commands-shared.js";
41
+ import type { Io } from "./commands-shared.js";
42
+ import { confirm, isInteractive, isPromptAborted } from "./ui.js";
43
+ import type { UiEnv } from "./ui.js";
44
+
45
+ export const DELETE_KINDS = ["conversation-text", "backups", "activity-log"] as const;
46
+ export type DeleteKind = (typeof DELETE_KINDS)[number];
47
+
48
+ /** The row each delete that ran leaves. Kind and counts only. */
49
+ export const OWNER_DELETED_EVENT = "owner.deleted";
50
+
51
+ const NOTHING_CHANGED = "Nothing has changed.";
52
+
53
+ // ── conversation text ───────────────────────────────────────────────────────
54
+
55
+ /** Every hash and session the buffer holds text for, from the four readers
56
+ * retention counts. Naming hashes as well as sessions means a line that
57
+ * carries no session is not missed. */
58
+ function heldText(buffer: SpanBuffer): { hashes: string[]; sessions: string[] } {
59
+ const hashes = new Set<string>();
60
+ const sessions = new Set<string>();
61
+ for (const scope of buffer.scopes()) {
62
+ for (const span of [
63
+ ...buffer.spans(scope),
64
+ ...buffer.assistantSpans(scope),
65
+ ...buffer.quarantined(scope),
66
+ ...buffer.claimedSpans(scope),
67
+ ]) {
68
+ if (typeof span.hash === "string") hashes.add(span.hash);
69
+ if (typeof span.session === "string" && span.session.length > 0) sessions.add(span.session);
70
+ }
71
+ }
72
+ return { hashes: [...hashes], sessions: [...sessions] };
73
+ }
74
+
75
+ /** What the store holds of conversation text now. Counts, never words. */
76
+ export function planConversationText(store: Store): { sessions: number; owed: number; lines: number } {
77
+ const buffer = new SpanBuffer({ dir: store.dir, observer: true, day: () => store.livedDay() });
78
+ const plan = writeUpPlan({ store, spans: buffer });
79
+ return {
80
+ sessions: plan.length,
81
+ owed: plan.filter((h) => h.owes).length,
82
+ lines: plan.reduce((n, h) => n + h.lines, 0),
83
+ };
84
+ }
85
+
86
+ /** Strike every line of text the buffer holds, recorded `by: "owner"`. */
87
+ export function deleteConversationText(store: Store): { ok: boolean; lines: number; reason: string } {
88
+ const buffer = new SpanBuffer({ dir: store.dir, day: () => store.livedDay() });
89
+ const held = heldText(buffer);
90
+ if (held.hashes.length === 0 && held.sessions.length === 0) return { ok: true, lines: 0, reason: "NOTHING" };
91
+ const report = strikeSpans(buffer, { scope: null, hashes: held.hashes, sessions: held.sessions, by: "owner" });
92
+ return {
93
+ ok: report.reason !== "OBSERVER" && report.reason !== "IO_FAILED",
94
+ lines: report.struck,
95
+ reason: report.reason,
96
+ };
97
+ }
98
+
99
+ // ── backups ─────────────────────────────────────────────────────────────────
100
+
101
+ /** The configuration beside the store (`<base>/claude-code.json`), or none. */
102
+ function configBeside(dir: string): AdapterConfig {
103
+ const beside = join(dir, "..", "claude-code.json");
104
+ if (!existsSync(beside)) return {};
105
+ try {
106
+ return loadConfig(JSON.parse(readFileSync(beside, "utf8"))).config;
107
+ } catch {
108
+ return {};
109
+ }
110
+ }
111
+
112
+ /** The directories copies live in: the snapshots directory and its mirror. */
113
+ function backupDirs(dir: string): string[] {
114
+ const config = configBeside(dir);
115
+ const out: string[] = [];
116
+ const primary = resolveSnapshotsDir(dir, config.snapshots?.dir).dir;
117
+ if (primary !== null) out.push(primary);
118
+ const mirror = config.snapshots?.mirror;
119
+ if (mirror !== undefined && !out.includes(mirror)) out.push(mirror);
120
+ return out;
121
+ }
122
+
123
+ /** How many copies of ours each directory holds. Read-only. */
124
+ export function planBackups(dir: string): { daily: number; preMigration: number; left: number } {
125
+ let daily = 0;
126
+ let preMigration = 0;
127
+ let left = 0;
128
+ for (const d of backupDirs(dir)) {
129
+ const read = readSnapshotsDir(d);
130
+ daily += read.names.length;
131
+ preMigration += read.preMigration.length;
132
+ left += read.preRows.length + read.unrecognised.length;
133
+ }
134
+ return { daily, preMigration, left };
135
+ }
136
+
137
+ // ── the command ─────────────────────────────────────────────────────────────
138
+
139
+ function plural(n: number, one: string, many = `${one}s`): string {
140
+ return `${String(n)} ${n === 1 ? one : many}`;
141
+ }
142
+
143
+ /** The plan, in words, and the question it ends on. Opens the store read-only
144
+ * and closes it before anyone is asked. */
145
+ function describe(kind: DeleteKind, dir: string): { lines: string[]; question: string; empty: boolean } {
146
+ if (kind === "conversation-text") {
147
+ const store = openStoreAt({ dir, observer: true });
148
+ let p;
149
+ try {
150
+ p = planConversationText(store);
151
+ } finally {
152
+ store.close();
153
+ }
154
+ const lines = [
155
+ `Conversation text held: ${plural(p.sessions, "session")}, ${plural(p.lines, "line")}.`,
156
+ p.owed === 0
157
+ ? "None of it is still owed a write-up."
158
+ : `${plural(p.owed, "session is", "sessions are")} still owed a write-up; ${p.owed === 1 ? "its" : "their"} text is lost if you delete now.`,
159
+ "Memories already made from it are not touched.",
160
+ ];
161
+ return { lines, question: "Delete all conversation text now?", empty: p.lines === 0 };
162
+ }
163
+ if (kind === "backups") {
164
+ const p = planBackups(dir);
165
+ const lines = [
166
+ `Backups held: ${plural(p.daily, "daily copy", "daily copies")} and ${plural(p.preMigration, "copy", "copies")} taken before an upgrade.`,
167
+ "After this, rollback has nothing to go back to until the next daily copy.",
168
+ ];
169
+ if (p.left > 0) lines.push(`${plural(p.left, "other folder")} in the backups directory ${p.left === 1 ? "is" : "are"} not ours and will be left.`);
170
+ return { lines, question: "Delete all backups now?", empty: p.daily + p.preMigration === 0 };
171
+ }
172
+ const days = logDates(dir).length;
173
+ return {
174
+ lines: [`Activity log: ${plural(days, "day")} of files.`, "It holds what the processes did, never what was said."],
175
+ question: "Delete the activity log now?",
176
+ empty: days === 0,
177
+ };
178
+ }
179
+
180
+ /** Do it, and say what happened. Returns the counts for the row. */
181
+ function act(kind: DeleteKind, dir: string, store: Store): { ok: boolean; said: string[]; counts: Record<string, number> } {
182
+ if (kind === "conversation-text") {
183
+ const before = planConversationText(store);
184
+ const r = deleteConversationText(store);
185
+ return {
186
+ ok: r.ok,
187
+ said: r.ok
188
+ ? [`Deleted ${plural(r.lines, "line")} of conversation text from ${plural(before.sessions, "session")}.`]
189
+ : [`The delete did not finish (${r.reason}); ${plural(r.lines, "line")} went. Run it again.`],
190
+ counts: { sessions: before.sessions, owed: before.owed, lines: r.lines },
191
+ };
192
+ }
193
+ if (kind === "backups") {
194
+ let copies = 0;
195
+ let left = 0;
196
+ const errors: string[] = [];
197
+ for (const d of backupDirs(dir)) {
198
+ try {
199
+ const r = deleteAllCopies(dir, d);
200
+ copies += r.deleted.length;
201
+ left += r.left.length;
202
+ errors.push(...r.errors);
203
+ } catch (err) {
204
+ errors.push(String((err as Error).message ?? err));
205
+ }
206
+ }
207
+ const said = [`Deleted ${plural(copies, "backup")}.`];
208
+ if (left > 0) said.push(`Left ${plural(left, "folder")} that ${left === 1 ? "is" : "are"} not ours.`);
209
+ for (const e of errors.slice(0, 5)) said.push(` could not: ${e}`);
210
+ return { ok: errors.length === 0, said, counts: { copies, left, errors: errors.length } };
211
+ }
212
+ const r = clearLog(dir);
213
+ return {
214
+ ok: r.failed === 0,
215
+ said: [`Deleted ${plural(r.removed, "day")} of activity log.${r.failed > 0 ? ` ${plural(r.failed, "file")} would not go.` : ""}`],
216
+ counts: { files: r.removed, failed: r.failed },
217
+ };
218
+ }
219
+
220
+ export async function deleteCommand(
221
+ dir: string,
222
+ io: Io,
223
+ env: UiEnv,
224
+ positional: readonly string[],
225
+ flags: Record<string, string | boolean | undefined>,
226
+ ): Promise<number> {
227
+ const kind = positional[0];
228
+ if (kind === undefined || !(DELETE_KINDS as readonly string[]).includes(kind) || positional.length > 1) {
229
+ io.err(`delete takes one kind: ${DELETE_KINDS.join(", ")}.`);
230
+ return EXIT.usage;
231
+ }
232
+ const k = kind as DeleteKind;
233
+ const plan = describe(k, dir);
234
+ for (const line of plan.lines) io.out(line);
235
+ if (plan.empty) {
236
+ io.out(`There is nothing to delete. ${NOTHING_CHANGED}`);
237
+ return EXIT.ok;
238
+ }
239
+ if (flags["yes"] !== true) {
240
+ if (!isInteractive(io, env)) {
241
+ io.out(`${NOTHING_CHANGED} To delete: counterparts delete ${k} --yes`);
242
+ return EXIT.ok;
243
+ }
244
+ let go: boolean;
245
+ try {
246
+ go = await confirm(io, plan.question, { default: false });
247
+ } catch (err) {
248
+ if (!isPromptAborted(err)) throw err;
249
+ go = false;
250
+ }
251
+ if (!go) {
252
+ io.out(NOTHING_CHANGED);
253
+ return EXIT.refused;
254
+ }
255
+ }
256
+ const store = openStoreAt({ dir });
257
+ try {
258
+ const done = act(k, dir, store);
259
+ for (const line of done.said) io.out(line);
260
+ try {
261
+ store.appendEvent({
262
+ name: OWNER_DELETED_EVENT,
263
+ day: store.livedDay(),
264
+ payload: { kind: k, ok: done.ok, ...done.counts },
265
+ });
266
+ } catch {
267
+ io.err("(the record of this delete could not be written)");
268
+ }
269
+ return done.ok ? EXIT.ok : EXIT.failed;
270
+ } finally {
271
+ store.close();
272
+ }
273
+ }
@@ -114,6 +114,13 @@ export function installCommand(
114
114
  * owner's blank store has always started.
115
115
  */
116
116
  newInstall?: "install" | "start-fresh";
117
+ /**
118
+ * Claude Code's ceiling for a configuration this call CREATES with no
119
+ * `--budget` (2026-10-12). On for every Claude Code install — the plugin's
120
+ * first run, the scripted arm, the terminal's — and off for Claude
121
+ * Desktop's (`installDesktop`), which has no measured ceiling.
122
+ */
123
+ defaultBudget?: boolean;
117
124
  } = {},
118
125
  ): number {
119
126
  const dirFlag = typeof parsed.flags["dir"] === "string" ? parsed.flags["dir"] : undefined;
@@ -190,6 +197,16 @@ export function installCommand(
190
197
  return EXIT.refused;
191
198
  }
192
199
  budgetBytes = Number(budgetFlag);
200
+ } else if (opts.defaultBudget !== false && !existsSync(layout.config)) {
201
+ // CLAUDE CODE'S CEILING, WRITTEN INTO A NEW CONFIGURATION (2026-10-12).
202
+ // Until 0.3.20 only the terminal arm wrote it, and the plugin's first run
203
+ // (`install --no-connect`, no terminal) and every scripted install made a
204
+ // store that never composed a wake: every session woke on the bootstrap
205
+ // line. 9,000 is that host's measured number, not one invented here (scar
206
+ // §2.18 keeps the core free of a default; `config.ts#withBudgetDefault`
207
+ // covers the files already written without it). Only a configuration
208
+ // being CREATED: a forced re-install carries a chosen ceiling forward (B1).
209
+ budgetBytes = DEFAULT_BUDGET_BYTES;
193
210
  }
194
211
  const name = typeof parsed.flags["name"] === "string" ? parsed.flags["name"] : undefined;
195
212
  const force = parsed.flags["force"] === true;
@@ -358,7 +375,7 @@ export function installCommand(
358
375
  if (config.what === "kept") {
359
376
  say(" (an existing file is never rewritten — pass --force to replace it)");
360
377
  }
361
- if (budgetBytes === undefined) {
378
+ if (budgetBytes === undefined && opts.defaultBudget === false) {
362
379
  say("");
363
380
  say(' NO "injectionBudgetBytes" was written: nobody told us this host\'s ceiling');
364
381
  say(" and this package invents none (scar §2.18). Re-run with --budget <bytes>,");
@@ -529,7 +546,9 @@ export function installDesktop(
529
546
  io.err(unavailable);
530
547
  return EXIT.refused;
531
548
  }
532
- const code = installCommand(parsed, io, env, home_, named, { hostSteps: false });
549
+ // NO CLAUDE CODE CEILING HERE: Desktop's wake is a tool result, and nobody
550
+ // has measured what that host carries (`defaultBudget`).
551
+ const code = installCommand(parsed, io, env, home_, named, { hostSteps: false, defaultBudget: false });
533
552
  if (code !== EXIT.ok) return code;
534
553
  const custom = customConfigPath(named, home_);
535
554
  const dirFlag = typeof parsed.flags["dir"] === "string" ? parsed.flags["dir"] : undefined;
@@ -691,12 +710,10 @@ async function installConversation(
691
710
 
692
711
  // ── the store and the configuration — SILENTLY ────────────────────────────
693
712
  //
694
- // THE CEILING GETS A NUMBER ON THIS ARM ONLY. Scar §2.18 says this package
695
- // invents no host ceiling, and nothing about that changes for a script: the
696
- // non-interactive arm still ends on its "NO injectionBudgetBytes was written"
697
- // paragraph. What changes here is that there is a person, and the sentence
698
- // explaining the knob moved off this screen into `help install` (item 10) — a
699
- // number that works is worth more to a stranger than a paragraph of homework.
713
+ // THE CEILING. This arm wrote Claude Code's 9,000 first (item 10: a number
714
+ // that works is worth more to a stranger than a paragraph of homework); since
715
+ // 2026-10-12 `installCommand` writes it on every Claude Code arm, the plugin's
716
+ // first run and the scripted one included, so this flag only says it twice.
700
717
  // A `--budget` on the line still wins.
701
718
  //
702
719
  // AND IT IS INJECTED ONLY WHEN THE CONFIGURATION IS BEING CREATED (review
@@ -1058,8 +1075,10 @@ function blankBeside(u: Ui, usable: readonly ParkedSighting[], home: string): "b
1058
1075
  }
1059
1076
 
1060
1077
  /**
1061
- * The interactive install's ceiling, and the ONLY default this package has for
1062
- * one (scar §2.18 holds everywhere else, the scripted arm included). It is the
1078
+ * Claude Code's ceiling, written into every configuration a Claude Code install
1079
+ * creates (the terminal's, the scripted arm's and the plugin's first run, since
1080
+ * 2026-10-12; `config.ts#withBudgetDefault` fills it in for a file written
1081
+ * without it). Claude Desktop's install writes none. It is the
1063
1082
  * ceiling the self page's write limit is sized against
1064
1083
  * (`self/briefing.ts#PAGE_HOST_BUDGET_BYTES`, 2026-10-09), read from there so
1065
1084
  * the two cannot drift: 9,000.
@@ -580,7 +580,7 @@ export function exportCommand(
580
580
  // no export kind carries it, and a person taking "a copy of my memory"
581
581
  // somewhere should not have to discover which half stayed behind.
582
582
  io.out(
583
- "Not included: spans/ — the raw captured conversation, kept 7 days after a session ends, or for as long as it waits to be written up.",
583
+ "Not included: spans/ — the raw captured conversation, deleted 3 days after a session is written up and ended, and never kept more than 14 days.",
584
584
  );
585
585
  // THE DURABLE ROW. Counts and flags only: which kind, how many rows went,
586
586
  // how many confidential ones were left out, whether it was sealed. NOT the
@@ -50,7 +50,7 @@ import { readSnapshotsDir, resolveSnapshotsDir } from "../snapshots.js";
50
50
  // the console's face on the file and the store that adapter owns, and a console
51
51
  // with its own idea of "what counts as red" is exactly the drift I32 ran inside of.
52
52
  import { SPAWN_REFUSAL_PREFIX, SPAWN_START_COUNT_KEY, SPAWN_START_DATE_KEY } from "../claude-code/hooks.js";
53
- import { zoneBeside } from "../config.js";
53
+ import { withBudgetDefault, zoneBeside } from "../config.js";
54
54
  import type { AdapterConfig } from "../config.js";
55
55
  import {
56
56
  anyRed,
@@ -934,7 +934,9 @@ export function doctorCommand(
934
934
  configPath,
935
935
  configReason: reason,
936
936
  ...(unreadableKeys === undefined ? {} : { configUnreadableKeys: unreadableKeys }),
937
- config,
937
+ // The ceiling the hooks will use (`config.ts#withBudgetDefault`), so the
938
+ // Config line can say which one is in force and where it came from.
939
+ config: reason === "loaded" ? withBudgetDefault(config) : config,
938
940
  dir,
939
941
  store,
940
942
  today,
@@ -8,6 +8,7 @@ import { storeExists } from "../../core/store/index.js";
8
8
  // The ONE rule for "which host configuration": the console resolves it with the
9
9
  // same function the hook, the worker and the MCP server do.
10
10
  import { defaultConfigPath } from "../config-path.js";
11
+ import { CLAUDE_CODE_BUDGET_BYTES } from "../config.js";
11
12
  import type { ConfigChoice, ConfigSource } from "../config-path.js";
12
13
  // The scope registry — host configuration, beside the host configuration. The
13
14
  // console is the surface that WRITES it; the hooks and the MCP server only read.
@@ -51,8 +52,9 @@ import type { Io, Parsed } from "./commands-shared.js";
51
52
  * consolidation, dedup and prune stay the boundary's work.
52
53
  *
53
54
  * The ceiling is the host's, never this file's (scar §2.18): `--budget`, else
54
- * `injectionBudgetBytes` from the host config beside the store, else a refusal
55
- * that names both.
55
+ * `injectionBudgetBytes` from the host config beside the store, else Claude
56
+ * Code's default when that config is there without the key (2026-10-12), else
57
+ * a refusal that names both.
56
58
  */
57
59
  export function rebriefCommand(
58
60
  dir: string,
@@ -383,6 +385,9 @@ function scopeEffect(mode: ScopeMode, resumeTo: string | undefined): string {
383
385
  * 3. `~/.counterparts/claude-code.json` — the hooks' own hardcoded path, which
384
386
  * is where `counterparts install` always writes, because `--dir` moves the
385
387
  * store and never the configuration.
388
+ * 4. One of those files there WITHOUT the key: Claude Code's default, the
389
+ * ceiling its hooks wake under (`config.ts#withBudgetDefault`, 2026-10-12).
390
+ * Only no file at all is a refusal.
386
391
  *
387
392
  * **Never `<dir>/claude-code.json`.** A file inside the data dir fails the layout
388
393
  * totality check (§5 G11) and the store stops opening; the `--help` said that
@@ -442,6 +447,8 @@ export function hostCeiling(
442
447
  ? [beside]
443
448
  : [beside, hooksConfig];
444
449
  const namedBy = named !== undefined && named.source !== "default" ? named.source : undefined;
450
+ // The first readable file with no key, for the default below.
451
+ let keyless: string | undefined;
445
452
  for (const candidate of searched) {
446
453
  if (!existsSync(candidate)) continue;
447
454
  try {
@@ -455,12 +462,26 @@ export function hostCeiling(
455
462
  ...(namedBy === undefined ? {} : { namedBy }),
456
463
  };
457
464
  }
465
+ if (value === undefined && keyless === undefined) keyless = candidate;
458
466
  } catch {
459
467
  /* an unreadable host config reports no ceiling — the refusal below says so */
460
468
  }
461
469
  }
462
- // Scar §2.18: the ceiling is a host capability. There is no default anywhere
463
- // in this package and this command does not become the place there is one.
470
+ // A CLAUDE CODE CONFIGURATION THAT NAMES NO CEILING gets that host's default
471
+ // (`config.ts#withBudgetDefault`, 2026-10-12), the one its hooks wake under:
472
+ // the plugin's first run and every scripted install wrote no key before
473
+ // 0.3.20, and a rebrief that refused them would leave those stores on the
474
+ // bootstrap line. The printed source says the number was the default.
475
+ if (keyless !== undefined) {
476
+ return {
477
+ bytes: CLAUDE_CODE_BUDGET_BYTES,
478
+ source: `${keyless} (no injectionBudgetBytes there, so Claude Code's default)`,
479
+ searched,
480
+ ...(namedBy === undefined ? {} : { namedBy }),
481
+ };
482
+ }
483
+ // Scar §2.18: the ceiling is a host capability. With no Claude Code
484
+ // configuration found at all, there is no host to take one from.
464
485
  return {
465
486
  refusal: [
466
487
  'refused: no injection ceiling. Nothing set "injectionBudgetBytes" in either place',
@@ -11,6 +11,7 @@ import { CLAIMS_ERA_CUTOFF_KEY, storeExists } from "../../core/store/index.js";
11
11
  // same function the hook, the worker and the MCP server do.
12
12
  import { CONFIG_FLAG, defaultConfigPath } from "../config-path.js";
13
13
  import type { ConfigChoice } from "../config-path.js";
14
+ import { withBudgetDefault } from "../config.js";
14
15
  import type { AdapterConfig } from "../config.js";
15
16
  import { BIN, DEFAULT_STORE_DIR } from "./install.js";
16
17
  import { bodyFrom, writeLines, versionLines, NO_PAGE_LINES, pageLines } from "./self-page.js";
@@ -733,7 +734,9 @@ export async function catchUpEntry(
733
734
  io.err(`refused: ${configPath} is there and will not be understood, so this will not guess which store to write into. --dir <path> names one directly.`);
734
735
  return EXIT.refused;
735
736
  }
736
- config = { ...host.config, dataDir: host.config.dataDir ?? join(dirname(configPath), DEFAULT_STORE_DIR) };
737
+ // The hooks' ceiling default (`config.ts#withBudgetDefault`): the run
738
+ // renders the wake under the ceiling a session start reads it at.
739
+ config = withBudgetDefault({ ...host.config, dataDir: host.config.dataDir ?? join(dirname(configPath), DEFAULT_STORE_DIR) });
737
740
  fromFile = configPath;
738
741
  }
739
742
  const dataDir = config.dataDir ?? "";
@@ -263,7 +263,7 @@ export async function startFreshCommand(
263
263
  io.out("");
264
264
  io.out(` Note: "injectionBudgetBytes": ${String(ceiling)} is not a whole number of bytes, so`);
265
265
  io.out(" it is not handed to the install. Your configuration is kept exactly as it is —");
266
- io.out(" this only means the install ends on its 'no ceiling was written' paragraph.");
266
+ io.out(" and the hooks read it as they always have.");
267
267
  }
268
268
 
269
269
  const rollback = rollbackLines(plan, existsSync, { parkTheBlankStore: false });
@@ -127,6 +127,7 @@ import { dashboardCommand } from "./commands-dashboard.js";
127
127
  import { startFreshCommand, rollbackCommand } from "./commands-start-fresh.js";
128
128
  import { noteCommand, recallCommand, backupCommand, exportCommand } from "./commands-note.js";
129
129
  import { removeCommand } from "./commands-remove.js";
130
+ import { deleteCommand } from "./commands-delete.js";
130
131
  import {
131
132
  verifyCommand,
132
133
  migrateCacheCommand,
@@ -186,6 +187,9 @@ export const COMMANDS = [
186
187
  "export",
187
188
  "backup",
188
189
  "remove",
190
+ // Delete ONE kind of data — conversation text, backups or the activity log —
191
+ // and nothing else (2026-10-13). `commands-delete.ts`.
192
+ "delete",
189
193
  "verify",
190
194
  "migrate-cache",
191
195
  "backfill-claims",
@@ -284,6 +288,7 @@ export const OWNER_OPS: readonly Command[] = [
284
288
  // has no owner ruling behind it and this change is not the place to make one.
285
289
  "backup",
286
290
  "remove",
291
+ "delete",
287
292
  "verify",
288
293
  // Box 3 is rebuildable, and rewriting it is still a WRITE: an instrument does
289
294
  // not migrate the store it is reading.
@@ -527,6 +532,9 @@ export const COMMAND_FLAGS: Record<Command, readonly string[]> = {
527
532
  // across every project on the machine is how one removal reaches into work
528
533
  // nobody named. The dry run lists what it WOULD match; this flag performs it.
529
534
  remove: ["confirm", "reason", "strike-by-content-across-scopes", "echo-scan"],
535
+ // `--yes` is the door for anything that cannot be asked — a script, the
536
+ // dashboard (which asks in the browser first).
537
+ delete: ["yes"],
530
538
  verify: ["rebuild", "drop-vectors", "prune-index", "keep-vectors", "retry-skipped"],
531
539
  "migrate-cache": ["apply", "batch", "yes"],
532
540
  "backfill-claims": ["apply"],
@@ -613,9 +621,11 @@ export const COMMAND_BLURB: Record<Command, string> = {
613
621
  ask: "Ask memory a question. Read-only.",
614
622
  recall: "Ask memory a question — the same command as `ask`, under its older name. Read-only.",
615
623
  export: "A portable copy of the store, encrypted unless you say otherwise.",
616
- backup: "Snapshot: prose plus the canonical DB via VACUUM INTO. The cache is excluded.",
624
+ backup: "Snapshot: the canonical DB via VACUUM INTO. The cache is excluded, and so is conversation text: backups never hold it.",
617
625
  remove:
618
626
  "The loud removal. With nothing after it, at a terminal, it asks for a memory id or for words to search for, numbers what it finds, lets you pick one or several (or name several ids outright), shows the plan for each, and asks once before it deletes them. --confirm is the scripted door: that exact id, confirmed by typing it back. Anywhere a person cannot be asked — a pipe, a redirect, a CI job — and without --confirm, it prints the plan and changes nothing.",
627
+ delete:
628
+ "Delete one kind of data, and nothing else: conversation-text (every word of conversation still held — sessions still owed a write-up lose theirs, and it says how many first), backups (every daily copy and every copy taken before an upgrade — rollback then has nothing to go back to) or activity-log (what the processes did, never what was said). Memories are not touched; start-fresh is their door. It prints what it would delete, then asks once at a terminal; anywhere else it changes nothing without --yes. Refuses under observer.",
619
629
  verify:
620
630
  "Census of the cache against canonical state. Read-only unless --rebuild, --prune-index or --retry-skipped. --rebuild, --prune-index, --retry-skipped and --drop-vectors require --dir.",
621
631
  "migrate-cache":
@@ -650,7 +660,7 @@ export const COMMAND_BLURB: Record<Command, string> = {
650
660
  about:
651
661
  "What a memory is about — me (who I am), us (the two of us), owner (you, as a person), work (the craft) or world (anything else). With an id alone, its mark and who set it; with an id and a mark, it changes the mark as you, keeps --why with it, and records it the way a nightly reflection's re-mark is recorded. Unmarked, a fact written in a project (or a skill) counts as that project's work and is shown only there; me, us and owner are shown everywhere and can become part of who I am. An archived memory can be marked too (the mark counts if it comes back); an earlier version's id marks the current one. Reading works under observer; the change refuses there.",
652
662
  coverage:
653
- "What is written up, and what is not yet, for one date (default today): each session that captured something that day, how much of it is written up, and what is not yet written up — how many pieces, over how long, since when — and whether that is owed (the nightly run catches it up, or counterparts catch-up does now), lapsed (let go unwritten after fourteen days of use — lost to memory; nothing is deleted), under the floor, or still at work. Read-only.",
663
+ "What is written up, and what is not yet, for one date (default today): each session that captured something that day, how much of it is written up, and what is not yet written up — how many pieces, over how long, since when — and whether that is owed (the nightly run catches it up, or counterparts catch-up does now), lapsed (let go unwritten after fourteen days of use — lost to memory; its text is deleted with the rest, never more than 14 days after the session), under the floor, or still at work. Read-only.",
654
664
  "catch-up":
655
665
  "Write up, now, every session that ended before it was written up — what the nightly run does each morning, on demand. Oldest first, in batches, each a windowless claude -p of its own allowed one tool (session_end); it prints each batch, then what it caught up and what is left. Sessions may be open meanwhile: one still at work is left for later, one being written up elsewhere is passed over. It uses your Claude subscription like any session. At most 400 parts and an hour a run; what is left stays owed. A part whose every word the session's own chapters or notes already wrote up is passed over, and a part answered with nothing kept and no reason why stays owed. --reowe <run> owes again the parts a run (cup_… or nrn_…) closed with nothing kept, when their words were not yet written up: it prints the plan, then asks for the run's id typed back (--yes skips that, --dry-run stops at the plan); it reads the run from the log, which keeps a week, and refuses by name what it cannot do. Refuses under observer.",
656
666
  dashboard:
@@ -668,6 +678,7 @@ const COMMAND_ARGS: Partial<Record<Command, string>> = {
668
678
  // Three shapes, and the bare one is the door a person uses: an id, the words
669
679
  // to find one by, or nothing at all and it asks.
670
680
  remove: " [<id>… | <words>]",
681
+ delete: " conversation-text|backups|activity-log",
671
682
  scope: " <path|.>",
672
683
  // The host is OPTIONAL and there is one of them: `counterparts connect` and
673
684
  // `counterparts connect claude-code` are the same command, and any other name
@@ -961,6 +972,10 @@ const CATCH_UP_FLAG_HELP: Record<string, string> = {
961
972
  yes: "with --reowe: skip typing the run's id back, for a script or a pipe",
962
973
  };
963
974
 
975
+ const DELETE_FLAG_HELP: Record<string, string> = {
976
+ yes: "delete without asking — for a script or a pipe, which otherwise get the counts and nothing changed",
977
+ };
978
+
964
979
  const DASHBOARD_FLAG_HELP: Record<string, string> = {
965
980
  dir: "a store to look at instead of the one your configuration names",
966
981
  };
@@ -1008,7 +1023,9 @@ export function commandHelp(command: Command): string {
1008
1023
  ? SETTLE_FLAG_HELP
1009
1024
  : command === "about"
1010
1025
  ? ABOUT_FLAG_HELP
1011
- : {};
1026
+ : command === "delete"
1027
+ ? DELETE_FLAG_HELP
1028
+ : {};
1012
1029
  const flagLine = (name: string): string => {
1013
1030
  const shown = `--${name}${VALUED_FLAGS.includes(name) ? " <value>" : ""}`;
1014
1031
  return ` ${shown.padEnd(20)} ${override[name] ?? FLAG_HELP[name] ?? "(undocumented)"}`;
@@ -1628,6 +1645,8 @@ export async function run(argv: readonly string[], opts: RunOptions): Promise<nu
1628
1645
  // gate key` is three of them. `env` rides along because the door test is
1629
1646
  // `isInteractive`, which reads `CI` out of it.
1630
1647
  return await removeCommand(dir, io, env, parsed.positional, parsed.flags, now);
1648
+ case "delete":
1649
+ return await deleteCommand(dir, io, env, parsed.positional, parsed.flags);
1631
1650
  case "backfill-claims":
1632
1651
  return backfillClaimsCommand(dir, io, parsed.flags);
1633
1652
  case "repair-dates":
@@ -111,20 +111,18 @@ export const SHORT: Record<string, string | readonly string[]> = {
111
111
  status: "Memories held and recent activity",
112
112
  doctor: "Check that everything is working",
113
113
  dashboard: "Open the dashboard in your browser",
114
- "self-page": [
115
- "The assistant's identity page — who it is, who you are —",
116
- "read at the start of every session",
117
- ],
114
+ "self-page": "See what it knows about you",
118
115
  // ── setup ──
119
116
  install: "First-time setup: your memory and Claude Code — safe to run again",
120
117
  connect: "Connect an AI to your memory (Claude Code today; more soon)",
121
118
  disconnect: "Disconnect an AI",
122
- scope: "Turn memory on or off for a directory",
119
+ scope: "Choose which folders it remembers",
123
120
  uninstall: "Remove Counterparts; keeps your memory unless you say otherwise",
124
121
  // ── your data ──
125
122
  export: "A copy of your memory you can take anywhere, encrypted by default",
126
123
  backup: "Save a snapshot of your memory to a folder",
127
124
  remove: "Delete one memory for good",
125
+ delete: "Delete one kind of data: conversation text, backups or the activity log",
128
126
  // ── advanced: the maintenance shelf, in a person's words rather than the
129
127
  // build's. Finding #18 is exactly this list read by somebody who had just
130
128
  // installed the package.
@@ -193,6 +191,7 @@ export const ADVANCED: readonly string[] = [
193
191
  "coverage",
194
192
  "catch-up",
195
193
  "init",
194
+ "delete",
196
195
  "start-fresh",
197
196
  "rollback",
198
197
  "verify",
@@ -371,8 +370,9 @@ export const COMMAND_DETAIL: Record<string, readonly string[]> = {
371
370
  "It needs an injection ceiling, and says which of these gave it one:",
372
371
  "--budget <bytes>, else the config named by --config / $COUNTERPARTS_CONFIG,",
373
372
  "else <dir>/../claude-code.json (beside the store), else",
374
- "~/.counterparts/claude-code.json (where the hooks read). Never a config",
375
- "INSIDE the data dir — that store stops opening (§5 G11).",
373
+ "~/.counterparts/claude-code.json (where the hooks read). A config found",
374
+ "there without the key gives Claude Code's 9000, as the hooks use. Never a",
375
+ "config INSIDE the data dir — that store stops opening (§5 G11).",
376
376
  ],
377
377
  "probe-oq4": [
378
378
  "recall CONTRACT §7. The footnote header is the one string the probe varies",
@@ -32,8 +32,10 @@
32
32
  * `install` on a live machine reports what it found and changes nothing —
33
33
  * the same idempotence `init` already has, extended to the two files.
34
34
  * 3. **No ceiling is invented** (scar §2.18). `injectionBudgetBytes` is
35
- * written only when `--budget` says what it is; without it the config is
36
- * written without the key and the printed steps say so out loud.
35
+ * what `--budget` says, else Claude Code's measured 9,000 on a Claude Code
36
+ * install (`commands-install.ts#installCommand`, every arm since
37
+ * 2026-10-12), else — Claude Desktop's install — no key, and the printed
38
+ * steps say so out loud.
37
39
  */
38
40
  import {
39
41
  chmodSync,