notesoup 0.53.2 → 0.54.1

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 (186) hide show
  1. package/README.md +6 -4
  2. package/dist/plugins/claude/src/helper.d.ts +2 -1
  3. package/dist/plugins/claude/src/helper.js +21 -24
  4. package/dist/plugins/claude/src/history.d.ts +3 -14
  5. package/dist/plugins/claude/src/history.js +2 -298
  6. package/dist/plugins/claude/src/text.d.ts +0 -1
  7. package/dist/plugins/claude/src/text.js +0 -1
  8. package/dist/plugins/codex/src/history.d.ts +3 -8
  9. package/dist/plugins/codex/src/history.js +2 -238
  10. package/dist/plugins/codex/src/hooks.js +1 -1
  11. package/dist/plugins/codex/src/identity.d.ts +1 -1
  12. package/dist/plugins/codex/src/identity.js +3 -3
  13. package/dist/plugins/codex/src/mcp.js +9 -8
  14. package/dist/plugins/codex/src/text.d.ts +1 -1
  15. package/dist/plugins/codex/src/text.js +2 -2
  16. package/dist/plugins/codex/src/transcript.d.ts +3 -39
  17. package/dist/plugins/codex/src/transcript.js +2 -313
  18. package/dist/plugins/dsh/engine.js +2 -2
  19. package/dist/plugins/dsh/history.d.ts +3 -0
  20. package/dist/plugins/dsh/history.js +15 -0
  21. package/dist/plugins/dsh/tools.js +12 -12
  22. package/dist/plugins/dsh/window.d.ts +1 -0
  23. package/dist/plugins/dsh/window.js +7 -3
  24. package/dist/plugins/pi/history-tools.d.ts +1 -1
  25. package/dist/plugins/pi/history-tools.js +9 -5
  26. package/dist/plugins/pi/history.d.ts +2 -3
  27. package/dist/plugins/pi/history.js +4 -147
  28. package/dist/plugins/pi/notes/tools.js +8 -6
  29. package/dist/plugins/pi/render.js +7 -4
  30. package/dist/plugins/pi/runtime.js +2 -2
  31. package/dist/plugins/pi/window.js +21 -7
  32. package/dist/src/boot/render.js +9 -11
  33. package/dist/src/boot/snapshot.d.ts +7 -7
  34. package/dist/src/boot/snapshot.js +17 -17
  35. package/dist/src/boot/text.d.ts +5 -3
  36. package/dist/src/boot/text.js +18 -10
  37. package/dist/src/dream/git.d.ts +2 -11
  38. package/dist/src/dream/git.js +6 -23
  39. package/dist/src/dream/lock.d.ts +2 -2
  40. package/dist/src/dream/lock.js +3 -3
  41. package/dist/src/history/claude.d.ts +16 -0
  42. package/dist/src/history/claude.js +336 -0
  43. package/dist/src/history/codex-transcript.d.ts +39 -0
  44. package/dist/src/history/codex-transcript.js +315 -0
  45. package/dist/src/history/codex.d.ts +8 -0
  46. package/dist/src/history/codex.js +238 -0
  47. package/dist/src/history/corpus.d.ts +35 -0
  48. package/dist/src/history/corpus.js +54 -0
  49. package/dist/src/history/history.d.ts +4 -8
  50. package/dist/src/history/history.js +3 -11
  51. package/dist/src/history/local.d.ts +17 -0
  52. package/dist/src/history/local.js +101 -0
  53. package/dist/src/history/pi.d.ts +36 -0
  54. package/dist/src/history/pi.js +202 -0
  55. package/dist/src/history/query.d.ts +15 -5
  56. package/dist/src/history/query.js +42 -13
  57. package/dist/src/index.d.ts +6 -3
  58. package/dist/src/index.js +6 -4
  59. package/dist/src/notes/address.d.ts +8 -8
  60. package/dist/src/notes/address.js +13 -13
  61. package/dist/src/notes/errors.d.ts +1 -1
  62. package/dist/src/notes/frontmatter.js +2 -2
  63. package/dist/src/notes/index.d.ts +1 -1
  64. package/dist/src/notes/index.js +1 -1
  65. package/dist/src/notes/paths.d.ts +6 -6
  66. package/dist/src/notes/paths.js +9 -9
  67. package/dist/src/notes/{project-home.d.ts → project-namespace.d.ts} +7 -7
  68. package/dist/src/notes/{project-home.js → project-namespace.js} +67 -25
  69. package/dist/src/notes/store.d.ts +4 -4
  70. package/dist/src/notes/store.js +55 -52
  71. package/dist/src/tools/dream.d.ts +21 -3
  72. package/dist/src/tools/dream.js +54 -16
  73. package/dist/src/tools/history.d.ts +7 -19
  74. package/dist/src/tools/history.js +80 -93
  75. package/dist/src/tools/notes-context.d.ts +10 -0
  76. package/dist/src/tools/notes-context.js +27 -0
  77. package/dist/src/tools/notes.d.ts +69 -20
  78. package/dist/src/tools/notes.js +40 -31
  79. package/dist/test/boot.integration.test.js +2 -3
  80. package/dist/test/claude-history.test.js +47 -34
  81. package/dist/test/claude-mod.test.js +96 -50
  82. package/dist/test/codex-history.test.js +4 -10
  83. package/dist/test/codex-plugin.test.js +50 -12
  84. package/dist/test/context-edit-budget.test.js +121 -0
  85. package/dist/test/dependencies.test.js +73 -6
  86. package/dist/test/dream-tools.test.js +153 -8
  87. package/dist/test/dsh.test.js +88 -19
  88. package/dist/test/helpers/dsh.d.ts +4 -1
  89. package/dist/test/helpers/dsh.js +20 -4
  90. package/dist/test/helpers/extension.d.ts +5 -1
  91. package/dist/test/helpers/extension.js +33 -2
  92. package/dist/test/helpers/history-corpus.d.ts +7 -0
  93. package/dist/test/helpers/history-corpus.js +26 -0
  94. package/dist/test/history-corpus.test.js +307 -0
  95. package/dist/test/history.integration.test.js +40 -48
  96. package/dist/test/host-neutral.test.js +20 -33
  97. package/dist/test/model-facing-text.test.js +14 -8
  98. package/dist/test/notes-cwd.test.d.ts +1 -0
  99. package/dist/test/notes-cwd.test.js +114 -0
  100. package/dist/test/notes-library.test.js +4 -4
  101. package/dist/test/notes-query-namespaces.test.d.ts +1 -0
  102. package/dist/test/{notes-query-homes.test.js → notes-query-namespaces.test.js} +13 -13
  103. package/dist/test/notes.integration.test.js +73 -24
  104. package/dist/test/notes.test.js +51 -21
  105. package/dist/test/pi-render.test.js +33 -1
  106. package/dist/test/project-namespace.test.d.ts +1 -0
  107. package/dist/test/project-namespace.test.js +324 -0
  108. package/docs/architecture.md +19 -12
  109. package/docs/claude-code-mod.md +7 -5
  110. package/docs/codex.md +6 -6
  111. package/docs/dsh.md +9 -9
  112. package/docs/history-sessions.md +52 -0
  113. package/docs/notes-library.md +9 -5
  114. package/docs/skills.md +3 -3
  115. package/docs/tool-results.md +14 -8
  116. package/package.json +4 -6
  117. package/playbook.md +6 -6
  118. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  119. package/plugins/claude/dist/claude/helper.js +2164 -1341
  120. package/plugins/claude/hooks/register.ts +19 -11
  121. package/plugins/claude/playbook.md +6 -6
  122. package/plugins/claude/skills/memory/SKILL.md +9 -7
  123. package/plugins/claude/src/helper.ts +22 -25
  124. package/plugins/claude/src/history.ts +3 -257
  125. package/plugins/claude/src/text.ts +0 -1
  126. package/plugins/codex/README.md +1 -1
  127. package/plugins/codex/dist/codex/notesoup.js +1582 -969
  128. package/plugins/codex/src/history.ts +3 -193
  129. package/plugins/codex/src/hooks.ts +1 -1
  130. package/plugins/codex/src/identity.ts +3 -3
  131. package/plugins/codex/src/mcp.ts +9 -8
  132. package/plugins/codex/src/text.ts +2 -2
  133. package/plugins/codex/src/transcript.ts +3 -275
  134. package/plugins/dsh/engine.ts +2 -2
  135. package/plugins/dsh/history.ts +17 -0
  136. package/plugins/dsh/tools.ts +12 -12
  137. package/plugins/dsh/window.ts +8 -3
  138. package/plugins/paseo/OVERVIEW.md +4 -4
  139. package/plugins/paseo/README.md +1 -1
  140. package/plugins/paseo/client/brain-empty-card.tsx +3 -4
  141. package/plugins/paseo/client/markdown.tsx +159 -0
  142. package/plugins/paseo/client/notes-op-card.tsx +35 -34
  143. package/plugins/paseo/client/notes-op-transformer.ts +17 -68
  144. package/plugins/paseo/client/paper-card.tsx +8 -19
  145. package/plugins/paseo/client/paper-palette.ts +40 -0
  146. package/plugins/paseo/client/sticky-card.tsx +6 -4
  147. package/plugins/paseo/package.json +3 -0
  148. package/plugins/paseo/paseo-plugin.json +2 -2
  149. package/plugins/paseo/shared/notes-op.ts +13 -9
  150. package/plugins/paseo/test/notes-op.test.ts +52 -73
  151. package/plugins/paseo/test/paper-palette.test.ts +54 -0
  152. package/plugins/pi/history-tools.ts +11 -5
  153. package/plugins/pi/history.ts +8 -157
  154. package/plugins/pi/notes/tools.ts +8 -6
  155. package/plugins/pi/render.ts +6 -4
  156. package/plugins/pi/runtime.ts +2 -2
  157. package/plugins/pi/window.ts +22 -7
  158. package/skills/memory/SKILL.md +9 -7
  159. package/src/boot/render.ts +10 -13
  160. package/src/boot/snapshot.ts +20 -20
  161. package/src/boot/text.ts +18 -10
  162. package/src/dream/git.ts +7 -24
  163. package/src/dream/lock.ts +3 -3
  164. package/src/history/claude.ts +286 -0
  165. package/src/history/codex-transcript.ts +276 -0
  166. package/src/history/codex.ts +193 -0
  167. package/src/history/corpus.ts +69 -0
  168. package/src/history/history.ts +5 -12
  169. package/src/history/local.ts +93 -0
  170. package/src/history/pi.ts +199 -0
  171. package/src/history/query.ts +45 -15
  172. package/src/index.ts +8 -5
  173. package/src/notes/address.ts +13 -13
  174. package/src/notes/errors.ts +1 -1
  175. package/src/notes/frontmatter.ts +2 -2
  176. package/src/notes/index.ts +1 -1
  177. package/src/notes/paths.ts +9 -9
  178. package/src/notes/{project-home.ts → project-namespace.ts} +59 -28
  179. package/src/notes/store.ts +61 -58
  180. package/src/tools/dream.ts +63 -16
  181. package/src/tools/history.ts +71 -101
  182. package/src/tools/notes-context.ts +29 -0
  183. package/src/tools/notes.ts +39 -29
  184. package/dist/test/project-home.test.js +0 -134
  185. /package/dist/test/{notes-query-homes.test.d.ts → context-edit-budget.test.d.ts} +0 -0
  186. /package/dist/test/{project-home.test.d.ts → history-corpus.test.d.ts} +0 -0
