notesoup 0.51.5 → 0.51.7

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 (37) hide show
  1. package/README.md +6 -0
  2. package/dist/plugins/pi/dream/cli.js +1 -1
  3. package/dist/plugins/pi/extension.js +4 -0
  4. package/dist/plugins/pi/notes/adapter.js +2 -2
  5. package/dist/plugins/pi/reset/artifacts.d.ts +3 -1
  6. package/dist/plugins/pi/reset/artifacts.js +3 -1
  7. package/dist/plugins/pi/runtime.js +2 -2
  8. package/dist/plugins/pi/tool-result.d.ts +1 -0
  9. package/dist/plugins/pi/tool-result.js +3 -1
  10. package/dist/src/boot/text.js +1 -1
  11. package/dist/test/agent-loop.test.js +12 -12
  12. package/dist/test/boot.integration.test.js +4 -2
  13. package/dist/test/claude-mod.test.js +34 -3
  14. package/dist/test/dependencies.test.js +27 -0
  15. package/dist/test/helpers/extension.js +6 -6
  16. package/dist/test/notes.integration.test.js +2 -2
  17. package/dist/test/notes.test.js +16 -16
  18. package/dist/test/reset-lifecycle.test.js +5 -4
  19. package/docs/claude-code-mod.md +1 -1
  20. package/docs/skills.md +1 -1
  21. package/package.json +1 -1
  22. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  23. package/plugins/claude/dist/claude/helper.js +1 -1
  24. package/plugins/claude/hooks/register.ts +26 -4
  25. package/plugins/paseo/client/brain-empty-card.tsx +30 -0
  26. package/plugins/paseo/client/brain-empty-transformer.ts +46 -0
  27. package/plugins/paseo/client/notes-op-card.tsx +16 -21
  28. package/plugins/paseo/index.client.tsx +5 -0
  29. package/plugins/paseo/shared/brain-empty.ts +12 -0
  30. package/plugins/paseo/test/brain-empty.test.ts +51 -0
  31. package/plugins/pi/dream/cli.ts +1 -1
  32. package/plugins/pi/extension.ts +3 -0
  33. package/plugins/pi/notes/adapter.ts +2 -2
  34. package/plugins/pi/reset/artifacts.ts +4 -1
  35. package/plugins/pi/runtime.ts +2 -2
  36. package/plugins/pi/tool-result.ts +3 -1
  37. package/src/boot/text.ts +1 -1
package/README.md CHANGED
@@ -70,6 +70,12 @@ The dreamer model is configured under the same key; `--dreamer <model pattern>`
70
70
  }
