notesoup 0.60.1 → 0.62.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.
- package/.agents/plugins/marketplace.json +15 -0
- package/README.md +14 -10
- package/dist/plugins/antigravity/src/cli.d.ts +1 -0
- package/dist/plugins/antigravity/src/cli.js +23 -0
- package/dist/plugins/antigravity/src/hooks.d.ts +18 -0
- package/dist/plugins/antigravity/src/hooks.js +53 -0
- package/dist/plugins/antigravity/src/identity.d.ts +26 -0
- package/dist/plugins/antigravity/src/identity.js +129 -0
- package/dist/plugins/claude/src/helper.js +2 -1
- package/dist/plugins/codex/src/hooks.js +1 -0
- package/dist/plugins/codex/src/identity.d.ts +6 -1
- package/dist/plugins/codex/src/identity.js +13 -1
- package/dist/plugins/codex/src/mcp.d.ts +35 -7
- package/dist/plugins/codex/src/mcp.js +26 -88
- package/dist/plugins/codex/src/text.js +3 -3
- package/dist/plugins/dsh/tools.js +8 -4
- package/dist/plugins/mcp/operations.d.ts +15 -0
- package/dist/plugins/mcp/operations.js +43 -0
- package/dist/plugins/mcp/server.d.ts +14 -0
- package/dist/plugins/mcp/server.js +13 -0
- package/dist/plugins/pi/budget.d.ts +1 -1
- package/dist/plugins/pi/budget.js +3 -2
- package/dist/plugins/pi/entries.d.ts +1 -0
- package/dist/plugins/pi/entries.js +1 -0
- package/dist/plugins/pi/history-tools.js +2 -1
- package/dist/plugins/pi/history.js +18 -1
- package/dist/plugins/pi/notes/tools.js +7 -3
- package/dist/plugins/pi/render.d.ts +7 -1
- package/dist/plugins/pi/render.js +2 -2
- package/dist/plugins/pi/reset/lifecycle.d.ts +1 -1
- package/dist/plugins/pi/reset/lifecycle.js +8 -9
- package/dist/plugins/pi/runtime.js +102 -61
- package/dist/plugins/pi/tool-result.js +7 -7
- package/dist/plugins/pi/window.d.ts +33 -3
- package/dist/plugins/pi/window.js +209 -9
- package/dist/src/boot/render.d.ts +5 -0
- package/dist/src/boot/render.js +60 -28
- package/dist/src/boot/text.d.ts +3 -3
- package/dist/src/boot/text.js +27 -26
- package/dist/src/budget/text.d.ts +2 -2
- package/dist/src/budget/text.js +13 -13
- package/dist/src/history/claude.d.ts +2 -0
- package/dist/src/history/claude.js +46 -0
- package/dist/src/history/codex-transcript.js +7 -5
- package/dist/src/history/codex.js +3 -0
- package/dist/src/history/corpus.d.ts +28 -1
- package/dist/src/history/corpus.js +40 -0
- package/dist/src/history/history.d.ts +37 -46
- package/dist/src/history/history.js +21 -40
- package/dist/src/history/local.js +67 -32
- package/dist/src/history/pi.d.ts +2 -1
- package/dist/src/history/pi.js +122 -48
- package/dist/src/history/prefilter.js +76 -19
- package/dist/src/history/query.d.ts +28 -49
- package/dist/src/history/query.js +83 -68
- package/dist/src/history/summary-cache.d.ts +8 -1
- package/dist/src/history/summary-cache.js +138 -12
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/notes/frontmatter.d.ts +4 -0
- package/dist/src/notes/frontmatter.js +15 -1
- package/dist/src/notes/index.d.ts +1 -1
- package/dist/src/notes/index.js +1 -1
- package/dist/src/notes/policy.d.ts +15 -1
- package/dist/src/notes/policy.js +47 -6
- package/dist/src/notes/store.d.ts +14 -0
- package/dist/src/notes/store.js +33 -12
- package/dist/src/text-match.d.ts +10 -1
- package/dist/src/text-match.js +42 -3
- package/dist/src/tools/dream.d.ts +22 -91
- package/dist/src/tools/dream.js +30 -27
- package/dist/src/tools/history.d.ts +33 -26
- package/dist/src/tools/history.js +257 -163
- package/dist/src/tools/notes.d.ts +58 -160
- package/dist/src/tools/notes.js +151 -99
- package/dist/src/tools/output.d.ts +2 -1
- package/dist/src/tools/output.js +2 -1
- package/dist/src/tools/result.d.ts +4 -7
- package/dist/src/tools/result.js +8 -9
- package/dist/src/tools/schema.d.ts +4 -1
- package/dist/src/tools/schema.js +25 -1
- package/dist/test/agent-loop.test.js +198 -16
- package/dist/test/antigravity-live.test.d.ts +1 -0
- package/dist/test/antigravity-live.test.js +142 -0
- package/dist/test/antigravity-plugin.test.d.ts +1 -0
- package/dist/test/antigravity-plugin.test.js +101 -0
- package/dist/test/boot.integration.test.js +133 -14
- package/dist/test/claude-history.test.js +14 -13
- package/dist/test/claude-mod.test.js +9 -6
- package/dist/test/codex-history.test.js +15 -3
- package/dist/test/codex-plugin.test.js +76 -38
- package/dist/test/dependencies.test.js +7 -3
- package/dist/test/dream-skill.test.js +3 -3
- package/dist/test/dream-tools.test.js +101 -56
- package/dist/test/dsh.test.js +34 -19
- package/dist/test/helpers/dependency-graph.js +2 -2
- package/dist/test/helpers/extension.d.ts +65 -2
- package/dist/test/helpers/extension.js +72 -3
- package/dist/test/history-corpus.test.js +79 -77
- package/dist/test/history-summary-cache.test.js +97 -9
- package/dist/test/history.integration.test.js +234 -168
- package/dist/test/host-neutral.test.js +69 -19
- package/dist/test/marker.test.js +1 -1
- package/dist/test/note-policy.test.js +189 -56
- package/dist/test/notes.integration.test.js +212 -94
- package/dist/test/notes.test.js +184 -113
- package/dist/test/pi-render.test.js +20 -12
- package/dist/test/project-namespace.test.js +3 -2
- package/dist/test/reset-lifecycle.test.js +2 -2
- package/docs/antigravity.md +44 -0
- package/docs/architecture.md +6 -4
- package/docs/claude-code-mod.md +2 -2
- package/docs/codex.md +36 -38
- package/docs/dsh.md +4 -4
- package/docs/history-sessions.md +28 -50
- package/docs/notes-library.md +6 -6
- package/docs/reset-lifecycle.md +1 -1
- package/docs/skills.md +3 -3
- package/docs/tool-results.md +47 -28
- package/package.json +3 -2
- package/playbook.md +3 -3
- package/plugins/antigravity/dist/antigravity/notesoup.js +26886 -0
- package/plugins/antigravity/hooks.json +7 -0
- package/plugins/antigravity/mcp_config.json +8 -0
- package/plugins/antigravity/plugin.json +6 -0
- package/plugins/antigravity/src/cli.ts +22 -0
- package/plugins/antigravity/src/hooks.ts +51 -0
- package/plugins/antigravity/src/identity.ts +127 -0
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/dist/claude/helper.js +1129 -549
- package/plugins/claude/hooks/register.ts +2 -2
- package/plugins/claude/playbook.md +3 -3
- package/plugins/claude/skills/dream/SKILL.md +2 -2
- package/plugins/claude/skills/notesoup/SKILL.md +92 -0
- package/plugins/claude/src/helper.ts +2 -1
- package/plugins/codex/.codex-plugin/plugin.json +8 -0
- package/plugins/codex/.mcp.json +11 -0
- package/plugins/codex/README.md +5 -21
- package/plugins/codex/dist/codex/notesoup.js +18494 -17905
- package/plugins/codex/src/hooks.ts +1 -0
- package/plugins/codex/src/identity.ts +14 -1
- package/plugins/codex/src/mcp.ts +28 -98
- package/plugins/codex/src/text.ts +3 -3
- package/plugins/dsh/tools.ts +8 -4
- package/plugins/mcp/operations.ts +50 -0
- package/plugins/mcp/server.ts +23 -0
- package/plugins/paseo/README.md +5 -10
- package/plugins/paseo/client/brain-empty-card.tsx +3 -3
- package/plugins/paseo/client/markdown.tsx +50 -38
- package/plugins/paseo/client/notes-op-card.tsx +12 -9
- package/plugins/paseo/client/paper-card.tsx +6 -5
- package/plugins/paseo/client/paper-palette.ts +2 -9
- package/plugins/paseo/client/sticky-card.tsx +2 -2
- package/plugins/paseo/client/tool-result.ts +7 -14
- package/plugins/paseo/package-lock.json +3406 -0
- package/plugins/paseo/package.json +1 -0
- package/plugins/paseo/test/markdown-core.test.ts +73 -66
- package/plugins/pi/budget.ts +3 -3
- package/plugins/pi/entries.ts +1 -0
- package/plugins/pi/history-tools.ts +2 -1
- package/plugins/pi/history.ts +30 -1
- package/plugins/pi/notes/tools.ts +7 -3
- package/plugins/pi/render.ts +6 -6
- package/plugins/pi/reset/lifecycle.ts +9 -10
- package/plugins/pi/runtime.ts +96 -60
- package/plugins/pi/tool-result.ts +8 -8
- package/plugins/pi/window.ts +198 -9
- package/skills/dream/SKILL.md +2 -2
- package/skills/notesoup/SKILL.md +92 -0
- package/src/boot/render.ts +59 -25
- package/src/boot/text.ts +30 -27
- package/src/budget/text.ts +13 -13
- package/src/history/claude.ts +41 -0
- package/src/history/codex-transcript.ts +6 -4
- package/src/history/codex.ts +2 -0
- package/src/history/corpus.ts +51 -2
- package/src/history/history.ts +35 -44
- package/src/history/local.ts +67 -27
- package/src/history/pi.ts +113 -35
- package/src/history/prefilter.ts +73 -15
- package/src/history/query.ts +93 -73
- package/src/history/summary-cache.ts +142 -17
- package/src/index.ts +1 -1
- package/src/notes/frontmatter.ts +16 -1
- package/src/notes/index.ts +1 -1
- package/src/notes/policy.ts +45 -6
- package/src/notes/store.ts +30 -15
- package/src/text-match.ts +46 -4
- package/src/tools/dream.ts +29 -31
- package/src/tools/history.ts +249 -142
- package/src/tools/notes.ts +150 -112
- package/src/tools/output.ts +2 -1
- package/src/tools/result.ts +12 -11
- package/src/tools/schema.ts +24 -1
- package/plugins/claude/skills/memory/SKILL.md +0 -69
- package/plugins/codex/mcp.json +0 -10
- package/plugins/codex/plugin.json +0 -6
- package/plugins/paseo/client/markdown-core.tsx +0 -189
- package/plugins/paseo/client/typography.ts +0 -24
- package/skills/memory/SKILL.md +0 -69
|
@@ -233,7 +233,7 @@ test("manual /empty spans tool turns and commits the stop at settlement", async
|
|
|
233
233
|
assert.equal(markers.length, 1, "the reset commits at settlement");
|
|
234
234
|
assert.equal(settle.continue, false, "a manual wipe does not continue after the reset");
|
|
235
235
|
});
|
|
236
|
-
test("off stops future automatic/manual reset requests
|
|
236
|
+
test("off stops future automatic/manual reset requests and hands compaction back to native Pi", async () => {
|
|
237
237
|
const h = harness();
|
|
238
238
|
await h.callTool("empty_brain");
|
|
239
239
|
const first = resultEntries(await h.emit("turn_end", fakeBoundaryEvent()));
|
|
@@ -248,7 +248,7 @@ test("off stops future automatic/manual reset requests while an existing marker
|
|
|
248
248
|
preparation: { tokensBefore: 100, firstKeptEntryId: null, keptMessages: [], droppedMessages: [] },
|
|
249
249
|
signal: new AbortController().signal,
|
|
250
250
|
});
|
|
251
|
-
assert.
|
|
251
|
+
assert.equal(before.at(-1), undefined, "off lets native Pi compaction run even after an earlier reset");
|
|
252
252
|
const afterOff = resultEntries(await h.emit("turn_end", fakeBoundaryEvent()));
|
|
253
253
|
assert.equal(afterOff.entries.length, 0, "off does not create another reset");
|
|
254
254
|
await h.runCommand("notesoup", "on");
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Antigravity CLI
|
|
2
|
+
|
|
3
|
+
Notesoup provides a native **Antigravity CLI 1.5.17** plugin: a first-invocation notes boot and the four notes operations. It shares the same notes store, names, addressing, schemas, and rendering as the Pi and other Notesoup hosts. It does not implement native Antigravity history, context-budget reporting or context reset/compaction recovery.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
From an unpacked Notesoup distribution, install the plugin directory (it contains its bundled helper, so Node.js must be on your PATH). From a source checkout, run the build first:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm run build
|
|
11
|
+
agy plugin validate plugins/antigravity --strict
|
|
12
|
+
agy plugin install plugins/antigravity
|
|
13
|
+
agy plugin list
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
For upgrades, repeat `agy plugin install` with the new build. Start or resume a conversation after installation. Notesoup does not request permissive global tool settings; approve its MCP calls using Antigravity's ordinary permissions. Its native MCP server appears as `notesoup_notesoup`, with `notes_write`, `notes_update`, `notes_read`, and `notes_list`.
|
|
17
|
+
|
|
18
|
+
Run `agy plugin disable notesoup` to disable the hooks and tools or `agy plugin uninstall notesoup` to remove the plugin. Neither command deletes the notes library. The default notes location is `~/.agents/notes`; set an absolute `NOTESOUP_HOME` before launching `agy` to use a different library.
|
|
19
|
+
|
|
20
|
+
## Boot and identity
|
|
21
|
+
|
|
22
|
+
The plugin uses a `PreInvocation` command hook, which runs before Antigravity calls a model (including native subagents), and an ordinary stdio MCP server. It injects the shared Notesoup protocol as a native `systemMessage` step and the identity/pinned notes/index separately as a `userMessage` step. Writable notebooks never enter the protocol message. On the tested Gemini serialization, Antigravity itself wraps the system step as a user-role `<SYSTEM_MESSAGE>` rather than placing it in Gemini's `systemInstruction`; the actual notebook data remains a distinct user message.
|
|
23
|
+
|
|
24
|
+
The hook saves the model name and cwd that the host reports, keyed by the **native conversation ID**, under the plugin's `PLUGIN_DATA`. The conversation's first invocation emits its own boot. Subsequent invocations refresh the identity for tools without repeating the persisted boot. Resume retains that boot in the native trajectory. This is one boot per conversation, **not** one per compacted context window: there is no native compaction-boundary integration or acknowledgement of hook output persistence. If the host discards the injected steps, refresh is not automatic.
|
|
25
|
+
|
|
26
|
+
MCP tools require host-provided `_meta["antigravity.google/conversation_id"]` and `_meta["antigravity.google/root_conversation_id"]` on every operation, and an exact hook binding for the invoking conversation. Roots, children and parallel siblings have separate session notebooks; a root ID is never a replacement for a child ID. Native parent/root/agent facts are cross-checked when present in the hook and the call. Project selection uses the hook's actual cwd and the shared project namespace resolver, not the MCP process's working directory. The current hook's concrete `modelName` selects `@model` (last provider path component, slugged); absent/`auto` model facts are refused rather than assigned to an arbitrary model notebook. An identity-refresh failure stops that model invocation instead of allowing tools to reuse an older binding. Start a new conversation before switching `NOTESOUP_HOME`.
|
|
27
|
+
|
|
28
|
+
The tested host did not supply `agentName` or ancestry in either root or dynamically defined child hooks, and the corresponding calls had no `agent_name`. These conversations use the shared `anonymous` agent shelf, not a fabricated name inferred from the prompt, role or agent definition. If the host supplies an agent name, Notesoup uses it; MCP's native agent name can refine a hook that did not name an agent. This is a host limitation: an unreported named agent cannot have its own name's pins at boot. A mismatched, absent or unbound conversation is refused; no global/latest-conversation fallback exists.
|
|
29
|
+
|
|
30
|
+
See [Notes library](notes-library.md) for notes usage.
|
|
31
|
+
|
|
32
|
+
## Native verification
|
|
33
|
+
|
|
34
|
+
The host contract comes from the installed 1.5.17 `agy-customizations/docs/{plugins,hooks,mcp_servers}.md` and its changelog (1.4.4 added the root conversation ID in MCP call metadata). The adapter was also verified against the actual 1.5.17 executable in a clean disposable home, with a scripted loopback Gemini API endpoint using the CLI's supported API-key provider. No personal account credentials, external model requests, real notes, or global permission changes were used. This verifies native host behavior, not model quality.
|
|
35
|
+
|
|
36
|
+
Run the normal fixture tests and the opt-in real-host smoke:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
npm run build
|
|
40
|
+
node --test dist/test/antigravity-plugin.test.js
|
|
41
|
+
NOTESOUP_AGY_LIVE="$(command -v agy)" node --test dist/test/antigravity-live.test.js
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The live smoke installs the unmodified native plugin in the isolated home. It confirms a first-turn request already contains pinned project, human and model sentinels with no tool reads; a root plus two overlapping native children each receive their own boot and successfully write, read, update and list their own session note through MCP; resuming the root retains one original boot and reads its original updated session note. The smoke's only permission rules are exact Notesoup operation allowances inside the disposable home.
|
package/docs/architecture.md
CHANGED
|
@@ -8,6 +8,8 @@ notesoup uses Pi's session branch as the durable source of truth. It does not ma
|
|
|
8
8
|
| --- | --- | --- |
|
|
9
9
|
| `index.ts` | The curated host-neutral core surface: the notes library, the boot snapshot/renderer and bindings, the shared operations, and the budget prose | Host entry only; the core never imports a plugin |
|
|
10
10
|
| `plugins/pi/index.ts` | The Pi plugin entry: default extension and `createNotesoup` | Pi only; composed from the domains |
|
|
11
|
+
| `plugins/mcp/` | Expose shared tool operations over stdio; validate arguments, then resolve identity for this request | No host session, hook, rollout, or process-cwd assumptions |
|
|
12
|
+
| `plugins/codex/`, `plugins/antigravity/` | Bind each native caller, register MCP and inject the shared notes snapshot through host hooks | Each owns its identity and lifecycle; neither imports the other |
|
|
11
13
|
| `plugins/claude/src/` | Claude Code helper, live transcript/head binding and threshold derivation | Claude only; wire decoding is shared under `src/history/claude.ts` |
|
|
12
14
|
| `notes/identity.ts`, `notes/store.ts`, `notes/address.ts`, `notes/paths.ts` | Explicit `NotesIdentity`, filesystem notebooks, metadata, addressing and mutations | Node filesystem, no SDK or host environment identity |
|
|
13
15
|
| `boot/snapshot.ts` | Load each of the five notebooks once; isolate filesystem errno failures | Explicit identity, captured time and optional scope loader |
|
|
@@ -19,7 +21,7 @@ notesoup uses Pi's session branch as the durable source of truth. It does not ma
|
|
|
19
21
|
| `budget/constants.ts`, `budget/policy.ts`, `budget/text.ts` | Pure thresholds, unknown/clamped countdown and reminder text | Values supplied by the caller; no settings reads or scheduling |
|
|
20
22
|
| `tools/notes-context.ts` | Host base cwd plus default identity, and one per-call cwd resolver | Shared current-project selection; no host SDK or sticky cwd mutation |
|
|
21
23
|
| `result.ts`, `text-match.ts` | Shared outcome/error primitives, literal-query validation/matching and prefix fitting | No tool-layer dependencies |
|
|
22
|
-
| `tools/notes.ts`, `tools/history.ts`, `tools/schema.ts`, `tools/result.ts`, `tools/output.ts` | Tool schemas, note/history operations, output limits/refusal copy, bounded result selection and pure text rendering | Explicit tool context/projection;
|
|
24
|
+
| `tools/notes.ts`, `tools/history.ts`, `tools/schema.ts`, `tools/result.ts`, `tools/output.ts` | Tool schemas, note/history operations, output limits/refusal copy, bounded result selection and pure text rendering | Explicit tool context/projection; text results within 32 KiB; structured data only for `notes_read` |
|
|
23
25
|
| `settings.ts` | The `notesoup` settings key, the plain-object test and the per-key global/project merge | Raw records only; each host names and validates the fields it consumes |
|
|
24
26
|
| `dream/settings.ts` | Dreamer-pattern validation over the merged record | Parsed values only; no SDK or I/O |
|
|
25
27
|
| `dream/` | Jail, crumpled-only physical deletion, locks, gates, Git audit, doctor, playbook and result/report logic | Independent filesystem/policy functions; no reverse import into Pi |
|
|
@@ -62,13 +64,13 @@ The Pi history adapter supplies the selected raw session branch on demand withou
|
|
|
62
64
|
|
|
63
65
|
The boot notes index in `boot/snapshot.ts` is a closed snapshot: the current session, project, human, agent, and model notebooks are each loaded at most once while constructing a boot. `boot/snapshot.ts` takes explicit `NotesIdentity`, captured `openedAt` and an optional notebook loader; `boot/render.ts` renders that snapshot and explicit tool bindings without reading the filesystem or consulting the clock. Pi supplies its unchanged tool names. MAP bodies and pocket metadata are derived from the same snapshot, so a boot cannot mix two filesystem reads. Note storage and notebook traversal use `node:fs/promises`; same-file operations queue by absolute physical filename across store instances in this process, without promising symlink/case-alias or cross-process locking. Known persisted metadata is camelCase. Old snake_case keys are unrecognized extras, not interpreted or migrated; startup does not migrate notes. A missing notebook (`ENOENT`) is normal. A real read failure omits only that notebook's index, preserves healthy notebooks, adds a model-facing `notes_list` recovery notice, and notifies the human once for that window. Boot/reset construction captures session, agent, and model identity before awaiting the snapshot, then checks lifecycle generation, active window, enabled state, and abort status before sending or returning artifacts; stale completions cannot commit into a switched or shut-down session. Boot acquisition uses listing and never updates access metadata. Explicit note reads update `lastAccessed` and `accessCount`; no fallback state is created.
|
|
64
66
|
|
|
65
|
-
Notes remain in their filesystem-backed notebooks, unchanged by session branch navigation. Tool reads expose metadata separately from body windows; search/read code-point offsets are body-relative and do not depend on frontmatter serialization or access-counter changes. A single effective per-note policy resolves optional `pinned`, `budget`, and `readonly` frontmatter
|
|
67
|
+
Notes remain in their filesystem-backed notebooks, unchanged by session branch navigation. Tool reads expose metadata separately from body windows; search/read code-point offsets are body-relative and do not depend on frontmatter serialization or access-counter changes. A single effective per-note policy resolves optional `pinned`, `budget`, and `readonly` frontmatter (root `CHEATSHEET.md` defaults pinned with a tighter UTF-8 byte budget; `readonly` defaults false as a soft lock, not security; see [per-note policy](notes-library.md#per-note-policy)). Storage serializes pin admission per notebook before file mutation; boot uses that metadata to inject pinned bodies truncated to their byte budget with out-of-body `<notesoup:warning>` notices, visibly naming omitted pins in manually over-cap notebooks.
|
|
66
68
|
|
|
67
69
|
Every notes tool accepts an optional per-call `cwd`. The host adapter supplies a `NotesToolContext` containing its base cwd and default `NotesIdentity`; shared tool code resolves a relative override against that base, requires an existing directory, and derives one override `projectKey` through the existing project resolver. Storage, addresses, globs, receipts, and new session-note ownership all consume that same resolved identity. The override neither mutates the context nor changes `NotesIdentity.home`; the standalone store still receives explicit identities and has no cwd-discovery behavior. Dream markers survive resolution, so an override cannot widen dream write permission.
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
All shared tools return text within 32 KiB, including notices and continuation hints. Only `notes_read` also offers structured data, bounded to the same size in JSON. In Pi codemode and DSH the other tools return strings. Pi's note mutation cards display policy, warnings and diffs without adding a structured tool result. The same selected body window supplies both text and structured note reads; continuation markers are not part of the note body. See [tool results](tool-results.md) for how to read and continue results.
|
|
70
72
|
|
|
71
|
-
The `/fresh-window` command only waits for idle when the session is busy with non-agent work; during model output it arms the close-out and steers the checkpoint prompt into the running turn. While enabled, `/compact` is cancelled with an actionable `/fresh-window` notice. Disabling notesoup stops new automatic resets,
|
|
73
|
+
The `/fresh-window` command only waits for idle when the session is busy with non-agent work; during model output it arms the close-out and steers the checkpoint prompt into the running turn. While enabled, `/compact` is cancelled with an actionable `/fresh-window` notice. Disabling notesoup stops new automatic resets and hands compaction back to native Pi semantics: before any later native compaction, an existing checkpoint/marker still excludes earlier history, and once a native compaction runs it supersedes the older reset boundary (and re-enabling notesoup lazily re-boots the post-compaction window). Threshold and warning accounting use active-window provider usage rather than pre-reset global usage. Pre-send hard-reserve checks estimate the complete projected transcript, including real system sections and tool declarations; native provider usage remains authoritative once available, and post-checkpoint unknown usage stays unknown. Budget policy and staged prompts are instance-owned, so concurrent sessions cannot share reserve/enablement or uncommitted drafts; default file-backed policy is cached per instance, while injected policy is resolved live on each decision and model/session transitions reset the diagnostic lifecycle.
|
|
72
74
|
|
|
73
75
|
## Evidence and limits
|
|
74
76
|
|
package/docs/claude-code-mod.md
CHANGED
|
@@ -26,11 +26,11 @@ Both interactive and headless (`-p` / SDK) resets use `$.command.run({command:"c
|
|
|
26
26
|
|
|
27
27
|
A command receipt and prepared boot are not commit evidence. On Claude Code 2.1.319, interactive completion exposes the installed boot through `$.session.messages()`. Headless completion still exposes the old request snapshot and precedes appends, so the worker waits for successful main `session.append` results: a kept compact boundary followed by the unchanged boot with its UUID. A missing or rewritten boot, veto, or rejected command cannot start continuation. Boot acquisition failure vetoes an explicit reset without advancing the window. After commit, a dropped or failed continuation is reported without compacting again. Native command/output rows remain alongside the fresh boot; no compaction model request is made. A Claude dream backend is not implemented, and budget reporting (`get_context_remaining`) remains Pi-only.
|
|
28
28
|
|
|
29
|
-
The notes tools also serve subagent calls, using the same session identity and shared operations. The plugin exposes the shared
|
|
29
|
+
The notes tools also serve subagent calls, using the same session identity and shared operations. The plugin exposes the shared notesoup and dream skills and the dream playbook; the build keeps these copies byte-identical to the canonical files.
|
|
30
30
|
|
|
31
31
|
## Persisted history
|
|
32
32
|
|
|
33
|
-
The [shared schemas and results](tool-results.md) apply here too: `notes_list` browses or searches with `query`; `history_list`
|
|
33
|
+
The [shared schemas and results](tool-results.md) apply here too: `notes_list` browses or searches with `query`; `history_list` pages through one timeline with seq/time bounds or lists sessions via wildcards; `history_search` finds passages using a required query, time bounds and optional neighboring events. With `session` omitted they read the current main session's persisted JSONL, via the documented `classic.SessionStart.transcript_path`; no path is guessed and `$.session.messages()` is not treated as full history. The classic binding survives typed `session.start`, which fires later. Without that path, current-session history calls refuse and the boot says history is unavailable. Subagent history calls refuse rather than silently exposing the main transcript.
|
|
34
34
|
|
|
35
35
|
Explicit `session` selectors use the [local cross-harness corpus](history-sessions.md), including Pi/Claude/Codex files, without needing the current main transcript to have a head yet. Explicitly selecting the current Claude session still uses its strict live binding. Offline Claude targets prefer non-attachment graph leaves when available, then select the last remaining leaf in transcript order; no leaves still refuses. The persisted Claude decoder is shared under `src/history/claude.ts`; its plugin entry remains in `plugins/claude/src/history.ts`.
|
|
36
36
|
|
package/docs/codex.md
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
# Codex plugin (native mode)
|
|
2
2
|
|
|
3
|
-
`plugins/codex/` makes notesoup a native Codex plugin:
|
|
3
|
+
`plugins/codex/` makes notesoup a native Codex plugin: five notebooks and two history tools over a bundled stdio MCP server, plus SessionStart/SubagentStart hooks that deliver the notes boot into the model's initial context. It does not wrap Codex's conversation or replace its context engine. Reset and budget stay native.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Validated against the installed **Codex 0.171.0**, including real model turns. The rollout reader checks supported wire shapes, not a version whitelist; an unknown producer version isn't automatically rejected. Unsupported or ambiguous data still fails explicitly. Compressed `.jsonl.zst` rollouts require **Node >=22.15** (`zstdDecompressSync`).
|
|
6
6
|
|
|
7
7
|
## Install (from this checkout)
|
|
8
8
|
|
|
9
|
-
Build the bundled helper first; `plugins/codex/dist/codex/notesoup.js` is generated and is not committed.
|
|
10
|
-
|
|
11
9
|
```sh
|
|
12
10
|
npm ci
|
|
13
11
|
npm run build
|
|
@@ -15,9 +13,9 @@ codex plugin marketplace add /absolute/path/to/notesoup
|
|
|
15
13
|
codex plugin add notesoup@notesoup
|
|
16
14
|
```
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
Codex copies the native `.codex-plugin/plugin.json`, `.mcp.json`, hooks and built helper into its cache; build before installing or refreshing the plugin. Review and trust the three notesoup hooks in Codex's `/hooks` UI. Review and approve the notesoup MCP tools according to your own permission settings. An untrusted hook does not run, and notesoup then refuses MCP calls as `unknown_thread`. Restart Codex or resume the thread after changing configuration.
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
Merge these settings into `~/.codex/config.toml` rather than replacing it (or use `CODEX_HOME` to select a different Codex home):
|
|
21
19
|
|
|
22
20
|
```toml
|
|
23
21
|
[features]
|
|
@@ -29,63 +27,63 @@ enabled = true
|
|
|
29
27
|
use_history_notes_extension = false
|
|
30
28
|
```
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
`context_management = false` disables the experiment notesoup replaces. `[features.token_budget]` supplies the native `new_context` and `get_context_remaining` tools; notesoup does not implement either one. `use_history_notes_extension = false` leaves notes and history to notesoup.
|
|
30
|
+
Do not also write `token_budget = true`: it is a table here. `context_management = false` disables the competing experiment. `token_budget` supplies native `new_context` and `get_context_remaining`, while `use_history_notes_extension = false` leaves persistent notes/history to notesoup. These flags are under development and may change in later releases.
|
|
35
31
|
|
|
36
32
|
## What the agent gets
|
|
37
33
|
|
|
38
|
-
- **A boot
|
|
39
|
-
- **Codex
|
|
40
|
-
- **Five notebooks** through `notes_write`, `notes_update`, `notes_read` and `notes_list` (add `query` to search). `NOTESOUP_HOME` overrides the root (default `~/.agents/notes`); a root thread's agent name is `NOTESOUP_AGENT` or `anonymous`.
|
|
41
|
-
- **Native history** through `history_list`
|
|
42
|
-
- **Per-turn model identity.** `@model` follows the current turn's `x-codex-turn-metadata.model`, not the model recorded at thread start.
|
|
43
|
-
- **Subagents and forks.** `SubagentStart` binds the child or fork to its own transcript while keeping the parent's root session. Its `@self` notebook is the slugged `agent_type` (for example `worker`), not the parent's.
|
|
34
|
+
- **A boot at native window start.** `SessionStart` reads the native rollout, binds the root thread and returns a notes snapshot as hook additional context. `SubagentStart` does the same for each separately spawned child. Dedupe requires a host-persisted `hooks.additional_context` record for the exact thread and native window, never a quoted marker.
|
|
35
|
+
- **Codex-native reset and budget tools.** `new_context` and `get_context_remaining` remain Codex's tools; notesoup does not implement a fallback.
|
|
36
|
+
- **Five notebooks** through `notes_write`, `notes_update`, `notes_read` and `notes_list` (add `query` to search). `NOTESOUP_HOME` overrides the notes root (default `~/.agents/notes`); a root thread's agent name is `NOTESOUP_AGENT` or `anonymous`. A child uses its slugged hook `agent_type` (for example `worker` or `default`).
|
|
37
|
+
- **Native history** through `history_list` (browse a timeline or list sessions), `history_search` (find passages by query), and `history_read` (open one event by seq). Optional `session` targets another local session; `history_list` and `history_search` also accept wildcards such as `"*"`; see [cross-session history](history-sessions.md). The boot's window tree retains native window UUIDs.
|
|
38
|
+
- **Per-turn model identity.** `@model` follows the current turn's `x-codex-turn-metadata.model`, not the model recorded at thread start.
|
|
44
39
|
|
|
45
|
-
Codex may
|
|
40
|
+
Codex may namespace MCP tools or expose them through its tool orchestrator; use the names in the current tool list.
|
|
46
41
|
|
|
47
42
|
## Native-window and identity rules
|
|
48
43
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
A notes or history call refuses, without reading or writing anything, when:
|
|
44
|
+
Hook-captured facts bind the thread and its cwd, root session, transcript, notes root, native window UUID and number. The MCP server never guesses a project from the server's working directory. Native Codex hooks receive `PLUGIN_DATA`; the native stdio launcher does not, so the fixed `notesoup@notesoup` installation reads the same binding directory at `$CODEX_HOME/plugins/data/notesoup-notesoup` (default `~/.codex`).
|
|
52
45
|
|
|
53
|
-
- the thread
|
|
54
|
-
- the binding's root session disagrees with the call's `sessionId` (`stale_thread_binding`);
|
|
55
|
-
- the call carries no `windowId` (`missing_window`) or a different one from the binding (`stale_thread_binding`);
|
|
56
|
-
- the turn supplies no model (`missing_model`);
|
|
57
|
-
- history finds the transcript's root session or current window no longer matches the binding (`stale_native_state`).
|
|
46
|
+
Codex 0.171.0 MCP `windowId` uses `<thread-id>:<window-number>`, while the rollout records a native window UUID. The adapter accepts the numbered ID only when it exactly matches the bound thread and the transcript-proven window number; the persisted UUID remains the history window identity. The older UUID form also works when it matches the same binding. All calls recheck native facts before accessing notes or history.
|
|
58
47
|
|
|
59
|
-
|
|
48
|
+
Calls refuse for a missing binding (`unknown_thread`), conflicting caller or transcript thread/root/window (`stale_thread_binding` / `stale_native_state`), missing native window (`missing_window`), or missing current turn model (`missing_model`). Resume or compact once to rebind root identity; a root-session disagreement is never overwritten by a hook.
|
|
60
49
|
|
|
61
|
-
The
|
|
50
|
+
The transcript decoder is strict about structural facts: unknown record/response types, malformed committed JSONL, non-increasing ordinals, copied `session_meta` ancestry and unsupported `thread_rolled_back` selection are refusals. An incomplete final line is ignored as an append tail. Native `additional_tools` catalog records consume their ordinal but aren't conversation events.
|
|
62
51
|
|
|
63
|
-
## Child limitation
|
|
52
|
+
## Child rollover limitation
|
|
64
53
|
|
|
65
|
-
Codex 0.
|
|
54
|
+
The root recovery path is `SessionStart` after compaction. Codex 0.171.0's child startup hook contract does not provide a supported context-injecting post-compact child recovery hook. Notesoup therefore answers a child `PreCompact` with `continue: false` before native history is cut, and tells the child to save a handoff note and start a fresh child; root `PreCompact` is transparent. Independent child first-turn boot and MCP calls are verified, but child rollover recovery is not implemented.
|
|
66
55
|
|
|
67
56
|
## Limits
|
|
68
57
|
|
|
69
58
|
| Limit | What to expect |
|
|
70
59
|
| --- | --- |
|
|
71
|
-
| Codex
|
|
60
|
+
| Codex wire format | Real 0.171.0 root and child rollouts, plus older producer-shaped fixtures; unknown shapes may refuse regardless of version. |
|
|
72
61
|
| Node | >=22.15 for compressed rollouts. |
|
|
73
|
-
| Boot size | Local cap 128 KiB
|
|
74
|
-
| Tool output | Shared
|
|
75
|
-
| History sources | Local Pi/Claude/Codex transcripts through the shared corpus
|
|
76
|
-
| Reset/budget | Codex-native only. No
|
|
62
|
+
| Boot size | Local cap 128 KiB; hook `additionalContextLimit: 0` avoids host spilling. Oversized boot warns instead of injecting truncated notes. |
|
|
63
|
+
| Tool output | Shared result bounds; use continuation fields or narrower filters. |
|
|
64
|
+
| History sources | Local Pi/Claude/Codex transcripts through the shared corpus. No remote history or text recovered from opaque/encrypted payloads. |
|
|
65
|
+
| Reset/budget | Codex-native only. No notesoup budget warning or close-out turn. |
|
|
77
66
|
| Child rollover | Unsupported; blocked at `PreCompact` as above. |
|
|
78
67
|
| Dream | No Codex dream backend or dream skill registration. |
|
|
79
|
-
| Notifications/commands | No custom UI notification, runtime toggle or `/fresh-window` command
|
|
68
|
+
| Notifications/commands | No custom UI notification, runtime toggle or `/fresh-window` command. |
|
|
80
69
|
|
|
81
|
-
## Validation
|
|
70
|
+
## Validation
|
|
82
71
|
|
|
83
|
-
|
|
72
|
+
The targeted tests drive copied bundled stdio helpers via the MCP SDK and exercise root, child, and fork bindings, history coordinates and strict lineage validation, caller window identity, native hook boot and dedupe, and the child PreCompact guard.
|
|
73
|
+
|
|
74
|
+
Redacted live evidence (Codex 0.171.0, 2026-11-26; fresh installation of the unmodified native bundle into an isolated Codex home):
|
|
75
|
+
|
|
76
|
+
| Probe | Native rollout ordinals and result |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| Root | 12: `hooks.additional_context` contains the pinned-note sentinel; 16: first assistant commentary reproduces it, before any tool execution; 22/23: `notes_list` and `history_list` complete successfully. The model identifies both native context tools. |
|
|
79
|
+
| Independent child | Spawned with `fork_turns="none"`, without the sentinel in its task. Its own ordinal 12 contains hook boot; 28/29: `history_list` and `notes_list` complete successfully; 38: final assistant message reproduces the sentinel. Parent confirms the child's initial report; no shell or notes-read operation was used. |
|
|
80
|
+
| History decoder | Both completed root and child rollouts decode with native window number 0 and one window. |
|
|
81
|
+
| Default installation | CLI install succeeded and the installed app-server listed SessionStart, SubagentStart and PreCompact as enabled, untrusted. Existing user permissions were not changed. |
|
|
84
82
|
|
|
85
|
-
The
|
|
83
|
+
The isolated probes allowed only the locally vetted plugin hooks and the two read-only list operations in their temporary configuration. No private notes were used; temporary raw diagnostics were removed after validation. No live compaction completion is claimed.
|
|
86
84
|
|
|
87
85
|
```sh
|
|
88
86
|
npm run typecheck
|
|
89
87
|
npm test
|
|
90
|
-
node --test dist/test/codex-plugin.test.js
|
|
88
|
+
node --test dist/test/codex-history.test.js dist/test/codex-plugin.test.js
|
|
91
89
|
```
|
package/docs/dsh.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DeepSeek Harness adapter
|
|
2
2
|
|
|
3
|
-
notesoup for **dsh 0.2.1-alpha.2** gives the agent a fresh page when context runs low: frozen boot text, the five notebooks,
|
|
3
|
+
notesoup for **dsh 0.2.1-alpha.2** gives the agent a fresh page when context runs low: frozen boot text, the five notebooks, seven notes/history tools, `get_context_remaining`, and `empty_brain`. A reset makes **zero model calls**. The old conversation leaves the model surface and remains in the session log for history reads. `notes_list` browses the notebooks or returns match lines and offsets when given `query`. Dream is not registered on dsh.
|
|
4
4
|
|
|
5
5
|
Install the package in your chosen dsh profile with `dsh plugin --profile <profile> add notesoup`, then copy the model declaration from [the profile patch example](dsh.profile.patch.yml) into `$DSH_HOME/profiles/<profile>/cordis.patch.yml`. The package bundle patch disables `compaction-basic` and inserts `notesoup-engine` and `notesoup`. Do not duplicate those rows when adding the model declaration. A source checkout needs `npm ci --ignore-scripts` and `npm run build`; use absolute `file:///.../dist/plugins/dsh/engine.js` and `file:///.../dist/plugins/dsh/index.js` module names. The example shows all rows for a profile assembled without the package bundle.
|
|
6
6
|
|
|
@@ -10,11 +10,11 @@ On load and before requests, preflight probes `systemPrompt.section`, `tools.reg
|
|
|
10
10
|
|
|
11
11
|
## Notes, boot and history
|
|
12
12
|
|
|
13
|
-
`notesHome` defaults to `~/.agents/notes`; `agentName` defaults to `dsh`. The filesystem layout and addressing match Pi and Claude: bare paths are session notes, with `@project`, `@human`, `@self`, and `@model` durable notebooks. Project identity uses the shared `resolveProjectNamespace(cwd, notesHome)` resolver: readable slug notebooks with a `.project` marker, including repository/worktree and origin identity. Other marked projects are readable through `@projects/<name>/`; named-notebook reads do not update access metadata and named-notebook writes are refused. Receipts, boot protocol (including
|
|
13
|
+
`notesHome` defaults to `~/.agents/notes`; `agentName` defaults to `dsh`. The filesystem layout and addressing match Pi and Claude: bare paths are session notes, with `@project`, `@human`, `@self`, and `@model` durable notebooks. Project identity uses the shared `resolveProjectNamespace(cwd, notesHome)` resolver: readable slug notebooks with a `.project` marker, including repository/worktree and origin identity. Other marked projects are readable through `@projects/<name>/`; named-notebook reads do not update access metadata and named-notebook writes are refused. Receipts, boot protocol (including root CHEATSHEET.md and the auto-generated per-shelf index), and bounds come from the shared modules, not dsh copies. A model change changes subsequent tools' `@model` identity; the boot remains frozen until reset.
|
|
14
14
|
|
|
15
15
|
The boot is a `systemPrompt.section` at order **2450**, with `interpolate: false`. Shared snapshot/render functions read the five notebooks once, using a captured timestamp. Rendering is deterministic for those inputs. A `plugin:notesoup/window` record stores the ordinal, id, timestamp, digest and exact boot text. `agent/created` adopts it before the first assembly. Notes written later appear in the next window's boot. Missing records reconstruct from the notesoup compact checkpoint, or from the marked root system section. Neither path rereads notes or regenerates a summary. Records are informational; checkpoints control the model surface.
|
|
16
16
|
|
|
17
|
-
`history_list` and `history_read` obtain the full raw log through `ctx.sessionQuery.readSession`, then feed the shared pairing, `after` / `before` paging and literal search with optional `context`
|
|
17
|
+
`history_list`, `history_search`, and `history_read` obtain the full raw log through `ctx.sessionQuery.readSession`, then feed the shared pairing, integer `after` / `before` timeline paging and wildcard session overview (`history_list`), and literal search with ISO `since` / `until` bounds and optional `context` (`history_search`). Public history seq **1** is native dsh seq **0**; always use the seq a notesoup tool returns. A fork's selected seed prefix is available in its history; no sibling or parent suffix is fetched. Tool results are paired at their call seq. Text blocks are verbatim; other recorded blocks are shown as JSON. Omit `session` for the current session. Explicit `session: "dsh:<id-or-prefix>"` resolves through `ctx.sessionQuery.listSessions()` and reads with `readSession`; `history_list` and `history_search` with `session: "*"` also overview or search the Pi/Claude/Codex local-file corpus. DSH service-backed discovery is available only inside DSH. Explicit-session results group rows under `=== session <harness>:<id> ===` and retain canonical session identity in continuation recipes; see [cross-session history](history-sessions.md).
|
|
18
18
|
|
|
19
19
|
## Reset and budget
|
|
20
20
|
|
|
@@ -47,7 +47,7 @@ The reminder and close-out warning go through `agent.steer`. Close-out remains a
|
|
|
47
47
|
| dsh versions | Tested against **0.2.1-alpha.2**. Capability checks do not establish wire or persistence compatibility with every newer preview. Run the scripted tests before upgrading. |
|
|
48
48
|
| Model calls per reset | **0** auxiliary model calls. The agent's note-writing turns and fresh-window continuation still make ordinary calls. |
|
|
49
49
|
| Retention | Surface node **0**, one boot/continuation checkpoint, and subsequent messages. An unfinished tool batch postpones reset; no partial tool pairs are discarded. |
|
|
50
|
-
| Boot bounds |
|
|
50
|
+
| Boot bounds | Shared per-notebook pin cap, UTF-8 byte budgets, and bounded auto-generated per-shelf index from the shared policy/renderer (see [per-note policy](notes-library.md#per-note-policy)). Over-budget pinned bodies truncate in boot with `<notesoup:warning>` outside the note frame; manually over-cap pins are omitted with a visible address list. |
|
|
51
51
|
| Tool output | Shared **32 KiB** bounds; use `next_offset_chars`, history cursors, or narrower filters. There is no unbounded hidden result. |
|
|
52
52
|
| Warning timing | Steering enters the next step; a large current response/tool batch can spend the runway. The hard reserve protects the next balanced boundary, not an in-flight provider call. |
|
|
53
53
|
| Unknown capacity | Countdown is **null** and automatic reserve checks skip. Add `models[].contextWindow` to `llm-deepseek`; explicit resets still work. |
|
package/docs/history-sessions.md
CHANGED
|
@@ -1,39 +1,41 @@
|
|
|
1
1
|
# Cross-session history
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
History tools inspect local sessions without switching sessions or changing them.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
Omit `session` to keep the current host's behavior unchanged. Items/read results do not contain `session`, headers remain `seq <seq> | <role>`, and the printed paging, expand and neighborhood recipes do not contain a session selector.
|
|
8
|
-
|
|
9
|
-
Pass an ID or unique prefix, optionally qualified by `pi:`, `claude:`, `codex:` or `dsh:`:
|
|
5
|
+
## Browse one timeline or list sessions
|
|
10
6
|
|
|
11
7
|
```js
|
|
12
|
-
history_list({
|
|
13
|
-
|
|
8
|
+
history_list({ before: 190, limit: 20 })
|
|
9
|
+
history_list({ session: "claude:target-prefix", after: 0 })
|
|
10
|
+
history_list({ session: "*" }) // Recent sessions, one representative each
|
|
11
|
+
history_list({ session: "pi:*", since: "2026-10-01", limit: 20 })
|
|
14
12
|
```
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
Omit `session` for the current session. For a single session, use exclusive integer seqs for `after` / `before` (`after: 0` starts at the beginning) and optional ISO 8601 `since` / `until`. Without `after` (or `since` alone), the newest eligible events are returned, still in ascending seq order. Follow the older/newer recipes to page with the same options. Use `roles` to see specific roles, or omit it to fold tool/context runs. Follow the expand recipe to see those events.
|
|
15
|
+
|
|
16
|
+
With a wildcard `session` (`*`, `pi:*`, `claude:prefix*`), `history_list` returns one representative event per session, preferring the first visible user prompt, then the latest assistant event, then the latest visible event. With `roles`, it returns the latest matching event. Role and ISO 8601 `since` / `until` filters apply before choosing representatives (`after` / `before` seq bounds are refused on wildcards). Wildcard overviews consider most recently modified sessions first (least recently modified first with `since`).
|
|
17
|
+
|
|
18
|
+
## Find passages
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
```js
|
|
21
|
+
history_search({ query: "deployment", context: 1 })
|
|
22
|
+
history_search({ session: "*", query: ["deployment", "rollback"], limit: 20 })
|
|
23
|
+
history_search({ session: "codex:*", query: "migration", roles: ["tool"], since: "2026-10-01", context: 1 })
|
|
24
|
+
```
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
- `query` is required, matching literal text case-insensitively; a list matches any of its non-empty terms, and an empty query returns no matches. All roles are searched by default, including tool arguments and output. `context: N` adds up to N neighboring visible events on either side of a hit, even outside the hit's filters. Neighbors are marked `search context`, and don't count toward `limit`.
|
|
27
|
+
- `since` and `until` are exclusive ISO 8601 times (local time without an offset). Untimed events are excluded by time bounds. `limit` counts from the newest end, or oldest end with `since`; default 20. Results are grouped by session, with seqs ascending inside each group. If more results are available, narrow by time, role, query or session pattern.
|
|
28
|
+
- Both `history_list` and `history_search` accept wildcard session patterns: `*` covers all available sessions, `pi:*` restricts to Pi, and `claude:prefix*` narrows the ID. All characters except `*` are literal.
|
|
21
29
|
|
|
22
|
-
|
|
30
|
+
## Read one event
|
|
23
31
|
|
|
24
32
|
```js
|
|
25
|
-
|
|
26
|
-
history_list({ session: "*", query: ["deployment", "rollback"], limit: 20 })
|
|
27
|
-
history_list({ session: "codex:*", query: "migration", roles: ["tool"], after: "2026-10-01", context: 1 })
|
|
33
|
+
history_read({ session: "claude:full-session-id", seq: 42, offset_chars: 120 })
|
|
28
34
|
```
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- `history_read` refuses wildcard selectors with `invalid_session`; take a specific `session` and `seq` from the result instead.
|
|
34
|
-
- A query searches all roles, including tool arguments/output and injected context; `roles` can narrow the hits. `context: N` includes up to N neighbors on each side from the hit’s own session, even outside the hit bounds. There are no folded rows.
|
|
35
|
-
- Hits and context are merged oldest first by event time, with a deterministic session/seq tie-break; untimed events sort first. `limit` counts hits from the newest end by default or from the oldest end with `after`. The complete text and structured result still share the 32 KiB budget.
|
|
36
|
-
- Each event carries its canonical `session`. `has_older` and `has_newer` indicate more matching results beyond the page; an overview with unvisited sessions may have more even if those sessions have no representative. Narrow by session pattern, query, roles or time rather than trying to page across per-session seqs.
|
|
36
|
+
An explicit session is shown as `=== session <harness>:<full-id> ===` above list/search rows. Copy that full ID and the event's seq into `history_read`. If a preview header shows ` | offset_chars N`, use `offset_chars: N` to open that passage; a shortened preview ends with ` [truncated]`. Follow the continuation for more text. Without a session heading, omit `session` to read the current session. Seqs are local to a session.
|
|
37
|
+
|
|
38
|
+
All three tools accept a full ID or unique prefix, optionally qualified by `pi:`, `claude:`, `codex:` or `dsh:`. Exact IDs take precedence over prefixes. An unqualified ID checks the current harness first. If no match or several matches are found, use a longer or harness-qualified ID. `history_read` rejects wildcards. The three tools return plain text bounded to 32 KiB including notices and footers.
|
|
37
39
|
|
|
38
40
|
## Local discovery and limits
|
|
39
41
|
|
|
@@ -41,37 +43,13 @@ history_list({ session: "codex:*", query: "migration", roles: ["tool"], after: "
|
|
|
41
43
|
| --- | --- | --- |
|
|
42
44
|
| Pi | `~/.pi/agent/sessions/<workspace>/<timestamp>_<id>.jsonl` | Current session uses the native active branch. Offline current-format files follow persisted parent links from the last tree entry, preserving append seqs and inactive-branch holes. |
|
|
43
45
|
| Claude | `~/.claude/projects/<project>/<id>.jsonl` | The current session still requires its live, confirmed append head. Offline files account for logical compact links, prefer non-attachment graph leaves when available, and select the last remaining leaf in transcript order. Only that leaf's confirmed ancestors are exposed; a graph with no leaves still refuses. |
|
|
44
|
-
| Codex | `~/.codex/sessions/YYYY/MM/DD/rollout-...-<threadId>.jsonl(.zst)` | The same
|
|
46
|
+
| Codex | `~/.codex/sessions/YYYY/MM/DD/rollout-...-<threadId>.jsonl(.zst)` | The same structural rollout/lineage decoder as current-session history; compressed files need Node >=22.15. Root `session_id` is not a child thread ID. |
|
|
45
47
|
| DSH | `ctx.sessionQuery.listSessions()` / `readSession(id)` | Available inside DSH only, over its live-preferred local session corpus. Other hosts cannot discover DSH files themselves. |
|
|
46
48
|
|
|
47
|
-
Filesystem discovery does not follow directory symlinks or recurse into Claude subagent stores. Missing roots are empty. Repeated native files for one qualified ID produce one descriptor (newest modified); the current live binding wins over its on-disk descriptor. Discovery and decoding never mutate transcript bytes or modification times. Unsupported/corrupt or unreadable selected transcripts return `history_unavailable` naming the session for single-session
|
|
49
|
+
Filesystem discovery does not follow directory symlinks or recurse into Claude subagent stores. Missing roots are empty. Repeated native files for one qualified ID produce one descriptor (newest modified); the current live binding wins over its on-disk descriptor. Discovery and decoding never mutate transcript bytes or modification times. Unsupported/corrupt or unreadable selected transcripts return `history_unavailable` naming the session for single-session calls. Wildcard searches and overviews skip individual sessions that cannot load; an empty wildcard result is not proof that an event never happened. A gap in Claude history appears as a notice; it does not change event text or read offsets.
|
|
48
50
|
|
|
49
51
|
The default roots respect `PI_CODING_AGENT_DIR` (Pi agent directory), `CLAUDE_CONFIG_DIR` (Claude config directory), and `CODEX_HOME` (Codex home). For direct root overrides use absolute paths in `NOTESOUP_HISTORY_PI_ROOT`, `NOTESOUP_HISTORY_CLAUDE_ROOT`, and `NOTESOUP_HISTORY_CODEX_ROOT`; these name the **sessions**, **projects**, and **sessions** directories respectively, not notes storage. `NOTESOUP_HOME` only changes notes.
|
|
50
52
|
|
|
51
|
-
##
|
|
52
|
-
|
|
53
|
-
Only an unfiltered wildcard overview uses the persistent offline representative cache: no nonempty query and no `roles`, `after`, or `before`. Empty queries still mean an overview. Explicit session reads/lists, searches, filtered overviews, DSH service descriptors and the current live binding do not use this cache. Session discovery, modified-time ordering, representative ordering, output budgeting and full event-preview limits are unchanged.
|
|
54
|
-
|
|
55
|
-
A cold miss deliberately reads and strictly decodes the whole transcript, including selected Codex ancestry. It saves only the complete selected event, canonical session identity, notice and source metadata—not a projection, header-only approximation or full-text index. Entries are versioned with the decoder/selection contract; decoder or presentation changes must bump that version. The key includes the canonical root transcript path, harness and session ID. Every source has a `dev`/`ino`/size/nanosecond mtime/ctime fingerprint taken before reading and checked after decoding. Codex records the actual root and ancestor files, and cache hits re-run native lineage discovery so newly ambiguous or missing sources cannot be hidden by unchanged file fingerprints. The fingerprint list must exactly match the root and lineage witness list.
|
|
56
|
-
|
|
57
|
-
Cache storage is `~/Library/Caches/notesoup/history` on macOS, or `$XDG_CACHE_HOME/notesoup/history` (`~/.cache/notesoup/history` by default) elsewhere. Entries use atomic temporary-file rename and are individually capped at 8 MiB, both on admission and before/after reading. Oversized representatives still use normal strict decoding and normal output budgets; they are not truncated for cache admission. Missing, corrupt or unwritable caches are transparent misses. Raced decodes are returned without persistence. Transcript failures are never cached: wildcard calls still skip those sessions, while explicit calls still refuse. There is no public cache option, background warmup, or whole-corpus index; the internal test-root seam keeps tests out of the user's cache.
|
|
58
|
-
|
|
59
|
-
### Cold and warm evidence
|
|
60
|
-
|
|
61
|
-
A November 1, 2026 local read-only measurement used a private empty cache and a fresh Node process for each pass. It ran the default 20-topic overview over offline descriptors last modified at least ten minutes earlier, excluding active work; both passes returned exactly the same serialized result. This is one local sample, not a cold-search or whole-corpus speed claim.
|
|
62
|
-
|
|
63
|
-
| Measurement | Cold cache | Warm cache |
|
|
64
|
-
| --- | ---: | ---: |
|
|
65
|
-
| Elapsed | 462.58 ms | 89.63 ms |
|
|
66
|
-
| Transcript body reads | 32 | 12 |
|
|
67
|
-
| Transcript bytes | 159,240,525 | 70,962,466 |
|
|
68
|
-
| JSON parses (including cache entries) | 10,636 | 32 |
|
|
69
|
-
| Peak process RSS | 305,200 KiB | 134,208 KiB |
|
|
70
|
-
|
|
71
|
-
All 20 unchanged supported sessions hit their summaries without body reads on the warm pass. The remaining 12 body reads in **both** passes were unavailable/unsupported sessions intentionally rechecked rather than negatively cached. Twenty entries occupied 184,431 bytes (largest 142,796 bytes). Focused hermetic tests independently prove zero second-call transcript reads for supported Pi and compressed Codex/ancestor fixtures, complete-event preview parity, invalidation, cache-growth fallback and live-binding precedence. Warm calls still pay discovery/stat/cache-validation costs; Codex lineage can require directory discovery. Cold decoding can still use substantial per-transcript memory, and rejected transcripts are retried on each browse.
|
|
72
|
-
|
|
73
|
-
Embedders/tests can use `localHistoryCorpus({ current, roots, home, env, dshSessions })` from the source module `src/history/local.ts`. Each `roots` member overrides that harness's discovery directory; `null` disables it. A supplied `home` with `env: {}` makes the defaults hermetic. These source-module helpers are not new package exports.
|
|
74
|
-
|
|
75
|
-
The shared operations still accept a bare `HistoryProjection` for current-session calls. Host adapters instead supply a `HistoryContext` with a lazy `current()` projection and a `HistoryCorpus`. Filesystem wire decoders live under `src/history/`, import no host SDK/plugin, and are shared by native adapter entries and corpus reads. DSH contributes descriptors through its public query service. Foreign reads do not require loading the current projection; Codex still validates the caller's hook binding and native identity/window before serving them.
|
|
53
|
+
## Recent-session overview speed
|
|
76
54
|
|
|
77
|
-
|
|
55
|
+
Repeated wildcard overviews can reuse saved session summaries for unchanged offline transcripts. Changes to a transcript or its source history invalidate the saved summary; live sessions are read directly. This does not change results, previews or notices. A missing or unusable cache falls back to reading transcripts. Searches may still take time when many sessions match.
|
package/docs/notes-library.md
CHANGED
|
@@ -55,16 +55,16 @@ A new notebook is staged under the notes home and renamed into `project/` with i
|
|
|
55
55
|
|
|
56
56
|
## Per-note policy
|
|
57
57
|
|
|
58
|
-
`NoteMeta` has optional `pinned?: boolean`, `budget?: number`,
|
|
58
|
+
`NoteMeta` has optional `pinned?: boolean`, `budget?: number`, `readonly?: boolean`, and `description?: string` fields. Set these in on-disk frontmatter or in write/update options. Policy values are validated on parse and mutation: booleans must be actual booleans; budget must be a positive safe integer. Invalid policy values raise `NoteError("invalid_policy", ...)` without saving. `description` collapses whitespace to a single line, clears on empty string, and saves over 160 Unicode code points with a warning (the boot index truncates it to 160). Unknown frontmatter remains intact across rewrites. As before, a leading frontmatter block in `write`'s **content** is stripped, not used to set metadata; use the options or edit the on-disk frontmatter instead.
|
|
59
59
|
|
|
60
|
-
`effectiveNotePolicy(meta, path)` returns `{ pinned, budget, readonly }` for a notebook-relative Markdown path (`
|
|
60
|
+
`effectiveNotePolicy(meta, path)` returns `{ pinned, budget, readonly }` for a notebook-relative Markdown path (`CHEATSHEET.md`, not an `@` address). This is the shared default resolver used by storage, tools and boot:
|
|
61
61
|
|
|
62
|
-
- Ordinary pages have a default budget of **
|
|
63
|
-
- Only root `CHEATSHEET.md`
|
|
64
|
-
- Every physical notebook allows **5 live pins**, including existing default pages. Crumpled pins don't count. New pinning, writes that restore notes, explicit restores, and moves/renames all check admission and refuse with `pin_limit` before mutation if they would add a sixth pin. Same-notebook moves of an already-live pin don't consume another slot. Existing over-cap notes can still be edited, unpinned or crumpled. Boot defensively selects at most five pins, default-page-first then path order, visibly naming omitted pins in a manually over-cap notebook.
|
|
62
|
+
- Ordinary pages have a default budget of **8192 UTF-8 bytes**; root `CHEATSHEET.md` defaults to **4096 UTF-8 bytes**, overridable in frontmatter (or store options) to any positive safe integer. `warnings` on write/update/rename results report body overflow without rejecting or truncating the saved file. The separate serialized-file byte limit still applies.
|
|
63
|
+
- Only root `CHEATSHEET.md` defaults to pinned; all other paths, including nested files with that name, default false. Explicit false overrides the default. Raw `meta` keeps absent policy fields absent, so implicit defaults are re-evaluated at a move's destination; explicitly set values travel with the note.
|
|
64
|
+
- Every physical notebook allows **5 live pins**, including existing default pages. Crumpled pins don't count. New pinning, writes that restore notes, explicit restores, and moves/renames all check admission and refuse with `pin_limit` before mutation if they would add a sixth pin. Same-notebook moves of an already-live pin don't consume another slot. Existing over-cap notes can still be edited, unpinned or crumpled. Boot defensively selects at most five pins, default-page-first then path order, visibly naming omitted pins in a manually over-cap notebook. Over-budget pinned bodies are truncated in boot to `budget` UTF-8 bytes on a code-point boundary with `[truncated at X/Y; offset_chars=X]` and an out-of-body `<notesoup:warning>`.
|
|
65
65
|
- `readonly: true` is a **soft lock**, not an authorization/security boundary. Existing locked notes refuse changes, overwrite, crumple/restore, rename/move, and dream deletion with `readonly`. Explicit `readonly: false` permits a metadata-only unlock or unlock plus the requested mutation in one call. A new/unlocked note may be written and locked together. Replacing a locked crumpled move target also requires explicit false. Reads/access counters still write, and filesystem edits can bypass the lock.
|
|
66
66
|
|
|
67
|
-
The
|
|
67
|
+
The model write/update tools expose `pinned`, `readonly`, and `description` (`budget` is not model-adjustable through tools; frontmatter overrides remain supported). Receipts and `notes_list` rows show only policy that differs from the note's path defaults; read metadata keeps the full effective policy. Warnings render inside `<notesoup:warning>...</notesoup:warning>`. Notebook pin admission is serialized across stores **within this process**; manual edits and other processes are not locked by this cooperative API.
|
|
68
68
|
|
|
69
69
|
## Library and plugin boundary
|
|
70
70
|
|
package/docs/reset-lifecycle.md
CHANGED
|
@@ -64,7 +64,7 @@ After a manual safety reset, `context_with_system` checks the committed boundary
|
|
|
64
64
|
|
|
65
65
|
Budget reminders are staged once per window at reserve plus reminder margin, then reserve plus warning runway. Hard reserve remains independent. Budget and command warnings use different types. The final budget warning notifies at first provider injection, not durability; early guidance stays UI-silent. Budget drafts are instance-local and discarded on abort, failed turn, transition or window mismatch. Active-window usage and the exact public `SettingsManager` authority determine thresholds.
|
|
66
66
|
|
|
67
|
-
Pi and Claude use the same budget warning: budget timing, the handoff checklist, note maintenance (including updating and trimming pinned pages, CHEATSHEET.md and
|
|
67
|
+
Pi and Claude use the same budget warning: budget timing, the handoff checklist, note maintenance (including updating and trimming pinned pages, `CHEATSHEET.md` by default, and keeping note descriptions accurate), a warning against large tool outputs, then `empty_brain` and the countdown. Pi's manual warnings replace the budget opening with the `/empty` notice inside `<notesoup:budget_notice>`. Optional command text sits after the closing tag as plain text for the closing model's notes; separate human input during close-out is intercepted and carried, never steered. The first-tier reminder reports the remaining room, explains that notes survive the wipe, asks for updated notes and offers an optional `empty_brain`, warning that it also clears what the model says to the human right before emptying. Pi's fixed system protocol retains its existing pre-reset hints; warnings no longer repeat those or the tool's `last_word` description.
|
|
68
68
|
|
|
69
69
|
`before_agent_start` supplies fixed protocol/maps teaching through the public named system sections, without promoting any note body. The hidden user boot remains the closed per-window identity/notes snapshot. `context_with_system` selects that boot by durable window identity, using Pi's canonical checkpoint projection or legacy slicing, and removes only recognized top-level teaching from older combined boots in the request projection; raw history and note quotations remain unchanged. Missing boot aborts safely instead of exposing raw history. Usage estimates use the same projection decision, and pre-send checks include the complete system/tool state. `/tree` summaries are suppressed when crossing reset branches because native branch summarization bypasses this projection.
|
|
70
70
|
|
package/docs/skills.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Skills and dream
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Notesoup skill
|
|
4
4
|
|
|
5
|
-
The package provides `/skill:
|
|
5
|
+
The package provides `/skill:notesoup`, a short self-contained guide to the notes and history tools: note addresses and notebooks, finding and paging notes, searching and paging history, saving recovery state, and what to do when a memory tool is unavailable. It is a fallback for sessions where the boot protocol is missing or unclear and a reference on demand; normal tool calls do not require reading it. It is written independently of the boot text rather than generated from it. The Claude Code Mod ships the same guide; current-session history requires the documented main-session transcript path and a confirmed append head, while explicit `session` selectors use the local cross-harness corpus (offline Claude prefers non-attachment leaves, then the last leaf in transcript order).
|
|
6
6
|
|
|
7
7
|
## Dream
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ The package provides `/skill:memory`, a short self-contained guide to the notes
|
|
|
10
10
|
|
|
11
11
|
In Pi the session gets three hidden `dream_*` tools; they are not declared to the model and are found with `tool_search` or codemode's `searchTools("dream")`:
|
|
12
12
|
|
|
13
|
-
- `dream_begin(
|
|
13
|
+
- `dream_begin(cwd?)` opens one project, by default the current one, as in `@projects/<name>/`. Pass `cwd` to select a directory's project (relative paths resolve against the host cwd). It lists that project's notes and every session note whose frontmatter `project` names it, crumpled notes included. While it is open, `notes_write` and `notes_update` may edit those addresses (existing notes only in other sessions), and reads leave no access stamp. Other projects stay read-only.
|
|
14
14
|
- `dream_forget(address)` permanently deletes one crumpled note within reach; live notes refuse.
|
|
15
15
|
- `dream_end()` closes the dream.
|
|
16
16
|
|