@@ -247,20 +247,23 @@ async function run($: { process: { run: (argv: readonly string[], init?: { cwd?:
247
247
  // reason (`timed out after …`), which a bare phrase would throw away.
248
248
  catch (error) { return { ok: false as const, error: `helper execution failed: ${describeFailure(error)}` } }
249
249
  }
250
+ function clearManualRequest(state: ResetState): void {
251
+ state.manualPending = false
252
+ state.toolResetRequested = state.lastWord = undefined
253
+ }
250
254
  /** Session start does not fire on /clear, /resume or /branch. Forget the old window on end. */
251
255
  function forgetSession(state: ResetState) {
252
256
  state.generation++
253
257
  state.identity = undefined
254
258
  state.historyWindowHead = undefined
255
259
  state.window = 0
256
- state.turnRunning = state.resetting = state.manualPending = state.usageFailureLogged = false
260
+ state.turnRunning = state.resetting = state.usageFailureLogged = false
261
+ clearManualRequest(state)
257
262
  state.manualCompacting = false
258
263
  state.preparedBoot = state.retainedBoot = undefined
259
264
  state.texts = state.limits = undefined
260
265
  state.continuation = undefined
261
266
  state.continuationWindow = undefined
262
- state.toolResetRequested = undefined
263
- state.lastWord = undefined
264
267
  state.limitsAttempts = state.limitsWindow = 0
265
268
  state.settingsFailureLogged = state.limitsFailureLogged = false
266
269
  state.warnedWindow = state.warningPending = undefined
@@ -394,10 +397,13 @@ export function register(on: On) {
394
397
  on("turn.complete", async ($, e, next) => {
395
398
  const result = await next(e)
396
399
  if (e.agentId !== undefined) return result
400
+ state.turnRunning = false
397
401
  if (state.disabled) return result
402
+ // A failed turn proves nothing about whether its notes were saved. Cancel
403
+ // the request instead of compacting now or springing it on a later turn.
404
+ if (e.reason !== "answer" && state.manualPending) cancelManualReset($, state, e.reason)
398
405
  if (!await refreshIdentity($, state)) return result
399
- state.turnRunning = false
400
- if (state.manualPending) await reset($, state)
406
+ if (e.reason === "answer" && state.manualPending) await reset($, state)
401
407
  return result
402
408
  })
403
409
  on("command.run", async ($, e, next) => {
@@ -459,9 +465,7 @@ export function register(on: On) {
459
465
  state.retainedBoot = built.boot
460
466
  state.preparedBoot = undefined
461
467
  state.window++
462
- state.manualPending = false
463
- state.toolResetRequested = undefined
464
- state.lastWord = undefined
468
+ clearManualRequest(state)
465
469
  log($, "Brain emptied")
466
470
  }
467
471
  return { messages: built.messages }
@@ -610,6 +614,12 @@ async function finishManual($: Engine, state: ResetState, signal: { wake?: () =>
610
614
  } finally { armManual($, state, signal) }
611
615
  }
612
616
 
617
+ /** A non-answer ends the request, never the context; the user can explicitly ask again. */
618
+ function cancelManualReset($: Engine, state: ResetState, reason: "aborted" | "refusal" | "error"): void {
619
+ clearManualRequest(state)
620
+ log($, `Brain emptying cancelled · turn ended ${reason}; ask /fresh-window again`)
621
+ }
622
+
613
623
  // The sandbox permits $ forwarding only to file-top-level helpers.
614
624
  async function reset($: Engine, state: ResetState): Promise<void> {
615
625
  if (!state.identity || state.compactDisabled || state.resetting) return
@@ -637,9 +647,7 @@ async function reset($: Engine, state: ResetState): Promise<void> {
637
647
  }
638
648
  state.retainedBoot = state.preparedBoot
639
649
  state.window++
640
- state.manualPending = false
641
- state.toolResetRequested = undefined
642
- state.lastWord = undefined
650
+ clearManualRequest(state)
643
651
  log($, "Brain emptied")
644
652
  } catch (error) {
645
653
  if (generation !== state.generation) return
@@ -6,7 +6,7 @@ I am reviewing my notes: keeping what is useful, connecting what belongs togethe
6
6
 
7
7
  A dream covers one project: its `@project` notes and the session notes born in it. `@human`, `@self`, and `@model` are not part of a dream unless the human asks for them or the dream runs from inside the notes home itself. Do not broaden that scope while exploring; if a boundary is unclear, ask before crossing it. Unknown ownership is a coverage gap to report, not a reason to guess or repair ownership.
8
8
 
9
- The homes serve different readers:
9
+ The notebooks serve different readers:
10
10
 
11
11
  - Session notes (`<path>`, no `@`) are a trip's working record. Read them as sources; do not rewrite them. Only the wastebasket rule below may remove another session's notes.
12
12
  - `@project` notes hold knowledge for whoever next works on that project.
@@ -16,7 +16,7 @@ The homes serve different readers:
16
16
 
17
17
  ## What a durable note holds
18
18
 
19
- Durable notes hold decisions, constraints, and lessons that stay true after the current work ends. They are not diaries: commit hashes, test counts, dates, and the story of how something was reached belong to git and history. A session finding is worth promoting only when it meets this bar.
19
+ Durable notes hold decisions, constraints, and lessons that stay true after the current work ends. They are not diaries: raw logs, scorecards, and blow-by-blow recaps belong to history. When a piece of history actually matters — such as why an earlier approach failed — keep only a brief background summary, clearly separated from what is true now. A session finding is worth promoting only when it meets this bar.
20
20
 
21
21
  ## Review and consolidate
22
22
 
@@ -24,22 +24,22 @@ Durable notes hold decisions, constraints, and lessons that stay true after the
24
24
  2. **Verify only what the proposed change depends on.** Before correcting, retiring, or promoting a conclusion, check the relevant evidence as needed. Do not revalidate every stable note or turn dream into a source-code audit. An unavailable referent is unverified, not proof that it is dead.
25
25
  3. **Retire what is no longer true.** When evidence shows a durable note is stale, correct it in place; if nothing true remains, crumple it. Remove or fix its MAP line either way. A note's last access is a hint, not evidence: long-unread notes are candidates to check, not to crumple on sight. A read reports the access before itself, so reviewing a note does not make it look fresh.
26
26
  4. **Merge only genuine duplicates.** Merge two notes only when they share a topic and kind (checkpoint, design, log). First carry every fact, condition, and exception unique to the absorbed note into the survivor, then crumple the absorbed note. Otherwise keep both and record any unresolved conflict.
27
- 5. **Relocate misfiled notes.** When a standing ruling or the note's own MAP already names its proper home, move it there, preserving its metadata, and update both homes' maps. Do it, don't propose it. Propose only when the destination home itself is unclear.
27
+ 5. **Relocate misfiled notes.** When a standing ruling or the note's own MAP already names its proper notebook, move it there, preserving its metadata, and update both notebooks' maps. Do it, don't propose it. Propose only when the destination notebook itself is unclear.
28
28
  6. **Preserve meaning and provenance.** Keep facts, conditions, exceptions, uncertainty, authorship, and sources. When promoting a finding, cite its source. Do not relabel agent-authored material as human-authored. If its destination or authority is unclear, propose the promotion instead.
29
29
  7. **Keep notes manageable.** Aim below about 200 lines / 8KB per note. Split oversized notes by topic with one-line cross-links.
30
- 8. **Keep wake-up pages useful.** Each writable home's `CHEATSHEET.md` holds standing reminders, kept to five lines. Its `MAP.md` holds only the note index: durable notes' addresses and short gists. Both load every window when present; do not create empty pages. Preserve standing rules, add promoted notes to the map, and drop entries that no longer hold. Maps follow the same size budget.
30
+ 8. **Keep wake-up pages useful.** Each writable notebook's `CHEATSHEET.md` holds standing reminders, kept to five lines. Its `MAP.md` holds only the note index: durable notes' addresses and short gists. Both load every window when present; do not create empty pages. Preserve standing rules, add promoted notes to the map, and drop entries that no longer hold. Maps follow the same size budget.
31
31
 
32
32
  ## Deleting
33
33
 
34
34
  Never physically delete a live note; crumple it first. Two cases allow deleting a crumpled note:
35
35
 
36
36
  - **Your own session's notes** may be deleted once crumpled.
37
- - **The wastebasket:** any note within the dream's reach that was crumpled more than 7 days ago may be deleted, whatever its home or session. Judge by its crumpled date; if none is readable, keep it and report it.
37
+ - **The wastebasket:** any note within the dream's reach that was crumpled more than 7 days ago may be deleted, whatever its notebook or session. Judge by its crumpled date; if none is readable, keep it and report it.
38
38
 
39
39
  Where notes cannot be deleted, list the doomed addresses in the report instead of blanking them.
40
40
 
41
41
  ## Report
42
42
 
43
- Give a concise report grouped by home: what you inspected, changed, retired, promoted, deleted, and left unresolved. Mention coverage gaps and partial failures. If no notes changed, say so. Distinguish actual note changes from execution or audit artifacts; do not claim success for an incomplete run.
43
+ Give a concise report grouped by notebook: what you inspected, changed, retired, promoted, deleted, and left unresolved. Mention coverage gaps and partial failures. If no notes changed, say so. Distinguish actual note changes from execution or audit artifacts; do not claim success for an incomplete run.
44
44
 
45
45
  Put skill ideas and unresolved questions in the final message as proposals for the human, not new skill files.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: memory
3
- description: How notesoup's `notes_*` and `history_*` tools fit together — note addresses and homes, finding things again, and saving recovery state. Use when the context-window protocol is missing or unclear, or when unsure where a note belongs or how to find something again.
3
+ description: How notesoup's `notes_*` and `history_*` tools fit together — note addresses and notebooks, finding things again, and saving recovery state. Use when the context-window protocol is missing or unclear, or when unsure where a note belongs or how to find something again.
4
4
  ---
5
5
 
6
6
  # Memory
@@ -8,7 +8,7 @@ description: How notesoup's `notes_*` and `history_*` tools fit together — not
8
8
  Two stores outlive the context window. Anything in neither is lost when the window ends or is wiped.
9
9
 
10
10
  - **Notes** (`notes_*`) — what you choose to keep. Plain markdown, written on purpose.
11
- - **History** (`history_*`) — what happened in this session: messages, tool calls, summaries. Read-only.
11
+ - **History** (`history_*`) — recorded messages, tool calls and summaries. Current session by default; other local sessions/harnesses through `session`. Read-only.
12
12
 
13
13
  Each tool's own description covers its parameters and paging. This guide covers what the descriptions cannot: where notes belong, and how the tools work together.
14
14
 
@@ -32,19 +32,21 @@ Any other `@` prefix is refused. A path is relative and `/`-separated, with no e
32
32
 
33
33
  `@` addresses are not file paths: never pass them to file tools like `read`, `write`, `edit`, or `bash`. That creates a stray directory instead of a note.
34
34
 
35
- `CHEATSHEET.md` and `MAP.md` at the root of each `@` home are separate pages you wake up with; absent pages are skipped. Keep standing reminders in `CHEATSHEET.md`, to five lines. `MAP.md` holds only the note index: each durable note's address and gist, for lookup. Update it whenever you add, move or crumple a durable note. Do not create empty pages.
35
+ `CHEATSHEET.md` and `MAP.md` at the root of each `@` notebook are separate pages you wake up with; absent pages are skipped. Keep standing reminders in `CHEATSHEET.md`, to five lines. `MAP.md` holds only the note index: each durable note's address and gist, for lookup. Update it whenever you add, move or crumple a durable note. Do not create empty pages.
36
36
 
37
- Write only what git and history cannot give back. Crumple notes that are no longer true; a stale note is worse than none.
37
+ Keep notes focused on what is true now; if a piece of past context still matters (such as why an approach was ruled out), keep only a brief summary rather than a blow-by-blow log. Crumple notes that are no longer true; a stale note is worse than none.
38
38
 
39
39
  ## Finding things again
40
40
 
41
- For list/search, omit `glob` or use the collection alias `@default` for this session and current shared homes. Use `**` for all homes or `@sessions/*/**` for all sessions. Results carry readable note addresses; `@default` itself is not a read/write address.
41
+ For list/search, omit `glob` or use the collection alias `@default` for this session and current shared notebooks. Use `**` for all notebooks or `@sessions/*/**` for all sessions. Results carry readable note addresses; `@default` itself is not a read/write address.
42
42
 
43
43
  - **A note**: `notes_list` with a `glob` when you know roughly where it lives, `notes_search` when you know a phrase; then `notes_read` the address.
44
44
  - **Something that happened**: `history_list` to browse or search this session's events; `history_read` the seq for the whole event.
45
- - **An earlier window**: `history_windows` gives window ids; pass one as `window_id` to `history_list`.
45
+ - **An earlier window**: use its seq range from the boot window tree with `history_list`'s `before_seq` / `after_seq` bounds, or search for a remembered phrase.
46
+ - **Another session**: pass `session: "<id-or-prefix>"` or `"pi:<id>"`, `"claude:<id>"`, `"codex:<id>"`, `"dsh:<id>"`. An unqualified selector checks this harness first. If ambiguous, use a longer ID or a harness prefix; never pick a candidate blindly.
47
+ - **A phrase across sessions**: `history_list({ session: "*", query: "remembered phrase" })`, or restrict to a harness with `"pi:*"`. A wildcard requires a non-empty query; it cannot use `before_seq`/`after_seq` or `history_read`. Results cover every role unless `roles` narrows them, are chronological, and have no paging cursors; narrow by time, role, query or session pattern instead. DSH sessions are discoverable only from DSH.
46
48
 
47
- Seqs are stable. Write the useful ones into a note so they need not be found twice.
49
+ Seqs are stable **within a session**. When a hit carries `session`, copy it together with `seq` into `history_read` and save both in your note. The paging/expand/neighborhood recipes already preserve the resolved session. Omit `session` only when you mean your current host session. An unreadable or unsupported local transcript refuses explicitly; do not treat that as proof the remembered event never happened.
48
50
 
49
51
  ## Saving recovery state
50
52
 
@@ -3,16 +3,18 @@ import { pathToFileURL } from "node:url";
3
3
  import type { Static, TSchema } from "typebox";
4
4
  import { Check, Errors } from "typebox/value";
5
5
  import { notesList, notesRead, notesSearch, notesUpdate, notesWrite } from "../../../src/tools/notes.js";
6
- import { historyList, historyRead, historyWindows, type HistoryTextWrapper } from "../../../src/tools/history.js";
6
+ import { historyList, historyRead, type HistoryTextWrapper } from "../../../src/tools/history.js";
7
+ import { localHistoryCorpus, type LocalHistoryOptions } from "../../../src/history/local.js";
7
8
  import { readClaudeHistory, type ClaudeHistorySource } from "./history.js";
8
9
  import { loadNotesSnapshot } from "../../../src/boot/snapshot.js";
9
10
  import { renderBootBlock } from "../../../src/boot/render.js";
10
11
  import type { BootToolNames } from "../../../src/boot/text.js";
11
12
  import { selectContinuation } from "../../../src/budget/text.js";
12
- import { claudeHistoryGapNotice, claudeHistoryUnconfirmedSeq, CLAUDE_HISTORY_UNKNOWN_PREVIOUS, CLAUDE_HISTORY_UNKNOWN_WINDOW, CLAUDE_HISTORY_UNAVAILABLE_SENTENCE, CLAUDE_WARNING_PROMPT } from "./text.js";
13
+ import { claudeHistoryGapNotice, claudeHistoryUnconfirmedSeq, CLAUDE_HISTORY_UNKNOWN_WINDOW, CLAUDE_HISTORY_UNAVAILABLE_SENTENCE, CLAUDE_WARNING_PROMPT } from "./text.js";
13
14
  import { resolveClaudeLimits } from "./thresholds.js";
14
15
  import { projectKey, snapshotNotesIdentity, type NotesIdentity } from "../../../src/notes/index.js";
15
16
  import type { Operation } from "../../../src/tools/result.js";
17
+ import { notesToolContext, type NotesToolContext } from "../../../src/tools/notes-context.js";
16
18
 
17
19
  const MAX_REQUEST_BYTES = 512 * 1024;
18
20
  const MAX_RESPONSE_BYTES = 1024 * 1024;
@@ -55,7 +57,7 @@ function boundOperation<TParams extends TSchema, TData, TContext extends readonl
55
57
  };
56
58
  }
57
59
 
58
- const OPERATIONS: Record<string, BoundOperation<[NotesIdentity]>> = {
60
+ const OPERATIONS: Record<string, BoundOperation<[NotesToolContext]>> = {
59
61
  notes_write: boundOperation(notesWrite),
60
62
  notes_update: boundOperation(notesUpdate),
61
63
  notes_read: boundOperation(notesRead),
@@ -66,7 +68,6 @@ const OPERATIONS: Record<string, BoundOperation<[NotesIdentity]>> = {
66
68
  const HISTORY_OPERATIONS = {
67
69
  history_list: boundOperation(historyList),
68
70
  history_read: boundOperation(historyRead),
69
- history_windows: boundOperation(historyWindows),
70
71
  };
71
72
  function historySource(value: unknown, sessionId: string): ClaudeHistorySource {
72
73
  if (!value || typeof value !== "object") throw new Error("Claude history transcript_path is unavailable");
@@ -75,7 +76,7 @@ function historySource(value: unknown, sessionId: string): ClaudeHistorySource {
75
76
  return source;
76
77
  }
77
78
 
78
- export async function dispatch(request: unknown): Promise<unknown> {
79
+ export async function dispatch(request: unknown, historyOptions: Pick<LocalHistoryOptions, "roots" | "home" | "env"> = {}): Promise<unknown> {
79
80
  if (!request || typeof request !== "object" || Array.isArray(request)) throw new Error("malformed request");
80
81
  const value = request as Record<string, unknown>;
81
82
  if (value.op === "schemas") return [...Object.entries(OPERATIONS), ...Object.entries(HISTORY_OPERATIONS)].map(([name, operation]) => ({ name, description: operation.description, inputSchema: JSON.parse(JSON.stringify(operation.parameters)) }));
@@ -98,33 +99,29 @@ export async function dispatch(request: unknown): Promise<unknown> {
98
99
  const id = identity(value.identity as ClaudeIdentityInput);
99
100
  if (Object.hasOwn(HISTORY_OPERATIONS, value.tool)) {
100
101
  const tool = value.tool as keyof typeof HISTORY_OPERATIONS;
102
+ if ((value.params as { session?: string }).session !== undefined) {
103
+ const current = () => readClaudeHistory(historySource(value.history, id.sessionId));
104
+ const corpus = localHistoryCorpus({ ...historyOptions, current: { harness: "claude", id: id.sessionId, async load() {
105
+ const projection = await current();
106
+ const notice = claudeHistoryGapNotice(projection.missingAncestors);
107
+ return { projection, ...(notice ? { notice } : {}) };
108
+ } } });
109
+ return HISTORY_OPERATIONS[tool].call(value.params, { current, corpus });
110
+ }
101
111
  const projection = await readClaudeHistory(historySource(value.history, id.sessionId));
102
112
  const notice = claudeHistoryGapNotice(projection.missingAncestors);
103
113
  const wrapText: HistoryTextWrapper = (text) => notice + text;
104
- let params = value.params;
105
- if (projection.missingAncestors.length > 0) {
106
- // An unknown segment is not evidence for the window before the current
107
- // one. Resolve the exact ordinal, never array adjacency across a gap.
108
- if ((params as { window_id?: string }).window_id === "@previous") {
109
- const previous = projection.currentWindowOrdinal === undefined ? undefined : `claude:${id.sessionId}:${projection.currentWindowOrdinal - 1}`;
110
- if (!projection.windows.some((window) => window.windowId === previous)) {
111
- return { ok: false, text: wrapText(CLAUDE_HISTORY_UNKNOWN_PREVIOUS) };
112
- }
113
- params = { ...params as object, window_id: previous };
114
- }
115
- if (value.tool === "history_read") {
116
- const { seq } = params as { seq: number };
117
- if (seq <= projection.highestSeq && !projection.branchSeqs.has(seq)) {
118
- return { ok: false, text: wrapText(claudeHistoryUnconfirmedSeq(seq)) };
119
- }
114
+ const params = value.params;
115
+ if (projection.missingAncestors.length > 0 && tool === "history_read") {
116
+ const { seq } = params as { seq: number };
117
+ if (seq <= projection.highestSeq && !projection.branchSeqs.has(seq)) {
118
+ return { ok: false, text: wrapText(claudeHistoryUnconfirmedSeq(seq)) };
120
119
  }
121
120
  }
122
- const result = tool === "history_windows"
123
- ? await HISTORY_OPERATIONS[tool].call(params, projection, id.sessionId, wrapText)
124
- : await HISTORY_OPERATIONS[tool].call(params, projection, wrapText);
121
+ const result = await HISTORY_OPERATIONS[tool].call(params, projection, wrapText);
125
122
  return { ...result, text: wrapText(result.text) };
126
123
  }
127
- return OPERATIONS[value.tool]!.call(value.params, id);
124
+ return OPERATIONS[value.tool]!.call(value.params, notesToolContext(id, (value.identity as ClaudeIdentityInput).cwd));
128
125
  }
129
126
  if (value.op === "history_state") {
130
127
  const id = identity(value.identity as ClaudeIdentityInput);
@@ -1,257 +1,3 @@
1
- /** Claude's persisted main transcript -> the shared history projection. No inference-context API. */
2
- import { readFile } from "node:fs/promises";
3
- import { isDeepStrictEqual } from "node:util";
4
- import { contentText, projectHistory, type DecodedHistoryItem, type DecodedHistoryWindow, type HistoryProjection } from "../../../src/history/history.js";
5
-
6
- type Row = Record<string, unknown>;
7
- type WindowPosition = { ordinal: number } | { unknownAncestor: string };
8
- type Version = { row: Row; ancestorUuid?: string; ancestor?: Version; position?: WindowPosition };
9
- type Node = { first: Version; latest: Version; items: DecodedHistoryItem[] };
10
- export type ClaudeHistorySource = { sessionId: string; transcriptPath: string; headUuid?: string };
11
- /** Claude graph evidence stays in the adapter; shared queries only see addressed windows. */
12
- export type ClaudeHistoryProjection = HistoryProjection & { missingAncestors: string[]; currentWindowOrdinal: number | undefined };
13
- const MESSAGE_TYPES = new Set(["user", "assistant", "system", "attachment"]);
14
- const NON_TEXT_BLOCKS = new Set(["thinking", "redacted_thinking", "image", "document", "audio", "video", "server_tool_use", "web_search_tool_result", "tool_reference"]);
15
- function object(value: unknown): value is Row { return typeof value === "object" && value !== null && !Array.isArray(value); }
16
- function requiredString(value: unknown, field: string): string {
17
- if (typeof value !== "string" || value.length === 0) throw new Error(`invalid Claude transcript ${field}`);
18
- return value;
19
- }
20
- function parent(row: Row): string | undefined {
21
- if (row.parentUuid === null) return undefined;
22
- return requiredString(row.parentUuid, "parentUuid");
23
- }
24
- function boundary(row: Row): boolean { return row.type === "system" && row.subtype === "compact_boundary"; }
25
-
26
- /** A trailing incomplete write is not a committed line. Valid unterminated JSON is still readable. */
27
- function rowsOf(text: string): Row[] {
28
- const lines = text.split("\n"), rows: Row[] = [];
29
- for (let index = 0; index < lines.length; index++) {
30
- const line = lines[index]!;
31
- if (line.trim() === "") continue;
32
- let value: unknown;
33
- try { value = JSON.parse(line); }
34
- catch {
35
- if (index === lines.length - 1 && !text.endsWith("\n")) break;
36
- throw new Error(`malformed Claude transcript JSON at line ${index + 1}`);
37
- }
38
- if (!object(value) || typeof value.type !== "string") throw new Error(`invalid Claude transcript record at line ${index + 1}`);
39
- rows.push(value);
40
- }
41
- return rows;
42
- }
43
-
44
- /** Only recorded visible text; never stringify unknown blocks or attachment internals (thinking included). */
45
- function blocksOf(value: unknown): Row[] {
46
- if (typeof value === "string") return [{ type: "text", text: value }];
47
- if (!Array.isArray(value)) throw new Error("invalid Claude transcript message content");
48
- return value.map((block) => {
49
- if (!object(block) || typeof block.type !== "string") throw new Error("invalid Claude transcript content block");
50
- if (block.type === "text") {
51
- if (typeof block.text !== "string") throw new Error("invalid Claude transcript text block");
52
- } else if (block.type !== "tool_use" && block.type !== "tool_result" && !NON_TEXT_BLOCKS.has(block.type)) {
53
- throw new Error(`unsupported Claude transcript content block: ${block.type}`);
54
- }
55
- return block;
56
- });
57
- }
58
- function decode(row: Row, seq: number): DecodedHistoryItem[] {
59
- // A system record without a body is graph metadata, not a message.
60
- if (row.type === "system" && row.content == null) return [];
61
- const common = { windowId: "", ...(typeof row.timestamp === "string" ? { createdAt: row.timestamp } : {}) };
62
- let blocks: Row[], role: DecodedHistoryItem["role"];
63
- if (row.type === "user" || row.type === "assistant") {
64
- if (!object(row.message) || row.message.role !== row.type) throw new Error("invalid Claude transcript message role");
65
- blocks = blocksOf(row.message.content);
66
- role = row.isCompactSummary === true || row.isMeta === true ? "system" : row.type;
67
- } else if (row.type === "system") {
68
- blocks = blocksOf(row.content);
69
- role = "system";
70
- } else {
71
- // Old/new attachments are graph nodes even when they put no bytes in the request.
72
- // `rendered` is a list of native rendered messages, not raw attachment payloads.
73
- if (row.rendered === undefined) blocks = [];
74
- else if (Array.isArray(row.rendered)) blocks = row.rendered.flatMap((message) => {
75
- if (!object(message)) throw new Error("invalid Claude transcript rendered attachment");
76
- return blocksOf(message.content);
77
- });
78
- else throw new Error("invalid Claude transcript rendered attachment");
79
- role = "system";
80
- }
81
- const items: DecodedHistoryItem[] = [{ ...common, seq, role, text: contentText(blocks) }];
82
- for (const block of blocks) {
83
- if (block.type === "tool_use") {
84
- if (!object(block.input)) throw new Error("invalid Claude transcript tool arguments");
85
- items.push({ ...common, seq: seq + items.length, role: "tool_call", text: "", toolName: requiredString(block.name, "tool name"), toolCallId: requiredString(block.id, "tool id"), arguments: block.input });
86
- } else if (block.type === "tool_result") {
87
- if (block.is_error !== undefined && typeof block.is_error !== "boolean") throw new Error("invalid Claude transcript tool error flag");
88
- const output = block.content === undefined ? "" : contentText(blocksOf(block.content));
89
- items.push({ ...common, seq: seq + items.length, role: "tool", text: output, toolCallId: requiredString(block.tool_use_id, "tool result id"), toolError: block.is_error === true });
90
- }
91
- }
92
- return items;
93
- }
94
-
95
- /**
96
- * The protocol tags a complete boot carries; `context_window` is the pre-rename spelling that
97
- * sessions and Claude transcripts already on disk still use, so both stay readable.
98
- */
99
- const BOOT_IDENTITY = /^<(?:notesoup:window_identity|context_window)>\nAgent name: claude \(/;
100
- const BOOT_PROTOCOL_OPEN = /\n<(?:notesoup:notes_protocol|context_window_protocol)>\n/;
101
- const BOOT_PROTOCOL_CLOSE = /\n<\/(?:notesoup:notes_protocol|context_window_protocol)>/;
102
-
103
- /** Match the complete retained notesoup boot, not a casually quoted window-id line. */
104
- function bootOrdinal(row: Row, retained: boolean): number | undefined {
105
- if (!retained || row.type !== "user" || !object(row.message)) return undefined;
106
- const text = contentText(row.message.content);
107
- if (!BOOT_IDENTITY.test(text) || !BOOT_PROTOCOL_OPEN.test(text) || !BOOT_PROTOCOL_CLOSE.test(text)) return undefined;
108
- // A fork copies the retained boot verbatim. Its ordinal survives, while
109
- // public window ids below always belong to the current transcript session.
110
- const suffix = /^Current context window id: claude:[^\n]+:(\d+)$/m.exec(text)?.[1];
111
- if (suffix === undefined) return undefined;
112
- const ordinal = Number(suffix);
113
- return Number.isSafeInteger(ordinal) ? ordinal : undefined;
114
- }
115
-
116
- /** All addresses are allocated on the full first-occurrence log, before branch selection. */
117
- export function claudeHistoryFromJsonl(text: string, source: Omit<ClaudeHistorySource, "transcriptPath">): ClaudeHistoryProjection {
118
- const nodes = new Map<string, Node>();
119
- let nextSeq = 1;
120
- for (const row of rowsOf(text)) {
121
- // Ignore non-message records, including future metadata. If selected ancestry
122
- // reaches a skipped UUID, it becomes a gap, never permission to expose its payload.
123
- if (!MESSAGE_TYPES.has(row.type as string)) continue;
124
- const uuid = requiredString(row.uuid, "uuid");
125
- parent(row);
126
- if (row.sessionId !== source.sessionId) throw new Error("Claude transcript belongs to a different session");
127
- if (row.isSidechain === true || row.agentId !== undefined) throw new Error("Claude history supports only the main session transcript");
128
- // Resolve the window in the graph as it existed at this append, not the final
129
- // rewritten tree. A preserved old row stays in its original window; a NEW child
130
- // of its rewritten version belongs to the new window.
131
- const ancestor = boundary(row) && typeof row.logicalParentUuid === "string" ? row.logicalParentUuid : parent(row);
132
- const version: Version = { row, ancestorUuid: ancestor, ancestor: ancestor === undefined ? undefined : nodes.get(ancestor)?.latest };
133
- const previous = nodes.get(uuid);
134
- if (previous) {
135
- // Native resume/compaction rewrites provenance and parent links, not logical identities.
136
- if (previous.first.row.type !== row.type || !["message", "content", "rendered"].every((field) => isDeepStrictEqual(previous.first.row[field], row[field]))) {
137
- throw new Error(`conflicting Claude transcript duplicate UUID: ${uuid}`);
138
- }
139
- previous.latest = version;
140
- continue;
141
- }
142
- const items = decode(row, nextSeq);
143
- nextSeq += items.length;
144
- nodes.set(uuid, { first: version, latest: version, items });
145
- }
146
- const missingAncestors = new Set<string>();
147
- function positionOf(version: Version): WindowPosition {
148
- // Resolve long chains iteratively. A gap destroys ordinal evidence, not the
149
- // confirmed suffix. Only a retained boot can re-anchor that suffix's ordinal.
150
- const chain: Version[] = [], calculating = new Set<Version>();
151
- let cursor = version;
152
- let before: WindowPosition = { ordinal: 0 };
153
- while (cursor.position === undefined) {
154
- // Forward references use the parent's first eventual version, not a rewrite.
155
- cursor.ancestor ??= cursor.ancestorUuid === undefined ? undefined : nodes.get(cursor.ancestorUuid)?.first;
156
- if (calculating.has(cursor)) throw new Error("cyclic Claude transcript ancestry");
157
- calculating.add(cursor);
158
- chain.push(cursor);
159
- if (cursor.ancestorUuid !== undefined && cursor.ancestor === undefined) {
160
- missingAncestors.add(cursor.ancestorUuid);
161
- before = { unknownAncestor: cursor.ancestorUuid };
162
- break;
163
- }
164
- if (cursor.ancestor === undefined) break;
165
- cursor = cursor.ancestor;
166
- }
167
- before = cursor.position ?? before;
168
- for (const current of chain.reverse()) {
169
- const retained = current.row.isCompactSummary === true || (current.ancestor !== undefined && boundary(current.ancestor.row));
170
- const marked = bootOrdinal(current.row, retained);
171
- current.position = marked !== undefined
172
- ? { ordinal: "ordinal" in before ? Math.max(before.ordinal, marked) : marked }
173
- : "ordinal" in before ? { ordinal: before.ordinal + (boundary(current.row) ? 1 : 0) } : before;
174
- before = current.position;
175
- }
176
- return version.position!;
177
- }
178
- if (!source.headUuid) throw new Error("Claude history has no confirmed active head yet; wait for a main-session append after startup/resume");
179
- if (!nodes.has(source.headUuid)) throw new Error("Claude history active head is not persisted yet; retry after the transcript write");
180
-
181
- // The inference tree uses the latest rewritten parents. At a compact boundary the logical
182
- // parent and preserved segments use ORIGINAL ancestry: the old context is still history.
183
- const selected = new Set<string>(), visited = new Set<string>(), visiting = new Set<string>();
184
- type Visit = { uuid: string; historical: boolean; exit?: boolean };
185
- const stack: Visit[] = [{ uuid: source.headUuid, historical: false }];
186
- while (stack.length > 0) {
187
- const step = stack.pop()!, { uuid, historical } = step;
188
- const key = `${historical ? "old" : "live"}:${uuid}`;
189
- if (step.exit) { visiting.delete(key); visited.add(key); continue; }
190
- if (visited.has(key)) continue;
191
- if (visiting.has(key)) throw new Error("cyclic Claude transcript ancestry");
192
- visiting.add(key);
193
- stack.push({ ...step, exit: true });
194
- const node = nodes.get(uuid);
195
- if (!node) { missingAncestors.add(uuid); continue; }
196
- selected.add(uuid);
197
- const row = (historical ? node.first : node.latest).row;
198
- const ancestor = parent(row);
199
- if (ancestor !== undefined) stack.push({ uuid: ancestor, historical });
200
- if (!boundary(row)) continue;
201
- if (row.logicalParentUuid != null) stack.push({ uuid: requiredString(row.logicalParentUuid, "logicalParentUuid"), historical: true });
202
- const meta = row.compactMetadata;
203
- if (!object(meta)) continue;
204
- if (object(meta.preservedSegment)) {
205
- for (const field of ["headUuid", "tailUuid"]) if (meta.preservedSegment[field] !== undefined) stack.push({ uuid: requiredString(meta.preservedSegment[field], field), historical: true });
206
- }
207
- if (object(meta.preservedMessages)) {
208
- const uuids = meta.preservedMessages.allUuids ?? meta.preservedMessages.uuids;
209
- if (uuids === undefined) continue;
210
- if (!Array.isArray(uuids)) throw new Error("invalid Claude preserved messages");
211
- for (const id of uuids) {
212
- const uuid = requiredString(id, "preserved UUID");
213
- // allUuids also names virtual/non-persisted attachments. It is auxiliary
214
- // evidence, not a reason to pretend the stored parent chain is missing.
215
- if (nodes.has(uuid)) stack.push({ uuid, historical: true });
216
- }
217
- }
218
- }
219
-
220
- const current = positionOf(nodes.get(source.headUuid)!.latest);
221
- const windowId = (position: WindowPosition) => `claude:${source.sessionId}:${"ordinal" in position ? position.ordinal : `unknown:${position.unknownAncestor}`}`;
222
- const windowsById = new Map<string, DecodedHistoryWindow & { ordinal?: number }>();
223
- const branchSeqs = new Set<number>();
224
- let maxOrdinal = "ordinal" in current ? current.ordinal : 0;
225
- for (const [uuid, node] of nodes) {
226
- if (!selected.has(uuid)) continue;
227
- const position = positionOf(node.first);
228
- if ("ordinal" in position) maxOrdinal = Math.max(maxOrdinal, position.ordinal);
229
- const id = windowId(position);
230
- let window = windowsById.get(id);
231
- if (!window) {
232
- window = { windowId: id, ...("ordinal" in position ? { ordinal: position.ordinal } : {}), items: [] };
233
- windowsById.set(id, window);
234
- }
235
- window.createdAt ??= node.items[0]?.createdAt;
236
- for (const item of node.items) { branchSeqs.add(item.seq); window.items.push({ ...item, windowId: id }); }
237
- }
238
- // Preserve complete-history empty windows (including copied boot ordinals).
239
- // With gaps, report only evidenced windows, never invent the missing ordinals.
240
- if (missingAncestors.size === 0) {
241
- for (let ordinal = 0; ordinal <= maxOrdinal; ordinal++) {
242
- const id = windowId({ ordinal });
243
- if (!windowsById.has(id)) windowsById.set(id, { windowId: id, ordinal, items: [] });
244
- }
245
- }
246
- // Forward references can put a newer numbered window on disk first. Unknown
247
- // segments are a separate, unordered group, not an inferred place in that timeline.
248
- const windows = [...windowsById.values()].sort((a, b) => a.ordinal === undefined
249
- ? b.ordinal === undefined ? 0 : 1
250
- : b.ordinal === undefined ? -1 : a.ordinal - b.ordinal);
251
- return { ...projectHistory(windows, nextSeq - 1, branchSeqs), missingAncestors: [...missingAncestors], currentWindowOrdinal: "ordinal" in current ? current.ordinal : undefined };
252
- }
253
-
254
- export async function readClaudeHistory(source: ClaudeHistorySource): Promise<ClaudeHistoryProjection> {
255
- if (!source || typeof source.transcriptPath !== "string" || !source.transcriptPath || typeof source.sessionId !== "string") throw new Error("Claude history transcript_path is unavailable");
256
- return claudeHistoryFromJsonl(await readFile(source.transcriptPath, "utf8"), source);
257
- }
1
+ /** Claude's SDK-facing entry; the persisted wire decoder is shared with the local corpus. */
2
+ export { claudeHistoryFromJsonl, readClaudeHistory } from "../../../src/history/claude.js";
3
+ export type { ClaudeHistorySource, ClaudeHistoryProjection } from "../../../src/history/claude.js";
@@ -7,7 +7,6 @@ export const CLAUDE_HISTORY_UNAVAILABLE_SENTENCE = "History isn't available in t
7
7
  export const CLAUDE_WARNING_PROMPT = warningNotice();
8
8
 
9
9
  export const CLAUDE_HISTORY_UNKNOWN_WINDOW = "Claude history cannot determine the current window ordinal across a missing ancestor; restore the ancestry or use a retained notesoup boot to re-anchor it.";
10
- export const CLAUDE_HISTORY_UNKNOWN_PREVIOUS = 'Cannot resolve "@previous": the immediately preceding window is not confirmed across the ancestry gap. Use an explicit window id from history_windows.';
11
10
  export function claudeHistoryUnconfirmedSeq(seq: number): string {
12
11
  return `Seq ${seq} is outside the confirmed selected history; it may be on another branch or beyond an unresolved ancestry gap.`;
13
12
  }
@@ -1,6 +1,6 @@
1
1
  # notesoup for Codex
2
2
 
3
- Native notes and history for Codex **0.160.1**. The plugin bundles one stdio MCP server with the five notes homes and three history tools, and one hook helper that injects the notes boot into each native context window. `new_context` and `get_context_remaining` stay Codex's own tools; notesoup does not replace Codex's reset or budget.
3
+ Native notes and history for Codex **0.160.1**. The plugin bundles one stdio MCP server with the five notebooks and three history tools, and one hook helper that injects the notes boot into each native context window. `new_context` and `get_context_remaining` stay Codex's own tools; notesoup does not replace Codex's reset or budget.
4
4
 
5
5
  ## Install
6
6