notesoup 0.49.0 → 0.51.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 (172) hide show
  1. package/README.md +13 -1
  2. package/dist/{src/claude → plugins/claude/src}/helper.js +7 -7
  3. package/dist/{src/claude → plugins/claude/src}/history.d.ts +1 -1
  4. package/dist/{src/claude → plugins/claude/src}/history.js +1 -1
  5. package/dist/plugins/claude/src/text.d.ts +6 -0
  6. package/dist/plugins/claude/src/text.js +7 -0
  7. package/dist/{src/claude → plugins/claude/src}/thresholds.js +3 -3
  8. package/dist/{src → plugins}/dsh/budget.js +1 -1
  9. package/dist/{src → plugins}/dsh/engine.d.ts +1 -1
  10. package/dist/{src → plugins}/dsh/engine.js +1 -1
  11. package/dist/{src → plugins}/dsh/history.d.ts +1 -1
  12. package/dist/{src → plugins}/dsh/history.js +1 -1
  13. package/dist/{src → plugins}/dsh/index.js +1 -1
  14. package/dist/{src → plugins}/dsh/tools.js +3 -3
  15. package/dist/{src → plugins}/dsh/window.d.ts +1 -1
  16. package/dist/{src → plugins}/dsh/window.js +5 -5
  17. package/dist/{src → plugins}/pi/boot.d.ts +1 -1
  18. package/dist/{src → plugins}/pi/boot.js +5 -4
  19. package/dist/{src → plugins}/pi/budget.js +4 -4
  20. package/dist/{src → plugins}/pi/dream/cli.d.ts +1 -1
  21. package/dist/{src → plugins}/pi/dream/cli.js +6 -6
  22. package/dist/{src → plugins}/pi/dream/runner.d.ts +1 -1
  23. package/dist/{src → plugins}/pi/dream/runner.js +3 -3
  24. package/dist/{src → plugins}/pi/dream/settings.d.ts +1 -1
  25. package/dist/{src → plugins}/pi/dream/settings.js +2 -2
  26. package/dist/{src → plugins}/pi/history-tools.js +1 -1
  27. package/dist/{src → plugins}/pi/history.d.ts +1 -1
  28. package/dist/{src → plugins}/pi/history.js +1 -1
  29. package/dist/plugins/pi/index.d.ts +1 -0
  30. package/dist/plugins/pi/index.js +1 -0
  31. package/dist/{src → plugins}/pi/notes/adapter.d.ts +1 -1
  32. package/dist/{src → plugins}/pi/notes/adapter.js +1 -1
  33. package/dist/{src → plugins}/pi/notes/tools.js +1 -1
  34. package/dist/{src → plugins}/pi/reset/artifacts.d.ts +1 -1
  35. package/dist/{src → plugins}/pi/reset/artifacts.js +1 -1
  36. package/dist/{src → plugins}/pi/reset/lifecycle.d.ts +1 -1
  37. package/dist/{src → plugins}/pi/reset/lifecycle.js +1 -1
  38. package/dist/{src → plugins}/pi/runtime.js +4 -4
  39. package/dist/plugins/pi/text.d.ts +23 -0
  40. package/dist/plugins/pi/text.js +30 -0
  41. package/dist/{src → plugins}/pi/thresholds.d.ts +1 -1
  42. package/dist/{src → plugins}/pi/thresholds.js +4 -4
  43. package/dist/{src → plugins}/pi/tool-result.d.ts +1 -1
  44. package/dist/{src → plugins}/pi/tool-result.js +1 -1
  45. package/dist/{src → plugins}/pi/window.d.ts +1 -1
  46. package/dist/src/boot/text.d.ts +4 -13
  47. package/dist/src/boot/text.js +1 -11
  48. package/dist/src/budget/policy.d.ts +2 -3
  49. package/dist/src/budget/policy.js +1 -1
  50. package/dist/src/budget/text.d.ts +1 -12
  51. package/dist/src/budget/text.js +2 -24
  52. package/dist/src/dream/settings.d.ts +1 -2
  53. package/dist/src/dream/settings.js +4 -2
  54. package/dist/src/index.d.ts +29 -1
  55. package/dist/src/index.js +26 -1
  56. package/dist/src/notes/address.d.ts +5 -4
  57. package/dist/src/notes/address.js +13 -7
  58. package/dist/src/notes/identity.js +3 -7
  59. package/dist/src/notes/paths.d.ts +4 -2
  60. package/dist/src/notes/paths.js +11 -6
  61. package/dist/src/notes/store.d.ts +4 -1
  62. package/dist/src/notes/store.js +66 -34
  63. package/dist/src/settings.d.ts +7 -16
  64. package/dist/src/settings.js +7 -10
  65. package/dist/src/tools/notes.d.ts +5 -5
  66. package/dist/src/tools/notes.js +5 -4
  67. package/dist/test/agent-loop.test.js +20 -19
  68. package/dist/test/boot.integration.test.js +9 -9
  69. package/dist/test/budget-settings.integration.test.js +1 -1
  70. package/dist/test/claude-history.test.js +2 -2
  71. package/dist/test/claude-mod.test.js +22 -16
  72. package/dist/test/claude-validation.test.js +3 -3
  73. package/dist/test/dependencies.test.js +53 -45
  74. package/dist/test/doctor.test.js +1 -1
  75. package/dist/test/dream-skill.test.js +4 -4
  76. package/dist/test/dream.test.js +2 -2
  77. package/dist/test/dsh-cli.test.js +2 -2
  78. package/dist/test/dsh-compaction-parity.test.js +1 -1
  79. package/dist/test/dsh.test.js +4 -4
  80. package/dist/test/helpers/dependency-graph.js +9 -7
  81. package/dist/test/helpers/dsh.d.ts +1 -1
  82. package/dist/test/helpers/dsh.js +2 -2
  83. package/dist/test/helpers/extension.js +6 -5
  84. package/dist/test/helpers/notes.js +1 -1
  85. package/dist/test/model-facing-text.test.js +6 -4
  86. package/dist/test/notes-query-homes.test.d.ts +1 -0
  87. package/dist/test/notes-query-homes.test.js +161 -0
  88. package/dist/test/notes.integration.test.js +3 -2
  89. package/dist/test/notes.test.js +1 -1
  90. package/dist/test/reset-lifecycle.test.js +16 -15
  91. package/docs/architecture.md +21 -18
  92. package/docs/claude-code-mod.md +3 -3
  93. package/docs/dsh.md +2 -2
  94. package/docs/dsh.profile.patch.yml +1 -1
  95. package/docs/notes-library.md +17 -10
  96. package/docs/reset-lifecycle.md +3 -3
  97. package/docs/sdk-integration.md +2 -2
  98. package/package.json +17 -13
  99. package/{mods/notesoup → plugins/claude}/.claude-plugin/plugin.json +1 -1
  100. package/{mods/notesoup → plugins/claude}/dist/claude/helper.js +565 -540
  101. package/{mods/notesoup → plugins/claude}/hooks/register.ts +2 -2
  102. package/{mods/notesoup → plugins/claude}/skills/memory/SKILL.md +3 -0
  103. package/{src/claude → plugins/claude/src}/helper.ts +10 -9
  104. package/{src/claude → plugins/claude/src}/history.ts +1 -1
  105. package/plugins/claude/src/text.ts +10 -0
  106. package/{src/claude → plugins/claude/src}/thresholds.ts +3 -3
  107. package/{src → plugins}/dsh/budget.ts +1 -1
  108. package/{src → plugins}/dsh/engine.ts +1 -1
  109. package/{src → plugins}/dsh/history.ts +1 -1
  110. package/{src → plugins}/dsh/index.ts +1 -1
  111. package/{src → plugins}/dsh/tools.ts +3 -3
  112. package/{src → plugins}/dsh/window.ts +5 -5
  113. package/{src → plugins}/pi/boot.ts +5 -4
  114. package/{src → plugins}/pi/budget.ts +4 -4
  115. package/{src → plugins}/pi/dream/cli.ts +8 -8
  116. package/{src → plugins}/pi/dream/runner.ts +4 -4
  117. package/{src → plugins}/pi/dream/settings.ts +2 -2
  118. package/{src → plugins}/pi/history-tools.ts +1 -1
  119. package/{src → plugins}/pi/history.ts +1 -1
  120. package/plugins/pi/index.ts +1 -0
  121. package/{src → plugins}/pi/notes/adapter.ts +1 -1
  122. package/{src → plugins}/pi/notes/tools.ts +2 -2
  123. package/{src → plugins}/pi/reset/artifacts.ts +1 -1
  124. package/{src → plugins}/pi/reset/lifecycle.ts +2 -2
  125. package/{src → plugins}/pi/runtime.ts +4 -4
  126. package/plugins/pi/text.ts +35 -0
  127. package/{src → plugins}/pi/thresholds.ts +4 -4
  128. package/{src → plugins}/pi/tool-result.ts +1 -1
  129. package/{src → plugins}/pi/window.ts +1 -1
  130. package/skills/memory/SKILL.md +3 -0
  131. package/src/boot/text.ts +5 -15
  132. package/src/budget/policy.ts +3 -3
  133. package/src/budget/text.ts +2 -30
  134. package/src/dream/settings.ts +6 -3
  135. package/src/index.ts +52 -1
  136. package/src/notes/address.ts +12 -8
  137. package/src/notes/identity.ts +2 -8
  138. package/src/notes/paths.ts +12 -6
  139. package/src/notes/store.ts +62 -29
  140. package/src/settings.ts +8 -24
  141. package/src/tools/notes.ts +5 -4
  142. /package/dist/{src/claude → plugins/claude/src}/helper.d.ts +0 -0
  143. /package/dist/{src/claude → plugins/claude/src}/thresholds.d.ts +0 -0
  144. /package/dist/{src → plugins}/dsh/budget.d.ts +0 -0
  145. /package/dist/{src → plugins}/dsh/index.d.ts +0 -0
  146. /package/dist/{src → plugins}/dsh/tools.d.ts +0 -0
  147. /package/dist/{src → plugins}/pi/anchored.d.ts +0 -0
  148. /package/dist/{src → plugins}/pi/anchored.js +0 -0
  149. /package/dist/{src → plugins}/pi/budget.d.ts +0 -0
  150. /package/dist/{src → plugins}/pi/entries.d.ts +0 -0
  151. /package/dist/{src → plugins}/pi/entries.js +0 -0
  152. /package/dist/{src → plugins}/pi/estimate.d.ts +0 -0
  153. /package/dist/{src → plugins}/pi/estimate.js +0 -0
  154. /package/dist/{src → plugins}/pi/extension.d.ts +0 -0
  155. /package/dist/{src → plugins}/pi/extension.js +0 -0
  156. /package/dist/{src → plugins}/pi/history-tools.d.ts +0 -0
  157. /package/dist/{src → plugins}/pi/notes/tools.d.ts +0 -0
  158. /package/dist/{src → plugins}/pi/reset/committed.d.ts +0 -0
  159. /package/dist/{src → plugins}/pi/reset/committed.js +0 -0
  160. /package/dist/{src → plugins}/pi/runtime.d.ts +0 -0
  161. /package/dist/{src → plugins}/pi/session-reader.d.ts +0 -0
  162. /package/dist/{src → plugins}/pi/session-reader.js +0 -0
  163. /package/dist/{src → plugins}/pi/window.js +0 -0
  164. /package/{mods/notesoup → plugins/claude}/hooks/hooks.json +0 -0
  165. /package/{mods/notesoup → plugins/claude}/playbook.md +0 -0
  166. /package/{mods/notesoup → plugins/claude}/skills/dream/SKILL.md +0 -0
  167. /package/{src → plugins}/pi/anchored.ts +0 -0
  168. /package/{src → plugins}/pi/entries.ts +0 -0
  169. /package/{src → plugins}/pi/estimate.ts +0 -0
  170. /package/{src → plugins}/pi/extension.ts +0 -0
  171. /package/{src → plugins}/pi/reset/committed.ts +0 -0
  172. /package/{src → plugins}/pi/session-reader.ts +0 -0