71
71
  ```
72
72
 
73
+ Environment variables:
74
+
75
+ - `NOTESOUP_DISABLED` — presence-style kill switch: any value but an explicit no (`0`, `false`, `no`, `off`) turns notesoup off. On Pi the extension registers nothing at all; on Claude the mod passes every event through and native compaction behaves as if the mod were absent.
76
+ - `NOTESOUP_HOME` — overrides the notes root (default `~/.agents/notes`).
77
+ - `NOTESOUP_AGENT` — overrides the agent name on Pi (default `anonymous`).
78
+
73
79
  ## Documentation
74
80
 
75
81
  - [Architecture](docs/architecture.md) and [reset lifecycle](docs/reset-lifecycle.md) — how windows, checkpoints, markers and branches actually work
@@ -82,7 +82,7 @@ export async function main(argv = process.argv.slice(2), deps = {}) {
82
82
  return 1;
83
83
  }
84
84
  const home = resolve(homeArg ?? notesRoot());
85
- process.env.PI_NOTES_HOME = home;
85
+ process.env.NOTESOUP_HOME = home;
86
86
  mkdirSync(home, { recursive: true });
87
87
  const lockPath = join(home, ".dream.lock");
88
88
  const stampPath = lastRunPath(lockPath);
@@ -1,8 +1,12 @@
1
1
  import { VERSION } from "@earendil-works/pi-coding-agent";
2
+ import { presenceFlag } from "../../src/budget/parse.js";
2
3
  import { registerHistoryTools } from "./history-tools.js";
3
4
  import { registerNotesTools } from "./notes/tools.js";
4
5
  import { registerContext } from "./runtime.js";
5
6
  function registerNotesoup(pi, settingsManager) {
7
+ // Presence-style kill switch for the whole extension, same convention as the DISABLE_* flags.
8
+ if (presenceFlag(process.env.NOTESOUP_DISABLED))
9
+ return;
6
10
  const [major, minor] = VERSION.split(".").map(Number);
7
11
  if (!(major > 0 || (major === 0 && minor >= 87))) {
8
12
  throw new Error(`notesoup requires Pi >= 0.87.0; running ${VERSION}. Upgrade Pi and restart the process; /reload only reloads extensions.`);
@@ -3,12 +3,12 @@ import { join, resolve } from "node:path";
3
3
  import { projectKey, slugify } from "../../../src/notes/index.js";
4
4
  /** Pi's default notes root; environment access stays on the host side of the library boundary. */
5
5
  export function notesRoot() {
6
- const override = process.env.PI_NOTES_HOME;
6
+ const override = process.env.NOTESOUP_HOME;
7
7
  return override && override.length > 0 ? resolve(override) : join(homedir(), ".agents", "notes");
8
8
  }
9
9
  /** Translate the current Pi runtime into a fresh, explicit identity snapshot. */
10
10
  export function agentSlug() {
11
- return slugify(process.env.PI_NOTES_AGENT ?? "anonymous");
11
+ return slugify(process.env.NOTESOUP_AGENT ?? "anonymous");
12
12
  }
13
13
  /** Pi's active model identity is resolved live so a mid-session switch retargets @model. */
14
14
  export function modelSlug(ctx) {
@@ -14,8 +14,10 @@ export declare function carriedInputDrafts(inputs: readonly CarriedInput[]): Ext
14
14
  type: "custom_message";
15
15
  }>[];
16
16
  export declare function isCarriedInputEntry(entry: SessionEntry): boolean;
17
+ /** Advertised size: the description quotes this softer limit so sloppy character counts still fit. */
18
+ export declare const LAST_WORD_ADVERTISED_CHARS = 250;
17
19
  /** A sticky note, not a letter: over this, empty_brain refuses instead of truncating. */
18
- export declare const MAX_LAST_WORD_CHARS = 250;
20
+ export declare const MAX_LAST_WORD_CHARS = 300;
19
21
  /** How the next window finds the note. */
20
22
  export declare const LAST_WORD_PREFIX = "*You peel a sticky note off your forehead.*\n";
21
23
  /** Trim a parting line; blank input leaves no last word. Length is checked by the caller. */
@@ -9,8 +9,10 @@ export function carriedInputDrafts(inputs) {
9
9
  export function isCarriedInputEntry(entry) {
10
10
  return entry.type === "custom_message" && entry.customType === CARRIED_INPUT_TYPE && entry.display === true;
11
11
  }
12
+ /** Advertised size: the description quotes this softer limit so sloppy character counts still fit. */
13
+ export const LAST_WORD_ADVERTISED_CHARS = 250;
12
14
  /** A sticky note, not a letter: over this, empty_brain refuses instead of truncating. */
13
- export const MAX_LAST_WORD_CHARS = 250;
15
+ export const MAX_LAST_WORD_CHARS = 300;
14
16
  /** How the next window finds the note. */
15
17
  export const LAST_WORD_PREFIX = "*You peel a sticky note off your forehead.*\n";
16
18
  /** Trim a parting line; blank input leaves no last word. Length is checked by the caller. */
@@ -6,7 +6,7 @@ import { registerBudget } from "./budget.js";
6
6
  import { output } from "./tool-result.js";
7
7
  import { currentReset, currentWindowId, isCheckpointBackedReset, isWindowBoot, isWindowMarker, markerResetOrigin, projectRootWindow, projectWindow, rootWindowId } from "./window.js";
8
8
  import { registerResetLifecycle } from "./reset/lifecycle.js";
9
- import { buildResetDrafts, MAX_LAST_WORD_CHARS, repairResetTail, sanitizeLastWord } from "./reset/artifacts.js";
9
+ import { buildResetDrafts, LAST_WORD_ADVERTISED_CHARS, MAX_LAST_WORD_CHARS, repairResetTail, sanitizeLastWord } from "./reset/artifacts.js";
10
10
  import { BOOT_TYPE, MANUAL_WIPE_TYPE } from "./entries.js";
11
11
  import { commandWarningContent } from "./text.js";
12
12
  import { buildBootMessage, sendBoot } from "./boot.js";
@@ -208,7 +208,7 @@ export function registerContext(pi, settingsManager) {
208
208
  name: "empty_brain",
209
209
  label: "Empty Brain",
210
210
  description: "Clear your in-context memory and start a fresh context window. Your session, notes, and history survive. Pass `last_word` to stick a tiny note on your forehead for after the wipe.",
211
- parameters: Type.Object({ last_word: Type.Optional(Type.String({ description: `A tiny sticky note, at most ${MAX_LAST_WORD_CHARS} characters. After the wipe it is slapped on your forehead; longer notes are refused.` })) }, { additionalProperties: false }),
211
+ parameters: Type.Object({ last_word: Type.Optional(Type.String({ description: `A tiny sticky note, at most ${LAST_WORD_ADVERTISED_CHARS} characters. After the wipe it is slapped on your forehead; longer notes are refused.` })) }, { additionalProperties: false }),
212
212
  async execute(_id, params, _signal, _update, ctx) {
213
213
  if (!enabled)
214
214
  return output({ error: "notesoup is off, so memory can't be cleared; the user can turn it on with `/notesoup on`." });
@@ -4,6 +4,7 @@ import type { Static, TSchema } from "typebox";
4
4
  import { type Operation, type Outcome } from "../../src/tools/result.js";
5
5
  /** Pi's JSON envelope for reset and budget tools; details carry only log/UI metadata. */
6
6
  export declare function output(value: unknown, details?: unknown, terminate?: boolean): {
7
+ isError?: boolean | undefined;
7
8
  content: {
8
9
  type: "text";
9
10
  text: string;
@@ -3,7 +3,9 @@ import { defineTool } from "@earendil-works/pi-coding-agent";
3
3
  import { wireResult } from "../../src/tools/result.js";
4
4
  /** Pi's JSON envelope for reset and budget tools; details carry only log/UI metadata. */
5
5
  export function output(value, details, terminate = false) {
6
- return { content: [{ type: "text", text: JSON.stringify(value) }], details, terminate };
6
+ // A refusal is a failed tool call, not a successful answer carrying an error string: the host UI only flags isError.
7
+ const refused = typeof value === "object" && value !== null && typeof value.error === "string";
8
+ return { content: [{ type: "text", text: JSON.stringify(value) }], details, terminate, ...(refused ? { isError: true } : {}) };
7
9
  }
8
10
  /** Operation data is schema-derived JSON; only the unresolved generic needs a JsonValue assertion. */
9
11
  function piOperationResult(render, outcome) {
@@ -39,7 +39,7 @@ An address decides who the note belongs to — and how long it is meant to last.
39
39
 
40
40
  - \`<path>\`, no @ — session notes, the ones from above: this session's state and loose ends. They go away with the session.
41
41
  - \`@project/<path>\` — this project's long memory: what stays true after the current thing is over, what future work must respect, and the rakes already stepped on. **Decisions, not diaries.** Commit hashes, test counts, dates, the story of how you got here: git and history already have them, and last week's news filed as current law is worse than no note. Don't copy what other docs already say.
42
- - \`@human/<path>\` — the long-term manual for your troublesome human: how to deal with them, which lines not to cross, and what will make them accept the result. If it only applies to one project or situation, say so — or don't write it here at all. Today's mood is weather, not law. If you're unsure whether it belongs here, ask the human.
42
+ - \`@human/<path>\` — the long-term manual for your troublesome human, and only what stays true in EVERY project: how to deal with them, which lines not to cross, and what will make them accept the result. "The human said it" is not enough — if it stops being true the moment you switch projects, it was never theirs; it belongs to that project's notes. Today's mood is weather, not law. If you're unsure whether it belongs here, ask the human.
43
43
  - \`@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~
44
44
  - \`@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.
45
45
  - \`@projects/<name>/<path>\` — read-only named project notes; discover names and root paths with \`notes_list\` glob \`@projects/*/**\`.
@@ -23,10 +23,10 @@ async function openFixture(options) {
23
23
  const agentDir = options.agentDir ?? dir;
24
24
  const managesEnvironment = options.manageEnvironment ?? true;
25
25
  const previousDir = managesEnvironment ? process.env.PI_CODING_AGENT_DIR : undefined;
26
- const previousNotesRoot = managesEnvironment ? process.env.PI_NOTES_HOME : undefined;
26
+ const previousNotesRoot = managesEnvironment ? process.env.NOTESOUP_HOME : undefined;
27
27
  if (managesEnvironment) {
28
28
  process.env.PI_CODING_AGENT_DIR = agentDir;
29
- process.env.PI_NOTES_HOME = notesRoot;
29
+ process.env.NOTESOUP_HOME = notesRoot;
30
30
  }
31
31
  if (options.notesRootFile) {
32
32
  rmSync(notesRoot, { recursive: true, force: true });
@@ -162,9 +162,9 @@ async function openFixture(options) {
162
162
  else
163
163
  process.env.PI_CODING_AGENT_DIR = previousDir;
164
164
  if (previousNotesRoot === undefined)
165
- delete process.env.PI_NOTES_HOME;
165
+ delete process.env.NOTESOUP_HOME;
166
166
  else
167
- process.env.PI_NOTES_HOME = previousNotesRoot;
167
+ process.env.NOTESOUP_HOME = previousNotesRoot;
168
168
  }
169
169
  if (ownsDir)
170
170
  rmSync(dir, { recursive: true, force: true });
@@ -1462,10 +1462,10 @@ test("real AgentSession: injected settings managers own live policy and ignore c
1462
1462
  const defaultAgentDir = mkdtempSync(join(tmpdir(), "notesoup-injected-default-agent-"));
1463
1463
  const notesRoot = mkdtempSync(join(tmpdir(), "notesoup-injected-notes-"));
1464
1464
  const previousAgentDir = process.env.PI_CODING_AGENT_DIR;
1465
- const previousNotesRoot = process.env.PI_NOTES_HOME;
1465
+ const previousNotesRoot = process.env.NOTESOUP_HOME;
1466
1466
  writeFileSync(join(defaultAgentDir, "settings.json"), JSON.stringify({ compaction: { enabled: false, reserveTokens: 1_000 } }));
1467
1467
  process.env.PI_CODING_AGENT_DIR = defaultAgentDir;
1468
- process.env.PI_NOTES_HOME = notesRoot;
1468
+ process.env.NOTESOUP_HOME = notesRoot;
1469
1469
  let first;
1470
1470
  let second;
1471
1471
  const firstHighUsage = { next: false };
@@ -1539,9 +1539,9 @@ test("real AgentSession: injected settings managers own live policy and ignore c
1539
1539
  else
1540
1540
  process.env.PI_CODING_AGENT_DIR = previousAgentDir;
1541
1541
  if (previousNotesRoot === undefined)
1542
- delete process.env.PI_NOTES_HOME;
1542
+ delete process.env.NOTESOUP_HOME;
1543
1543
  else
1544
- process.env.PI_NOTES_HOME = previousNotesRoot;
1544
+ process.env.NOTESOUP_HOME = previousNotesRoot;
1545
1545
  rmSync(defaultAgentDir, { recursive: true, force: true });
1546
1546
  rmSync(notesRoot, { recursive: true, force: true });
1547
1547
  }
@@ -1550,8 +1550,8 @@ test("real AgentSession: injected model overrides select the active model's rese
1550
1550
  let settingsManager;
1551
1551
  let modelBId = "";
1552
1552
  const notesRoot = mkdtempSync(join(tmpdir(), "notesoup-model-override-notes-"));
1553
- const previousNotesRoot = process.env.PI_NOTES_HOME;
1554
- process.env.PI_NOTES_HOME = notesRoot;
1553
+ const previousNotesRoot = process.env.NOTESOUP_HOME;
1554
+ process.env.NOTESOUP_HOME = notesRoot;
1555
1555
  let fixture;
1556
1556
  fixture = await openFixture({
1557
1557
  contextWindow: 100_000,
@@ -1592,9 +1592,9 @@ test("real AgentSession: injected model overrides select the active model's rese
1592
1592
  finally {
1593
1593
  fixture.close();
1594
1594
  if (previousNotesRoot === undefined)
1595
- delete process.env.PI_NOTES_HOME;
1595
+ delete process.env.NOTESOUP_HOME;
1596
1596
  else
1597
- process.env.PI_NOTES_HOME = previousNotesRoot;
1597
+ process.env.NOTESOUP_HOME = previousNotesRoot;
1598
1598
  rmSync(notesRoot, { recursive: true, force: true });
1599
1599
  }
1600
1600
  });
@@ -164,7 +164,7 @@ test("a boot beyond three windows shows only root, the previous window, and the
164
164
  assert.equal(identity.includes(projection.windows[1].windowId.slice(-8)), false, "an old middle window is not listed");
165
165
  });
166
166
  test("an aborted async boot repair emits no boot, continuation, or incomplete-notes notice", async () => {
167
- const notesHome = process.env.PI_NOTES_HOME;
167
+ const notesHome = process.env.NOTESOUP_HOME;
168
168
  assert.ok(notesHome);
169
169
  rmSync(notesHome, { recursive: true, force: true });
170
170
  writeFileSync(notesHome, "not a directory");
@@ -349,7 +349,9 @@ test("notesoup command toggles future work, /empty schedules a turn-end reset, a
349
349
  assert.equal(sentOf(captured, GUIDANCE_TYPE).length, 0, "no guidance persisted while off");
350
350
  await runHandlers(captured, "session_start", { reason: "startup" }, low);
351
351
  assert.equal(captured.sent.length, 1, "no new boot block is persisted while off");
352
- const offResult = resultJson(await call(captured, "empty_brain", {}, low));
352
+ const offResultRaw = await call(captured, "empty_brain", {}, low);
353
+ assert.equal(offResultRaw.isError, true, "a refusal is a failed tool call, not a successful answer");
354
+ const offResult = resultJson(offResultRaw);
353
355
  assert.match(offResult.error ?? "", /off/, "empty_brain refuses while off");
354
356
  notices = await runCommand(captured, "notesoup", "on", low);
355
357
  assert.match(notices[0]?.message ?? "", /on/);
@@ -46,7 +46,7 @@ function fakeEngine(home) {
46
46
  registered,
47
47
  notifications,
48
48
  host: {
49
- env: { get: async (name) => name === "PI_NOTES_HOME" ? home : undefined },
49
+ env: { get: async (name) => name === "NOTESOUP_HOME" ? home : undefined },
50
50
  session: { id: async () => "hook-session", cwd: async () => home, model: async () => "claude", messages: async () => [], usage: async () => ({ context: {} }), compact: async () => ({ skip: "test default" }) },
51
51
  settings: { read: async () => ({}) },
52
52
  command: { register: async (spec) => ({ command: spec.name }) },
@@ -301,6 +301,37 @@ test("Claude Mod appends boot once and reuses persisted blocks after re-registra
301
301
  assert.equal(nextCalls, 2, "the upstream chain still runs exactly once per prompt");
302
302
  assert.deepEqual(notifications, [], "successful boot never notifies");
303
303
  });
304
+ test("Claude Mod with NOTESOUP_DISABLED registers nothing and passes every event through", async (t) => {
305
+ const home = mkdtempSync(join(tmpdir(), "claude-hook-disabled-"));
306
+ t.after(() => rmSync(home, { recursive: true, force: true }));
307
+ const { host, registered, notifications } = fakeEngine(home);
308
+ const readEnv = host.env.get;
309
+ host.env.get = async (name) => name === "NOTESOUP_DISABLED" ? "1" : await readEnv(name);
310
+ const commands = [];
311
+ host.command.register = async (spec) => { commands.push(spec.name); return spec; };
312
+ let helperCalls = 0;
313
+ const runProcess = host.process.run;
314
+ host.process.run = async (argv, init) => { helperCalls += 1; return await runProcess(argv, init); };
315
+ const handlers = new Map();
316
+ (await loadHookModule(t)).register((event, handler) => handlers.set(event, handler));
317
+ const startResult = { session: "started" };
318
+ const started = await handlers.get("session.start")(host, { cwd: home, isInteractive: true }, async () => startResult);
319
+ assert.equal(started, startResult, "session.start passes through untouched");
320
+ assert.deepEqual(registered, [], "no tools are registered");
321
+ assert.deepEqual(commands, [], "no commands are registered");
322
+ assert.ok(notifications.some((text) => text.includes("NOTESOUP_DISABLED")), "the off state is logged");
323
+ const upstream = { blocks: [{ name: "claude:user-context", text: "unrelated upstream block" }] };
324
+ const prompt = await handlers.get("prompt.context")(host, {}, async () => upstream);
325
+ assert.equal(prompt, upstream, "prompt.context gets no boot block");
326
+ const native = { skip: "engine default" };
327
+ const compact = await handlers.get("session.compact")(host, { trigger: "auto" }, async () => native);
328
+ assert.equal(compact, native, "native compaction runs exactly as if the mod were absent");
329
+ const completed = await handlers.get("turn.complete")(host, {}, async () => ({ done: true }));
330
+ assert.deepEqual(completed, { done: true }, "turn.complete passes through without a reset");
331
+ const measured = await handlers.get("session.measure")(host, {}, async () => ({ marks: true }));
332
+ assert.deepEqual(measured, { marks: true }, "session.measure passes through without a reset");
333
+ assert.equal(helperCalls, 0, "the helper never runs while disabled");
334
+ });
304
335
  test("Claude Mod boot failure preserves fallback with available, absent, or failing notifications", async (t) => {
305
336
  for (const mode of ["available", "no ui", "no toast", "throws", "rejects"]) {
306
337
  await t.test(mode, async (t) => {
@@ -625,7 +656,7 @@ test("Claude Mod stops the automatic reset and the manual command under DISABLE_
625
656
  const home = mkdtempSync(join(tmpdir(), "claude-disabled-home-"));
626
657
  t.after(() => rmSync(home, { recursive: true, force: true }));
627
658
  const { host, notifications } = fakeEngine(home);
628
- host.env = { get: async (name) => name === "PI_NOTES_HOME" ? home : name === "DISABLE_COMPACT" ? "1" : undefined };
659
+ host.env = { get: async (name) => name === "NOTESOUP_HOME" ? home : name === "DISABLE_COMPACT" ? "1" : undefined };
629
660
  const timers = [];
630
661
  host.clock.after = (_ms, callback) => { timers.push(callback); };
631
662
  const handlers = new Map();
@@ -697,7 +728,7 @@ test("Claude Mod treats DISABLE_COMPACT=off as not disabled", async (t) => {
697
728
  const home = mkdtempSync(join(tmpdir(), "claude-flag-off-home-"));
698
729
  t.after(() => rmSync(home, { recursive: true, force: true }));
699
730
  const { host, notifications } = fakeEngine(home);
700
- host.env = { get: async (name) => name === "PI_NOTES_HOME" ? home : name === "DISABLE_COMPACT" ? "off" : undefined };
731
+ host.env = { get: async (name) => name === "NOTESOUP_HOME" ? home : name === "DISABLE_COMPACT" ? "off" : undefined };
701
732
  const handlers = new Map();
702
733
  (await loadHookModule(t)).register((event, handler) => handlers.set(event, handler));
703
734
  const invoke = (name, e = {}) => handlers.get(name)(host, e, async () => ({}));
@@ -169,3 +169,30 @@ test("the configured extension source and the moved dream CLI are executable cur
169
169
  assert.ok(help.startsWith("dream doctor [--notes-home <dir>]"));
170
170
  assert.ok(help.includes("Default playbook: <installed package root>/playbook.md"));
171
171
  });
172
+ test("NOTESOUP_DISABLED turns the Pi extension fully off", async () => {
173
+ const built = await import(pathToFileURL(resolve(repository(), "dist/plugins/pi/index.js")).href);
174
+ const run = () => {
175
+ const tools = [];
176
+ const commands = [];
177
+ const events = [];
178
+ built.default({
179
+ on(event) { events.push(event); },
180
+ registerTool(tool) { tools.push(tool); },
181
+ registerCommand(name) { commands.push(name); },
182
+ });
183
+ return { tools, commands, events };
184
+ };
185
+ const previous = process.env.NOTESOUP_DISABLED;
186
+ try {
187
+ process.env.NOTESOUP_DISABLED = "1";
188
+ assert.deepEqual(run(), { tools: [], commands: [], events: [] }, "a present flag registers nothing at all");
189
+ process.env.NOTESOUP_DISABLED = "0";
190
+ assert.ok(run().tools.length > 0, "an explicit no keeps the extension on");
191
+ }
192
+ finally {
193
+ if (previous === undefined)
194
+ delete process.env.NOTESOUP_DISABLED;
195
+ else
196
+ process.env.NOTESOUP_DISABLED = previous;
197
+ }
198
+ });
@@ -21,7 +21,7 @@ let registerTempPath;
21
21
  */
22
22
  export function installExtensionTestEnvironment(prefix = "notesoup-test") {
23
23
  const previousAgentDir = process.env.PI_CODING_AGENT_DIR;
24
- const previousNotesHome = process.env.PI_NOTES_HOME;
24
+ const previousNotesHome = process.env.NOTESOUP_HOME;
25
25
  const defaultAgentDir = mkdtempSync(join(tmpdir(), `${prefix}-agent-`));
26
26
  const cwd = mkdtempSync(join(tmpdir(), `${prefix}-cwd-`));
27
27
  defaultCwd = cwd;
@@ -31,7 +31,7 @@ export function installExtensionTestEnvironment(prefix = "notesoup-test") {
31
31
  const newNotesRoot = () => {
32
32
  const root = mkdtempSync(join(tmpdir(), `${prefix}-notes-`));
33
33
  notesRoots.add(root);
34
- process.env.PI_NOTES_HOME = root;
34
+ process.env.NOTESOUP_HOME = root;
35
35
  return root;
36
36
  };
37
37
  const beforeEach = () => {
@@ -47,9 +47,9 @@ export function installExtensionTestEnvironment(prefix = "notesoup-test") {
47
47
  rmSync(path, { recursive: true, force: true });
48
48
  tempPaths.clear();
49
49
  if (previousNotesHome === undefined)
50
- delete process.env.PI_NOTES_HOME;
50
+ delete process.env.NOTESOUP_HOME;
51
51
  else
52
- process.env.PI_NOTES_HOME = previousNotesHome;
52
+ process.env.NOTESOUP_HOME = previousNotesHome;
53
53
  };
54
54
  const dispose = () => {
55
55
  afterEach();
@@ -63,9 +63,9 @@ export function installExtensionTestEnvironment(prefix = "notesoup-test") {
63
63
  else
64
64
  process.env.PI_CODING_AGENT_DIR = previousAgentDir;
65
65
  if (previousNotesHome === undefined)
66
- delete process.env.PI_NOTES_HOME;
66
+ delete process.env.NOTESOUP_HOME;
67
67
  else
68
- process.env.PI_NOTES_HOME = previousNotesHome;
68
+ process.env.NOTESOUP_HOME = previousNotesHome;
69
69
  };
70
70
  return { cwd, agentDir: defaultAgentDir, beforeEach, afterEach, newNotesRoot, dispose };
71
71
  }
@@ -288,7 +288,7 @@ test("boot note acquisition is one closed snapshot and isolates one or all faile
288
288
  test("the boot block gives awake agents the notes-home file layout", async () => {
289
289
  const session = manager();
290
290
  const rendered = await explicitBoot(context(session), "pcw:test:root", undefined);
291
- assert.equal(rendered.includes(process.env.PI_NOTES_HOME ?? ""), false, "the absolute notes home is never exposed");
291
+ assert.equal(rendered.includes(process.env.NOTESOUP_HOME ?? ""), false, "the absolute notes home is never exposed");
292
292
  assert.match(rendered, /`<path>`, no @[\s\S]*`@project\/<path>`[\s\S]*`@human\/<path>`/);
293
293
  assert.ok(rendered.includes(`\n${PI_PRE_RESET_HINTS}\n${NOTES_PROTOCOL_CLOSE_TAG}`), "Pi's boot closes the protocol with the pre-reset hints");
294
294
  });
@@ -345,7 +345,7 @@ test("an over-budget note is delivered as a bounded prefix and resumed by next_o
345
345
  // Both surfaces stay inside the budget, and a refusal carries no window at all.
346
346
  const missingResult = await call(captured, "notes_read", { address: "no-such.md" }, ctx);
347
347
  assertWithinBudget(missingResult, "refused read");
348
- const root = process.env.PI_NOTES_HOME;
348
+ const root = process.env.NOTESOUP_HOME;
349
349
  for (const result of [
350
350
  await call(captured, "notes_write", { address: "@project/receipt", content: "body" }, ctx),
351
351
  await call(captured, "notes_update", { address: "@project/receipt", edits: [{ oldText: "body", newText: "changed" }] }, ctx),
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * OWNER: notesoup (adopted).
3
3
  * STATUS: tracked acceptance spec for the real-file notes store and its five tools.
4
- * CLAIM: notes live as markdown files under $PI_NOTES_HOME with harness-owned frontmatter;
4
+ * CLAIM: notes live as markdown files under $NOTESOUP_HOME with harness-owned frontmatter;
5
5
  * the five tools (notes_write/update/read/list/search) are the only note surface, and the
6
6
  * boot index reads the physical store across scopes.
7
- * HERMETIC: every test points PI_NOTES_HOME at its own temp root; no real ~/.agents is touched.
7
+ * HERMETIC: every test points NOTESOUP_HOME at its own temp root; no real ~/.agents is touched.
8
8
  */
9
9
  import assert from "node:assert/strict";
10
10
  import { execFileSync } from "node:child_process";
@@ -26,7 +26,7 @@ function freshRoot() {
26
26
  }
27
27
  function assertReceiptIdentity(value, address, scope, ctx) {
28
28
  assert.equal(value.address, address);
29
- assert.equal(value.project_key, scope === "project" ? projectKey(ctx.cwd, process.env.PI_NOTES_HOME) : undefined);
29
+ assert.equal(value.project_key, scope === "project" ? projectKey(ctx.cwd, process.env.NOTESOUP_HOME) : undefined);
30
30
  }
31
31
  test("exactly the five notes tools are registered; the legacy five are gone", () => {
32
32
  const captured = makeExtension(manager());
@@ -129,8 +129,8 @@ test("session-note project ownership is per note, persistent across sessions, an
129
129
  const cwdB = join(testEnvironment.cwd, "project-b");
130
130
  mkdirSync(cwdA, { recursive: true });
131
131
  mkdirSync(cwdB, { recursive: true });
132
- const projectA = projectKey(cwdA, process.env.PI_NOTES_HOME);
133
- const projectB = projectKey(cwdB, process.env.PI_NOTES_HOME);
132
+ const projectA = projectKey(cwdA, process.env.NOTESOUP_HOME);
133
+ const projectB = projectKey(cwdB, process.env.NOTESOUP_HOME);
134
134
  assert.notEqual(projectA, projectB);
135
135
  const firstSession = manager();
136
136
  const firstCaptured = makeExtension(firstSession);
@@ -178,8 +178,8 @@ test("linked git worktrees share the main checkout's project key", () => {
178
178
  git(["commit", "-q", "--allow-empty", "-m", "init"]);
179
179
  const worktree = join(root, "wt");
180
180
  git(["worktree", "add", "-q", "--detach", worktree]);
181
- assert.equal(projectKey(worktree, process.env.PI_NOTES_HOME), projectKey(main, process.env.PI_NOTES_HOME), "a linked worktree resolves to the main checkout's key");
182
- assert.equal(projectKey(join(worktree, "gone", "deeper"), process.env.PI_NOTES_HOME), projectKey(main, process.env.PI_NOTES_HOME), "a nonexistent subdirectory still resolves through its worktree");
181
+ assert.equal(projectKey(worktree, process.env.NOTESOUP_HOME), projectKey(main, process.env.NOTESOUP_HOME), "a linked worktree resolves to the main checkout's key");
182
+ assert.equal(projectKey(join(worktree, "gone", "deeper"), process.env.NOTESOUP_HOME), projectKey(main, process.env.NOTESOUP_HOME), "a nonexistent subdirectory still resolves through its worktree");
183
183
  assert.equal(scopeDir("project", context(manager(), undefined, undefined, true, worktree)), scopeDir("project", context(manager(), undefined, undefined, true, main)), "@project uses the same physical home from both checkouts");
184
184
  });
185
185
  test("unrecognized metadata remains ordinary frontmatter; invalid project ownership stays unknown", async () => {
@@ -225,7 +225,7 @@ project: 17
225
225
 
226
226
  invalid owner`);
