notesoup 0.61.0 → 0.63.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/.agents/plugins/marketplace.json +15 -0
  2. package/README.md +14 -11
  3. package/dist/plugins/antigravity/src/cli.d.ts +1 -0
  4. package/dist/plugins/antigravity/src/cli.js +23 -0
  5. package/dist/plugins/antigravity/src/hooks.d.ts +18 -0
  6. package/dist/plugins/antigravity/src/hooks.js +53 -0
  7. package/dist/plugins/antigravity/src/identity.d.ts +26 -0
  8. package/dist/plugins/antigravity/src/identity.js +129 -0
  9. package/dist/plugins/claude/src/helper.js +24 -5
  10. package/dist/plugins/claude/src/text.d.ts +7 -0
  11. package/dist/plugins/claude/src/text.js +12 -1
  12. package/dist/plugins/codex/src/hooks.js +1 -0
  13. package/dist/plugins/codex/src/identity.d.ts +6 -1
  14. package/dist/plugins/codex/src/identity.js +13 -1
  15. package/dist/plugins/codex/src/mcp.d.ts +35 -7
  16. package/dist/plugins/codex/src/mcp.js +26 -88
  17. package/dist/plugins/codex/src/text.js +3 -3
  18. package/dist/plugins/dsh/tools.js +8 -4
  19. package/dist/plugins/mcp/operations.d.ts +15 -0
  20. package/dist/plugins/mcp/operations.js +43 -0
  21. package/dist/plugins/mcp/server.d.ts +14 -0
  22. package/dist/plugins/mcp/server.js +13 -0
  23. package/dist/plugins/pi/budget.d.ts +4 -1
  24. package/dist/plugins/pi/budget.js +35 -8
  25. package/dist/plugins/pi/entries.d.ts +2 -0
  26. package/dist/plugins/pi/entries.js +2 -0
  27. package/dist/plugins/pi/history-tools.js +2 -1
  28. package/dist/plugins/pi/history.js +18 -1
  29. package/dist/plugins/pi/notes/tools.js +7 -3
  30. package/dist/plugins/pi/render.d.ts +7 -1
  31. package/dist/plugins/pi/render.js +2 -2
  32. package/dist/plugins/pi/reset/artifacts.d.ts +1 -1
  33. package/dist/plugins/pi/reset/artifacts.js +4 -4
  34. package/dist/plugins/pi/reset/lifecycle.d.ts +9 -2
  35. package/dist/plugins/pi/reset/lifecycle.js +109 -31
  36. package/dist/plugins/pi/runtime.js +104 -63
  37. package/dist/plugins/pi/tool-result.js +7 -7
  38. package/dist/plugins/pi/window.d.ts +25 -3
  39. package/dist/plugins/pi/window.js +219 -9
  40. package/dist/src/boot/render.js +18 -15
  41. package/dist/src/boot/text.d.ts +3 -1
  42. package/dist/src/boot/text.js +22 -20
  43. package/dist/src/budget/text.d.ts +7 -3
  44. package/dist/src/budget/text.js +24 -15
  45. package/dist/src/history/claude.d.ts +2 -0
  46. package/dist/src/history/claude.js +46 -0
  47. package/dist/src/history/codex-transcript.js +7 -5
  48. package/dist/src/history/codex.js +3 -0
  49. package/dist/src/history/corpus.d.ts +28 -1
  50. package/dist/src/history/corpus.js +40 -0
  51. package/dist/src/history/history.d.ts +37 -46
  52. package/dist/src/history/history.js +21 -40
  53. package/dist/src/history/local.js +67 -32
  54. package/dist/src/history/pi.d.ts +2 -1
  55. package/dist/src/history/pi.js +122 -48
  56. package/dist/src/history/prefilter.js +76 -19
  57. package/dist/src/history/query.d.ts +28 -49
  58. package/dist/src/history/query.js +83 -68
  59. package/dist/src/history/summary-cache.d.ts +8 -1
  60. package/dist/src/history/summary-cache.js +138 -12
  61. package/dist/src/index.d.ts +2 -2
  62. package/dist/src/index.js +1 -1
  63. package/dist/src/notes/errors.d.ts +1 -1
  64. package/dist/src/notes/frontmatter.d.ts +0 -2
  65. package/dist/src/notes/frontmatter.js +0 -2
  66. package/dist/src/notes/index.d.ts +1 -1
  67. package/dist/src/notes/index.js +1 -1
  68. package/dist/src/notes/policy.d.ts +15 -1
  69. package/dist/src/notes/policy.js +46 -5
  70. package/dist/src/notes/store.d.ts +12 -0
  71. package/dist/src/notes/store.js +16 -20
  72. package/dist/src/text-match.d.ts +10 -1
  73. package/dist/src/text-match.js +42 -3
  74. package/dist/src/tools/dream.d.ts +22 -93
  75. package/dist/src/tools/dream.js +30 -27
  76. package/dist/src/tools/history.d.ts +33 -26
  77. package/dist/src/tools/history.js +257 -163
  78. package/dist/src/tools/notes.d.ts +51 -163
  79. package/dist/src/tools/notes.js +146 -100
  80. package/dist/src/tools/output.d.ts +2 -1
  81. package/dist/src/tools/output.js +2 -1
  82. package/dist/src/tools/result.d.ts +4 -7
  83. package/dist/src/tools/result.js +8 -9
  84. package/dist/src/tools/schema.d.ts +4 -1
  85. package/dist/src/tools/schema.js +25 -1
  86. package/dist/test/agent-loop.test.js +394 -56
  87. package/dist/test/antigravity-live.test.d.ts +1 -0
  88. package/dist/test/antigravity-live.test.js +142 -0
  89. package/dist/test/antigravity-plugin.test.d.ts +1 -0
  90. package/dist/test/antigravity-plugin.test.js +101 -0
  91. package/dist/test/boot.integration.test.js +156 -15
  92. package/dist/test/budget-settings.integration.test.js +4 -4
  93. package/dist/test/claude-history.test.js +14 -13
  94. package/dist/test/claude-mod.test.js +199 -16
  95. package/dist/test/claude-validation.test.js +69 -2
  96. package/dist/test/codex-history.test.js +15 -3
  97. package/dist/test/codex-plugin.test.js +76 -38
  98. package/dist/test/dependencies.test.js +7 -3
  99. package/dist/test/dream-skill.test.js +3 -3
  100. package/dist/test/dream-tools.test.js +101 -56
  101. package/dist/test/dsh.test.js +34 -19
  102. package/dist/test/helpers/dependency-graph.js +2 -2
  103. package/dist/test/helpers/extension.d.ts +68 -3
  104. package/dist/test/helpers/extension.js +74 -5
  105. package/dist/test/history-corpus.test.js +79 -77
  106. package/dist/test/history-summary-cache.test.js +97 -9
  107. package/dist/test/history.integration.test.js +234 -168
  108. package/dist/test/host-neutral.test.js +69 -19
  109. package/dist/test/marker.test.js +1 -1
  110. package/dist/test/model-facing-text.test.js +13 -3
  111. package/dist/test/note-policy.test.js +96 -77
  112. package/dist/test/notes.integration.test.js +212 -94
  113. package/dist/test/notes.test.js +184 -113
  114. package/dist/test/pi-render.test.js +20 -12
  115. package/dist/test/project-namespace.test.js +3 -2
  116. package/dist/test/reset-lifecycle.test.js +12 -2
  117. package/docs/antigravity.md +44 -0
  118. package/docs/architecture.md +6 -4
  119. package/docs/claude-code-mod.md +7 -7
  120. package/docs/codex.md +36 -38
  121. package/docs/dsh.md +3 -3
  122. package/docs/history-sessions.md +28 -50
  123. package/docs/notes-library.md +4 -4
  124. package/docs/reset-lifecycle.md +1 -1
  125. package/docs/skills.md +3 -3
  126. package/docs/tool-results.md +47 -28
  127. package/package.json +3 -2
  128. package/playbook.md +1 -1
  129. package/plugins/antigravity/dist/antigravity/notesoup.js +26886 -0
  130. package/plugins/antigravity/hooks.json +7 -0
  131. package/plugins/antigravity/mcp_config.json +8 -0
  132. package/plugins/antigravity/plugin.json +6 -0
  133. package/plugins/antigravity/src/cli.ts +22 -0
  134. package/plugins/antigravity/src/hooks.ts +51 -0
  135. package/plugins/antigravity/src/identity.ts +127 -0
  136. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  137. package/plugins/claude/dist/claude/helper.js +1108 -539
  138. package/plugins/claude/hooks/register.ts +202 -62
  139. package/plugins/claude/playbook.md +1 -1
  140. package/plugins/claude/skills/dream/SKILL.md +1 -1
  141. package/plugins/claude/skills/notesoup-guide/SKILL.md +92 -0
  142. package/plugins/claude/src/helper.ts +24 -5
  143. package/plugins/claude/src/text.ts +14 -1
  144. package/plugins/codex/.codex-plugin/plugin.json +8 -0
  145. package/plugins/codex/.mcp.json +11 -0
  146. package/plugins/codex/README.md +5 -21
  147. package/plugins/codex/dist/codex/notesoup.js +18480 -17946
  148. package/plugins/codex/src/hooks.ts +1 -0
  149. package/plugins/codex/src/identity.ts +14 -1
  150. package/plugins/codex/src/mcp.ts +28 -98
  151. package/plugins/codex/src/text.ts +3 -3
  152. package/plugins/dsh/tools.ts +8 -4
  153. package/plugins/mcp/operations.ts +50 -0
  154. package/plugins/mcp/server.ts +23 -0
  155. package/plugins/paseo/README.md +5 -10
  156. package/plugins/paseo/client/brain-empty-card.tsx +3 -3
  157. package/plugins/paseo/client/markdown.tsx +50 -38
  158. package/plugins/paseo/client/notes-op-card.tsx +12 -9
  159. package/plugins/paseo/client/paper-card.tsx +6 -5
  160. package/plugins/paseo/client/paper-palette.ts +2 -9
  161. package/plugins/paseo/client/sticky-card.tsx +2 -2
  162. package/plugins/paseo/client/tool-result.ts +7 -14
  163. package/plugins/paseo/package-lock.json +3406 -0
  164. package/plugins/paseo/package.json +1 -0
  165. package/plugins/paseo/test/markdown-core.test.ts +73 -66
  166. package/plugins/pi/budget.ts +31 -8
  167. package/plugins/pi/entries.ts +2 -0
  168. package/plugins/pi/history-tools.ts +2 -1
  169. package/plugins/pi/history.ts +30 -1
  170. package/plugins/pi/notes/tools.ts +7 -3
  171. package/plugins/pi/render.ts +6 -6
  172. package/plugins/pi/reset/artifacts.ts +4 -3
  173. package/plugins/pi/reset/lifecycle.ts +125 -32
  174. package/plugins/pi/runtime.ts +98 -62
  175. package/plugins/pi/tool-result.ts +8 -8
  176. package/plugins/pi/window.ts +210 -10
  177. package/skills/dream/SKILL.md +1 -1
  178. package/skills/notesoup-guide/SKILL.md +92 -0
  179. package/src/boot/render.ts +18 -15
  180. package/src/boot/text.ts +23 -19
  181. package/src/budget/text.ts +27 -15
  182. package/src/history/claude.ts +41 -0
  183. package/src/history/codex-transcript.ts +6 -4
  184. package/src/history/codex.ts +2 -0
  185. package/src/history/corpus.ts +51 -2
  186. package/src/history/history.ts +35 -44
  187. package/src/history/local.ts +67 -27
  188. package/src/history/pi.ts +113 -35
  189. package/src/history/prefilter.ts +73 -15
  190. package/src/history/query.ts +93 -73
  191. package/src/history/summary-cache.ts +142 -17
  192. package/src/index.ts +2 -2
  193. package/src/notes/errors.ts +1 -1
  194. package/src/notes/frontmatter.ts +0 -3
  195. package/src/notes/index.ts +1 -1
  196. package/src/notes/policy.ts +44 -5
  197. package/src/notes/store.ts +17 -20
  198. package/src/text-match.ts +46 -4
  199. package/src/tools/dream.ts +29 -31
  200. package/src/tools/history.ts +249 -142
  201. package/src/tools/notes.ts +145 -113
  202. package/src/tools/output.ts +2 -1
  203. package/src/tools/result.ts +12 -11
  204. package/src/tools/schema.ts +24 -1
  205. package/plugins/claude/skills/memory/SKILL.md +0 -69
  206. package/plugins/codex/mcp.json +0 -10
  207. package/plugins/codex/plugin.json +0 -6
  208. package/plugins/paseo/client/markdown-core.tsx +0 -189
  209. package/plugins/paseo/client/typography.ts +0 -24
  210. package/skills/memory/SKILL.md +0 -69
