notesoup 0.57.4 → 0.58.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -1
- package/dist/plugins/claude/src/helper.js +2 -11
- package/dist/plugins/claude/src/thresholds.js +23 -43
- package/dist/plugins/codex/src/mcp.js +3 -11
- package/dist/plugins/codex/src/state.d.ts +1 -1
- package/dist/plugins/codex/src/state.js +1 -1
- package/dist/plugins/dsh/tools.js +1 -1
- package/dist/plugins/pi/boot.d.ts +1 -1
- package/dist/plugins/pi/boot.js +2 -3
- package/dist/plugins/pi/budget.d.ts +1 -1
- package/dist/plugins/pi/budget.js +1 -1
- package/dist/plugins/pi/render.d.ts +1 -1
- package/dist/plugins/pi/render.js +20 -11
- package/dist/plugins/pi/runtime.js +6 -2
- package/dist/plugins/pi/tool-result.d.ts +2 -1
- package/dist/plugins/pi/window.js +24 -1
- package/dist/src/boot/render.d.ts +3 -4
- package/dist/src/boot/render.js +23 -21
- package/dist/src/boot/text.d.ts +2 -5
- package/dist/src/boot/text.js +12 -9
- package/dist/src/budget/text.d.ts +1 -1
- package/dist/src/budget/text.js +1 -1
- package/dist/src/history/corpus.d.ts +1 -1
- package/dist/src/history/corpus.js +1 -1
- package/dist/src/history/history.d.ts +2 -2
- package/dist/src/history/history.js +5 -8
- package/dist/src/history/query.d.ts +11 -3
- package/dist/src/history/query.js +7 -11
- package/dist/src/index.d.ts +4 -3
- package/dist/src/index.js +1 -1
- package/dist/src/notes/constants.d.ts +1 -1
- package/dist/src/notes/constants.js +1 -1
- package/dist/src/notes/errors.d.ts +1 -1
- package/dist/src/notes/frontmatter.d.ts +2 -1
- package/dist/src/notes/frontmatter.js +3 -1
- package/dist/src/notes/index.d.ts +1 -0
- package/dist/src/notes/index.js +1 -0
- package/dist/src/notes/policy.d.ts +16 -0
- package/dist/src/notes/policy.js +43 -0
- package/dist/src/notes/store.d.ts +7 -2
- package/dist/src/notes/store.js +61 -19
- package/dist/src/result.d.ts +21 -0
- package/dist/src/result.js +18 -0
- package/dist/src/text-match.d.ts +8 -0
- package/dist/src/text-match.js +34 -0
- package/dist/src/tools/dream.d.ts +9 -1
- package/dist/src/tools/dream.js +2 -1
- package/dist/src/tools/history.js +14 -5
- package/dist/src/tools/notes.d.ts +75 -13
- package/dist/src/tools/notes.js +58 -19
- package/dist/src/tools/output.d.ts +1 -3
- package/dist/src/tools/output.js +1 -19
- package/dist/src/tools/result.d.ts +2 -20
- package/dist/src/tools/result.js +4 -18
- package/dist/src/tools/schema.d.ts +3 -7
- package/dist/src/tools/schema.js +10 -16
- package/dist/test/agent-loop.test.js +78 -6
- package/dist/test/boot.integration.test.js +30 -3
- package/dist/test/claude-mod.test.js +101 -16
- package/dist/test/codex-history.test.js +2 -2
- package/dist/test/codex-plugin.test.js +2 -0
- package/dist/test/dependencies.test.js +38 -3
- package/dist/test/dsh.test.js +1 -1
- package/dist/test/helpers/dependency-graph.js +12 -6
- package/dist/test/helpers/extension.d.ts +2 -1
- package/dist/test/history.integration.test.js +47 -1
- package/dist/test/host-neutral.test.js +4 -3
- package/dist/test/model-facing-text.test.js +20 -16
- package/dist/test/note-policy.test.d.ts +1 -0
- package/dist/test/note-policy.test.js +227 -0
- package/dist/test/notes.integration.test.js +9 -9
- package/dist/test/notes.test.js +4 -4
- package/dist/test/pi-render.test.js +28 -1
- package/dist/test/project-namespace.test.js +1 -1
- package/docs/architecture.md +10 -7
- package/docs/claude-code-mod.md +3 -3
- package/docs/dsh.md +1 -1
- package/docs/notes-library.md +19 -6
- package/docs/reset-lifecycle.md +2 -2
- package/docs/tool-results.md +3 -1
- package/package.json +12 -12
- package/playbook.md +1 -1
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/dist/claude/helper.js +535 -439
- package/plugins/claude/hooks/register.ts +26 -36
- package/plugins/claude/playbook.md +1 -1
- package/plugins/claude/skills/dream/SKILL.md +1 -1
- package/plugins/claude/skills/memory/SKILL.md +1 -1
- package/plugins/claude/src/helper.ts +2 -11
- package/plugins/claude/src/thresholds.ts +22 -42
- package/plugins/codex/dist/codex/notesoup.js +519 -403
- package/plugins/codex/src/mcp.ts +5 -12
- package/plugins/codex/src/state.ts +1 -1
- package/plugins/dsh/tools.ts +2 -1
- package/plugins/pi/boot.ts +3 -4
- package/plugins/pi/budget.ts +1 -1
- package/plugins/pi/render.ts +20 -8
- package/plugins/pi/runtime.ts +6 -2
- package/plugins/pi/tool-result.ts +2 -1
- package/plugins/pi/window.ts +20 -1
- package/skills/dream/SKILL.md +1 -1
- package/skills/memory/SKILL.md +1 -1
- package/src/boot/render.ts +24 -21
- package/src/boot/text.ts +12 -9
- package/src/budget/text.ts +1 -1
- package/src/history/corpus.ts +1 -1
- package/src/history/history.ts +5 -6
- package/src/history/query.ts +11 -14
- package/src/index.ts +5 -2
- package/src/notes/constants.ts +1 -1
- package/src/notes/errors.ts +1 -1
- package/src/notes/frontmatter.ts +4 -2
- package/src/notes/index.ts +1 -0
- package/src/notes/policy.ts +49 -0
- package/src/notes/store.ts +63 -24
- package/src/result.ts +26 -0
- package/src/text-match.ts +32 -0
- package/src/tools/dream.ts +2 -1
- package/src/tools/history.ts +15 -6
- package/src/tools/notes.ts +60 -20
- package/src/tools/output.ts +1 -17
- package/src/tools/result.ts +4 -26
- package/src/tools/schema.ts +11 -17
- package/dist/plugins/codex/src/history.d.ts +0 -3
- package/dist/plugins/codex/src/history.js +0 -2
- package/dist/plugins/codex/src/transcript.d.ts +0 -3
- package/dist/plugins/codex/src/transcript.js +0 -2
- package/plugins/codex/src/history.ts +0 -3
- package/plugins/codex/src/transcript.ts +0 -3
|
@@ -10,7 +10,7 @@ import { createNotesStore } from "../src/notes/index.js";
|
|
|
10
10
|
import { assertAddress } from "../src/notes/address.js";
|
|
11
11
|
import { normalizeRemote, projectKey } from "../src/notes/project-namespace.js";
|
|
12
12
|
import { notesList, notesRead, notesSearch, notesUpdate, notesWrite } from "../src/tools/notes.js";
|
|
13
|
-
import { success } from "../src/
|
|
13
|
+
import { success } from "../src/result.js";
|
|
14
14
|
import { notesToolContext } from "../src/tools/notes-context.js";
|
|
15
15
|
const toolContext = (identity) => notesToolContext(identity, "/work/current");
|
|
16
16
|
function fixture(t) {
|
package/docs/architecture.md
CHANGED
|
@@ -11,14 +11,15 @@ notesoup uses Pi's session branch as the durable source of truth. It does not ma
|
|
|
11
11
|
| `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
12
|
| `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
13
|
| `boot/snapshot.ts` | Load each of the five notebooks once; isolate filesystem errno failures | Explicit identity, captured time and optional scope loader |
|
|
14
|
-
| `boot/render.ts`, `boot/text.ts` | Render
|
|
14
|
+
| `boot/render.ts`, `boot/text.ts` | Render window data separately from fixed protocol/maps teaching; retain a combined boot for other hosts | Explicit snapshot and logical tool-name bindings; no I/O or clock |
|
|
15
15
|
| `history/history.ts` | Project decoded events and pair tool calls/results, preserving supplied addresses | Decoded items and branch visibility; never inference messages |
|
|
16
|
-
| `history/query.ts` | Bounded paging, `from` selection, literal matching, folding and chronological cross-session hit merging |
|
|
16
|
+
| `history/query.ts` | Bounded paging, `from` selection, literal matching, folding and chronological cross-session hit merging | Caller-supplied budget check and page-too-large facts; no tool dependencies or native SDK/session traversal |
|
|
17
17
|
| `history/corpus.ts`, `history/local.ts` | Session selector resolution and read-only local discovery, with explicit roots/env | Lazy projections and canonical identities; DSH contributes service-backed descriptors |
|
|
18
18
|
| `history/pi.ts`, `history/claude.ts`, `history/codex.ts`, `history/codex-transcript.ts` | Persisted wire decoding, stable seq allocation and recorded branch/lineage evidence | Node/structural data only; no SDK or plugin imports; shared by corpus and native adapter entries |
|
|
19
19
|
| `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
20
|
| `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
|
-
| `
|
|
21
|
+
| `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; one bounded result feeds both text and structured output |
|
|
22
23
|
| `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 |
|
|
23
24
|
| `dream/settings.ts` | Dreamer-pattern validation over the merged record | Parsed values only; no SDK or I/O |
|
|
24
25
|
| `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 |
|
|
@@ -35,7 +36,7 @@ notesoup uses Pi's session branch as the durable source of truth. It does not ma
|
|
|
35
36
|
|
|
36
37
|
In the notes vocabulary a **namespace** is a note partition: a `Scope` plus its storage directory (`session`, `@project`, `@human`, `@self`, `@model`, or a named `@projects`/`@agents`/`@models` member). Pi's `ToolNamespace` in `plugins/pi/tool-result.ts` is a tool-registration group (`notes`, `history`) and is unrelated; the word "home" is reserved for the store root directory.
|
|
37
38
|
|
|
38
|
-
Dependencies flow from a plugin into the core, never back. Core code under `src/` cannot import an SDK or anything under `plugins/`, and a plugin cannot import another plugin's modules or a foreign host SDK; a plugin reaches note storage only through `src/notes/index.ts`. Each plugin owns its host's words: the Pi-only pre-reset hints, the `last_word` nudge and the `/empty <prompt>` close-out live in `plugins/pi/text.ts`, and the Claude wipe, missing-history and warning prose in `plugins/claude/src/text.ts`. `test/dependencies.test.ts` uses TypeScript resolution and AST traversal over every core source and each plugin tree, and tests rejecting indirect, aliased, dynamic and import-type edges. Shared external packages must be declared in the package manifest. `typebox` is declared as a peer and development dependency rather than imported through Pi's SDK.
|
|
39
|
+
Dependencies flow from a plugin into the core, never back. Core code under `src/` cannot import an SDK or anything under `plugins/`, and a plugin cannot import another plugin's modules or a foreign host SDK; a plugin reaches note storage only through `src/notes/index.ts`. History under `src/history/` cannot reach `src/tools/` directly or transitively, including type-only edges through shared modules. Each plugin owns its host's words: the Pi-only pre-reset hints, the `last_word` nudge and the `/empty <prompt>` close-out live in `plugins/pi/text.ts`, and the Claude wipe, missing-history and warning prose in `plugins/claude/src/text.ts`. `test/dependencies.test.ts` uses TypeScript resolution and AST traversal over every core source and each plugin tree, and tests rejecting indirect, aliased, dynamic and import-type edges. Shared external packages must be declared in the package manifest. `typebox` is declared as a peer and development dependency rather than imported through Pi's SDK.
|
|
39
40
|
|
|
40
41
|
The configured extension is `plugins/pi/index.ts`, loaded straight from TypeScript — no bundling step, so git installs work without a build. Its `pi-ai/utils/estimate` dependency is vendored in `plugins/pi/estimate.ts` because Pi's root-package aliases misresolve that public subpath on source loads; host-owned SDK APIs stay external. The package root `.` exports the host-neutral core, `./pi` the Pi plugin, `/notes` the standalone library, and `./dsh` plus `./dsh/engine` the Cordis rows. The CLI is `dist/plugins/pi/dream/cli.js`, and the Claude Code plugin is the self-contained `plugins/claude/` directory. Old internal bags, `NotesContext`, root history helpers and the deep-entry export alias are removed. This breaks source/import paths, not storage: the on-disk notes layout is unchanged and host-independent — `pi/session/<sessionId>/` is a historical directory name every host still writes to, not a Pi adapter choice, and nothing migrates it. Note notebooks, metadata, session paths and raw history remain intact. There is no universal Harness, host-event emulator, registry, daemon or speculative second backend. No `src/window` exists because the current window responsibilities are genuinely native.
|
|
41
42
|
|
|
@@ -53,19 +54,21 @@ Boot and reminder deduplication inspect the current branch-local window. Reloadi
|
|
|
53
54
|
|
|
54
55
|
Manual `/fresh-window` stores command settlement policy and sends a hidden warning: idle commands start a model turn, running commands steer it. Tool requests are recorded independently and retained under that policy. Every command settles and stops unless separate human input arrives during close-out; command text is supplied only to the closing window for its notes. Tool, hard-reserve and overflow resets never replay input already submitted to a model request. Only withheld command-close-out input or native queued new messages cross into the fresh window. Budget warnings create no reset state: only an explicit tool request, hard reserve or bounded overflow recovery triggers a reset. Abort and ordinary errors do not count as successful settlement. Hard reserve preserves a bare command's stop in a run-scoped latch; `context_with_system` cancels only an empty tool-batch follow-up after confirming the committed boundary. Queued user input is answered before stopping. See [reset lifecycle](reset-lifecycle.md) for the state and recovery rules.
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
Pi's `before_agent_start` mutates the public `systemPromptOptions.sections`: `notesoup_protocol` contains only the existing fixed protocol and maps/pin-policy teaching (with Pi's tool bindings, pre-reset hints and live named/nameless variant), alongside `notesoup_tools`. It never replaces the whole system prompt or reads notes. Pi persists/diffs these named sections and retains them across native reset checkpoints; unchanged teaching produces no duplicate patch. Development and verification use the published Pi 1.5.0 family: `pi-coding-agent`, `pi-agent-core`, `pi-ai` and `pi-tui` are pinned together at 1.5.0 in npm's manifest/lock, with optional host peers requiring `^1.5.0`. TypeBox schemas come directly from `typebox`, not Pi AI's removed schema re-exports.
|
|
58
|
+
|
|
59
|
+
The Pi boot remains a fixed snapshot for its window, stored as a hidden extension custom message and converted to a user-role model message. It contains only the window identity/tree and notes index/pinned bodies: no note, including `@human`, becomes a system instruction, and readonly semantics are unchanged. On resume, provider projection removes only a recognized old boot's consecutive top-level identity -> protocol -> maps -> notes prefix teaching; tags or quotations inside note bodies and ordinary messages remain untouched. Persisted boot/history bytes are never rewritten. Claude, Codex and dsh retain the combined renderer and their existing injection paths. History internally distinguishes native system summaries and extension-authored custom messages; its public `context` event groups both without implying provider instruction priority. Boot injection is silent, including startup, reload, and boot repair. `/empty` and `/fresh-window` acknowledge a new request with `🥣 Dumping Brain`. Normal reset completion is silent; only forced reset completion produces `🥣 Brain forcibly emptied: overflow` through `ctx.ui.notify`, after the verified checkpoint, marker, boot, and continuation are present in the session. Committed resets are checked at the next turn start or final settlement. `plugins/pi/reset/committed.ts` confirms an ordered hidden boot/continuation after a checkpoint-backed marker even when later conversation exists. That is distinct from `inspectResetTail`, which refuses suffix repair after real work or malformed ordering. Uncommitted reset drafts never announce success. Boot and continuation messages retain `display: false`.
|
|
57
60
|
|
|
58
61
|
The Pi history adapter supplies the selected raw session branch on demand without a cache. Its shared wire decoder allocates stable seq values from the session's append-order entry list, then selects current-branch-only visibility, so navigation cannot expose a sibling's history. Shared history pairs and queries those decoded events; it neither traverses SessionReader nor reconstructs inference messages. Optional `session` targeting uses a lazy `HistoryContext`/`HistoryCorpus`; filesystem-only Pi/Claude/Codex wire decoders are shared under `src/history/`, while DSH contributes descriptors through its native query service. Omitted `session` retains the original result/header/recipe shapes; explicit selectors carry canonical session identity throughout, and wildcard search merges hits chronologically without cross-session seq cursors. See [cross-session history](history-sessions.md). The public stream combines each tool call with its result at the call seq; paired result slots are not public event addresses, and unpaired results retain their own seq. Summaries and injected messages project as `context`. List pages chronologically with seq anchors and an explicit `from`. Tool executions retain structured call/result facts and any native nested-call metadata. A deterministic event document supplies both query-match positions and read windows. Nested calls have no independent seq and never imply that unrecorded child outputs are available.
|
|
59
62
|
|
|
60
63
|
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.
|
|
61
64
|
|
|
62
|
-
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.
|
|
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: root CHEATSHEET/MAP default pinned, every page defaults to a 2048-code-point advisory budget, and readonly defaults false (a soft lock, not security). Storage serializes pin admission per notebook (five live pins) before file mutation; boot uses that metadata to inject full pinned bodies with budget warnings, visibly naming omitted pins in manually over-cap notebooks.
|
|
63
66
|
|
|
64
67
|
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.
|
|
65
68
|
|
|
66
69
|
Notes/history operations return schema-derived `Outcome<T>` values, not host `content` objects. One bounded candidate is measured against both its complete structured serialization and its text renderer. Pi registers the outcome schema and packages that same value as `structuredContent`, derives `isError` from it and puts rendered text in `content`. Claude uses the same operations and renderers. Neither adapter parses text or independently chooses a page. Read continuation hints follow Pi's native trailing-notice style and are not part of the addressed text. See [tool results](tool-results.md) for the breaking protocol and coordinate contract.
|
|
67
70
|
|
|
68
|
-
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, but an existing native checkpoint/marker still excludes earlier history and native compaction is still cancelled on that marked branch; a fresh root may use native Pi semantics. Threshold and warning accounting use active-window provider usage rather than pre-reset global usage. 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.
|
|
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, but an existing native checkpoint/marker still excludes earlier history and native compaction is still cancelled on that marked branch; a fresh root may use native Pi semantics. 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.
|
|
69
72
|
|
|
70
73
|
## Evidence and limits
|
|
71
74
|
|
package/docs/claude-code-mod.md
CHANGED
|
@@ -6,15 +6,15 @@ There is no independent proactive automatic clear line: crossing a measured thre
|
|
|
6
6
|
|
|
7
7
|
1. `$.session.usage({breakdown:"summary"}).context.breakdown.autoCompactThreshold` when it is a positive number, with `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` applied the way Claude applies it (it can only lower the point);
|
|
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; `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` lowers this fallback point by the same formula. With auto-compaction off, the percent override is ignored;
|
|
9
|
-
3. otherwise the percent fallback, which
|
|
9
|
+
3. otherwise the percent fallback, which assumes a classic 200K capacity, applies the same configured-window caps and token derivation, then converts the points to percentages.
|
|
10
10
|
|
|
11
|
-
The warning remains `resetMarginTokens` (default 8192) plus `warningRunwayTokens` (default `WARNING_RUNWAY_TOKENS`, 16384) below that point. The internal reset-derived intermediate is only warning math, not a clear trigger. 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 budget warning. `DISABLE_COMPACT=1` is detected at `session.start`, logs once, suppresses budget warnings and explicit resets, 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.
|
|
11
|
+
The warning remains `resetMarginTokens` (default 8192) plus `warningRunwayTokens` (default `WARNING_RUNWAY_TOKENS`, 16384) below that point. Resolved points are reused only while the current model, threshold inputs and settings match; changing context fill alone does not invalidate them. The internal reset-derived intermediate is only warning math, not a clear trigger. 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 budget warning. `DISABLE_COMPACT=1` is detected at `session.start`, logs once, suppresses budget warnings and explicit resets, 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, main-agent tool results or prompt submission carry exactly the same budget warning as Pi, ending with `empty_brain` and the countdown. Delivery is consumed only when the downstream chain accepts the warning. 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 handoff paragraph (normal only when the model called `empty_brain`, otherwise forced), selected once for the new window and reused on retry — the same boot-then-handoff order as Pi — while user `/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 binds the shared reset sentence to `mcp__notesoup__empty_brain`; 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
|
|
|
15
15
|
The model can request the same reset through `empty_brain`, optionally passing a short `last_word` that is retained after the boot and handoff. The tool queues the reset and tells the model to end its turn; compaction runs at main-agent `turn.complete`, never inside a running tool call. Subagents cannot reset the main brain, and `DISABLE_COMPACT` sessions refuse the tool without queuing a reset. Successful reset or session change clears the pending request and sticky note.
|
|
16
16
|
|
|
17
|
-
`/empty` and its alias `/fresh-window` request the same reset. While idle it submits one hidden normal-model close-out turn to let the model save notes, then resets at `turn.complete`; while busy it waits for the current turn instead. The close-out prompt is the same shared warning text the automatic path shows. Interactive resets use `$.session.compact`. Headless (`-p` / SDK) resets instead queue the native command with `$.command.run({command:"compact"})` after `turn.complete`; Claude Code 2.1.299 runs this command non-interactively and invokes the same plugin's compact hook. Only that internally initiated command admits the manual trigger; user `/compact` remains vetoed. The command receipt is not a compaction result: successful completion also requires the hook to have prepared the notes boot.
|
|
17
|
+
`/empty` and its alias `/fresh-window` request the same reset. While idle it submits one hidden normal-model close-out turn to let the model save notes, then resets at `turn.complete`; while busy it waits for the current turn instead. The close-out prompt is the same shared warning text the automatic path shows. If that prompt cannot load, submission fails, or another hook drops it, the request is cancelled so `/fresh-window` can retry; an unrelated later turn does not reset on its behalf. Interactive resets use `$.session.compact`. Headless (`-p` / SDK) resets instead queue the native command with `$.command.run({command:"compact"})` after `turn.complete`; Claude Code 2.1.299 runs this command non-interactively and invokes the same plugin's compact hook. Only that internally initiated command admits the manual trigger; user `/compact` remains vetoed. The command receipt is not a compaction result: successful completion also requires the hook to have prepared the notes boot. Once the close-out has started, rejected or vetoed compactions keep their pending request and sticky note for retry. Native command/caveat/output rows remain in the next request alongside the fresh boot; no compaction model request is made. Boot acquisition failure vetoes reset, leaving the current window intact. A Claude dream backend is not implemented; budget reporting (`get_context_remaining`) remains Pi-only, while the one warning per window follows Claude's own configuration.
|
|
18
18
|
|
|
19
19
|
The notes tools also serve subagent calls, using the same session identity and shared operations. The plugin exposes the shared memory and dream skills and the dream playbook; the build keeps these copies byte-identical to the canonical files.
|
|
20
20
|
|
package/docs/dsh.md
CHANGED
|
@@ -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 | Up to **
|
|
50
|
+
| Boot bounds | Up to **5 live pins** and **3 recent notes per notebook**, from the shared policy/renderer. Root CHEATSHEET/MAP default pinned; explicit `pinned:false` overrides. All pages default to a **2048-code-point advisory budget**, adjustable per note. Pinned bodies arrive **whole**, with over-budget warnings instead of truncation; 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/notes-library.md
CHANGED
|
@@ -34,19 +34,32 @@ const matches = await notes.search(["library"]);
|
|
|
34
34
|
|
|
35
35
|
The standalone store does **not** accept `cwd`: its `projectKey` is already the resolved storage identity. The shared model-tool operations exported from the package root instead take a `NotesToolContext`, constructed with `notesToolContext(identity, baseCwd)`. Their optional `cwd` parameter selects the current project for one call. A relative override resolves against the host-supplied `baseCwd`, never a helper or MCP process cwd; an explicit override must be an existing directory or the operation refuses with `invalid_cwd`. The resolver preserves the session, notes root, agent, model, and dream marker while replacing only `projectKey`. It does not mutate the context or affect later calls. Bare session notes stay in that session, although a newly created one records the selected project in its ownership metadata.
|
|
36
36
|
|
|
37
|
-
- `write(address, content, { origin? }?)` returns `Promise<{ meta, outcome }>` (`created`, `
|
|
37
|
+
- `write(address, content, { origin?, pinned?, budget?, readonly? }?)` returns `Promise<{ meta, outcome, warnings }>` (`created`, `overwrote` or `uncrumpled`). New notes default to origin `self`; overwriting preserves the existing origin unless explicitly supplied, creation time, project ownership, and unknown metadata, and always produces an uncrumpled note (it clears any `crumpledAt`).
|
|
38
38
|
- `read(address)` returns `Promise<{ meta, body, resolvedScope } | undefined>`. Reads update `lastAccessed` and `accessCount` on disk, except explicit named project/session reads, which leave the file untouched. The body is separate from metadata; the serialized frontmatter is not part of the read API.
|
|
39
|
-
- `update(address, edits?, { origin?, crumpled?, replaceAll?, renameTo? }?)` returns `Promise<{ meta, applied, resolvedScope, change, moved, replacedCrumpledTarget }>`. Body edits, origin, crumpled state and a move can be combined. Every edit, destination and size check passes before saving; a live target refuses with `already_exists`, while a crumpled target can be replaced. Moves into or out of the current session notebook update project ownership; explicit named session addresses are read-only. Each replacement uses the evolving body in array order. `crumpled: true` keeps an existing `crumpledAt` or adds it; false removes it; omitted preserves it. `updatedAt` advances for body/origin changes and actual moves, not crumpling alone. `change` contains `{ kind, before, after }`, with kind `body`, `metadata` or `none`; a body edit that also changes metadata or moves includes the whole serialized file in its diff inputs. Moves lock both paths in stable order, atomically write the destination, then remove the source; this is not a crash-atomic two-file transaction.
|
|
40
|
-
- `rename(fromAddress, toAddress)` returns `Promise<{ meta, replacedCrumpledTarget }>`. It delegates to the same update path with `renameTo`, preserving metadata. A same-file destination, including a case or symlink alias resolved by the filesystem, applies accompanying edits without removing the source. An exact path alias needs only one lock.
|
|
39
|
+
- `update(address, edits?, { origin?, pinned?, budget?, readonly?, crumpled?, replaceAll?, renameTo? }?)` returns `Promise<{ meta, warnings, applied, resolvedScope, change, moved, replacedCrumpledTarget }>`. Body edits, origin, crumpled state and a move can be combined. Every edit, destination and size check passes before saving; a live target refuses with `already_exists`, while a crumpled target can be replaced. Moves into or out of the current session notebook update project ownership; explicit named session addresses are read-only. Each replacement uses the evolving body in array order. `crumpled: true` keeps an existing `crumpledAt` or adds it; false removes it; omitted preserves it. `updatedAt` advances for body/origin/policy changes and actual moves, not crumpling alone. `change` contains `{ kind, before, after }`, with kind `body`, `metadata` or `none`; a body edit that also changes metadata or moves includes the whole serialized file in its diff inputs. Moves lock both paths in stable order, atomically write the destination, then remove the source; this is not a crash-atomic two-file transaction.
|
|
40
|
+
- `rename(fromAddress, toAddress)` returns `Promise<{ meta, warnings, replacedCrumpledTarget }>`. It delegates to the same update path with `renameTo`, preserving metadata. A same-file destination, including a case or symlink alias resolved by the filesystem, applies accompanying edits without removing the source. An exact path alias needs only one lock.
|
|
41
41
|
- `list({ glob?, crumpled? }?)` returns `Promise<NoteRow[]>`, sorted by update time descending with address tie-breaking. Rows contain address, scope, virtual path, metadata, body, and body byte size. Crumpled notes are excluded by default; `crumpled: true` returns only crumpled notes.
|
|
42
|
-
- `search(queries: string[], { glob?, crumpled? }?)` returns `Promise<NoteSearchRow[]>`, sorted by address, with the same selection and crumpled-note rules. An empty queries array returns matching notes with empty `matches`. Otherwise search is case-insensitive literal OR over body lines; matches contain one-based `line`, `text`, and code-point `offsetChars` into the body. Neither listing nor search increments access metadata.
|
|
42
|
+
- `search(queries: string[], { glob?, crumpled? }?)` returns `Promise<NoteSearchRow[]>`, sorted by address, with the same selection and crumpled-note rules. Rows also carry body-budget `warnings`. An empty queries array returns matching notes with empty `matches`. Otherwise search is case-insensitive literal OR over body lines; matches contain one-based `line`, `text`, and code-point `offsetChars` into the body. Neither listing nor search increments access metadata.
|
|
43
43
|
|
|
44
44
|
`list` and `search` share `NotesQuery`: **glob is the only notebook/path selector**. Omit it or use the bare collection alias `@default` for the five current notebooks. Explicit `*` or `**` searches all notebooks, including other sessions, projects, agents and models (any pattern without `@` or `/` matches note filenames at any depth as `**/<pattern>`); `@sessions/*/**` selects all session notebooks. Use `@project/**`, `@self/**`, or `@projects/<name>/**` to select a notebook. `@default` is query-only, not a directory or a read/write address; `@default/**` is not its spelling. The former `scope`/`who` query parameters are removed, without compatibility aliases. Row metadata still includes scope.
|
|
45
45
|
|
|
46
|
-
The library returns full data, not tool envelopes or paginated/truncated output. `NoteError` exposes the existing named store refusals through `code`, with `lineNumbers` for ambiguous edits and `editIndex` for a failed edit. Runtime API fields and known persisted note metadata use camelCase; Pi tool wire fields such as `updated_at`, `offset_chars`, and `replace_all` retain their established names. The notes partition status field is `NoteQueryStatus.namespacesUnavailable` in the library and `namespaces_unavailable` on the `notes_list`/`notes_search` wire; both replace `NoteQueryStatus.homesUnavailable` and `homes_unavailable` with no compatibility alias, and the on-disk layout is unchanged. Unrecognized frontmatter keys, including old snake_case metadata, are preserved as ordinary extras; they are not interpreted as current camelCase fields or migrated automatically. Invalid addresses/identities and filesystem failures reject; only a missing `read` returns `undefined`. Notes remain markdown files with the existing size limits and same-directory atomic rename. Same-file read/modify/write work is serialized by absolute physical filename across all store instances in this process (including `.md` address aliases);
|
|
46
|
+
The library returns full data, not tool envelopes or paginated/truncated output. `NoteError` exposes the existing named store refusals through `code`, with `lineNumbers` for ambiguous edits and `editIndex` for a failed edit. Runtime API fields and known persisted note metadata use camelCase; Pi tool wire fields such as `updated_at`, `offset_chars`, and `replace_all` retain their established names. The notes partition status field is `NoteQueryStatus.namespacesUnavailable` in the library and `namespaces_unavailable` on the `notes_list`/`notes_search` wire; both replace `NoteQueryStatus.homesUnavailable` and `homes_unavailable` with no compatibility alias, and the on-disk layout is unchanged. Unrecognized frontmatter keys, including old snake_case metadata, are preserved as ordinary extras; they are not interpreted as current camelCase fields or migrated automatically. Invalid addresses/identities and filesystem failures reject; only a missing `read` returns `undefined`. Notes remain markdown files with the existing size limits and same-directory atomic rename. Same-file read/modify/write work is serialized by absolute physical filename across all store instances in this process (including `.md` address aliases). Mutations additionally acquire notebook admission locks in stable order before file locks so concurrent stores cannot admit a sixth pin; reads/scans only acquire file locks. Symlink/case aliases and cross-process locking are not guaranteed. `list` and `search` asynchronously traverse notebooks and serialize each discovered file read against pending mutations, but are not global snapshots and may not discover a file created after traversal. Foreign named notebooks can be read, but their bodies cannot be written or edited through the store. Named project and session reads do not update access metadata. These are cooperative address rules, not an OS security sandbox.
|
|
47
47
|
|
|
48
48
|
Addresses are a relative path (a current-session note), `@project/`, `@human/`, `@self/`, `@model/`, or explicit `@projects/<slug>/`, `@sessions/<id>/`, `@agents/<slug>/` and `@models/<slug>/`. Named project and session addresses are read-only, including for rename sources and destinations. Session IDs use the same safe single-directory-component grammar as `NotesIdentity.sessionId`, not the agent/model slug grammar. Only the first character of an address is sigil-position: an unknown leading `@head` refuses, while `@` inside the path (`release@v1.md`, `@project/mail/alice@example.com.md`) is an ordinary character. Relative self/model addresses resolve to the supplied identity. Results show the current agent's and model's notes as `@self/` and `@model/`; only other agents' or models' notes carry an explicit `@agents/<slug>/` or `@models/<slug>/`. Globs accept either form. The disk layout remains `pi/session/<sessionId>/`, `project/<projectKey>/`, `human/`, `agents/<agent>/`, and `models/<model>/`. No data migration happens on library import or construction. Notes already using camelCase metadata retain their metadata; old snake_case keys are preserved as unrecognized extras, not interpreted or migrated. New session notes record the supplied project key.
|
|
49
49
|
|
|
50
|
+
## Per-note policy
|
|
51
|
+
|
|
52
|
+
`NoteMeta` has optional `pinned?: boolean`, `budget?: number`, and `readonly?: boolean` fields. Set these in on-disk frontmatter or in write/update options. Values are validated on parse and mutation: booleans must be actual booleans; budget must be a positive safe integer. Invalid values raise `NoteError("invalid_policy", ...)` without saving. 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.
|
|
53
|
+
|
|
54
|
+
`effectiveNotePolicy(meta, path)` returns `{ pinned, budget, readonly }` for a notebook-relative Markdown path (`MAP.md`, not an `@` address). This is the shared default resolver used by storage, tools and boot:
|
|
55
|
+
|
|
56
|
+
- All pages have a default budget of **2048 Unicode code points**, adjustable to any positive safe integer. `warnings` on write/update/rename results report body overflow but do not reject it. Astral characters count once. The separate serialized-file byte limit still applies.
|
|
57
|
+
- Only root `CHEATSHEET.md` and `MAP.md` default to pinned; all other paths, including nested files with those names, 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.
|
|
58
|
+
- 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. Pinned bodies are injected whole, with budget warnings rather than truncation.
|
|
59
|
+
- `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.
|
|
60
|
+
|
|
61
|
+
The five model tools accept the same policy options (write/update) and return effective policy visibly in receipts, read metadata, list and search rows, alongside budget warnings. Notebook pin admission is serialized across stores **within this process**; manual edits and other processes are not locked by this cooperative API.
|
|
62
|
+
|
|
50
63
|
## Library and plugin boundary
|
|
51
64
|
|
|
52
65
|
Ownership is explicit in the file tree:
|
|
@@ -80,6 +93,6 @@ A note **namespace** is a partition of the note store: a `Scope` plus its storag
|
|
|
80
93
|
|
|
81
94
|
The disk layout is older than this split and is shared by every host: `pi/session/<sessionId>/` is a historical directory name, not the Pi adapter's private layout, and nothing here migrates or renames it.
|
|
82
95
|
|
|
83
|
-
The public runtime exports
|
|
96
|
+
The public runtime exports include `createNotesStore`, `effectiveNotePolicy(meta, path)`, `noteIdentity`, `NoteError`, `projectKey(cwd)`, and `slugify(value)`, alongside the API's TypeScript types. The factory and `projectKey` remain synchronous; `projectKey` provides the existing repository/worktree identity algorithm, while `slugify` normalizes an agent/model name. The six primary store methods return promises and use asynchronous filesystem operations. Path/glob helpers, serialization, validation internals and constants are implementation details, not exported through `/notes`.
|
|
84
97
|
|
|
85
98
|
The Pi plugin supplies the root and live session/project/agent/model identity on each call. Tools and boot use the same storage implementation. Shared tool schemas use `typebox`, declared as a peer supplied by Pi and as a dev dependency for standalone development; note handlers accept a `NotesToolContext` containing the explicit default identity and host base cwd, while history handlers accept decoded history projections or a lazy `HistoryContext`/`HistoryCorpus` for optional cross-session lookup. Pi owns registration, execution-context extraction and native edit diff rendering. Boot snapshot acquisition receives identity, a captured timestamp and an optional notebook loader; rendering receives explicit logical tool names. Native live session traversal and active-head/branch identity stay in each adapter; SDK-free persisted wire decoding and stable seq allocation are shared under `src/history/` for native and cross-harness reads. Shared history is a query view, never a way to reconstruct inference messages. There are no compatibility shims or generic host runtime. Internal source paths are not the supported library API.
|
package/docs/reset-lifecycle.md
CHANGED
|
@@ -62,9 +62,9 @@ After a manual safety reset, `context_with_system` checks the committed boundary
|
|
|
62
62
|
|
|
63
63
|
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.
|
|
64
64
|
|
|
65
|
-
Pi and Claude use the same budget warning: budget timing, the handoff checklist, note maintenance (including updating and trimming CHEATSHEET.md and MAP.md), 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
|
|
65
|
+
Pi and Claude use the same budget warning: budget timing, the handoff checklist, note maintenance (including updating and trimming pinned pages, CHEATSHEET.md and MAP.md by default), 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.
|
|
66
66
|
|
|
67
|
-
`context_with_system` selects
|
|
67
|
+
`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.
|
|
68
68
|
|
|
69
69
|
`resetBoundaryCommitted` validates checkpoint -> marker -> matching hidden boot -> hidden continuation; trailing last words, carried input or later conversation cannot undo that committed prefix. `inspectResetTail` checks the entire repairable suffix: optional last word and carried inputs must follow the continuation, with no duplicate/misordered artifacts or later conversation. A carried input before boot/continuation blocks repair rather than allowing metadata to be appended after human content. Startup/tree repair only fills missing boot/continuation when safe, rechecking lifecycle identity after notes acquisition. UI success notices use committed confirmation, not repairability.
|
|
70
70
|
|
package/docs/tool-results.md
CHANGED
|
@@ -69,9 +69,11 @@ One selection determines the structured result and its text. Both complete repre
|
|
|
69
69
|
|
|
70
70
|
`after_seq` is a strict lower bound; `after_seq: 0` starts from the beginning. History pages carry boolean `has_older` and `has_newer` flags. For single-session pages, use the first item’s `seq` as `before_seq` to page older, and the last item’s `seq` as `after_seq` to page newer; include its `session` when present. Wildcard pages instead report more results and suggest narrowing by time, query, roles or session pattern; an overview with unvisited sessions may have more. The single-session rendered newer footer gives `→ newer: {"after_seq":...}` with an optional session. `from` picks which end of a bounded range `limit` counts from: it defaults to `oldest` when `after_seq` is set, and `newest` otherwise. Explicit `from` wins. `since`/`until` narrow that range by event `created_at`, and only a single-session call without roles or a non-empty query folds tool/context runs. Omitted queries, empty strings and empty lists all disable search filtering; empty entries in a query list are ignored. Without a query, notes search returns scoped notes with empty `matches`, not every body line. Notes listings/search are snapshots with a `more` count and can be narrowed by `glob`; they are not falsely advertised as paginated. A read can stop anywhere in the event document, including inside serialized arguments; concatenate its verbatim text slices before parsing any arguments. There is no separately truncated arguments object.
|
|
71
71
|
|
|
72
|
+
`notes_write` and `notes_update` accept optional `pinned`, `budget`, and `readonly` policy fields. Their receipts, list/search rows, and read `metadata` expose the effective `pinned`, `budget`, and `readonly` values as structured fields **and visible text**. Successes also carry a `warnings` array (per file for list/search), rendered visibly when a body exceeds its budget: the default is 2048 Unicode code points for every page, adjustable per note. Overflow saves successfully; boot injects full pinned bodies instead of cutting them. Pi's custom write/update/read renderers show policy and warnings even when collapsed, outside the expandable body/diff and clipped summary. A readonly note refuses mutations with `readonly` until explicitly unlocked with `readonly:false`; this is a soft lock, not security. Pin admission refuses a sixth live pin per notebook with `pin_limit`, including restore/move/rename. Invalid policy fields refuse with `invalid_policy`.
|
|
73
|
+
|
|
72
74
|
A note read reports unrecognized frontmatter under `metadata.extra`; a value too large to carry, or past the verbatim budget, is named in place as `[omitted: too large]` under its key rather than delivered in part, and the value itself stays in the note file. A rename receipt uses `address` for the destination and `rename_from` for the source; it has no duplicate `rename_to` field.
|
|
73
75
|
|
|
74
|
-
`output_too_large` is not one failure. Each operation's own message says what it means: a read that cannot deliver a single advancing character is refused rather than answered with an empty window, and a search result whose first match line cannot fit is cut to the longest prefix that does and ends with ` [truncated]`. `notes_update` returns a
|
|
76
|
+
`output_too_large` is not one failure. Each operation's own message says what it means: a read that cannot deliver a single advancing character is refused rather than answered with an empty window, and a search result whose first match line cannot fit is cut to the longest prefix that does and ends with ` [truncated]`. `notes_update` returns a compact policy-bearing receipt plus any budget warning; Pi attaches the rendered diff under `details.diff` for the UI rather than repeating it in model-facing text or `structuredContent`. Narrowing helps only where a parameter genuinely reduces the selection — `glob` or `query`, `roles`, `limit`, `max_chars_per_item`, a `before_seq`/`after_seq` range, or a `since`/`until` time window — and cannot help a read whose own metadata is what overflows. History pages refuse with `page_too_large` for the same reason. Nothing is ever quietly delivered short: every other omission is reported on the successful result that carries it.
|
|
75
77
|
|
|
76
78
|
## Ownership
|
|
77
79
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "notesoup",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.58.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/src/index.js",
|
|
6
6
|
"types": "./dist/src/index.d.ts",
|
|
@@ -66,22 +66,22 @@
|
|
|
66
66
|
"prepack": "npm run build"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"typebox": "*",
|
|
70
|
-
"@earendil-works/pi-agent-core": "*",
|
|
71
|
-
"@earendil-works/pi-ai": "*",
|
|
72
|
-
"@earendil-works/pi-coding-agent": "*",
|
|
73
|
-
"@earendil-works/pi-tui": "*",
|
|
74
69
|
"@deepseek-ai/cordis": "*",
|
|
75
70
|
"@deepseek-ai/cordis-plugin-loader": "*",
|
|
76
71
|
"@deepseek-ai/dsh-agent": "*",
|
|
77
|
-
"@deepseek-ai/dsh-compaction": "*",
|
|
78
72
|
"@deepseek-ai/dsh-commands": "*",
|
|
73
|
+
"@deepseek-ai/dsh-compaction": "*",
|
|
79
74
|
"@deepseek-ai/dsh-llm": "*",
|
|
80
75
|
"@deepseek-ai/dsh-session": "*",
|
|
81
76
|
"@deepseek-ai/dsh-session-query": "*",
|
|
82
77
|
"@deepseek-ai/dsh-system-prompt": "*",
|
|
83
78
|
"@deepseek-ai/dsh-token-meter": "*",
|
|
84
|
-
"@deepseek-ai/dsh-tools": "*"
|
|
79
|
+
"@deepseek-ai/dsh-tools": "*",
|
|
80
|
+
"@earendil-works/pi-agent-core": "^1.5.0",
|
|
81
|
+
"@earendil-works/pi-ai": "^1.5.0",
|
|
82
|
+
"@earendil-works/pi-coding-agent": "^1.5.0",
|
|
83
|
+
"@earendil-works/pi-tui": "^1.5.0",
|
|
84
|
+
"typebox": "*"
|
|
85
85
|
},
|
|
86
86
|
"peerDependenciesMeta": {
|
|
87
87
|
"@earendil-works/pi-agent-core": {
|
|
@@ -132,10 +132,10 @@
|
|
|
132
132
|
},
|
|
133
133
|
"devDependencies": {
|
|
134
134
|
"@deepseek-ai/dsh": "0.2.1-alpha.2",
|
|
135
|
-
"@earendil-works/pi-agent-core": "
|
|
136
|
-
"@earendil-works/pi-ai": "
|
|
137
|
-
"@earendil-works/pi-coding-agent": "
|
|
138
|
-
"@earendil-works/pi-tui": "1.
|
|
135
|
+
"@earendil-works/pi-agent-core": "1.5.0",
|
|
136
|
+
"@earendil-works/pi-ai": "1.5.0",
|
|
137
|
+
"@earendil-works/pi-coding-agent": "1.5.0",
|
|
138
|
+
"@earendil-works/pi-tui": "1.5.0",
|
|
139
139
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
140
140
|
"@types/node": "^22.19.19",
|
|
141
141
|
"esbuild": "^0.28.2",
|
package/playbook.md
CHANGED
|
@@ -27,7 +27,7 @@ Durable notes hold decisions, constraints, and lessons that stay true after the
|
|
|
27
27
|
5. **Relocate misfiled notes.** When a standing ruling or the note's own MAP already names its proper notebook, move it there, preserving its metadata, and update both notebooks' maps. Do it, don't propose it. Propose only when the destination notebook itself is unclear.
|
|
28
28
|
6. **Preserve meaning and provenance.** Keep facts, conditions, exceptions, uncertainty, authorship, and sources. When promoting a finding, cite its source. Do not relabel agent-authored material as human-authored. If its destination or authority is unclear, propose the promotion instead.
|
|
29
29
|
7. **Keep notes manageable.** Aim below about 200 lines / 8KB per note. Split oversized notes by topic with one-line cross-links.
|
|
30
|
-
8. **Keep wake-up pages useful.** Each writable notebook's `CHEATSHEET.md` holds standing reminders, kept to five lines. Its `MAP.md` holds only the note index: durable notes' addresses and short gists. Both load every window when
|
|
30
|
+
8. **Keep wake-up pages useful.** Each writable notebook's `CHEATSHEET.md` holds standing reminders, kept to five lines. Its `MAP.md` holds only the note index: durable notes' addresses and short gists. Both default to pinned and load every window when live unless explicitly unpinned; do not create empty pages. Each notebook allows five live pins. Every page defaults to a 2048-code-point advisory budget, adjustable per note; overflow warns without truncating a pinned body. Preserve standing rules, add promoted notes to the map, and drop entries that no longer hold. Maps follow the same size budget.
|
|
31
31
|
|
|
32
32
|
## Deleting
|
|
33
33
|
|