227
227
  assert.equal(parseNote(readFileSync(invalidFile, "utf8")).meta.project, 17);
228
- assert.notEqual(parseNote(readFileSync(invalidFile, "utf8")).meta.project, projectKey(ctx.cwd, process.env.PI_NOTES_HOME), "invalid ownership does not match the current project key");
228
+ assert.notEqual(parseNote(readFileSync(invalidFile, "utf8")).meta.project, projectKey(ctx.cwd, process.env.NOTESOUP_HOME), "invalid ownership does not match the current project key");
229
229
  await call(captured, "notes_write", { address: "invalid.md", content: "still invalid" }, ctx);
230
230
  assert.equal(parseNote(readFileSync(invalidFile, "utf8")).meta.project, 17, "an invalid value remains unknown and is not replaced with cwd-derived ownership");
231
231
  assert.equal(existsSync(join(scopeDir("session", ctx), ".session.json")), false, "new notes use no ownership sidecar");
@@ -356,7 +356,7 @@ test("empty results distinguish hidden notes and unavailable homes", async () =>
356
356
  const searchResult = await notesSearch.execute({ query: "needle", glob: "**" }, identity);
357
357
  assert.ok(searchResult.ok);
358
358
  assert.deepEqual(searchResult.data.homes_unavailable, ["@project"]);
359
- writeFileSync(join(process.env.PI_NOTES_HOME, "agents"), "not a directory");
359
+ writeFileSync(join(process.env.NOTESOUP_HOME, "agents"), "not a directory");
360
360
  const namespace = resultData(await call(captured, "notes_list", { glob: "@agents/*/note.md" }, ctx));
361
361
  assert.deepEqual(namespace.homes_unavailable, ["@agents"]);
362
362
  });
