notesoup 0.53.2 → 0.54.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/README.md +2 -2
- package/dist/plugins/claude/src/helper.js +2 -1
- package/dist/plugins/codex/src/hooks.js +1 -1
- package/dist/plugins/codex/src/identity.d.ts +1 -1
- package/dist/plugins/codex/src/identity.js +3 -3
- package/dist/plugins/codex/src/mcp.js +2 -1
- package/dist/plugins/codex/src/text.d.ts +1 -1
- package/dist/plugins/codex/src/text.js +2 -2
- package/dist/plugins/dsh/engine.js +2 -2
- package/dist/plugins/dsh/tools.js +8 -7
- package/dist/plugins/dsh/window.d.ts +1 -0
- package/dist/plugins/dsh/window.js +7 -3
- package/dist/plugins/pi/history-tools.d.ts +1 -1
- package/dist/plugins/pi/history-tools.js +4 -4
- package/dist/plugins/pi/notes/tools.js +8 -6
- package/dist/plugins/pi/render.js +7 -4
- package/dist/plugins/pi/runtime.js +2 -2
- package/dist/plugins/pi/window.js +21 -7
- package/dist/src/boot/render.js +7 -7
- package/dist/src/boot/snapshot.d.ts +7 -7
- package/dist/src/boot/snapshot.js +17 -17
- package/dist/src/boot/text.d.ts +2 -2
- package/dist/src/boot/text.js +7 -5
- package/dist/src/dream/git.d.ts +2 -11
- package/dist/src/dream/git.js +6 -23
- package/dist/src/dream/lock.d.ts +2 -2
- package/dist/src/dream/lock.js +3 -3
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +3 -2
- package/dist/src/notes/address.d.ts +8 -8
- package/dist/src/notes/address.js +13 -13
- package/dist/src/notes/errors.d.ts +1 -1
- package/dist/src/notes/frontmatter.js +2 -2
- package/dist/src/notes/index.d.ts +1 -1
- package/dist/src/notes/index.js +1 -1
- package/dist/src/notes/paths.d.ts +6 -6
- package/dist/src/notes/paths.js +9 -9
- package/dist/src/notes/{project-home.d.ts → project-namespace.d.ts} +7 -7
- package/dist/src/notes/{project-home.js → project-namespace.js} +67 -25
- package/dist/src/notes/store.d.ts +4 -4
- package/dist/src/notes/store.js +55 -52
- package/dist/src/tools/dream.d.ts +21 -3
- package/dist/src/tools/dream.js +54 -16
- package/dist/src/tools/notes-context.d.ts +10 -0
- package/dist/src/tools/notes-context.js +27 -0
- package/dist/src/tools/notes.d.ts +69 -20
- package/dist/src/tools/notes.js +40 -31
- package/dist/test/boot.integration.test.js +1 -1
- package/dist/test/claude-mod.test.js +89 -43
- package/dist/test/codex-plugin.test.js +18 -1
- package/dist/test/context-edit-budget.test.js +121 -0
- package/dist/test/dependencies.test.js +71 -4
- package/dist/test/dream-tools.test.js +153 -8
- package/dist/test/dsh.test.js +62 -15
- package/dist/test/helpers/dsh.d.ts +4 -1
- package/dist/test/helpers/dsh.js +20 -4
- package/dist/test/helpers/extension.d.ts +5 -0
- package/dist/test/helpers/extension.js +33 -2
- package/dist/test/host-neutral.test.js +17 -15
- package/dist/test/model-facing-text.test.js +12 -8
- package/dist/test/notes-cwd.test.js +114 -0
- package/dist/test/notes-library.test.js +4 -4
- package/dist/test/notes-query-namespaces.test.d.ts +1 -0
- package/dist/test/{notes-query-homes.test.js → notes-query-namespaces.test.js} +13 -13
- package/dist/test/notes.integration.test.js +72 -23
- package/dist/test/notes.test.js +50 -20
- package/dist/test/pi-render.test.js +33 -1
- package/dist/test/project-namespace.test.d.ts +1 -0
- package/dist/test/project-namespace.test.js +324 -0
- package/docs/architecture.md +12 -7
- package/docs/codex.md +4 -4
- package/docs/dsh.md +8 -8
- package/docs/notes-library.md +9 -5
- package/docs/skills.md +3 -3
- package/docs/tool-results.md +6 -2
- package/package.json +4 -6
- package/playbook.md +6 -6
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/dist/claude/helper.js +677 -615
- package/plugins/claude/hooks/register.ts +19 -11
- package/plugins/claude/playbook.md +6 -6
- package/plugins/claude/skills/memory/SKILL.md +4 -4
- package/plugins/claude/src/helper.ts +3 -2
- package/plugins/codex/README.md +1 -1
- package/plugins/codex/dist/codex/notesoup.js +877 -815
- package/plugins/codex/src/hooks.ts +1 -1
- package/plugins/codex/src/identity.ts +3 -3
- package/plugins/codex/src/mcp.ts +2 -1
- package/plugins/codex/src/text.ts +2 -2
- package/plugins/dsh/engine.ts +2 -2
- package/plugins/dsh/tools.ts +8 -7
- package/plugins/dsh/window.ts +8 -3
- package/plugins/paseo/OVERVIEW.md +4 -4
- package/plugins/paseo/README.md +1 -1
- package/plugins/paseo/client/brain-empty-card.tsx +3 -4
- package/plugins/paseo/client/markdown.tsx +179 -0
- package/plugins/paseo/client/notes-op-card.tsx +35 -34
- package/plugins/paseo/client/notes-op-transformer.ts +17 -68
- package/plugins/paseo/client/paper-card.tsx +8 -19
- package/plugins/paseo/client/paper-palette.ts +40 -0
- package/plugins/paseo/client/sticky-card.tsx +6 -4
- package/plugins/paseo/package.json +3 -0
- package/plugins/paseo/paseo-plugin.json +2 -2
- package/plugins/paseo/shared/notes-op.ts +13 -9
- package/plugins/paseo/test/notes-op.test.ts +52 -73
- package/plugins/paseo/test/paper-palette.test.ts +54 -0
- package/plugins/pi/history-tools.ts +4 -4
- package/plugins/pi/notes/tools.ts +8 -6
- package/plugins/pi/render.ts +6 -4
- package/plugins/pi/runtime.ts +2 -2
- package/plugins/pi/window.ts +22 -7
- package/skills/memory/SKILL.md +4 -4
- package/src/boot/render.ts +8 -8
- package/src/boot/snapshot.ts +20 -20
- package/src/boot/text.ts +7 -5
- package/src/dream/git.ts +7 -24
- package/src/dream/lock.ts +3 -3
- package/src/index.ts +4 -3
- package/src/notes/address.ts +13 -13
- package/src/notes/errors.ts +1 -1
- package/src/notes/frontmatter.ts +2 -2
- package/src/notes/index.ts +1 -1
- package/src/notes/paths.ts +9 -9
- package/src/notes/{project-home.ts → project-namespace.ts} +59 -28
- package/src/notes/store.ts +61 -58
- package/src/tools/dream.ts +63 -16
- package/src/tools/notes-context.ts +29 -0
- package/src/tools/notes.ts +39 -29
- package/dist/test/project-home.test.js +0 -134
- /package/dist/test/{notes-query-homes.test.d.ts → context-edit-budget.test.d.ts} +0 -0
- /package/dist/test/{project-home.test.d.ts → notes-cwd.test.d.ts} +0 -0
|
@@ -247,20 +247,23 @@ async function run($: { process: { run: (argv: readonly string[], init?: { cwd?:
|
|
|
247
247
|
// reason (`timed out after …`), which a bare phrase would throw away.
|
|
248
248
|
catch (error) { return { ok: false as const, error: `helper execution failed: ${describeFailure(error)}` } }
|
|
249
249
|
}
|
|
250
|
+
function clearManualRequest(state: ResetState): void {
|
|
251
|
+
state.manualPending = false
|
|
252
|
+
state.toolResetRequested = state.lastWord = undefined
|
|
253
|
+
}
|
|
250
254
|
/** Session start does not fire on /clear, /resume or /branch. Forget the old window on end. */
|
|
251
255
|
function forgetSession(state: ResetState) {
|
|
252
256
|
state.generation++
|
|
253
257
|
state.identity = undefined
|
|
254
258
|
state.historyWindowHead = undefined
|
|
255
259
|
state.window = 0
|
|
256
|
-
state.turnRunning = state.resetting = state.
|
|
260
|
+
state.turnRunning = state.resetting = state.usageFailureLogged = false
|
|
261
|
+
clearManualRequest(state)
|
|
257
262
|
state.manualCompacting = false
|
|
258
263
|
state.preparedBoot = state.retainedBoot = undefined
|
|
259
264
|
state.texts = state.limits = undefined
|
|
260
265
|
state.continuation = undefined
|
|
261
266
|
state.continuationWindow = undefined
|
|
262
|
-
state.toolResetRequested = undefined
|
|
263
|
-
state.lastWord = undefined
|
|
264
267
|
state.limitsAttempts = state.limitsWindow = 0
|
|
265
268
|
state.settingsFailureLogged = state.limitsFailureLogged = false
|
|
266
269
|
state.warnedWindow = state.warningPending = undefined
|
|
@@ -394,10 +397,13 @@ export function register(on: On) {
|
|
|
394
397
|
on("turn.complete", async ($, e, next) => {
|
|
395
398
|
const result = await next(e)
|
|
396
399
|
if (e.agentId !== undefined) return result
|
|
400
|
+
state.turnRunning = false
|
|
397
401
|
if (state.disabled) return result
|
|
402
|
+
// A failed turn proves nothing about whether its notes were saved. Cancel
|
|
403
|
+
// the request instead of compacting now or springing it on a later turn.
|
|
404
|
+
if (e.reason !== "answer" && state.manualPending) cancelManualReset($, state, e.reason)
|
|
398
405
|
if (!await refreshIdentity($, state)) return result
|
|
399
|
-
state.
|
|
400
|
-
if (state.manualPending) await reset($, state)
|
|
406
|
+
if (e.reason === "answer" && state.manualPending) await reset($, state)
|
|
401
407
|
return result
|
|
402
408
|
})
|
|
403
409
|
on("command.run", async ($, e, next) => {
|
|
@@ -459,9 +465,7 @@ export function register(on: On) {
|
|
|
459
465
|
state.retainedBoot = built.boot
|
|
460
466
|
state.preparedBoot = undefined
|
|
461
467
|
state.window++
|
|
462
|
-
state
|
|
463
|
-
state.toolResetRequested = undefined
|
|
464
|
-
state.lastWord = undefined
|
|
468
|
+
clearManualRequest(state)
|
|
465
469
|
log($, "Brain emptied")
|
|
466
470
|
}
|
|
467
471
|
return { messages: built.messages }
|
|
@@ -610,6 +614,12 @@ async function finishManual($: Engine, state: ResetState, signal: { wake?: () =>
|
|
|
610
614
|
} finally { armManual($, state, signal) }
|
|
611
615
|
}
|
|
612
616
|
|
|
617
|
+
/** A non-answer ends the request, never the context; the user can explicitly ask again. */
|
|
618
|
+
function cancelManualReset($: Engine, state: ResetState, reason: "aborted" | "refusal" | "error"): void {
|
|
619
|
+
clearManualRequest(state)
|
|
620
|
+
log($, `Brain emptying cancelled · turn ended ${reason}; ask /fresh-window again`)
|
|
621
|
+
}
|
|
622
|
+
|
|
613
623
|
// The sandbox permits $ forwarding only to file-top-level helpers.
|
|
614
624
|
async function reset($: Engine, state: ResetState): Promise<void> {
|
|
615
625
|
if (!state.identity || state.compactDisabled || state.resetting) return
|
|
@@ -637,9 +647,7 @@ async function reset($: Engine, state: ResetState): Promise<void> {
|
|
|
637
647
|
}
|
|
638
648
|
state.retainedBoot = state.preparedBoot
|
|
639
649
|
state.window++
|
|
640
|
-
state
|
|
641
|
-
state.toolResetRequested = undefined
|
|
642
|
-
state.lastWord = undefined
|
|
650
|
+
clearManualRequest(state)
|
|
643
651
|
log($, "Brain emptied")
|
|
644
652
|
} catch (error) {
|
|
645
653
|
if (generation !== state.generation) return
|
|
@@ -6,7 +6,7 @@ I am reviewing my notes: keeping what is useful, connecting what belongs togethe
|
|
|
6
6
|
|
|
7
7
|
A dream covers one project: its `@project` notes and the session notes born in it. `@human`, `@self`, and `@model` are not part of a dream unless the human asks for them or the dream runs from inside the notes home itself. Do not broaden that scope while exploring; if a boundary is unclear, ask before crossing it. Unknown ownership is a coverage gap to report, not a reason to guess or repair ownership.
|
|
8
8
|
|
|
9
|
-
The
|
|
9
|
+
The notebooks serve different readers:
|
|
10
10
|
|
|
11
11
|
- Session notes (`<path>`, no `@`) are a trip's working record. Read them as sources; do not rewrite them. Only the wastebasket rule below may remove another session's notes.
|
|
12
12
|
- `@project` notes hold knowledge for whoever next works on that project.
|
|
@@ -16,7 +16,7 @@ The homes serve different readers:
|
|
|
16
16
|
|
|
17
17
|
## What a durable note holds
|
|
18
18
|
|
|
19
|
-
Durable notes hold decisions, constraints, and lessons that stay true after the current work ends. They are not diaries:
|
|
19
|
+
Durable notes hold decisions, constraints, and lessons that stay true after the current work ends. They are not diaries: raw logs, scorecards, and blow-by-blow recaps belong to history. When a piece of history actually matters — such as why an earlier approach failed — keep only a brief background summary, clearly separated from what is true now. A session finding is worth promoting only when it meets this bar.
|
|
20
20
|
|
|
21
21
|
## Review and consolidate
|
|
22
22
|
|
|
@@ -24,22 +24,22 @@ Durable notes hold decisions, constraints, and lessons that stay true after the
|
|
|
24
24
|
2. **Verify only what the proposed change depends on.** Before correcting, retiring, or promoting a conclusion, check the relevant evidence as needed. Do not revalidate every stable note or turn dream into a source-code audit. An unavailable referent is unverified, not proof that it is dead.
|
|
25
25
|
3. **Retire what is no longer true.** When evidence shows a durable note is stale, correct it in place; if nothing true remains, crumple it. Remove or fix its MAP line either way. A note's last access is a hint, not evidence: long-unread notes are candidates to check, not to crumple on sight. A read reports the access before itself, so reviewing a note does not make it look fresh.
|
|
26
26
|
4. **Merge only genuine duplicates.** Merge two notes only when they share a topic and kind (checkpoint, design, log). First carry every fact, condition, and exception unique to the absorbed note into the survivor, then crumple the absorbed note. Otherwise keep both and record any unresolved conflict.
|
|
27
|
-
5. **Relocate misfiled notes.** When a standing ruling or the note's own MAP already names its proper
|
|
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
|
|
30
|
+
8. **Keep wake-up pages useful.** Each writable notebook's `CHEATSHEET.md` holds standing reminders, kept to five lines. Its `MAP.md` holds only the note index: durable notes' addresses and short gists. Both load every window when present; do not create empty pages. Preserve standing rules, add promoted notes to the map, and drop entries that no longer hold. Maps follow the same size budget.
|
|
31
31
|
|
|
32
32
|
## Deleting
|
|
33
33
|
|
|
34
34
|
Never physically delete a live note; crumple it first. Two cases allow deleting a crumpled note:
|
|
35
35
|
|
|
36
36
|
- **Your own session's notes** may be deleted once crumpled.
|
|
37
|
-
- **The wastebasket:** any note within the dream's reach that was crumpled more than 7 days ago may be deleted, whatever its
|
|
37
|
+
- **The wastebasket:** any note within the dream's reach that was crumpled more than 7 days ago may be deleted, whatever its notebook or session. Judge by its crumpled date; if none is readable, keep it and report it.
|
|
38
38
|
|
|
39
39
|
Where notes cannot be deleted, list the doomed addresses in the report instead of blanking them.
|
|
40
40
|
|
|
41
41
|
## Report
|
|
42
42
|
|
|
43
|
-
Give a concise report grouped by
|
|
43
|
+
Give a concise report grouped by notebook: what you inspected, changed, retired, promoted, deleted, and left unresolved. Mention coverage gaps and partial failures. If no notes changed, say so. Distinguish actual note changes from execution or audit artifacts; do not claim success for an incomplete run.
|
|
44
44
|
|
|
45
45
|
Put skill ideas and unresolved questions in the final message as proposals for the human, not new skill files.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: memory
|
|
3
|
-
description: How notesoup's `notes_*` and `history_*` tools fit together — note addresses and
|
|
3
|
+
description: How notesoup's `notes_*` and `history_*` tools fit together — note addresses and notebooks, finding things again, and saving recovery state. Use when the context-window protocol is missing or unclear, or when unsure where a note belongs or how to find something again.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Memory
|
|
@@ -32,13 +32,13 @@ Any other `@` prefix is refused. A path is relative and `/`-separated, with no e
|
|
|
32
32
|
|
|
33
33
|
`@` addresses are not file paths: never pass them to file tools like `read`, `write`, `edit`, or `bash`. That creates a stray directory instead of a note.
|
|
34
34
|
|
|
35
|
-
`CHEATSHEET.md` and `MAP.md` at the root of each `@`
|
|
35
|
+
`CHEATSHEET.md` and `MAP.md` at the root of each `@` notebook are separate pages you wake up with; absent pages are skipped. Keep standing reminders in `CHEATSHEET.md`, to five lines. `MAP.md` holds only the note index: each durable note's address and gist, for lookup. Update it whenever you add, move or crumple a durable note. Do not create empty pages.
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
Keep notes focused on what is true now; if a piece of past context still matters (such as why an approach was ruled out), keep only a brief summary rather than a blow-by-blow log. Crumple notes that are no longer true; a stale note is worse than none.
|
|
38
38
|
|
|
39
39
|
## Finding things again
|
|
40
40
|
|
|
41
|
-
For list/search, omit `glob` or use the collection alias `@default` for this session and current shared
|
|
41
|
+
For list/search, omit `glob` or use the collection alias `@default` for this session and current shared notebooks. Use `**` for all notebooks or `@sessions/*/**` for all sessions. Results carry readable note addresses; `@default` itself is not a read/write address.
|
|
42
42
|
|
|
43
43
|
- **A note**: `notes_list` with a `glob` when you know roughly where it lives, `notes_search` when you know a phrase; then `notes_read` the address.
|
|
44
44
|
- **Something that happened**: `history_list` to browse or search this session's events; `history_read` the seq for the whole event.
|
|
@@ -13,6 +13,7 @@ import { claudeHistoryGapNotice, claudeHistoryUnconfirmedSeq, CLAUDE_HISTORY_UNK
|
|
|
13
13
|
import { resolveClaudeLimits } from "./thresholds.js";
|
|
14
14
|
import { projectKey, snapshotNotesIdentity, type NotesIdentity } from "../../../src/notes/index.js";
|
|
15
15
|
import type { Operation } from "../../../src/tools/result.js";
|
|
16
|
+
import { notesToolContext, type NotesToolContext } from "../../../src/tools/notes-context.js";
|
|
16
17
|
|
|
17
18
|
const MAX_REQUEST_BYTES = 512 * 1024;
|
|
18
19
|
const MAX_RESPONSE_BYTES = 1024 * 1024;
|
|
@@ -55,7 +56,7 @@ function boundOperation<TParams extends TSchema, TData, TContext extends readonl
|
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
const OPERATIONS: Record<string, BoundOperation<[
|
|
59
|
+
const OPERATIONS: Record<string, BoundOperation<[NotesToolContext]>> = {
|
|
59
60
|
notes_write: boundOperation(notesWrite),
|
|
60
61
|
notes_update: boundOperation(notesUpdate),
|
|
61
62
|
notes_read: boundOperation(notesRead),
|
|
@@ -124,7 +125,7 @@ export async function dispatch(request: unknown): Promise<unknown> {
|
|
|
124
125
|
: await HISTORY_OPERATIONS[tool].call(params, projection, wrapText);
|
|
125
126
|
return { ...result, text: wrapText(result.text) };
|
|
126
127
|
}
|
|
127
|
-
return OPERATIONS[value.tool]!.call(value.params, id);
|
|
128
|
+
return OPERATIONS[value.tool]!.call(value.params, notesToolContext(id, (value.identity as ClaudeIdentityInput).cwd));
|
|
128
129
|
}
|
|
129
130
|
if (value.op === "history_state") {
|
|
130
131
|
const id = identity(value.identity as ClaudeIdentityInput);
|
package/plugins/codex/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# notesoup for Codex
|
|
2
2
|
|
|
3
|
-
Native notes and history for Codex **0.160.1**. The plugin bundles one stdio MCP server with the five
|
|
3
|
+
Native notes and history for Codex **0.160.1**. The plugin bundles one stdio MCP server with the five notebooks and three history tools, and one hook helper that injects the notes boot into each native context window. `new_context` and `get_context_remaining` stay Codex's own tools; notesoup does not replace Codex's reset or budget.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|