@@ -9,7 +9,7 @@ import { renderBootBlock } from "../src/boot/render.js";
9
9
  import { unavailableNotesSnapshot } from "../src/boot/snapshot.js";
10
10
  import { DEFAULT_BOOT_TOOL_NAMES } from "../src/boot/text.js";
11
11
  import { allItems, eventDocument } from "../src/history/history.js";
12
- import { historyList, historyRead } from "../src/tools/history.js";
12
+ import { historyList, historySearch, historyRead } from "../src/tools/history.js";
13
13
  import { TOOL_OUTPUT_MAX_BYTES } from "../src/tools/output.js";
14
14
  import { dispatch } from "../plugins/claude/src/helper.js";
15
15
  import { writePiTranscript } from "./helpers/history-corpus.js";
@@ -44,7 +44,7 @@ test("Claude helper resolves foreign history without requiring a current append
44
44
  assert.ok(read.ok);
45
45
  assert.match(read.text, /^session pi:foreign-pi \| seq 1 \| user/);
46
46
  assert.match(read.text, /foreign needle/);
47
- const list = await invoke("history_list", { session: "pi:*", query: "needle" });
47
+ const list = await invoke("history_search", { session: "pi:*", query: "needle" });
48
48
  assert.ok(list.ok);
49
49
  assert.match(list.text, /session pi:foreign-pi/);
50
50
  const invalid = await invoke("history_read", { session: "*", seq: 1 });
@@ -90,7 +90,7 @@ test("Claude append and result arrival preserve call addresses and use the share
90
90
  const resultRead = await historyRead.execute({ seq: 7 }, completed);
91
91
  assert.ok(resultRead.ok);
92
92
  assert.equal(resultRead.data.seq, 3);
93
- const search = await historyList.execute({ query: "output one" }, completed);
93
+ const search = await historySearch.execute({ query: "output one" }, completed);
94
94
  assert.ok(search.ok);
95
95
  assert.deepEqual(search.data.items.map((item) => "seq" in item ? item.seq : -1), [3]);
96
96
  });