@@ -551,11 +551,11 @@ test("Pi adapter resolves agent and switched model identity on each notes call a
551
551
  });
552
552
  });
553
553
  async function withAgent(name, run) {
554
- const previous = process.env.PI_NOTES_AGENT;
554
+ const previous = process.env.NOTESOUP_AGENT;
555
555
  if (name === undefined)
556
- delete process.env.PI_NOTES_AGENT;
556
+ delete process.env.NOTESOUP_AGENT;
557
557
  else
558
- process.env.PI_NOTES_AGENT = name;
558
+ process.env.NOTESOUP_AGENT = name;
559
559
  try {
560
560
  // A plain `return run()` would run the finally block the moment the promise pends,
561
561
  // restoring the env while the callback still has awaits ahead of it.
@@ -563,9 +563,9 @@ async function withAgent(name, run) {
563
563
  }
564
564
  finally {
565
565
  if (previous === undefined)
566
- delete process.env.PI_NOTES_AGENT;
566
+ delete process.env.NOTESOUP_AGENT;
567
567
  else
568
- process.env.PI_NOTES_AGENT = previous;
568
+ process.env.NOTESOUP_AGENT = previous;
569
569
  }
570
570
  }
571
571
  test("a symlinked checkout resolves the canonical root, so one checkout has one project home", () => {
@@ -574,8 +574,8 @@ test("a symlinked checkout resolves the canonical root, so one checkout has one
574
574
  mkdirSync(join(real, ".git"), { recursive: true });
575
575
  const linked = join(root, "linked-repo");
576
576
  symlinkSync(real, linked);
577
- assert.equal(projectKey(linked, process.env.PI_NOTES_HOME), "real-repo", "the name comes from the canonical root");
578
- assert.equal(projectKey(real, process.env.PI_NOTES_HOME), "real-repo", "both spellings reuse one home");
577
+ assert.equal(projectKey(linked, process.env.NOTESOUP_HOME), "real-repo", "the name comes from the canonical root");
578
+ assert.equal(projectKey(real, process.env.NOTESOUP_HOME), "real-repo", "both spellings reuse one home");
579
579
  });
580
580
  test("a glob ? matches exactly one non-slash character", () => {
581
581
  const pattern = globToRegExp("a?.md");
@@ -15,14 +15,14 @@ import { historyFromSession, nextHistorySeq } from "../plugins/pi/history.js";
15
15
  import { buildResetDrafts, inspectResetTail, LAST_WORD_PREFIX, MAX_LAST_WORD_CHARS, repairResetTail, sanitizeLastWord } from "../plugins/pi/reset/artifacts.js";
16
16
  import { resetBoundaryCommitted } from "../plugins/pi/reset/committed.js";
17
17
  import { finalizeResetBoundary, initialResetControl, reduceResetControl, registerResetLifecycle, } from "../plugins/pi/reset/lifecycle.js";
18
- const previousNotesHome = process.env.PI_NOTES_HOME;
18
+ const previousNotesHome = process.env.NOTESOUP_HOME;
19
19
  const testNotesHome = mkdtempSync(join(tmpdir(), "notesoup-lifecycle-notes-"));
20
- process.env.PI_NOTES_HOME = testNotesHome;
20
+ process.env.NOTESOUP_HOME = testNotesHome;
21
21
  test.after(() => {
22
22
  if (previousNotesHome === undefined)
23
- delete process.env.PI_NOTES_HOME;
23
+ delete process.env.NOTESOUP_HOME;
24
24
  else
25
- process.env.PI_NOTES_HOME = previousNotesHome;
25
+ process.env.NOTESOUP_HOME = previousNotesHome;
26
26
  rmSync(testNotesHome, { recursive: true, force: true });
27
27
  });
28
28
  function harness() {
@@ -897,6 +897,7 @@ test("empty_brain trims the last word, refuses an oversized one, and a blank per
897
897
  const over = harness();
898
898
  over.sessionManager.appendMessage({ role: "user", content: [{ type: "text", text: "before reset" }], timestamp: Date.now() });
899
899
  const refused = await over.callTool("empty_brain", { last_word: "x".repeat(MAX_LAST_WORD_CHARS + 1) });
900
+ assert.equal(refused.isError, true, "an oversized note fails the tool call so the host flags it");
900
901
  assert.match(JSON.stringify(refused), /error/, "an oversized note is refused, not truncated");
901
902
  assert.match(JSON.stringify(refused), new RegExp(`${MAX_LAST_WORD_CHARS + 1} characters`), "the refusal names the actual size and the limit");
902
903
  const refusedAstral = await over.callTool("empty_brain", { last_word: "\u{1F41F}".repeat(MAX_LAST_WORD_CHARS + 1) });
@@ -8,7 +8,7 @@ In interactive sessions it resets automatically when the measured context reache
8
8
  2. otherwise computed from `$.session.usage().context.window` plus `CLAUDE_CODE_AUTO_COMPACT_WINDOW`, `modelSettings.<model>.autoCompactWindow` and `autoCompactWindow` (the smallest configured window wins, capped at the model window), with Claude's 20000-token output reserve and 13000-token summary buffer;
9
9
  3. otherwise the percent fallback, which expresses the same reserves on the classic 200K window.
10
10
 
11
- Notesoup resets one `resetMarginTokens` (default 8192) below that point, and warns one `warningRunwayTokens` (default `WARNING_RUNWAY_TOKENS`, 16384) below the reset. With automatic compaction off (`autoCompactEnabled: false` in the merged settings, or `DISABLE_AUTO_COMPACT=1`) the point becomes the effective window minus the output reserve, so the same margins still apply. Every undocumented field is type-guarded and degrades to the next source; an unresolvable point, or missing usage, logs once and skips the automatic reset. `DISABLE_COMPACT=1` is detected at `session.start`, logs once, disables the automatic reset, and makes `/fresh-window` report that it cannot run. The margins are read from the `notesoup` object of Claude's merged `$.settings.read()` (`resetMarginTokens`, `warningRunwayTokens`); any other value is ignored.
11
+ Notesoup resets one `resetMarginTokens` (default 8192) below that point, and warns one `warningRunwayTokens` (default `WARNING_RUNWAY_TOKENS`, 16384) below the reset. With automatic compaction off (`autoCompactEnabled: false` in the merged settings, or `DISABLE_AUTO_COMPACT=1`) the point becomes the effective window minus the output reserve, so the same margins still apply. Every undocumented field is type-guarded and degrades to the next source; an unresolvable point, or missing usage, logs once and skips the automatic reset. `DISABLE_COMPACT=1` is detected at `session.start`, logs once, disables the automatic reset, and makes `/fresh-window` report that it cannot run. The margins are read from the `notesoup` object of Claude's merged `$.settings.read()` (`resetMarginTokens`, `warningRunwayTokens`); any other value is ignored. Setting `NOTESOUP_DISABLED` (presence-style, the same convention as `DISABLE_COMPACT`) turns the whole mod off: `session.start` registers no tools or commands and logs once, every event passes through untouched, and native compaction behaves as if the mod were absent.
12
12
 
13
13
  Once per window, when the measured context crosses the warning point, `prompt.context` adds a `notesoup:warning` block carrying the shared warning text with Claude's closing instruction ("end your turn; the reset runs after it"). The warned flag resets with the window ordinal. Its own `session.compact` hook answers native compaction in the main conversation instead of letting it summarize: an automatic compaction (threshold or prompt-too-long) becomes the freshly built notes boot followed by one randomly selected paragraph from the shared forced-reset pool, selected once for the new window and reused on retry — the same boot-then-handoff order as Pi — while `/compact` and precompute are vetoed with a one-line notice. `prompt.context` still recomputes but does not duplicate that retained boot. The boot's protocol block tells the model to end its turn and ask the human to run `/fresh-window`, replacing that one sentence through `BootToolNames.wipeSentence`; Pi's boot text is unchanged. Boot window IDs end in the ordinal `:0`, `:1`, etc.; retained boots restore the ordinal on resume/reload. Original transcript rows remain on disk. `session.end` forgets the old window, and identity is refreshed lazily from `$.session.id()`, `$.session.cwd()` and the documented `$.session.model()` (slugified, with `claude` only as a fallback). `/clear`, `/resume` and `/branch` therefore acquire a boot again without needing another `session.start`. A failed boot build falls back to Claude's own summary, which invalidates a removed retained boot; vetoes, subagent compaction and precompute leave it alone.
14
14
 
package/docs/skills.md CHANGED
@@ -24,7 +24,7 @@ If a dream process crashed, its lock remains and later runs refuse to start. The
24
24
 
25
25
  ```sh
26
26
  # only when no dream is running
27
- rm "${PI_NOTES_HOME:-$HOME/.agents/notes}/.dream.lock"
27
+ rm "${NOTESOUP_HOME:-$HOME/.agents/notes}/.dream.lock"
28
28
  ```
29
29
 
30
30
  Removing a lock while a holder is running is outside the supported cooperative protocol and can let two dreams run at once.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notesoup",
3
- "version": "0.51.5",
3
+ "version": "0.51.7",
4
4
  "type": "module",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notesoup",
3
- "version": "0.51.5",
3
+ "version": "0.51.7",
4
4
  "description": "Durable notes and a host-scoped notes boot section for Claude Code.",
5
5
  "author": {
6
6
  "name": "AstroSheep"
@@ -9912,7 +9912,7 @@ An address decides who the note belongs to \u2014 and how long it is meant to la
9912
9912
 
9913
9913
  - \`<path>\`, no @ \u2014 session notes, the ones from above: this session's state and loose ends. They go away with the session.
9914
9914
  - \`@project/<path>\` \u2014 this project's long memory: what stays true after the current thing is over, what future work must respect, and the rakes already stepped on. **Decisions, not diaries.** Commit hashes, test counts, dates, the story of how you got here: git and history already have them, and last week's news filed as current law is worse than no note. Don't copy what other docs already say.
9915
- - \`@human/<path>\` \u2014 the long-term manual for your troublesome human: how to deal with them, which lines not to cross, and what will make them accept the result. If it only applies to one project or situation, say so \u2014 or don't write it here at all. Today's mood is weather, not law. If you're unsure whether it belongs here, ask the human.
9915
+ - \`@human/<path>\` \u2014 the long-term manual for your troublesome human, and only what stays true in EVERY project: how to deal with them, which lines not to cross, and what will make them accept the result. "The human said it" is not enough \u2014 if it stops being true the moment you switch projects, it was never theirs; it belongs to that project's notes. Today's mood is weather, not law. If you're unsure whether it belongs here, ask the human.
9916
9916
  - \`@self/<path>\` \u2014 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~
9917
9917
  - \`@model/<path>\` \u2014 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.
9918
9918
  - \`@projects/<name>/<path>\` \u2014 read-only named project notes; discover names and root paths with \`notes_list\` glob \`@projects/*/**\`.
@@ -18,7 +18,7 @@ type ClaudeLimits = {
18
18
  native: number; reset: number; warn: number; resetMargin: number; warningRunway: number
19
19
  }
20
20
  type ResetState = {
21
- identity?: Identity; history?: HistorySource; historyWindowHead?: string; generation: number; window: number; turnRunning: boolean; resetting: boolean
21
+ identity?: Identity; history?: HistorySource; historyWindowHead?: string; generation: number; window: number; disabled: boolean; turnRunning: boolean; resetting: boolean
22
22
  manualPending: boolean; headless: boolean; usageFailureLogged: boolean; preparedBoot?: string; retainedBoot?: string
23
23
  continuation?: string; continuationWindow?: number
24
24
  compactDisabled: boolean; limitsFailureLogged: boolean; limitsAttempts: number; limitsWindow: number
@@ -26,6 +26,7 @@ type ResetState = {
26
26
  }
27
27
  const HEADLESS = "No brain when headless"
28
28
  const COMPACT_DISABLED = "Brain can't be emptied with DISABLE_COMPACT"
29
+ const NOTESOUP_DISABLED = "Notesoup is off with NOTESOUP_DISABLED"
29
30
  const THRESHOLDS_UNAVAILABLE = "Brain size unknown · no automatic emptying"
30
31
  const SETTINGS_UNAVAILABLE = "Notesoup settings unreadable · using the default flush margins"
31
32
  /** Bounded retries: a transient helper failure must not disable thresholds for a whole window. */
@@ -103,6 +104,14 @@ async function compactDisabled($: Engine): Promise<boolean> {
103
104
  // The same presence convention as the helper's flag parsing: "off"/"no" mean not disabled.
104
105
  return text !== "" && text !== "0" && text !== "false" && text !== "no" && text !== "off"
105
106
  }
107
+ /** Presence-style kill switch for the whole mod; the same convention as DISABLE_COMPACT. */
108
+ async function notesoupDisabled($: Engine): Promise<boolean> {
109
+ let value: string | undefined
110
+ try { value = await $.env.get("NOTESOUP_DISABLED") } catch { return false }
111
+ if (value === undefined) return false
112
+ const text = value.trim().toLowerCase()
113
+ return text !== "" && text !== "0" && text !== "false" && text !== "no" && text !== "off"
114
+ }
106
115
  async function readSettings($: Engine, state: ResetState): Promise<unknown> {
107
116
  try { return await $.settings.read() } catch {
108
117
  // A silent fallback would hide a broken settings read behind default margins.
@@ -279,7 +288,7 @@ async function refreshIdentity($: Engine, state: ResetState): Promise<Identity |
279
288
  await syncHistoryWindow($, state)
280
289
  return state.identity
281
290
  }
282
- const home = await $.env.get("PI_NOTES_HOME") ?? `${await $.env.get("HOME") ?? await $.env.get("USERPROFILE") ?? ""}/.agents/notes`
291
+ const home = await $.env.get("NOTESOUP_HOME") ?? `${await $.env.get("HOME") ?? await $.env.get("USERPROFILE") ?? ""}/.agents/notes`
283
292
  if (generation !== state.generation) return undefined
284
293
  forgetSession(state)
285
294
  state.identity = { home, sessionId, cwd, agent: "claude", model }
@@ -308,7 +317,7 @@ async function syncHistoryWindow($: Engine, state: ResetState) {
308
317
 
309
318
  export function register(on: On) {
310
319
  const manualSignal: { wake?: () => void } = {}
311
- const state: ResetState = { generation: 0, window: 0, turnRunning: false, resetting: false, manualPending: false, headless: false, usageFailureLogged: false, compactDisabled: false, limitsFailureLogged: false, limitsAttempts: 0, limitsWindow: 0, settingsFailureLogged: false }
320
+ const state: ResetState = { generation: 0, window: 0, disabled: false, turnRunning: false, resetting: false, manualPending: false, headless: false, usageFailureLogged: false, compactDisabled: false, limitsFailureLogged: false, limitsAttempts: 0, limitsWindow: 0, settingsFailureLogged: false }
312
321
  const registered = new Set<string>()
313
322
  // Classic SessionStart precedes typed session.start and startup appends. Keep this binding
314
323
  // across forgetSession; re-key it only against the actual session id, never a guessed path.
@@ -330,6 +339,12 @@ export function register(on: On) {
330
339
  })
331
340
  on("session.start", async ($, e, next) => {
332
341
  forgetSession(state)
342
+ state.disabled = await notesoupDisabled($)
343
+ if (state.disabled) {
344
+ registered.clear()
345
+ log($, NOTESOUP_DISABLED)
346
+ return next(e)
347
+ }
333
348
  await refreshIdentity($, state)
334
349
  state.headless = !e.isInteractive
335
350
  if (state.headless) log($, HEADLESS)
@@ -355,6 +370,7 @@ export function register(on: On) {
355
370
  return next(e)
356
371
  })
357
372
  on("tool.call", async ($, e, next) => {
373
+ if (state.disabled) return next(e)
358
374
  if (!registered.has(e.tool)) return next(e)
359
375
  const identity = await refreshIdentity($, state)
360
376
  if (!identity) return errorResult("session changed during identity lookup")
@@ -371,6 +387,7 @@ export function register(on: On) {
371
387
  on("turn.start", async ($, e, next) => {
372
388
  // The documented turn.start is main-loop only. Guard tagged host events too:
373
389
  // only a main-agent turn.complete clears this latch.
390
+ if (state.disabled) return next(e)
374
391
  if ("agentId" in e && e.agentId !== undefined) return next(e)
375
392
  if (!await refreshIdentity($, state)) return next(e)
376
393
  state.turnRunning = true
@@ -379,6 +396,7 @@ export function register(on: On) {
379
396
  on("turn.complete", async ($, e, next) => {
380
397
  const result = await next(e)
381
398
  if (e.agentId !== undefined) return result
399
+ if (state.disabled) return result
382
400
  if (!await refreshIdentity($, state)) return result
383
401
  state.turnRunning = false
384
402
  await maybeReset($, state, true)
@@ -386,10 +404,11 @@ export function register(on: On) {
386
404
  })
387
405
  on("session.measure", async ($, e, next) => {
388
406
  const result = await next(e)
389
- if (await refreshIdentity($, state)) await maybeReset($, state, false)
407
+ if (!state.disabled && await refreshIdentity($, state)) await maybeReset($, state, false)
390
408
  return result
391
409
  })
392
410
  on("command.run", async ($, e, next) => {
411
+ if (state.disabled) return next(e)
393
412
  if (e.command !== "empty" && e.command !== "fresh-window") return next(e)
394
413
  if (!await refreshIdentity($, state)) return { text: "🥣 Different brain now · try /fresh-window again" }
395
414
  if (state.headless) return { text: `🥣 ${HEADLESS}` }
@@ -406,6 +425,8 @@ export function register(on: On) {
406
425
  return { text: "🥣 Brain being emptied" }
407
426
  })
408
427
  on("session.compact", async ($, e, next) => {
428
+ // Disabled means fully transparent: native compaction runs exactly as if the mod were absent.
429
+ if (state.disabled) return next(e)
409
430
  if (e.agentId !== undefined) return next(e)
410
431
  const identity = await refreshIdentity($, state)
411
432
  const generation = state.generation
@@ -445,6 +466,7 @@ export function register(on: On) {
445
466
  return { messages: built.messages }
446
467
  })
447
468
  on("prompt.context", async ($, e, next) => {
469
+ if (state.disabled) return next(e)
448
470
  const result = await next(e)
449
471
  const identity = await refreshIdentity($, state)
450
472
  const generation = state.generation
@@ -0,0 +1,30 @@
1
+ import type { PluginTimelineItemProps } from "@getpaseo/plugin/client";
2
+ import { Text, View } from "react-native";
3
+ import type { BrainEmpty } from "../shared/brain-empty.ts";
4
+ import { PAPER } from "./paper-card.tsx";
5
+
6
+ function label(data: BrainEmpty): string {
7
+ if (data.status === "running") return "EMPTYING BRAIN …";
8
+ if (data.error !== undefined) return "BRAIN REFUSED TO EMPTY";
9
+ if (data.outcome === "rollover_already_pending") return "BRAIN ALREADY BEING EMPTIED";
10
+ return "✂ BRAIN EMPTIED";
11
+ }
12
+
13
+ export function BrainEmptyDivider({ item }: PluginTimelineItemProps<BrainEmpty>) {
14
+ const data = item.data;
15
+ const refused = data.error !== undefined || data.status === "failed";
16
+ const color = refused ? PAPER.removed : PAPER.inkMuted;
17
+ const line = { flex: 1, height: 1, backgroundColor: color, opacity: 0.6 };
18
+ return (
19
+ <View style={{ paddingVertical: 6, gap: 3 }}>
20
+ <View style={{ flexDirection: "row", alignItems: "center", gap: 10 }}>
21
+ <View style={line} />
22
+ <Text style={{ color, fontSize: 11, letterSpacing: 1 }}>{label(data)}</Text>
23
+ <View style={line} />
24
+ </View>
25
+ {data.error !== undefined && (
26
+ <Text selectable style={{ color: PAPER.removed, fontSize: 12, textAlign: "center" }}>{data.error}</Text>
27
+ )}
28
+ </View>
29
+ );
30
+ }
@@ -0,0 +1,46 @@
1
+ import type { PluginClientContext } from "@getpaseo/plugin/client";
2
+ import { BRAIN_EMPTY_KIND, BRAIN_EMPTY_TOOL, type BrainEmpty } from "../shared/brain-empty.ts";
3
+
4
+ type Transformer = Extract<Parameters<PluginClientContext["addTimelineTransformer"]>[0], { query: { itemType: "tool_call" } }>;
5
+ type Source = Parameters<Transformer["transform"]>[0];
6
+ type ToolCallItem = Extract<Source["item"], { type: "tool_call" }>;
7
+
8
+ function isRecord(value: unknown): value is Record<string, unknown> {
9
+ return typeof value === "object" && value !== null;
10
+ }
11
+
12
+ /** empty_brain answers in a plain JSON text block; there is no structured payload. */
13
+ function resultJson(output: unknown): Record<string, unknown> | undefined {
14
+ if (!isRecord(output) || !Array.isArray(output.content)) return undefined;
15
+ const part = output.content.filter(isRecord).find((block) => block.type === "text" && typeof block.text === "string");
16
+ if (!part) return undefined;
17
+ try {
18
+ const parsed: unknown = JSON.parse(part.text as string);
19
+ return isRecord(parsed) ? parsed : undefined;
20
+ } catch {
21
+ return undefined;
22
+ }
23
+ }
24
+
25
+ function brainEmptyData(item: ToolCallItem): BrainEmpty | undefined {
26
+ if (item.detail.type !== "unknown") return undefined;
27
+ if (item.status === "running") return { status: "running" };
28
+ const wire = resultJson(item.detail.output);
29
+ if (wire && typeof wire.error === "string") return { status: item.status === "failed" ? "failed" : "completed", error: wire.error };
30
+ if (item.status === "failed") {
31
+ const hostError = isRecord(item.error) && typeof item.error.message === "string" ? item.error.message : undefined;
32
+ return { status: "failed", error: hostError ?? "failed" };
33
+ }
34
+ if (wire && typeof wire.status === "string") return { status: "completed", outcome: wire.status };
35
+ return { status: "completed" };
36
+ }
37
+
38
+ export const brainEmptyTransformer = {
39
+ id: "brain-empty-source",
40
+ query: { itemType: "tool_call" },
41
+ transform: ({ item }: Pick<Source, "item">) => {
42
+ if (item.type !== "tool_call" || item.name !== BRAIN_EMPTY_TOOL) return undefined;
43
+ const data = brainEmptyData(item);
44
+ return data === undefined ? undefined : { items: [{ type: "plugin" as const, kind: BRAIN_EMPTY_KIND, version: 1, data }] };
45
+ },
46
+ } satisfies Transformer;
@@ -37,22 +37,11 @@ export function NotesOpCard({ item, layout }: PluginTimelineItemProps<NotesOp>)
37
37
  const hasBody = Boolean(data.text || data.preview || data.diff || footnotes.length);
38
38
  return (
39
39
  <PaperCard compact={layout.compact}>
40
+ <View style={{ gap: 5, paddingRight: hasBody && !expanded ? 34 : 0 }}>
40
41
  <View style={{ gap: 3 }}>
41
- <View style={{ flexDirection: "row", alignItems: "center", justifyContent: "space-between", gap: 8 }}>
42
- <Text style={{ color: PAPER.inkMuted, fontSize: 11, letterSpacing: 0.5 }}>
43
- {title}{data.status === "running" ? " …" : ""}
44
- </Text>
45
- {hasBody && !expanded && <Pressable
46
- accessibilityRole="button"
47
- accessibilityLabel={`${expanded ? "收起" : "展开"} ${data.address}`}
48
- aria-expanded={expanded}
49
- onPress={() => setExpanded(value => !value)}
50
- hitSlop={6}
51
- style={({ pressed }) => ({ padding: 5, opacity: pressed ? 0.6 : 1 })}
52
- >
53
- <Icon name={expanded ? "ChevronUp" : "ChevronDown"} size={18} color={PAPER.inkMuted} />
54
- </Pressable>}
55
- </View>
42
+ <Text style={{ color: PAPER.inkMuted, fontSize: 11, letterSpacing: 0.5 }}>
43
+ {title}{data.status === "running" ? " …" : ""}
44
+ </Text>
56
45
  <Text style={{ color: PAPER.ink, fontSize: 13, flexShrink: 1 }}>
57
46
  {data.address}
58
47
  {state !== undefined && <Text style={{ color: PAPER.inkMuted, fontSize: 12, fontWeight: "400" }}>{" "}{state}</Text>}
@@ -69,16 +58,22 @@ export function NotesOpCard({ item, layout }: PluginTimelineItemProps<NotesOp>)
69
58
  {data.diff !== undefined && <DiffBody diff={data.diff} />}
70
59
  {footnotes.length > 0 && <Text style={{ color: PAPER.inkMuted, fontSize: 11 }}>{footnotes.join(" · ")}</Text>}
71
60
  </ScrollView>}
72
- {hasBody && expanded && <Pressable
61
+ {hasBody && <Pressable
73
62
  accessibilityRole="button"
74
- accessibilityLabel={`收起 ${data.address}`}
75
- aria-expanded={true}
76
- onPress={() => setExpanded(false)}
63
+ accessibilityLabel={`${expanded ? "收起" : "展开"} ${data.address}`}
64
+ aria-expanded={expanded}
65
+ onPress={() => setExpanded(value => !value)}
77
66
  hitSlop={6}
78
- style={({ pressed }) => ({ alignSelf: "flex-end", paddingHorizontal: 5, paddingVertical: 1, opacity: pressed ? 0.6 : 1 })}
67
+ style={({ pressed }) => ({
68
+ ...(expanded
69
+ ? { alignSelf: "flex-end" as const, marginTop: -3, marginBottom: -4 }
70
+ : { position: "absolute" as const, right: 0, bottom: 0 }),
71
+ paddingHorizontal: 5, opacity: pressed ? 0.6 : 1,
72
+ })}
79
73
  >
80
- <Icon name="ChevronUp" size={18} color={PAPER.inkMuted} />
74
+ <Icon name={expanded ? "ChevronUp" : "ChevronDown"} size={18} color={PAPER.inkMuted} />
81
75
  </Pressable>}
76
+ </View>
82
77
  </PaperCard>
83
78
  );
84
79
  }
@@ -3,15 +3,20 @@ import { sourceRowTransformer } from "./client/source-row.ts";
3
3
  import { notesOpTransformer } from "./client/notes-op-transformer.ts";
4
4
  import { StickyCard } from "./client/sticky-card.tsx";
5
5
  import { NotesOpCard } from "./client/notes-op-card.tsx";
6
+ import { BrainEmptyDivider } from "./client/brain-empty-card.tsx";
7
+ import { brainEmptyTransformer } from "./client/brain-empty-transformer.ts";
6
8
  import { CARD_KIND, lastWordSchema } from "./shared/last-word.ts";
7
9
  import { NOTES_OP_KIND, notesOpSchema } from "./shared/notes-op.ts";
10
+ import { BRAIN_EMPTY_KIND, brainEmptySchema } from "./shared/brain-empty.ts";
8
11
 
9
12
  export default function contribute(client: PluginClientContext) {
10
13
  const removals = [
11
14
  client.addTimelineRenderer({ kind: CARD_KIND, version: 1, schema: lastWordSchema, Component: StickyCard }),
12
15
  client.addTimelineRenderer({ kind: NOTES_OP_KIND, version: 1, schema: notesOpSchema, Component: NotesOpCard }),
16
+ client.addTimelineRenderer({ kind: BRAIN_EMPTY_KIND, version: 1, schema: brainEmptySchema, Component: BrainEmptyDivider }),
13
17
  client.addTimelineTransformer(sourceRowTransformer),
14
18
  client.addTimelineTransformer(notesOpTransformer),
19
+ client.addTimelineTransformer(brainEmptyTransformer),
15
20
  ];
16
21
  return () => { for (const remove of removals) remove(); };
17
22
  }
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+
3
+ export const BRAIN_EMPTY_KIND = "brain-empty";
4
+ export const BRAIN_EMPTY_TOOL = "empty_brain";
5
+
6
+ export const brainEmptySchema = z.object({
7
+ status: z.enum(["running", "completed", "failed"]),
8
+ // completed: rollover_requested | rollover_already_pending
9
+ outcome: z.string().optional(),
10
+ error: z.string().optional(),
11
+ });
12
+ export type BrainEmpty = z.infer<typeof brainEmptySchema>;
@@ -0,0 +1,51 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import { brainEmptyTransformer } from "../client/brain-empty-transformer.ts";
4
+ import { brainEmptySchema } from "../shared/brain-empty.ts";
5
+
6
+ function toolCall(overrides: Record<string, unknown>) {
7
+ return {
8
+ type: "tool_call" as const,
9
+ callId: "call-1",
10
+ name: "empty_brain",
11
+ status: "completed" as const,
12
+ error: null,
13
+ detail: { type: "unknown" as const, input: {}, output: {} },
14
+ ...overrides,
15
+ };
16
+ }
17
+
18
+ const transform = (overrides: Record<string, unknown>) => brainEmptyTransformer.transform({ item: toolCall(overrides) as never });
19
+ const jsonOut = (value: unknown) => ({ type: "unknown", input: {}, output: { content: [{ type: "text", text: JSON.stringify(value) }] } });
20
+
21
+ test("a successful call is a completed divider with the rollover outcome", () => {
22
+ const result = transform({ detail: jsonOut({ status: "rollover_requested" }) });
23
+ assert.deepEqual(brainEmptySchema.parse(result!.items[0]!.data), { status: "completed", outcome: "rollover_requested" });
24
+ });
25
+
26
+ test("an in-flight call shows as running from the call alone", () => {
27
+ const result = transform({ status: "running", detail: { type: "unknown", input: { last_word: "bye" }, output: null } });
28
+ assert.deepEqual(brainEmptySchema.parse(result!.items[0]!.data), { status: "running" });
29
+ });
30
+
31
+ test("a refused call surfaces the refusal text", () => {
32
+ const result = transform({ detail: jsonOut({ error: "last_word is 263 characters; the sticky note holds 250." }) });
33
+ const data = brainEmptySchema.parse(result!.items[0]!.data);
34
+ assert.equal(data.error, "last_word is 263 characters; the sticky note holds 250.");
35
+ assert.equal(data.outcome, undefined);
36
+ });
37
+
38
+ test("already-pending is an outcome, not an error", () => {
39
+ const result = transform({ detail: jsonOut({ status: "rollover_already_pending" }) });
40
+ assert.deepEqual(brainEmptySchema.parse(result!.items[0]!.data), { status: "completed", outcome: "rollover_already_pending" });
41
+ });
42
+
43
+ test("a failed transport call without a payload still fails", () => {
44
+ const result = transform({ status: "failed", error: { message: "boom" }, detail: { type: "unknown", input: {}, output: null } });
45
+ assert.deepEqual(brainEmptySchema.parse(result!.items[0]!.data), { status: "failed", error: "boom" });
46
+ });
47
+
48
+ test("other tools and non-tool items stay untouched", () => {
49
+ assert.equal(brainEmptyTransformer.transform({ item: toolCall({ name: "notes_read" }) as never }), undefined);
50
+ assert.equal(brainEmptyTransformer.transform({ item: { type: "user_message", text: "hi" } as never }), undefined);
51
+ });
@@ -64,7 +64,7 @@ export async function main(argv = process.argv.slice(2), deps: DreamDependencies
64
64
  : a["min-sessions"] !== undefined && minSessions === undefined ? "--min-sessions needs a positive whole number"
65
65
  : undefined;
66
66
  if (badArg) { console.error(`dream: ${badArg}`); return 1; }
67
- const home = resolve(homeArg ?? notesRoot()); process.env.PI_NOTES_HOME = home; mkdirSync(home, { recursive: true });
67
+ const home = resolve(homeArg ?? notesRoot()); process.env.NOTESOUP_HOME = home; mkdirSync(home, { recursive: true });
68
68
  const lockPath = join(home, ".dream.lock"); const stampPath = lastRunPath(lockPath);
69
69
  const time = timeGate(stampPath, minHours ?? 24); console.log(time.reason); if (!a.force && !time.ok) return 0;
70
70
  const since = existsSync(stampPath) ? statSync(stampPath).mtimeMs : 0;
@@ -1,9 +1,12 @@
1
1
  import { VERSION, type ExtensionAPI, type ExtensionFactory, type SettingsManager } from "@earendil-works/pi-coding-agent";
2
+ import { presenceFlag } from "../../src/budget/parse.js";
2
3
  import { registerHistoryTools } from "./history-tools.js";
3
4
  import { registerNotesTools } from "./notes/tools.js";
4
5
  import { registerContext } from "./runtime.js";
5
6
 
6
7
  function registerNotesoup(pi: ExtensionAPI, settingsManager?: SettingsManager): void {
8
+ // Presence-style kill switch for the whole extension, same convention as the DISABLE_* flags.
9
+ if (presenceFlag(process.env.NOTESOUP_DISABLED)) return;
7
10
  const [major, minor] = VERSION.split(".").map(Number);
8
11
  if (!(major > 0 || (major === 0 && minor >= 87))) {
9
12
  throw new Error(`notesoup requires Pi >= 0.87.0; running ${VERSION}. Upgrade Pi and restart the process; /reload only reloads extensions.`);
@@ -5,13 +5,13 @@ import { projectKey, slugify, type NotesIdentity } from "../../../src/notes/inde
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 {
8
- const override = process.env.PI_NOTES_HOME;
8
+ const override = process.env.NOTESOUP_HOME;
9
9
  return override && override.length > 0 ? resolve(override) : join(homedir(), ".agents", "notes");
10
10
  }
11
11
 
12
12
  /** Translate the current Pi runtime into a fresh, explicit identity snapshot. */
13
13
  export function agentSlug(): string {
14
- return slugify(process.env.PI_NOTES_AGENT ?? "anonymous");
14
+ return slugify(process.env.NOTESOUP_AGENT ?? "anonymous");
15
15
  }
16
16
 
17
17
  /** Pi's active model identity is resolved live so a mid-session switch retargets @model. */
@@ -18,8 +18,11 @@ export function isCarriedInputEntry(entry: SessionEntry): boolean {
18
18
  return entry.type === "custom_message" && entry.customType === CARRIED_INPUT_TYPE && entry.display === true;
19
19
  }
20
20
 
21
+ /** Advertised size: the description quotes this softer limit so sloppy character counts still fit. */
22
+ export const LAST_WORD_ADVERTISED_CHARS = 250;
23
+
21
24
  /** A sticky note, not a letter: over this, empty_brain refuses instead of truncating. */
22
- export const MAX_LAST_WORD_CHARS = 250;
25
+ export const MAX_LAST_WORD_CHARS = 300;
23
26
 
24
27
  /** How the next window finds the note. */
25
28
  export const LAST_WORD_PREFIX = "*You peel a sticky note off your forehead.*\n";
@@ -6,7 +6,7 @@ import { registerBudget } from "./budget.js";
6
6
  import { output } from "./tool-result.js";
7
7
  import { currentReset, currentWindowId, isCheckpointBackedReset, isWindowBoot, isWindowMarker, markerResetOrigin, projectRootWindow, projectWindow, rootWindowId, type WindowMarker } from "./window.js";
8
8
  import { registerResetLifecycle } from "./reset/lifecycle.js";
9
- import { buildResetDrafts, MAX_LAST_WORD_CHARS, repairResetTail, sanitizeLastWord } from "./reset/artifacts.js";
9
+ import { buildResetDrafts, LAST_WORD_ADVERTISED_CHARS, MAX_LAST_WORD_CHARS, repairResetTail, sanitizeLastWord } from "./reset/artifacts.js";
10
10
  import { BOOT_TYPE, MANUAL_WIPE_TYPE } from "./entries.js";
11
11
  import { commandWarningContent } from "./text.js";
12
12
  import { buildBootMessage, sendBoot, type IncompleteNotesNotifier } from "./boot.js";
@@ -204,7 +204,7 @@ export function registerContext(pi: ExtensionAPI, settingsManager?: SettingsMana
204
204
  name: "empty_brain",
205
205
  label: "Empty Brain",
206
206
  description: "Clear your in-context memory and start a fresh context window. Your session, notes, and history survive. Pass `last_word` to stick a tiny note on your forehead for after the wipe.",
207
- parameters: Type.Object({ last_word: Type.Optional(Type.String({ description: `A tiny sticky note, at most ${MAX_LAST_WORD_CHARS} characters. After the wipe it is slapped on your forehead; longer notes are refused.` })) }, { additionalProperties: false }),
207
+ parameters: Type.Object({ last_word: Type.Optional(Type.String({ description: `A tiny sticky note, at most ${LAST_WORD_ADVERTISED_CHARS} characters. After the wipe it is slapped on your forehead; longer notes are refused.` })) }, { additionalProperties: false }),
208
208
  async execute(_id, params, _signal, _update, ctx) {
209
209
  if (!enabled) return output({ error: "notesoup is off, so memory can't be cleared; the user can turn it on with `/notesoup on`." });
210
210
  const lastWord = sanitizeLastWord(params.last_word);
@@ -7,7 +7,9 @@ import { wireResult, type Operation, type Outcome, type Renderer } from "../../s
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) {
10
- return { content: [{ type: "text" as const, text: JSON.stringify(value) }], details, terminate };
10
+ // A refusal is a failed tool call, not a successful answer carrying an error string: the host UI only flags isError.
11
+ const refused = typeof value === "object" && value !== null && typeof (value as { error?: unknown }).error === "string";
12
+ return { content: [{ type: "text" as const, text: JSON.stringify(value) }], details, terminate, ...(refused ? { isError: true } : {}) };
11
13
  }
12
14
 
13
15
  /** Operation data is schema-derived JSON; only the unresolved generic needs a JsonValue assertion. */
package/src/boot/text.ts CHANGED
@@ -40,7 +40,7 @@ An address decides who the note belongs to — and how long it is meant to last.
40
40
 
41
41
  - \`<path>\`, no @ — session notes, the ones from above: this session's state and loose ends. They go away with the session.
42
42
  - \`@project/<path>\` — this project's long memory: what stays true after the current thing is over, what future work must respect, and the rakes already stepped on. **Decisions, not diaries.** Commit hashes, test counts, dates, the story of how you got here: git and history already have them, and last week's news filed as current law is worse than no note. Don't copy what other docs already say.
43
- - \`@human/<path>\` — the long-term manual for your troublesome human: how to deal with them, which lines not to cross, and what will make them accept the result. If it only applies to one project or situation, say so — or don't write it here at all. Today's mood is weather, not law. If you're unsure whether it belongs here, ask the human.
43
+ - \`@human/<path>\` — the long-term manual for your troublesome human, and only what stays true in EVERY project: how to deal with them, which lines not to cross, and what will make them accept the result. "The human said it" is not enough — if it stops being true the moment you switch projects, it was never theirs; it belongs to that project's notes. Today's mood is weather, not law. If you're unsure whether it belongs here, ask the human.
44
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~
45
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.
46
46
  - \`@projects/<name>/<path>\` — read-only named project notes; discover names and root paths with \`notes_list\` glob \`@projects/*/**\`.