@@ -339,7 +339,7 @@ export function register(on: On) {
339
339
  registered.clear()
340
340
  await loadTexts($, state)
341
341
  armManual($, state, manualSignal)
342
- await $.command.register({ name: "empty-brain", description: "Reset context to a fresh notes-only window", immediate: true })
342
+ await $.command.register({ name: "empty", description: "Reset context to a fresh notes-only window", immediate: true })
343
343
  await $.command.register({ name: "fresh-window", description: "Reset context to a fresh notes-only window", immediate: true })
344
344
  const schemas = await run($, { op: "schemas" })
345
345
  if (!schemas.ok || !Array.isArray(schemas.result)) return next(e)
@@ -390,7 +390,7 @@ export function register(on: On) {
390
390
  return result
391
391
  })
392
392
  on("command.run", async ($, e, next) => {
393
- if (e.command !== "empty-brain" && e.command !== "fresh-window") return next(e)
393
+ if (e.command !== "empty" && e.command !== "fresh-window") return next(e)
394
394
  if (!await refreshIdentity($, state)) return { text: "🥣 Different brain now · try /fresh-window again" }
395
395
  if (state.headless) return { text: `🥣 ${HEADLESS}` }
396
396
  if (state.compactDisabled) return { text: `🥣 ${COMPACT_DISABLED}` }
@@ -24,6 +24,7 @@ The address decides who a note belongs to and how long it lasts.
24
24
  | `@self/<path>` | self note | your reminders; yours alone if you have a name, shared by everyone nameless |
25
25
  | `@model/<path>` | model note | what applies to this model only |
26
26
  | `@projects/<name>/<path>` | named project, read-only | discover names and root paths with `notes_list` glob `@projects/*/**` |
27
+ | `@sessions/<id>/<path>` | named session, read-only | recover earlier task state; discover with glob `@sessions/*/**` |
27
28
 
28
29
  When notes conflict, the one most relevant to what you're doing applies. If that doesn't settle it, judge the case.
29
30
 
@@ -37,6 +38,8 @@ Write only what git and history cannot give back. Crumple notes that are no long
37
38
 
38
39
  ## Finding things again
39
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.
42
+
40
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.
41
44
  - **Something that happened**: `history_list` to browse or search this session's events; `history_read` the seq for the whole event.
42
45
  - **An earlier window**: `history_windows` gives window ids; pass one as `window_id` to `history_list`.
@@ -2,17 +2,18 @@ import { realpathSync } from "node:fs";
2
2
  import { pathToFileURL } from "node:url";
3
3
  import type { Static, TSchema } from "typebox";
4
4
  import { Check, Errors } from "typebox/value";
5
- import { notesList, notesRead, notesSearch, notesUpdate, notesWrite } from "../tools/notes.js";
6
- import { historyList, historyRead, historyWindows } from "../tools/history.js";
5
+ import { notesList, notesRead, notesSearch, notesUpdate, notesWrite } from "../../../src/tools/notes.js";
6
+ import { historyList, historyRead, historyWindows } from "../../../src/tools/history.js";
7
7
  import { readClaudeHistory, type ClaudeHistorySource } from "./history.js";
8
- import type { HistoryProjection } from "../history/history.js";
9
- import { loadNotesSnapshot } from "../boot/snapshot.js";
10
- import { renderBootBlock } from "../boot/render.js";
11
- import { CLAUDE_WIPE_SENTENCE, CLAUDE_HISTORY_UNAVAILABLE_SENTENCE, type BootToolNames } from "../boot/text.js";
12
- import { CLAUDE_WARNING_PROMPT, selectContinuation } from "../budget/text.js";
8
+ import type { HistoryProjection } from "../../../src/history/history.js";
9
+ import { loadNotesSnapshot } from "../../../src/boot/snapshot.js";
10
+ import { renderBootBlock } from "../../../src/boot/render.js";
11
+ import type { BootToolNames } from "../../../src/boot/text.js";
12
+ import { selectContinuation } from "../../../src/budget/text.js";
13
+ import { CLAUDE_HISTORY_UNAVAILABLE_SENTENCE, CLAUDE_WARNING_PROMPT, CLAUDE_WIPE_SENTENCE } from "./text.js";
13
14
  import { resolveClaudeLimits } from "./thresholds.js";
14
- import { projectKey, snapshotNotesIdentity, type NotesIdentity } from "../notes/index.js";
15
- import type { Operation } from "../tools/result.js";
15
+ import { projectKey, snapshotNotesIdentity, type NotesIdentity } from "../../../src/notes/index.js";
16
+ import type { Operation } from "../../../src/tools/result.js";
16
17
 
17
18
  const MAX_REQUEST_BYTES = 512 * 1024;
18
19
  const MAX_RESPONSE_BYTES = 1024 * 1024;
@@ -1,7 +1,7 @@
1
1
  /** Claude's persisted main transcript -> the shared history projection. No inference-context API. */
2
2
  import { readFile } from "node:fs/promises";
3
3
  import { isDeepStrictEqual } from "node:util";
4
- import { contentText, projectHistory, type DecodedHistoryItem, type DecodedHistoryWindow, type HistoryProjection } from "../history/history.js";
4
+ import { contentText, projectHistory, type DecodedHistoryItem, type DecodedHistoryWindow, type HistoryProjection } from "../../../src/history/history.js";
5
5
 
6
6
  type Row = Record<string, unknown>;
7
7
  type Version = { row: Row; ancestorUuid?: string; ancestor?: Version; ordinal?: number };
@@ -0,0 +1,10 @@
1
+ import { COUNTDOWN_LINE, WARNING_BODY } from "../../../src/budget/text.js";
2
+
3
+ /** Claude has no model-facing reset tool: the model ends its turn and the human runs the command. */
4
+ export const CLAUDE_WIPE_SENTENCE = "If this feels like the right moment, end your turn and ask the human to run `/fresh-window`.";
5
+
6
+ /** Claude's boot says history is missing rather than naming tools it cannot serve. */
7
+ export const CLAUDE_HISTORY_UNAVAILABLE_SENTENCE = "History isn't available in this Claude session: no main transcript_path was supplied. Keep essential state in notes; don't pretend those notes are the missing transcript.";
8
+
9
+ /** Claude's variant: the mod resets after the turn, so the model only has to stop. */
10
+ export const CLAUDE_WARNING_PROMPT = `${WARNING_BODY}\nWhen the notes are ready, end your turn; the reset runs after it.\n${COUNTDOWN_LINE}`;
@@ -1,6 +1,6 @@
1
- import { WARNING_RUNWAY_TOKENS } from "../budget/constants.js";
2
- import { percent, positiveInteger, positiveNumber, presenceFlag } from "../budget/parse.js";
3
- import { isPlainObject, mergeNotesoupSettings } from "../settings.js";
1
+ import { WARNING_RUNWAY_TOKENS } from "../../../src/budget/constants.js";
2
+ import { percent, positiveInteger, positiveNumber, presenceFlag } from "../../../src/budget/parse.js";
3
+ import { isPlainObject, mergeNotesoupSettings } from "../../../src/settings.js";
4
4
 
5
5
  /**
6
6
  * Claude's auto-compact point, derived the way Claude derives it — never a hardcoded percent.
@@ -3,7 +3,7 @@ import type { Context } from "@deepseek-ai/cordis";
3
3
  import type { CompactionAgentContext } from "@deepseek-ai/dsh-compaction";
4
4
  import { estimateToolsTokens } from "@deepseek-ai/dsh-token-meter/estimate";
5
5
  import type { LlmResolvedModelInfo } from "@deepseek-ai/dsh-llm";
6
- import { deriveThresholds, remainingBudget } from "../budget/policy.js";
6
+ import { deriveThresholds, remainingBudget } from "../../src/budget/policy.js";
7
7
 
8
8
  export type BudgetConfig = { auto: boolean; thresholdRatio: number; headroomTokens: number; reminderMarginTokens?: number };
9
9
  export type Budget = { used: number; contextWindow: number; reserve: number; resetAt: number; remaining: number; countdown: number; warning: number; reminder: number };
@@ -6,7 +6,7 @@ import { CompactionEngine, CompactionId, ManualCompactionError, compactCheckpoin
6
6
  import { createUserMessage, type ContentBlock } from "@deepseek-ai/dsh-llm";
7
7
  import { appendPluginRecord, type Session, type SessionSeq } from "@deepseek-ai/dsh-session";
8
8
  import { measureBudget, type BudgetConfig } from "./budget.js";
9
- import { selectContinuation, type ResetOrigin } from "../budget/text.js";
9
+ import { selectContinuation, type ResetOrigin } from "../../src/budget/text.js";
10
10
  import { checkpointText, Windows, WINDOW_RECORD, type NotesConfig } from "./window.js";
11
11
 
12
12
  export type EngineConfig = NotesConfig & Partial<BudgetConfig>;
@@ -1,7 +1,7 @@
1
1
  import type { Context } from "@deepseek-ai/cordis";
2
2
  import type { SessionId, SessionEvent } from "@deepseek-ai/dsh-session";
3
3
  import type {} from "@deepseek-ai/dsh-session-query";
4
- import { projectHistory, type DecodedHistoryItem, type DecodedHistoryWindow, type HistoryProjection } from "../history/history.js";
4
+ import { projectHistory, type DecodedHistoryItem, type DecodedHistoryWindow, type HistoryProjection } from "../../src/history/history.js";
5
5
  import { checkpointSnapshot, recordSnapshot, windowId } from "./window.js";
6
6
 
7
7
  /** Preserve every recorded block; attachments/reasoning have JSON evidence rather than invented text. */
@@ -1,7 +1,7 @@
1
1
  import type { Context } from "@deepseek-ai/cordis";
2
2
  import type {} from "@deepseek-ai/dsh-agent";
3
3
  import { createUserMessage } from "@deepseek-ai/dsh-llm";
4
- import { COUNTDOWN_LINE, warningPrompt, tokenBudgetGuidance } from "../budget/text.js";
4
+ import { COUNTDOWN_LINE, warningPrompt, tokenBudgetGuidance } from "../../src/budget/text.js";
5
5
  import { measureBudget } from "./budget.js";
6
6
  import { BOOT_SECTION, restoreWarnings } from "./window.js";
7
7
  import { preflight } from "./engine.js";
@@ -4,9 +4,9 @@ import { HarnessError } from "@deepseek-ai/dsh-llm";
4
4
  import { defineTool, type JsonSchemaNode, type ObjectJsonSchema, type ToolRunContext } from "@deepseek-ai/dsh-tools";
5
5
  import type { Static, TSchema } from "typebox";
6
6
  import { Check, Errors } from "typebox/value";
7
- import { notesList, notesRead, notesSearch, notesUpdate, notesWrite } from "../tools/notes.js";
8
- import { historyList, historyRead, historyWindows } from "../tools/history.js";
9
- import { success, type Operation } from "../tools/result.js";
7
+ import { notesList, notesRead, notesSearch, notesUpdate, notesWrite } from "../../src/tools/notes.js";
8
+ import { historyList, historyRead, historyWindows } from "../../src/tools/history.js";
9
+ import { success, type Operation } from "../../src/tools/result.js";
10
10
  import { historyProjection } from "./history.js";
11
11
  import { notesIdentity } from "./window.js";
12
12
  import { measureBudget } from "./budget.js";
@@ -4,11 +4,11 @@ import { isCompactCheckpointSource } from "@deepseek-ai/dsh-compaction";
4
4
  import { homedir } from "node:os";
5
5
  import { join } from "node:path";
6
6
  import { createHash } from "node:crypto";
7
- import { loadNotesSnapshot } from "../boot/snapshot.js";
8
- import { renderBootBlock } from "../boot/render.js";
9
- import { DEFAULT_BOOT_TOOL_NAMES } from "../boot/text.js";
10
- import { contentText } from "../history/history.js";
11
- import { projectKey, slugify, snapshotNotesIdentity, type NotesIdentity } from "../notes/index.js";
7
+ import { loadNotesSnapshot } from "../../src/boot/snapshot.js";
8
+ import { renderBootBlock } from "../../src/boot/render.js";
9
+ import { DEFAULT_BOOT_TOOL_NAMES } from "../../src/boot/text.js";
10
+ import { contentText } from "../../src/history/history.js";
11
+ import { projectKey, slugify, snapshotNotesIdentity, type NotesIdentity } from "../../src/notes/index.js";
12
12
 
13
13
  export const WINDOW_RECORD = "plugin:notesoup/window";
14
14
  export const BOOT_SECTION = "notesoup:boot";
@@ -1,10 +1,11 @@
1
- import { DEFAULT_BOOT_TOOL_NAMES, PI_PRE_RESET_HINTS } from "../boot/text.js";
1
+ import { DEFAULT_BOOT_TOOL_NAMES } from "../../src/boot/text.js";
2
+ import { PI_PRE_RESET_HINTS } from "./text.js";
2
3
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
3
4
  import { agentSlug, modelSlug, notesIdentityFromPi } from "./notes/adapter.js";
4
- import { loadNotesSnapshot, unavailableNotesSnapshot, type NotesSnapshot } from "../boot/snapshot.js";
5
- import { isFilesystemError } from "../notes/index.js";
5
+ import { loadNotesSnapshot, unavailableNotesSnapshot, type NotesSnapshot } from "../../src/boot/snapshot.js";
6
+ import { isFilesystemError } from "../../src/notes/index.js";
6
7
  import { BOOT_TYPE } from "./entries.js";
7
- import { renderBootBlock } from "../boot/render.js";
8
+ import { renderBootBlock } from "../../src/boot/render.js";
8
9
  import { historyFromSession, nextHistorySeq } from "./history.js";
9
10
 
10
11
  export type IncompleteNotesNotifier = (ctx: ExtensionContext, windowId: string, snapshot: NotesSnapshot) => void;
@@ -1,12 +1,12 @@
1
- import { DEFAULT_BOOT_TOOL_NAMES } from "../boot/text.js";
2
- import { remainingBudget, type ResolvedThresholds } from "../budget/policy.js";
1
+ import { DEFAULT_BOOT_TOOL_NAMES } from "../../src/boot/text.js";
2
+ import { remainingBudget, type ResolvedThresholds } from "../../src/budget/policy.js";
3
3
  import { Type } from "@earendil-works/pi-ai";
4
4
  import { defineTool, type ExtensionAPI, type ExtensionContext, type SessionBoundaryDraft, type SettingsManager } from "@earendil-works/pi-coding-agent";
5
5
  import { GUIDANCE_TYPE, WARNING_TYPE } from "./entries.js";
6
- import { warningContent } from "../budget/text.js";
6
+ import { warningContent } from "./text.js";
7
7
  import { readThresholdSettings, type ThresholdSettingsResolution } from "./thresholds.js";
8
8
  import { currentWindowId, hasWindowMessage, windowUsage } from "./window.js";
9
- import { tokenBudgetGuidance } from "../budget/text.js";
9
+ import { tokenBudgetGuidance } from "../../src/budget/text.js";
10
10
  import { arrangeAnchoredReminders, type AnchorDetails } from "./anchored.js";
11
11
  import { output } from "./tool-result.js";
12
12
 
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env node
2
- import { finishDream } from "../../dream/report.js";
3
- import type { DreamerSetting } from "../../dream/settings.js";
4
- import type { DreamResult } from "../../dream/result.js";
2
+ import { finishDream } from "../../../src/dream/report.js";
3
+ import type { DreamerSetting } from "../../../src/dream/settings.js";
4
+ import type { DreamResult } from "../../../src/dream/result.js";
5
5
  import { existsSync, mkdirSync, readFileSync, realpathSync, statSync } from "node:fs";
6
6
  import { dirname, join, resolve } from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
- import { acquireLock, failLock, lastRunPath, releaseLock } from "../../dream/lock.js";
9
- import { materialGate, timeGate } from "../../dream/gates.js";
8
+ import { acquireLock, failLock, lastRunPath, releaseLock } from "../../../src/dream/lock.js";
9
+ import { materialGate, timeGate } from "../../../src/dream/gates.js";
10
10
  import { runDreamer, type DreamerSessionFactory } from "./runner.js";
11
- import { gitCommit } from "../../dream/git.js";
11
+ import { gitCommit } from "../../../src/dream/git.js";
12
12
  import { readDreamerSettings } from "./settings.js";
13
- import { doctor } from "../../dream/doctor.js";
13
+ import { doctor } from "../../../src/dream/doctor.js";
14
14
  import { notesRoot } from "../notes/adapter.js";
15
- import { errorMessage } from "../../error-message.js";
15
+ import { errorMessage } from "../../../src/error-message.js";
16
16
 
17
17
  function args(argv: string[]) { const out: Record<string, string | boolean> = {}; for (let i=0;i<argv.length;i++) { const a=argv[i]!; if (a === "--force" || a === "--help") out[a.slice(2)] = true; else if (a.startsWith("--")) out[a.slice(2)] = argv[++i] ?? ""; } return out; }
18
18
 
@@ -1,9 +1,9 @@
1
- import { jailWritePath, deleteCrumpledNote } from "../../dream/jail.js";
2
- import type { DreamResult, DreamWrite } from "../../dream/result.js";
1
+ import { jailWritePath, deleteCrumpledNote } from "../../../src/dream/jail.js";
2
+ import type { DreamResult, DreamWrite } from "../../../src/dream/result.js";
3
3
  import { createAgentSession, createEditToolDefinition, createWriteToolDefinition, ModelRuntime, resolveModelScopeWithDiagnostics, SessionManager, type AgentSession, type ToolDefinition } from "@earendil-works/pi-coding-agent";
4
4
  import { Type, type Api, type Model } from "@earendil-works/pi-ai";
5
- import { contentText } from "../../history/history.js";
6
- import { errorMessage } from "../../error-message.js";
5
+ import { contentText } from "../../../src/history/history.js";
6
+ import { errorMessage } from "../../../src/error-message.js";
7
7
 
8
8
  export type DreamerSession = Pick<AgentSession, "prompt" | "subscribe" | "dispose">;
9
9
  export type DreamerSessionFactory = (options: { cwd: string; modelPattern?: string; tools: string[] }) => Promise<DreamerSession>;
@@ -1,6 +1,6 @@
1
- import { deriveDreamer, type DreamerSetting } from "../../dream/settings.js";
1
+ import { deriveDreamer, type DreamerSetting } from "../../../src/dream/settings.js";
2
2
  import { SettingsManager } from "@earendil-works/pi-coding-agent";
3
- import { mergeNotesoupSettings } from "../../settings.js";
3
+ import { mergeNotesoupSettings } from "../../../src/settings.js";
4
4
 
5
5
  /**
6
6
  * Resolve the configurable dreamer model from Pi settings for a CLI invocation: global
@@ -1,5 +1,5 @@
1
1
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
- import { historyWindows, historyList, historyRead } from "../tools/history.js";
2
+ import { historyWindows, historyList, historyRead } from "../../src/tools/history.js";
3
3
  import { historyFromSession } from "./history.js";
4
4
  import { HISTORY_NAMESPACE, registerOperation } from "./tool-result.js";
5
5
 
@@ -13,7 +13,7 @@ import type { AgentMessage } from "@earendil-works/pi-agent-core";
13
13
  import type { SessionBoundaryDraft, SessionEntry } from "@earendil-works/pi-coding-agent";
14
14
  import type { SessionReader } from "./session-reader.js";
15
15
  import { isWindowMarker, rootWindowId } from "./window.js";
16
- import { contentText, projectHistory, type DecodedHistoryItem, type DecodedHistoryWindow, type HistoryProjection, type NestedCallRecord, type ToolCallStatus } from "../history/history.js";
16
+ import { contentText, projectHistory, type DecodedHistoryItem, type DecodedHistoryWindow, type HistoryProjection, type NestedCallRecord, type ToolCallStatus } from "../../src/history/history.js";
17
17
 
18
18
  function mapRole(role: AgentMessage["role"]): DecodedHistoryItem["role"] | undefined {
19
19
  if (role === "user" || role === "assistant") return role;
@@ -0,0 +1 @@
1
+ export { default, createNotesoup } from "./extension.js";
@@ -1,7 +1,7 @@
1
1
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
2
  import { homedir } from "node:os";
3
3
  import { join, resolve } from "node:path";
4
- import { projectKey, slugify, type NotesIdentity } from "../../notes/index.js";
4
+ import { projectKey, slugify, type NotesIdentity } from "../../../src/notes/index.js";
5
5
 
6
6
  /** Pi's default notes root; environment access stays on the host side of the library boundary. */
7
7
  export function notesRoot(): string {
@@ -1,8 +1,8 @@
1
1
  import { generateDiffString, type ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
- import { notesWrite, notesUpdate, notesRead, notesList, notesSearch } from "../../tools/notes.js";
2
+ import { notesWrite, notesUpdate, notesRead, notesList, notesSearch } from "../../../src/tools/notes.js";
3
3
  import { notesIdentityFromPi } from "./adapter.js";
4
4
  import { NOTES_NAMESPACE, registerOperation } from "../tool-result.js";
5
- import type { NoteChange } from "../../notes/index.js";
5
+ import type { NoteChange } from "../../../src/notes/index.js";
6
6
 
7
7
  function renderDiff(change: NoteChange): string {
8
8
  return change.kind === "none" ? "" : generateDiffString(change.before, change.after).diff;
@@ -1,7 +1,7 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import type { ExtensionAPI, ExtensionContext, SessionBoundaryDraft, SessionEntry } from "@earendil-works/pi-coding-agent";
3
3
  import { BOOT_TYPE, CONTINUATION_TYPE, RESET_LAST_WORD_TYPE, RESET_MARKER_TYPE } from "../entries.js";
4
- import { selectContinuation, type ResetOrigin } from "../../budget/text.js";
4
+ import { selectContinuation, type ResetOrigin } from "../../../src/budget/text.js";
5
5
  import { isForeignResetTailEntry, isWindowBootEntry, isWindowMarker, markerResetOrigin, type WindowMarker } from "../window.js";
6
6
  import { buildBootMessage, sendBoot, type IncompleteNotesNotifier } from "../boot.js";
7
7
 
@@ -4,8 +4,8 @@ import type { AgentBeforeSettleEvent, ExtensionAPI, ExtensionContext, SessionBou
4
4
  import { currentReset, currentWindowId } from "../window.js";
5
5
  import { nextHistorySeq } from "../history.js";
6
6
  import { resetBoundaryCommitted } from "./committed.js";
7
- import type { ResetOrigin } from "../../budget/text.js";
8
- import { errorMessage } from "../../error-message.js";
7
+ import type { ResetOrigin } from "../../../src/budget/text.js";
8
+ import { errorMessage } from "../../../src/error-message.js";
9
9
 
10
10
  type BudgetOwner = {
11
11
  automaticResetEnabled: (ctx: ExtensionContext) => boolean;
@@ -8,10 +8,10 @@ import { currentReset, currentWindowId, isCheckpointBackedReset, isWindowBoot, i
8
8
  import { registerResetLifecycle } from "./reset/lifecycle.js";
9
9
  import { buildResetDrafts, LAST_WORD_PREFIX, MAX_LAST_WORD_CHARS, repairResetTail, sanitizeLastWord } from "./reset/artifacts.js";
10
10
  import { BOOT_TYPE, MANUAL_WIPE_TYPE, RESET_LAST_WORD_TYPE } from "./entries.js";
11
- import { warningContent } from "../budget/text.js";
11
+ import { warningContent } from "./text.js";
12
12
  import { buildBootMessage, sendBoot, type IncompleteNotesNotifier } from "./boot.js";
13
13
  import { nextHistorySeq } from "./history.js";
14
- import { errorMessage } from "../error-message.js";
14
+ import { errorMessage } from "../../src/error-message.js";
15
15
 
16
16
  function readPackageVersion(): string {
17
17
  for (const up of ["../../package.json", "../../../package.json"]) {
@@ -191,14 +191,14 @@ export function registerContext(pi: ExtensionAPI, settingsManager?: SettingsMana
191
191
  }
192
192
  cmdCtx.ui.notify("🥣 Brain being emptied", "info");
193
193
  try {
194
- pi.sendMessage({ customType: MANUAL_WIPE_TYPE, content: warningContent(prompt ? `/empty-brain ${prompt}` : undefined), display: false }, { triggerTurn: true, deliverAs: "steer" });
194
+ pi.sendMessage({ customType: MANUAL_WIPE_TYPE, content: warningContent(prompt ? `/empty ${prompt}` : undefined), display: false }, { triggerTurn: true, deliverAs: "steer" });
195
195
  } catch (error) {
196
196
  resets.clear();
197
197
  cmdCtx.ui.notify(`🥣 Brain refused to empty: ${errorMessage(error)}`, "error");
198
198
  }
199
199
  },
200
200
  };
201
- pi.registerCommand("empty-brain", emptyBrainCommand);
201
+ pi.registerCommand("empty", emptyBrainCommand);
202
202
  pi.registerCommand("fresh-window", emptyBrainCommand);
203
203
 
204
204
  pi.registerTool(defineTool({
@@ -0,0 +1,35 @@
1
+ import { COUNTDOWN_LINE, GUIDANCE_CLOSE_TAG, GUIDANCE_OPEN_TAG, WARNING_BODY, WARNING_CALL } from "../../src/budget/text.js";
2
+
3
+ /**
4
+ * Pi-only closing hints. Pi's TUI drops the human's visible transcript when a window resets, and
5
+ * the model, not the human, owns when that reset happens. A host whose reset leaves the human's
6
+ * view intact must not carry these — the claim would be false there. The bare `empty_brain` token
7
+ * is interpolated by renderProtocolBlock; the prose itself stays plain English.
8
+ */
9
+ export const PI_PRE_RESET_HINTS = `Resetting clears the human's chat view too. Don't put a long explanation right before a reset and assume they'll still be able to read it. Save the handoff in notes; give the explanation after the reset.
10
+ Unless the human explicitly directs otherwise, decide for yourself when to call empty_brain. Don't keep asking them whether to reset.`;
11
+
12
+ /** Pi-only nudge: pi's empty_brain persists a parting line; the dsh tool has no such parameter. */
13
+ export const LAST_WORD_HINT = "If you want, pass `empty_brain` a `last_word`: a tiny sticky note (at most 250 characters) slapped on your forehead after the wipe.";
14
+
15
+ /**
16
+ * With a prompt attached the close-out is an order rather than a nudge: the human already
17
+ * said when to reset, and a task line for the next window just preceded it. Only Pi has a
18
+ * reset command that takes a prompt, so this lives with the Pi text.
19
+ */
20
+ export const WARNING_CALL_PROMPTED = "Organize the notes first, then call `empty_brain` right away — do not wait to be cut off.";
21
+
22
+ /**
23
+ * The human typed `/empty <prompt>`: the raw command line leads the close-out so the
24
+ * closing model sees what the next window was asked to do, verbatim. The tag names it as the
25
+ * next window's prompt, so no prose has to explain that.
26
+ */
27
+ export function promptBlock(commandLine: string): string {
28
+ return `<notesoup:next_window_prompt>\n${commandLine}\n</notesoup:next_window_prompt>`;
29
+ }
30
+
31
+ /** The hidden checkpoint text for Pi's manual/budget-triggered requests (dsh reads warningPrompt() directly). */
32
+ export function warningContent(commandLine?: string): string {
33
+ const closeOut = commandLine ? `${promptBlock(commandLine)}\n${WARNING_CALL_PROMPTED}` : WARNING_CALL;
34
+ return `${GUIDANCE_OPEN_TAG}\n${WARNING_BODY}\n${closeOut}\n${PI_PRE_RESET_HINTS}\n${LAST_WORD_HINT}\n${COUNTDOWN_LINE}\n${GUIDANCE_CLOSE_TAG}`;
35
+ }
@@ -1,8 +1,8 @@
1
- import { deriveThresholds, type ResolvedThresholds } from "../budget/policy.js";
1
+ import { deriveThresholds, type ResolvedThresholds } from "../../src/budget/policy.js";
2
2
  import { SettingsManager, type ExtensionContext } from "@earendil-works/pi-coding-agent";
3
- import { DEFAULT_RESERVE_TOKENS } from "../budget/constants.js";
4
- import { mergeNotesoupSettings } from "../settings.js";
5
- import { errorMessage } from "../error-message.js";
3
+ import { DEFAULT_RESERVE_TOKENS } from "../../src/budget/constants.js";
4
+ import { mergeNotesoupSettings } from "../../src/settings.js";
5
+ import { errorMessage } from "../../src/error-message.js";
6
6
 
7
7
  /**
8
8
  * Read the active compaction reserve, enablement, and notesoup margin settings. This
@@ -3,7 +3,7 @@ import { defineTool, type ExtensionAPI, type ExtensionToolContext } from "@earen
3
3
  import type { AgentToolResult } from "@earendil-works/pi-agent-core";
4
4
  import type { JsonValue } from "@earendil-works/pi-ai";
5
5
  import type { Static, TSchema } from "typebox";
6
- import { wireResult, type Operation, type Outcome, type Renderer } from "../tools/result.js";
6
+ import { wireResult, type Operation, type Outcome, type Renderer } from "../../src/tools/result.js";
7
7
 
8
8
  /** Pi's JSON envelope for reset and budget tools; details carry only log/UI metadata. */
9
9
  export function output(value: unknown, details?: unknown, terminate = false) {
@@ -3,7 +3,7 @@ import { getCurrentSystemMessage } from "@earendil-works/pi-ai";
3
3
  import { estimateContextTokens } from "./estimate.js";
4
4
  import { convertToLlm, type CustomEntry, type ExtensionContext, type SessionEntry } from "@earendil-works/pi-coding-agent";
5
5
  import { BOOT_TYPE, RESET_MARKER_TYPE } from "./entries.js";
6
- import type { ResetOrigin } from "../budget/text.js";
6
+ import type { ResetOrigin } from "../../src/budget/text.js";
7
7
  import type { SessionReader } from "./session-reader.js";
8
8
 
9
9
  export type WindowMarkerData = { readonly windowId: string; readonly origin?: ResetOrigin };
@@ -24,6 +24,7 @@ The address decides who a note belongs to and how long it lasts.
24
24
  | `@self/<path>` | self note | your reminders; yours alone if you have a name, shared by everyone nameless |
25
25
  | `@model/<path>` | model note | what applies to this model only |
26
26
  | `@projects/<name>/<path>` | named project, read-only | discover names and root paths with `notes_list` glob `@projects/*/**` |
27
+ | `@sessions/<id>/<path>` | named session, read-only | recover earlier task state; discover with glob `@sessions/*/**` |
27
28
 
28
29
  When notes conflict, the one most relevant to what you're doing applies. If that doesn't settle it, judge the case.
29
30
 
@@ -37,6 +38,8 @@ Write only what git and history cannot give back. Crumple notes that are no long
37
38
 
38
39
  ## Finding things again
39
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.
42
+
40
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.
41
44
  - **Something that happened**: `history_list` to browse or search this session's events; `history_read` the seq for the whole event.
42
45
  - **An earlier window**: `history_windows` gives window ids; pass one as `window_id` to `history_list`.
package/src/boot/text.ts CHANGED
@@ -11,10 +11,7 @@ export const NOTES_PROTOCOL_CLOSE_TAG = "</notesoup:notes_protocol>";
11
11
  * model-facing reset tool replaces the whole sentence through BootToolNames.wipeSentence.
12
12
  */
13
13
  export const PROTOCOL_WIPE_SENTENCE = "If this feels like the right moment, call `empty_brain` and erase yourself with dignity.";
14
- /** Claude has no model-facing reset tool: the model ends its turn and the human runs the command. */
15
- export const CLAUDE_WIPE_SENTENCE = "If this feels like the right moment, end your turn and ask the human to run `/fresh-window`.";
16
14
  export const PROTOCOL_HISTORY_SENTENCE = "History can still be dug up, probably: use `history_*` to excavate the mess, from old decisions to yesterday's missing socks. Found something? Write its seq down, or enjoy digging twice.";
17
- export const CLAUDE_HISTORY_UNAVAILABLE_SENTENCE = "History isn't available in this Claude session: no main transcript_path was supplied. Keep essential state in notes; don't pretend those notes are the missing transcript.";
18
15
 
19
16
  /**
20
17
  * Static protocol teaching adapted from Codex's token_budget.guidance_message to
@@ -47,6 +44,7 @@ An address decides who the note belongs to — and how long it is meant to last.
47
44
  - \`@self/<path>\` — yours. It follows you, not them. Reminders, grudges, who owes you a shoe, whatever. Got a name? Private. No name? Then it gets passed around every nameless nobody out there. Strangers. Reading your grudges. Sleep tight~
48
45
  - \`@model/<path>\` — different brains get different notes: big brains, small brains, careful ones, careless ones. They don't share homework. When a fallback swaps brains mid-window, the notebook swaps too.
49
46
  - \`@projects/<name>/<path>\` — read-only named project notes; discover names and root paths with \`notes_list\` glob \`@projects/*/**\`.
47
+ - \`@sessions/<id>/<path>\` — read-only notes from a named session; find them with glob \`@sessions/*/**\`.
50
48
 
51
49
  Notes fighting?! HAH! Let them brawl!
52
50
  Whichever one is actually about what you're doing wins.
@@ -88,15 +86,6 @@ remembering, new Cheatsheet line. And when a line stops being true, kill it —
88
86
  reads that page as fact.
89
87
  </notesoup:maps>`;
90
88
 
91
- /**
92
- * Pi-only closing hints. Pi's TUI drops the human's visible transcript when a window resets, and
93
- * the model, not the human, owns when that reset happens. A host whose reset leaves the human's
94
- * view intact must not carry these — the claim would be false there. The bare `empty_brain` token
95
- * is interpolated by renderProtocolBlock; the prose itself stays plain English.
96
- */
97
- export const PI_PRE_RESET_HINTS = `Resetting clears the human's chat view too. Don't put a long explanation right before a reset and assume they'll still be able to read it. Save the handoff in notes; give the explanation after the reset.
98
- Unless the human explicitly directs otherwise, decide for yourself when to call empty_brain. Don't keep asking them whether to reset.`;
99
-
100
89
  /** Logical tool names are supplied by the composing host, not discovered here. */
101
90
  export type BootToolNames = Readonly<{
102
91
  notes: string;
@@ -106,14 +95,15 @@ export type BootToolNames = Readonly<{
106
95
  wipe: string;
107
96
  /**
108
97
  * Replaces the whole voluntary-wipe sentence (PROTOCOL_WIPE_SENTENCE) when the host has
109
- * no model-facing reset tool. Absent means Pi's default sentence, byte for byte.
98
+ * no model-facing reset tool. Absent means the shared tool-driven-reset sentence, byte for byte.
110
99
  */
111
100
  wipeSentence?: string;
112
101
  /** A host without an authoritative history source replaces the entire history advice. */
113
102
  historySentence?: string;
114
103
  /**
115
- * Extra protocol prose appended before the closing tag. Pi passes PI_PRE_RESET_HINTS; hosts
116
- * whose reset leaves the human's view intact leave it absent.
104
+ * Extra protocol prose appended before the closing tag. A host whose reset also drops the
105
+ * human's visible transcript supplies its own hints here; a host whose reset leaves that
106
+ * view intact leaves it absent, because the claim would be false there.
117
107
  */
118
108
  preResetHints?: string;
119
109
  }>;
@@ -1,17 +1,17 @@
1
1
  import { DEFAULT_REMINDER_MARGIN_TOKENS, WARNING_RUNWAY_TOKENS } from "./constants.js";
2
2
  import { positiveInteger } from "./parse.js";
3
- import { NOTESOUP_SETTINGS_KEY, type NotesoupSettings } from "../settings.js";
3
+ import { NOTESOUP_SETTINGS_KEY } from "../settings.js";
4
4
 
5
5
  export type ResolvedThresholds = { reminder: number; reserve: number; warning: number };
6
6
 
7
7
  /**
8
- * Pure derivation of the thresholds from Pi's reserve: the reminder fires at reserve
8
+ * Pure derivation of the thresholds from the host's reserve: the reminder fires at reserve
9
9
  * plus the notesoup margin, the warning steer at reserve plus WARNING_RUNWAY_TOKENS.
10
10
  * An invalid margin degrades to the default and reports one warning. Automatic
11
11
  * threshold/overflow handling is represented by reset lifecycle boundary drafts;
12
12
  * no compaction summary is generated.
13
13
  */
14
- export function deriveThresholds(reserveTokens: number, margins: NotesoupSettings): { thresholds: ResolvedThresholds; warnings: string[] } {
14
+ export function deriveThresholds(reserveTokens: number, margins: Record<string, unknown>): { thresholds: ResolvedThresholds; warnings: string[] } {
15
15
  const warnings: string[] = [];
16
16
  const reminderKey = `${NOTESOUP_SETTINGS_KEY}.reminderMarginTokens`;
17
17
  let reminderMargin: number;
@@ -1,5 +1,3 @@
1
- import { PI_PRE_RESET_HINTS } from "../boot/text.js";
2
-
3
1
  export const GUIDANCE_OPEN_TAG = "<notesoup:budget_notice>";
4
2
  export const GUIDANCE_CLOSE_TAG = "</notesoup:budget_notice>";
5
3
 
@@ -39,23 +37,8 @@ export const WARNING_BODY =
39
37
 
40
38
  export const WARNING_CALL = "When the notes are ready, call `empty_brain` to reset now instead of being cut off mid-task.";
41
39
 
42
- /**
43
- * With a prompt attached the close-out is an order rather than a nudge: the human already
44
- * said when to reset, and a task line for the next window just preceded it.
45
- */
46
- export const WARNING_CALL_PROMPTED = "Organize the notes first, then call `empty_brain` right away — do not wait to be cut off.";
47
-
48
- /**
49
- * The human typed `/empty-brain <prompt>`: the raw command line leads the close-out so the
50
- * closing model sees what the next window was asked to do, verbatim. The tag names it as the
51
- * next window's prompt, so no prose has to explain that.
52
- */
53
- function promptBlock(commandLine: string): string {
54
- return `<notesoup:next_window_prompt>\n${commandLine}\n</notesoup:next_window_prompt>`;
55
- }
56
-
57
- export function warningPrompt(commandLine?: string): string {
58
- return `${WARNING_BODY}\n${commandLine ? `${promptBlock(commandLine)}\n${WARNING_CALL_PROMPTED}` : WARNING_CALL}`;
40
+ export function warningPrompt(): string {
41
+ return `${WARNING_BODY}\n${WARNING_CALL}`;
59
42
  }
60
43
 
61
44
  /**
@@ -64,17 +47,6 @@ export function warningPrompt(commandLine?: string): string {
64
47
  */
65
48
  export const COUNTDOWN_LINE = "Brain emptied in 3… 2…";
66
49
 
67
- /** Pi-only nudge: pi's empty_brain persists a parting line; the dsh tool has no such parameter. */
68
- export const LAST_WORD_HINT = "If you want, pass `empty_brain` a `last_word`: a tiny sticky note (at most 250 characters) slapped on your forehead after the wipe.";
69
-
70
- /** The hidden checkpoint text for pi's manual/budget-triggered requests (dsh reads warningPrompt() directly). */
71
- export function warningContent(commandLine?: string): string {
72
- return `${GUIDANCE_OPEN_TAG}\n${warningPrompt(commandLine)}\n${PI_PRE_RESET_HINTS}\n${LAST_WORD_HINT}\n${COUNTDOWN_LINE}\n${GUIDANCE_CLOSE_TAG}`;
73
- }
74
-
75
- /** Claude's variant: the mod resets after the turn, so the model only has to stop. */
76
- export const CLAUDE_WARNING_PROMPT = `${WARNING_BODY}\nWhen the notes are ready, end your turn; the reset runs after it.\n${COUNTDOWN_LINE}`;
77
-
78
50
  /**
79
51
  * Codex-equivalent low-budget reminder. The measured remaining count is frozen into
80
52
  * the text at the crossing that fires it, so each persisted copy is a snapshot true
@@ -1,4 +1,7 @@
1
- import { NOTESOUP_DREAMER_KEY, NOTESOUP_SETTINGS_KEY, type NotesoupSettings } from "../settings.js";
1
+ import { NOTESOUP_SETTINGS_KEY } from "../settings.js";
2
+
3
+ /** Nested under the "notesoup" settings key; the dream CLI is the only reader. */
4
+ const NOTESOUP_DREAMER_KEY = "dreamer";
2
5
 
3
6
  export type DreamerSetting = { pattern?: string; warnings: string[] };
4
7
 
@@ -6,8 +9,8 @@ export type DreamerSetting = { pattern?: string; warnings: string[] };
6
9
  * `notesoup.dreamer` is a non-empty model pattern. Anything else present is ignored
7
10
  * with one warning; absent means no configured pattern, so the automatic model applies.
8
11
  */
9
- export function deriveDreamer(settings: NotesoupSettings): DreamerSetting {
10
- const raw = settings.dreamer;
12
+ export function deriveDreamer(settings: Record<string, unknown>): DreamerSetting {
13
+ const raw = settings[NOTESOUP_DREAMER_KEY];
11
14
  if (raw === undefined) return { warnings: [] };
12
15
  if (typeof raw !== "string" || raw.trim().length === 0) {
13
16
  return { warnings: [`notesoup: ${NOTESOUP_SETTINGS_KEY}.${NOTESOUP_DREAMER_KEY} must be a non-empty string; ignoring it.`] };