@@ -286,7 +286,7 @@ test("Claude gaps retain only confirmed suffixes, keep pairing/seqs, and disappe
286
286
  assert.equal(incomplete.pairedResults.get(6), 4);
287
287
  assert.equal(incomplete.highestSeq, 7);
288
288
  assert.match(incomplete.windows[0].windowId, /:unknown:missing$/);
289
- const suffix = await historyList.execute({ query: "searchable suffix" }, incomplete);
289
+ const suffix = await historySearch.execute({ query: "searchable suffix" }, incomplete);
290
290
  assert.ok(suffix.ok);
291
291
  assert.deepEqual(suffix.data.items.map((item) => "seq" in item ? item.seq : -1), [3]);
292
292
  const tool = await historyRead.execute({ seq: 4 }, incomplete);
@@ -314,7 +314,7 @@ test("Claude helper reports gaps on list/read and re-anchors reset state only wi
314
314
  const invoke = (tool, params = {}) => dispatch({ op: "tool", tool, params, identity, history });
315
315
  writeFileSync(transcriptPath, jsonl(rows));
316
316
  for (const [tool, params] of [["history_list", {}], ["history_read", { seq: 2 }],
317
- ["history_list", { query: "no matches" }], ["history_read", { seq: 99 }]]) {
317
+ ["history_search", { query: "no matches" }], ["history_read", { seq: 99 }]]) {
318
318
  const response = await invoke(tool, params);
319
319
  assert.match(response.text, /"missing"/, "the gap evidence still names the missing ancestor");
320
320
  assert.doesNotMatch(response.text, /do not expose/);
@@ -341,7 +341,7 @@ test("Claude helper reports gaps on list/read and re-anchors reset state only wi
341
341
  assert.deepEqual(await dispatch({ op: "history_state", identity, history }), { window: 8 }, "never windows.length - 1");
342
342
  const anchoredRead = await invoke("history_read", { seq: 6 });
343
343
  assert.match(anchoredRead.text, /history is incomplete/);
344
- assert.match(anchoredRead.text, /seq 6 \| user\n/);
344
+ assert.match(anchoredRead.text, /seq 6 \| user(?: \| [^|\n]+)?\n/);
345
345
  rows.push(compact("next", "after"), row("next-boot", "next", "user", bootText(9)), user("latest", "next-boot", "latest"));
346
346
  writeFileSync(transcriptPath, jsonl(rows));
347
347
  history.headUuid = "latest";
@@ -386,13 +386,13 @@ test("Claude gap notices participate in list/read budgets without changing read
386
386
  return response.text;
387
387
  };
388
388
  const first = await invoke("history_read", { seq: 1, max_chars: 50000 });
389
- const offset = Number(/\[truncated; continue at offset_chars=(\d+)\]$/.exec(first)?.[1]);
389
+ const offset = Number(/\[truncated at \d+\/\d+ chars; continue at offset_chars=(\d+)\]$/.exec(first)?.[1]);
390
390
  assert.ok(offset > 0 && offset < text.length);
391
- const firstBody = /\n\n(x+)\n\n\[truncated;/.exec(first)?.[1];
391
+ const firstBody = /\n\n(x+)\n\n\[truncated at /.exec(first)?.[1];
392
392
  assert.equal(firstBody, text.slice(0, offset), "the footer addresses the first undelivered character, not the decorated text");
393
393
  const rest = await invoke("history_read", { seq: 1, offset_chars: offset, max_chars: 50000 });
394
394
  assert.equal(/\n\n(x+)$/.exec(rest)?.[1], text.slice(offset));
395
- assert.doesNotMatch(rest, /\[truncated;/);
395
+ assert.doesNotMatch(rest, /\[truncated at /);
396
396
  await invoke("history_list", { max_chars_per_item: 50000 });
397
397
  });
398
398
  test("Claude helper history tools reuse shared schemas, outcomes and text rendering from a supplied path", async (t) => {
@@ -406,12 +406,13 @@ test("Claude helper history tools reuse shared schemas, outcomes and text render
406
406
  const identity = { home: join(root, "notes"), sessionId, cwd: root, agent: "claude", model: "claude" };
407
407
  const history = { sessionId, transcriptPath, headUuid: "r" };
408
408
  const projection = await readClaudeHistory(history);
409
- const operations = [historyList, historyRead];
409
+ const operations = [historyList, historySearch, historyRead];
410
410
  for (const operation of operations) {
411
- const params = operation.name === "history_read" ? { seq: 3 } : {};
411
+ const params = operation.name === "history_read" ? { seq: 3 } : operation.name === "history_search" ? { query: "remember" } : {};
412
412
  const actual = await dispatch({ op: "tool", tool: operation.name, params, identity, history });
413
- const expected = operation.name === "history_read" ? { text: historyRead.render(await historyRead.execute({ seq: 3 }, projection)), ok: true }
414
- : { text: historyList.render(await historyList.execute({}, projection)), ok: true };
413
+ const expected = { text: operation === historyRead ? historyRead.render(await historyRead.execute({ seq: 3 }, projection))
414
+ : operation === historySearch ? historySearch.render(await historySearch.execute({ query: "remember" }, projection))
415
+ : historyList.render(await historyList.execute({}, projection)), ok: true };
415
416
  assert.deepEqual(actual, expected);
416
417
  }
417
418
  assert.deepEqual(await dispatch({ op: "history_state", identity, history }), { window: 0 });
@@ -1,5 +1,5 @@
1
1
  import assert from "node:assert/strict";
2
- import { cpSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
2
+ import { cpSync, existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
3
3
  import { execFileSync } from "node:child_process";
4
4
  import { tmpdir } from "node:os";
5
5
  import { join } from "node:path";
@@ -10,8 +10,8 @@ import { dispatch, handleLine } from "../plugins/claude/src/helper.js";
10
10
  import { DEFAULT_CLAUDE_RESET_MARGIN_TOKENS, resolveClaudeLimits } from "../plugins/claude/src/thresholds.js";
11
11
  import { WARNING_RUNWAY_TOKENS } from "../src/budget/constants.js";
12
12
  import { MAPS_BLOCK, NOTES_PROTOCOL_OPEN_TAG, PROTOCOL_WIPE_SENTENCE, renderProtocolBlock } from "../src/boot/text.js";
13
- import { CLAUDE_WARNING_PROMPT } from "../plugins/claude/src/text.js";
14
- import { COUNTDOWN_LINE, FORCED_CONTINUATIONS, GUIDANCE_CLOSE_TAG, NORMAL_CONTINUATIONS, warningNotice } from "../src/budget/text.js";
13
+ import { CLAUDE_WARNING_PROMPT, claudeCommandWarningContent } from "../plugins/claude/src/text.js";
14
+ import { BETWEEN_TURNS_CONTINUATIONS, COUNTDOWN_LINE, FORCED_CONTINUATIONS, GUIDANCE_CLOSE_TAG, NORMAL_CONTINUATIONS, warningNotice } from "../src/budget/text.js";
15
15
  import { createNotesStore } from "../src/notes/index.js";
16
16
  import { resolveProjectNamespace } from "../src/notes/project-namespace.js";
17
17
  import { notesIdentityFromPi } from "../plugins/pi/notes/adapter.js";
@@ -74,10 +74,24 @@ async function loadHookModule(t) {
74
74
  on(event, ($, e, next) => Object.entries(matcherOrHandler).every(([key, value]) => Array.isArray(value) ? value.includes(e[key]) : e[key] === value) ? handler($, e, next) : next(e));
75
75
  }) };
76
76
  }
77
+ /** Plugin skill names whose bare slash-command aliases collide with $.command.register in Claude Code. */
78
+ function claudePluginOwnedBareCommands() {
79
+ const manifest = JSON.parse(readFileSync(join(process.cwd(), "plugins/claude/.claude-plugin/plugin.json"), "utf8"));
80
+ const skillsDir = join(process.cwd(), "plugins/claude/skills");
81
+ const names = new Set();
82
+ if (existsSync(skillsDir)) {
83
+ for (const entry of readdirSync(skillsDir, { withFileTypes: true })) {
84
+ if (entry.isDirectory() && entry.name === manifest.name)
85
+ names.add(entry.name);
86
+ }
87
+ }
88
+ return names;
89
+ }
77
90
  /** An engine that answers the hook by running the real helper against a throwaway notes home. */
78
91
  function fakeEngine(home) {
79
92
  const registered = [];
80
93
  const notifications = [];
94
+ const reservedCommands = claudePluginOwnedBareCommands();
81
95
  return {
82
96
  registered,
83
97
  notifications,
@@ -85,7 +99,15 @@ function fakeEngine(home) {
85
99
  env: { get: async (name) => name === "NOTESOUP_HOME" ? home : undefined },
86
100
  session: { id: async () => "hook-session", cwd: async () => home, model: async () => "claude", messages: async () => [], usage: async () => ({ context: {} }), compact: async () => ({ skip: "test default" }) },
87
101
  settings: { read: async () => ({}) },
88
- command: { run: async () => ({}), register: async (spec) => ({ command: spec.name }) },
102
+ command: {
103
+ run: async () => ({}),
104
+ register: async (spec) => {
105
+ if (reservedCommands.has(spec.name)) {
106
+ throw new Error(`notesoup: $.command.register: "/${spec.name}" refused: it is the plugin's /${spec.name}:${spec.name}`);
107
+ }
108
+ return { command: spec.name };
109
+ },
110
+ },
89
111
  clock: { after: () => { throw new Error("test has no pending manual timer"); } },
90
112
  prompt: { submit: async ({ text }) => ({ text }) },
91
113
  tool: { register: async (spec) => { registered.push(structuredClone(spec)); return { tool: `mcp__notesoup__${spec.name}` }; } },
@@ -124,7 +146,7 @@ test("Claude notes survive removal of the session's worktree cwd", async (t) =>
124
146
  });
125
147
  test("Claude helper exposes the shared notes/history schemas", async () => {
126
148
  const schemas = await dispatch({ op: "schemas" });
127
- assert.deepEqual(schemas.map((schema) => schema.name), ["notes_write", "notes_update", "notes_read", "notes_list", "history_list", "history_read"]);
149
+ assert.deepEqual(schemas.map((schema) => schema.name), ["notes_write", "notes_update", "notes_read", "notes_list", "history_list", "history_search", "history_read"]);
128
150
  assert.ok(schemas.every((schema) => schema.description.length > 20 && schema.inputSchema.type === "object"));
129
151
  });
130
152
  test("Claude helper delivers only shared rendered text and success", async () => {
@@ -155,7 +177,7 @@ test("Claude helper rejects malformed or unknown requests", async () => {
155
177
  const malformed = JSON.parse(await handleLine("not json"));
156
178
  assert.equal(malformed.ok, false);
157
179
  assert.match(malformed.error, /Unexpected|malformed/);
158
- const unknown = JSON.parse(await handleLine(JSON.stringify({ op: "tool", tool: "history_search", identity, params: {} })));
180
+ const unknown = JSON.parse(await handleLine(JSON.stringify({ op: "tool", tool: "history_unknown", identity, params: {} })));
159
181
  assert.equal(unknown.ok, false);
160
182
  assert.equal(unknown.error, "unknown tool");
161
183
  });
@@ -328,7 +350,7 @@ test("Claude Mod helper runs from a standalone copied plugin directory", () => {
328
350
  }));
329
351
  const schemas = run('{"op":"schemas"}');
330
352
  assert.equal(schemas.ok, true);
331
- assert.equal(schemas.result?.length, 6);
353
+ assert.equal(schemas.result?.length, 7);
332
354
  assert.equal(run("not json").ok, false);
333
355
  }
334
356
  finally {
@@ -524,7 +546,7 @@ test("Claude Mod hook delivers the helper's shared text, and marks only a refusa
524
546
  const handlers = new Map();
525
547
  hooks.register((event, handler) => handlers.set(event, handler));
526
548
  await handlers.get("session.start")(host, { cwd: home, isInteractive: true }, async (event) => event);
527
- assert.deepEqual(registered.map((spec) => spec.name), ["empty_brain", "notes_write", "notes_update", "notes_read", "notes_list", "history_list", "history_read"]);
549
+ assert.deepEqual(registered.map((spec) => spec.name), ["empty_brain", "get_context_remaining", "notes_write", "notes_update", "notes_read", "notes_list", "history_list", "history_search", "history_read"]);
528
550
  for (const spec of registered) {
529
551
  assert.equal(spec.isDeferred, false, `${spec.name} is available from the start without tool search`);
530
552
  assert.ok(spec.description.length > 20);
@@ -614,7 +636,7 @@ test("Claude Mod clears at the shared hard point after successful settlement and
614
636
  assert.match(kept[0].text, /Previous context window id: claude:hook-session:0/);
615
637
  assert.match(kept[0].text, /FRESH_NOTES_AT_RESET/);
616
638
  assert.doesNotMatch(kept[0].text, /OLD_SECRET/);
617
- assert.ok(FORCED_CONTINUATIONS.includes(kept[1].text), "the handoff comes from the shared forced pool");
639
+ assert.ok(BETWEEN_TURNS_CONTINUATIONS.includes(kept[1].text), "a post-answer hard clear uses the honest between-turns pool");
618
640
  assert.equal(compactions, 1, "invalidated tokens cannot immediately reset twice");
619
641
  const upstream = { blocks: [{ name: "unrelated", text: "leave this alone" }], sentinel: "kept" };
620
642
  assert.deepEqual(await handlers.get("prompt.context")(host, {}, async () => upstream), upstream, "the retained boot is not injected a second time");
@@ -731,7 +753,7 @@ test("Claude headless warns, automatically resets at the hard point, and support
731
753
  await settleHooks();
732
754
  }
733
755
  assert.equal(attempts, 3);
734
- assert.equal(prompts, 3, "one tool continuation and one close-out for each idle alias");
756
+ assert.equal(prompts, 2, "post-answer auto-reset submits no ghost continuation; only the two idle aliases submit close-outs");
735
757
  });
736
758
  test("Claude Mod keeps its window numbering from a boot written before the tag rename", async (t) => {
737
759
  const home = mkdtempSync(join(tmpdir(), "claude-legacy-boot-"));
@@ -820,7 +842,7 @@ test("Claude Mod manual reset uses one hidden close-out turn, then recovers its
820
842
  assert.equal(command.text, "🥣 Dumping Brain");
821
843
  await settleHooks();
822
844
  assert.equal(prompts.length, 1, "exactly one hidden normal-model close-out turn, not a summary");
823
- assert.equal(prompts[0], CLAUDE_WARNING_PROMPT, "the close-out is the same warning text the automatic path shows");
845
+ assert.equal(prompts[0], claudeCommandWarningContent(), "the manual close-out uses the command notice without false budget timing");
824
846
  assert.equal(compactions, 1);
825
847
  assert.equal(kept.length, 2);
826
848
  assert.match(kept[0].text, /Current context window id: claude:hook-session:1/);
@@ -832,9 +854,11 @@ test("Claude Mod manual reset uses one hidden close-out turn, then recovers its
832
854
  assert.deepEqual(await handlers.get("prompt.context")(host, {}, async () => ({ blocks: [] })), { blocks: [] }, "reload does not duplicate the already-retained boot");
833
855
  await invoke("turn.start");
834
856
  await invoke("command.run", { command: "empty" });
857
+ const busyTool = await invoke("tool.call", { tool: "Read" });
858
+ assert.deepEqual(busyTool.context, [claudeCommandWarningContent()], "busy /empty injects its close-out notice into the running turn's tool result");
835
859
  await invoke("turn.complete", turnComplete());
836
860
  await settleHooks();
837
- assert.equal(prompts.length, 1, "a busy manual request reuses the current turn instead of submitting another");
861
+ assert.equal(prompts.length, 1, "a busy manual request that delivered its notice in-turn reuses the current turn instead of submitting another");
838
862
  assert.match(kept[0].text, /Current context window id: claude:hook-session:2/);
839
863
  });
840
864
  test("Claude failed close-outs release the request so manual reset can retry", async (t) => {
@@ -1063,7 +1087,12 @@ test("Claude Mod skips the warning when thresholds cannot be resolved", async (t
1063
1087
  const home = mkdtempSync(join(tmpdir(), "claude-nolimits-home-"));
1064
1088
  t.after(() => rmSync(home, { recursive: true, force: true }));
1065
1089
  const { host, notifications } = fakeEngine(home);
1066
- host.process.run = async () => ({ exitCode: 1, stdout: "" });
1090
+ const run = host.process.run;
1091
+ host.process.run = async (argv, init) => {
1092
+ if (init?.stdin && JSON.parse(init.stdin).op === "limits")
1093
+ return { exitCode: 1, stdout: "" };
1094
+ return run(argv, init);
1095
+ };
1067
1096
  const handlers = new Map();
1068
1097
  (await loadHookModule(t)).register((event, handler) => handlers.set(event, handler));
1069
1098
  const invoke = (name, e = {}) => handlers.get(name)(host, e, async () => ({}));
@@ -1078,10 +1107,11 @@ test("Claude Mod skips the warning when thresholds cannot be resolved", async (t
1078
1107
  assert.equal(compactions, 0, "an unresolvable point never resets");
1079
1108
  assert.equal(notifications.filter((text) => text.includes("Brain size unknown")).length, 1, "one line, not one per turn");
1080
1109
  });
1081
- test("Claude skill projections stay byte-identical to canonical shared files", () => {
1082
- assert.deepEqual(readFileSync(join(process.cwd(), "plugins/claude/skills/memory/SKILL.md")), readFileSync(join(process.cwd(), "skills/memory/SKILL.md")));
1110
+ test("Claude skill projections stay byte-identical to canonical shared files and never collide with commands", () => {
1111
+ assert.deepEqual(readFileSync(join(process.cwd(), "plugins/claude/skills/notesoup-guide/SKILL.md")), readFileSync(join(process.cwd(), "skills/notesoup-guide/SKILL.md")));
1083
1112
  assert.deepEqual(readFileSync(join(process.cwd(), "plugins/claude/skills/dream/SKILL.md")), readFileSync(join(process.cwd(), "skills/dream/SKILL.md")));
1084
1113
  assert.deepEqual(readFileSync(join(process.cwd(), "plugins/claude/playbook.md")), readFileSync(join(process.cwd(), "playbook.md")));
1114
+ assert.equal(claudePluginOwnedBareCommands().size, 0, "no plugin skill shares the plugin's own bare slash-command name");
1085
1115
  const skill = readFileSync(join(process.cwd(), "plugins/claude/skills/dream/SKILL.md"), "utf8");
1086
1116
  assert.match(skill, /\.\.\/\.\.\/playbook\.md/);
1087
1117
  assert.doesNotMatch(skill, /Claude.*runner|dream runner/i);
@@ -1848,7 +1878,9 @@ test("Claude history keeps classic transcript_path across startup, confirms appe
1848
1878
  assert.doesNotMatch(listed.result, /another branch/);
1849
1879
  const boot = await invoke("prompt.context", {}, { blocks: [] });
1850
1880
  assert.match(boot.blocks[0].text, /mcp__notesoup__history_\*/);
1851
- const subagent = await call("history_list", {}, "worker");
1881
+ const search = await call("history_search", { query: "startup injection" });
1882
+ assert.match(search.result, /startup injection/);
1883
+ const subagent = await call("history_search", {}, "worker");
1852
1884
  assert.equal(subagent.isError, true);
1853
1885
  assert.match(subagent.result, /unavailable for subagents/);
1854
1886
  // Subagent classic payloads/append results must not overwrite the main binding.
@@ -1867,6 +1899,7 @@ test("Claude history keeps classic transcript_path across startup, confirms appe
1867
1899
  await call("notes_list");
1868
1900
  assert.equal(budgets.get("history_list"), 120_000);
1869
1901
  assert.equal(budgets.get("history_read"), 120_000);
1902
+ assert.equal(budgets.get("history_search"), 120_000);
1870
1903
  assert.equal(budgets.get("notes_list"), 10_000);
1871
1904
  assert.equal(budgets.get("history_state"), 10_000);
1872
1905
  });
@@ -1885,3 +1918,153 @@ test("Claude history without a documented path refuses honestly and keeps notes
1885
1918
  const boot = await handlers.get("prompt.context")(host, {}, async () => ({ blocks: [] }));
1886
1919
  assert.match(boot.blocks[0].text, /History isn't available.*no main transcript_path/);
1887
1920
  });
1921
+ test("Claude Mod isolates command registration failures and disarms auto-reset when core tools fail to load", async (t) => {
1922
+ await t.test("command failure keeps all tools registered and logs/toasts loudly", async (t) => {
1923
+ const home = mkdtempSync(join(tmpdir(), "claude-cmd-fail-"));
1924
+ t.after(() => rmSync(home, { recursive: true, force: true }));
1925
+ const { host, registered, notifications } = fakeEngine(home);
1926
+ const toasts = [];
1927
+ host.ui.toast = async (text) => { toasts.push(text); };
1928
+ host.command.register = async (spec) => {
1929
+ throw new Error(`"/${spec.name}" refused`);
1930
+ };
1931
+ const handlers = new Map();
1932
+ (await loadHookModule(t)).register((event, handler) => handlers.set(event, handler));
1933
+ await handlers.get("session.start")(host, { cwd: home, isInteractive: true }, async () => ({}));
1934
+ assert.equal(registered.length, 9, "every notesoup tool registers even when every slash command fails");
1935
+ for (const cmd of ["/notesoup", "/empty", "/fresh-window"]) {
1936
+ assert.ok(notifications.some((line) => line.includes(cmd) && line.includes("failed")), `log mentions ${cmd}`);
1937
+ assert.ok(toasts.some((line) => line.includes(cmd)), `toast mentions ${cmd}`);
1938
+ }
1939
+ });
1940
+ await t.test("core tool failure notifies, keeps native compaction, and never lies in boot or wipes blind", async (t) => {
1941
+ const home = mkdtempSync(join(tmpdir(), "claude-tools-degraded-"));
1942
+ t.after(() => rmSync(home, { recursive: true, force: true }));
1943
+ const { host, notifications } = fakeEngine(home);
1944
+ const run = host.process.run;
1945
+ host.process.run = async (argv, init) => {
1946
+ if (init?.stdin && JSON.parse(init.stdin).op === "schemas")
1947
+ return { exitCode: 1, stdout: "" };
1948
+ return run(argv, init);
1949
+ };
1950
+ let compactions = 0;
1951
+ host.session.usage = async () => ({ context: { tokens: 190_000, window: 200_000 } });
1952
+ host.command.run = async () => { compactions++; return {}; };
1953
+ const handlers = new Map();
1954
+ (await loadHookModule(t)).register((event, handler) => handlers.set(event, handler));
1955
+ const invoke = (name, e = {}) => handlers.get(name)(host, e, async () => ({}));
1956
+ await invoke("session.start", { cwd: home, isInteractive: true });
1957
+ assert.ok(notifications.some((line) => line.includes("automatic brain reset disabled")));
1958
+ await invoke("turn.start");
1959
+ await invoke("turn.complete", turnComplete());
1960
+ await settleHooks();
1961
+ assert.equal(compactions, 0, "degraded startup never runs blind automatic reset");
1962
+ const nativeCompact = { messages: [{ role: "user", text: "native summary" }] };
1963
+ assert.deepEqual(await handlers.get("session.compact")(host, { trigger: "auto" }, async () => nativeCompact), nativeCompact, "auto compaction falls back to Claude's native summary when tools are missing");
1964
+ const boot = await handlers.get("prompt.context")(host, {}, async () => ({ blocks: [] }));
1965
+ assert.match(boot.blocks[0].text, /Notesoup tools failed to load/);
1966
+ assert.doesNotMatch(boot.blocks[0].text, /mcp__notesoup__notes_\*/);
1967
+ const emptyReply = await invoke("command.run", { command: "empty", args: "" });
1968
+ assert.match(emptyReply.text, /Notesoup tools unavailable/);
1969
+ const statusReply = await invoke("command.run", { command: "notesoup", args: "" });
1970
+ assert.match(statusReply.text, /degraded/);
1971
+ });
1972
+ });
1973
+ test("Claude Mod serves get_context_remaining, rich /notesoup status, and /empty args on idle and busy turns", async (t) => {
1974
+ const home = mkdtempSync(join(tmpdir(), "claude-ux-parity-"));
1975
+ t.after(() => rmSync(home, { recursive: true, force: true }));
1976
+ const { host } = fakeEngine(home);
1977
+ let tokens = 100_000;
1978
+ host.session.usage = async () => ({ context: { tokens, window: 200_000 } });
1979
+ const prompts = [];
1980
+ host.prompt.submit = async ({ text }) => { prompts.push(text); return { text }; };
1981
+ const handlers = new Map();
1982
+ (await loadHookModule(t)).register((event, handler) => handlers.set(event, handler));
1983
+ const invoke = (name, e = {}) => handlers.get(name)(host, e, async () => ({}));
1984
+ await invoke("classic.SessionStart", { session_id: "hook-session", transcript_path: join(home, "t.jsonl") });
1985
+ await invoke("session.start", { cwd: home, isInteractive: true });
1986
+ const rem = await invoke("tool.call", { tool: "mcp__notesoup__get_context_remaining", tool_use_id: "rem-1" });
1987
+ assert.equal(rem.isError, undefined);
1988
+ assert.deepEqual(JSON.parse(rem.result), { remaining_tokens: CLAUDE_200K.reset - 100_000 });
1989
+ const subRem = await invoke("tool.call", { tool: "mcp__notesoup__get_context_remaining", tool_use_id: "rem-sub", agentId: "child" });
1990
+ assert.equal(subRem.isError, true);
1991
+ const status = await invoke("command.run", { command: "notesoup", args: "" });
1992
+ assert.match(status.text, /notesoup v/);
1993
+ assert.match(status.text, /cap off/);
1994
+ assert.match(status.text, /58,808 tokens left/);
1995
+ assert.match(status.text, /tools 9\/9/);
1996
+ assert.match(status.text, /history ready/);
1997
+ tokens = undefined;
1998
+ const unknownRem = await invoke("tool.call", { tool: "mcp__notesoup__get_context_remaining", tool_use_id: "rem-2" });
1999
+ assert.deepEqual(JSON.parse(unknownRem.result), { remaining_tokens: null });
2000
+ // Idle /empty <args> includes close-out context verbatim.
2001
+ assert.deepEqual(await invoke("command.run", { command: "empty", args: "keep Prefer untouched" }), { text: "🥣 Dumping Brain" });
2002
+ await settleHooks();
2003
+ assert.equal(prompts.length, 1);
2004
+ assert.equal(prompts[0], claudeCommandWarningContent("/empty keep Prefer untouched"));
2005
+ // Busy /empty <args> injects close-out context into the running turn's next tool result once.
2006
+ await invoke("turn.start", { turnId: "t-busy" });
2007
+ await invoke("turn.complete", turnComplete({ turnId: "t-busy", reason: "aborted" }));
2008
+ await invoke("turn.start", { turnId: "t-busy-2" });
2009
+ assert.deepEqual(await invoke("command.run", { command: "empty", args: "save frog findings" }), { text: "🥣 Dumping Brain" });
2010
+ const firstTool = await invoke("tool.call", { tool: "Read" });
2011
+ assert.deepEqual(firstTool.context, [claudeCommandWarningContent("/empty save frog findings")]);
2012
+ const secondTool = await invoke("tool.call", { tool: "Bash" });
2013
+ assert.equal(secondTool.context, undefined, "busy close-out notice is delivered once");
2014
+ await invoke("turn.complete", turnComplete({ turnId: "t-busy-2", reason: "aborted" }));
2015
+ // Busy /empty <args> when the turn finishes final text with NO further tool calls: runs one close-out turn so notes/args are never dropped.
2016
+ tokens = 50_000;
2017
+ let compactions = 0;
2018
+ host.command.run = async ({ args }) => {
2019
+ compactions++;
2020
+ await nativeCompaction(host, handlers, args);
2021
+ return {};
2022
+ };
2023
+ host.prompt.submit = async ({ text }) => {
2024
+ prompts.push(text);
2025
+ await invoke("turn.start", { turnId: "t-closeout-fallback" });
2026
+ await invoke("turn.complete", turnComplete({ turnId: "t-closeout-fallback" }));
2027
+ return { text };
2028
+ };
2029
+ await invoke("turn.start", { turnId: "t-text-only" });
2030
+ assert.deepEqual(await invoke("command.run", { command: "empty", args: "remember to fix A" }), { text: "🥣 Dumping Brain" });
2031
+ await invoke("turn.complete", turnComplete({ turnId: "t-text-only" }));
2032
+ await settleHooks();
2033
+ assert.equal(prompts.length, 2, "busy /empty without any tool call falls back to one close-out turn instead of dropping args");
2034
+ assert.equal(prompts[1], claudeCommandWarningContent("/empty remember to fix A"));
2035
+ assert.equal(compactions, 1, "close-out turn then commits one reset and stops");
2036
+ });
2037
+ test("Claude post-answer hard clear stays quiet while mid-turn cutoff resumes unfinished work", async (t) => {
2038
+ const { host, invoke, handlers } = await retainedFixture(t);
2039
+ let tokens = CLAUDE_200K.reset;
2040
+ host.session.usage = async () => ({ context: { tokens, window: 200_000 } });
2041
+ const prompts = [];
2042
+ const continuations = [];
2043
+ host.prompt.submit = async ({ text }) => { prompts.push(text); return { text }; };
2044
+ host.command.run = async ({ args }) => {
2045
+ const result = await nativeCompaction(host, handlers, args);
2046
+ continuations.push(result.messages[1].text);
2047
+ tokens = undefined;
2048
+ return {};
2049
+ };
2050
+ // Post-answer hard clear (turn.complete with no turn.step cutoff): clears quietly without waking the model.
2051
+ await invoke("turn.start", { turnId: "post-answer" });
2052
+ await invoke("turn.complete", turnComplete({ turnId: "post-answer" }));
2053
+ await settleHooks();
2054
+ assert.equal(continuations.length, 1);
2055
+ assert.ok(BETWEEN_TURNS_CONTINUATIONS.includes(continuations[0]), "post-answer clear uses honest between-turns prose");
2056
+ assert.equal(prompts.length, 0, "post-answer clear never submits a ghost continuation turn");
2057
+ // Mid-turn cutoff (turn.step): stops the batch and resumes once with forced mid-flight prose.
2058
+ tokens = CLAUDE_200K.reset;
2059
+ await invoke("turn.start", { turnId: "mid-turn" });
2060
+ const step = handlers.get("turn.step");
2061
+ const chunks = [];
2062
+ for await (const chunk of step(host, { turnId: "mid-turn", index: 1 }, async function* () { yield { kind: "text", text: "nope" }; return {}; }))
2063
+ chunks.push(chunk);
2064
+ assert.deepEqual(chunks, [{ kind: "stop", stopReason: "end_turn", usage: null }]);
2065
+ await invoke("turn.complete", turnComplete({ turnId: "mid-turn" }));
2066
+ await settleHooks();
2067
+ assert.equal(continuations.length, 2);
2068
+ assert.ok(FORCED_CONTINUATIONS.includes(continuations[1]), "mid-turn cutoff keeps urgent forced prose");
2069
+ assert.equal(prompts.length, 1, "mid-turn cutoff continues once to finish the interrupted turn");
2070
+ });
@@ -1,6 +1,6 @@
1
1
  import assert from "node:assert/strict";
2
- import { spawnSync } from "node:child_process";
3
- import { cpSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
2
+ import { spawn, spawnSync } from "node:child_process";
3
+ import { cpSync, existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { tmpdir } from "node:os";
5
5
  import { join } from "node:path";
6
6
  import test from "node:test";
@@ -73,3 +73,70 @@ for (const mutation of [
73
73
  assert.ok(result.report.contents.some((entry) => entry.errors.some((error) => error.path === "modules../register.ts")), result.stdout);
74
74
  });
75
75
  }
76
+ test("Claude mod loads cleanly in the installed engine and registers every tool and command", async (t) => {
77
+ const probe = spawnSync("claude", ["--version"], { encoding: "utf8", timeout: 10_000 });
78
+ if (probe.error?.code === "ENOENT") {
79
+ t.skip("Claude runtime load check skipped: claude is not installed (not found on PATH)");
80
+ return;
81
+ }
82
+ assert.ifError(probe.error);
83
+ const fixture = mkdtempSync(join(tmpdir(), "claude-runtime-load-"));
84
+ t.after(() => rmSync(fixture, { recursive: true, force: true }));
85
+ const debugFile = join(fixture, "claude-debug.log");
86
+ const child = spawn("claude", ["-p", "ok", "--plugin-dir", plugin, "--setting-sources", "", "--no-session-persistence", "--debug-file", debugFile], {
87
+ cwd: fixture,
88
+ stdio: ["ignore", "ignore", "ignore"],
89
+ env: {
90
+ ...process.env,
91
+ ANTHROPIC_BASE_URL: "http://127.0.0.1:1",
92
+ ANTHROPIC_AUTH_TOKEN: "notesoup-load-smoke",
93
+ API_TIMEOUT_MS: "2000",
94
+ NOTESOUP_HOME: join(fixture, "notes"),
95
+ },
96
+ });
97
+ t.after(() => {
98
+ if (child.exitCode === null && child.signalCode === null)
99
+ child.kill("SIGKILL");
100
+ });
101
+ const deadline = Date.now() + 20_000;
102
+ let log = "";
103
+ while (Date.now() < deadline) {
104
+ if (existsSync(debugFile)) {
105
+ log = readFileSync(debugFile, "utf8");
106
+ if (log.includes("session.start settled") && log.includes("notesoup"))
107
+ break;
108
+ if (log.includes("notesoup: session.start hook skipped"))
109
+ break;
110
+ }
111
+ if (child.exitCode !== null || child.signalCode !== null)
112
+ break;
113
+ await new Promise((resolve) => setTimeout(resolve, 100));
114
+ }
115
+ if (child.exitCode === null && child.signalCode === null) {
116
+ child.kill("SIGTERM");
117
+ await new Promise((resolve) => {
118
+ const timer = setTimeout(() => { child.kill("SIGKILL"); resolve(undefined); }, 2000);
119
+ child.once("exit", () => { clearTimeout(timer); resolve(undefined); });
120
+ });
121
+ }
122
+ if (existsSync(debugFile))
123
+ log = readFileSync(debugFile, "utf8");
124
+ assert.equal(log.includes("hook failed: notesoup"), false, `notesoup hook failed during session.start:\n${log}`);
125
+ assert.equal(log.includes("notesoup: session.start hook skipped"), false, `notesoup session.start skipped:\n${log}`);
126
+ for (const tool of [
127
+ "mcp__notesoup__empty_brain",
128
+ "mcp__notesoup__get_context_remaining",
129
+ "mcp__notesoup__notes_write",
130
+ "mcp__notesoup__notes_update",
131
+ "mcp__notesoup__notes_read",
132
+ "mcp__notesoup__notes_list",
133
+ "mcp__notesoup__history_list",
134
+ "mcp__notesoup__history_search",
135
+ "mcp__notesoup__history_read",
136
+ ]) {
137
+ assert.ok(log.includes(`$.tool.register (notesoup): ${tool}`), `missing tool registration ${tool}`);
138
+ }
139
+ for (const command of ["/notesoup", "/empty", "/fresh-window"]) {
140
+ assert.ok(log.includes(`$.command.register (notesoup): ${command} listed`), `missing command registration ${command}`);
141
+ }
142
+ });
@@ -9,7 +9,7 @@ import { readCodexHistory } from "../src/history/codex.js";
9
9
  import { readCodexTranscriptState } from "../src/history/codex-transcript.js";
10
10
  import { createCodexTranscriptReader } from "../src/history/codex-transcript.js";
11
11
  import { allItems, eventDocument } from "../src/history/history.js";
12
- import { historyList, historyRead } from "../src/tools/history.js";
12
+ import { historyList, historySearch, historyRead } from "../src/tools/history.js";
13
13
  /* Producer-shaped synthetic fixtures, not captured/private transcripts.
14
14
  * Frozen official rust-v0.160.1, d27764b82f7118f674371e6d6e76271d9d606edb:
15
15
  * - history/src/{lib.rs,rollout_payload.rs}: flattened JSONL envelope, top-level
@@ -180,7 +180,7 @@ test("root: raw messages, top-level envelope metadata, native tool pairing and n
180
180
  const omitted = await historyRead.execute({ seq: 6 }, projection);
181
181
  assert.ok(!omitted.ok);
182
182
  assert.equal(omitted.error.code, "unknown_seq");
183
- const page = await historyList.execute({ query: "printf output" }, projection);
183
+ const page = await historySearch.execute({ query: "printf output" }, projection);
184
184
  assert.ok(page.ok);
185
185
  assert.equal(page.data.items.length, 1);
186
186
  assert.equal(page.data.items[0]?.seq, 7);
@@ -372,12 +372,24 @@ test("header-only native facts exist before any compaction, but absent facts are
372
372
  await appendFile(f.path, jsonl([row("response_item", message("user", "unaddressable"), 1)]));
373
373
  await assert.rejects(readCodexHistory(source), /native window identity missing/);
374
374
  });
375
+ test("producer version is informational; 0.171.0 tool catalog preserves ordinal coordinates", async (t) => {
376
+ const f = await fixture(t), source = { transcriptPath: f.path, threadId: ROOT };
377
+ await writeFile(f.path, jsonl([
378
+ row("session_meta", meta(ROOT, { cli_version: "0.171.0" }), 0),
379
+ row("response_item", { type: "additional_tools", id: "at_test", role: "developer", tools: [{ type: "namespace", name: "functions", tools: [] }] }, 1),
380
+ row("response_item", message("user", "live shape"), 2),
381
+ ]));
382
+ const parsed = await readCodexHistory(source);
383
+ assert.equal(parsed.cliVersion, "0.171.0");
384
+ assert.deepEqual(parsed.projection.windows.flatMap((w) => w.items).map((item) => [item.seq, item.text]), [[3, "live shape"]]);
385
+ });
375
386
  test("committed malformed, unsupported, unsafe and unproved native shapes refuse explicitly", async (t) => {
376
387
  const f = await fixture(t), source = { transcriptPath: f.path, threadId: ROOT };
377
388
  await assert.rejects(readCodexHistory(source), /ENOENT/);
378
389
  const head = row("session_meta", meta(), 0);
379
390
  for (const [rows, expected] of [
380
- [[row("session_meta", meta(ROOT, { cli_version: "0.161.0" }), 0)], /Unsupported Codex producer/],
391
+ [[row("session_meta", meta(ROOT, { cli_version: 171 }), 0)], /session_meta.cli_version/],
392
+ [[head, row("response_item", { type: "additional_tools", role: "developer", tools: {} }, 1)], /Invalid Codex additional_tools/],
381
393
  [[head, row("future_record", {}, 1)], /Unsupported Codex rollout record/],
382
394
  [[head, row("response_item", { type: "future_item" }, 1)], /Unsupported Codex response/],
383
395
  [[head, row("response_item", message("user", "x"))], /paginated record ordinal/],