notesoup 0.61.0 → 0.63.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 -11
- 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 +24 -5
- package/dist/plugins/claude/src/text.d.ts +7 -0
- package/dist/plugins/claude/src/text.js +12 -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 +4 -1
- package/dist/plugins/pi/budget.js +35 -8
- package/dist/plugins/pi/entries.d.ts +2 -0
- package/dist/plugins/pi/entries.js +2 -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/artifacts.d.ts +1 -1
- package/dist/plugins/pi/reset/artifacts.js +4 -4
- package/dist/plugins/pi/reset/lifecycle.d.ts +9 -2
- package/dist/plugins/pi/reset/lifecycle.js +109 -31
- package/dist/plugins/pi/runtime.js +104 -63
- package/dist/plugins/pi/tool-result.js +7 -7
- package/dist/plugins/pi/window.d.ts +25 -3
- package/dist/plugins/pi/window.js +219 -9
- package/dist/src/boot/render.js +18 -15
- package/dist/src/boot/text.d.ts +3 -1
- package/dist/src/boot/text.js +22 -20
- package/dist/src/budget/text.d.ts +7 -3
- package/dist/src/budget/text.js +24 -15
- 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 +2 -2
- package/dist/src/index.js +1 -1
- package/dist/src/notes/errors.d.ts +1 -1
- package/dist/src/notes/frontmatter.d.ts +0 -2
- package/dist/src/notes/frontmatter.js +0 -2
- 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 +46 -5
- package/dist/src/notes/store.d.ts +12 -0
- package/dist/src/notes/store.js +16 -20
- 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 -93
- 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 +51 -163
- package/dist/src/tools/notes.js +146 -100
- 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 +394 -56
- 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 +156 -15
- package/dist/test/budget-settings.integration.test.js +4 -4
- package/dist/test/claude-history.test.js +14 -13
- package/dist/test/claude-mod.test.js +199 -16
- package/dist/test/claude-validation.test.js +69 -2
- 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 +68 -3
- package/dist/test/helpers/extension.js +74 -5
- 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/model-facing-text.test.js +13 -3
- package/dist/test/note-policy.test.js +96 -77
- 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 +12 -2
- package/docs/antigravity.md +44 -0
- package/docs/architecture.md +6 -4
- package/docs/claude-code-mod.md +7 -7
- package/docs/codex.md +36 -38
- package/docs/dsh.md +3 -3
- package/docs/history-sessions.md +28 -50
- package/docs/notes-library.md +4 -4
- 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 +1 -1
- 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 +1108 -539
- package/plugins/claude/hooks/register.ts +202 -62
- package/plugins/claude/playbook.md +1 -1
- package/plugins/claude/skills/dream/SKILL.md +1 -1
- package/plugins/claude/skills/notesoup-guide/SKILL.md +92 -0
- package/plugins/claude/src/helper.ts +24 -5
- package/plugins/claude/src/text.ts +14 -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 +18480 -17946
- 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 +31 -8
- package/plugins/pi/entries.ts +2 -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/artifacts.ts +4 -3
- package/plugins/pi/reset/lifecycle.ts +125 -32
- package/plugins/pi/runtime.ts +98 -62
- package/plugins/pi/tool-result.ts +8 -8
- package/plugins/pi/window.ts +210 -10
- package/skills/dream/SKILL.md +1 -1
- package/skills/notesoup-guide/SKILL.md +92 -0
- package/src/boot/render.ts +18 -15
- package/src/boot/text.ts +23 -19
- package/src/budget/text.ts +27 -15
- 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 +2 -2
- package/src/notes/errors.ts +1 -1
- package/src/notes/frontmatter.ts +0 -3
- package/src/notes/index.ts +1 -1
- package/src/notes/policy.ts +44 -5
- package/src/notes/store.ts +17 -20
- 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 +145 -113
- 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
package/plugins/pi/window.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import type { AgentMessage } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import type { SystemMessage, Tool, ToolReference } from "@earendil-works/pi-ai";
|
|
2
3
|
import { getCurrentSystemMessage } from "@earendil-works/pi-ai";
|
|
4
|
+
import { realpathSync } from "node:fs";
|
|
5
|
+
import { resolve, sep } from "node:path";
|
|
3
6
|
import { estimateContextTokens } from "./estimate.js";
|
|
4
7
|
import { convertToLlm, type CustomEntry, type ExtensionContext, type SessionEntry } from "@earendil-works/pi-coding-agent";
|
|
5
|
-
import { BOOT_TYPE, RESET_MARKER_TYPE } from "./entries.js";
|
|
8
|
+
import { BOOT_TYPE, CONTINUATION_TYPE, ENABLED_TYPE, GUIDANCE_TYPE, MANUAL_WIPE_TYPE, MARKER_TYPE, RESET_LAST_WORD_TYPE, RESET_MARKER_TYPE, TURNOVER_TRIGGER_TYPE, WARNING_TYPE } from "./entries.js";
|
|
6
9
|
import type { ResetOrigin } from "../../src/budget/text.js";
|
|
7
10
|
import { NOTES_PROTOCOL_OPEN_TAG, NOTES_PROTOCOL_CLOSE_TAG, WINDOW_IDENTITY_OPEN_TAG, WINDOW_IDENTITY_CLOSE_TAG } from "../../src/boot/text.js";
|
|
8
11
|
import type { SessionReader } from "./session-reader.js";
|
|
9
12
|
|
|
10
|
-
export type WindowMarkerData = { readonly windowId: string; readonly origin?: ResetOrigin };
|
|
13
|
+
export type WindowMarkerData = { readonly windowId: string; readonly origin?: ResetOrigin; readonly betweenTurns?: boolean };
|
|
11
14
|
export type WindowMarker = CustomEntry<WindowMarkerData> & { data: WindowMarkerData };
|
|
12
15
|
|
|
13
16
|
export function isWindowMarker(entry: SessionEntry): entry is WindowMarker {
|
|
@@ -25,16 +28,87 @@ export function markerResetOrigin(marker: WindowMarker): ResetOrigin {
|
|
|
25
28
|
return marker.data.origin === "forced" ? "forced" : "normal";
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
function lastWindowMarker(entries: readonly SessionEntry[]): WindowMarker | undefined {
|
|
32
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
33
|
+
const entry = entries[i];
|
|
34
|
+
if (entry && isWindowMarker(entry)) return entry;
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Branch entries after the latest compaction, or the full branch before any compaction. */
|
|
40
|
+
export function activeBranchTail(branch: readonly SessionEntry[]): readonly SessionEntry[] {
|
|
41
|
+
for (let i = branch.length - 1; i >= 0; i--) {
|
|
42
|
+
if (branch[i]?.type === "compaction") return branch.slice(i + 1);
|
|
43
|
+
}
|
|
44
|
+
return branch;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Only a reset marker still ahead of any later native compaction owns the active projection boundary. */
|
|
29
48
|
export function currentReset(ctx: SessionReader): WindowMarker | undefined {
|
|
30
|
-
|
|
49
|
+
return lastWindowMarker(activeBranchTail(ctx.sessionManager.getBranch()));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The explicit `/notesoup on|off|reset` choice for this branch, or undefined when never chosen. */
|
|
53
|
+
export function sessionEnabled(branch: readonly SessionEntry[]): boolean | undefined {
|
|
31
54
|
for (let i = branch.length - 1; i >= 0; i--) {
|
|
32
|
-
const entry = branch[i]
|
|
33
|
-
if (entry
|
|
55
|
+
const entry = branch[i]!;
|
|
56
|
+
if (entry.type !== "custom" || entry.customType !== ENABLED_TYPE) continue;
|
|
57
|
+
const data = entry.data;
|
|
58
|
+
if (typeof data !== "object" || data === null) continue;
|
|
59
|
+
const enabled = (data as { enabled?: unknown }).enabled;
|
|
60
|
+
if (enabled === true) return true;
|
|
61
|
+
if (enabled === false) return false;
|
|
62
|
+
if (enabled === null) return undefined;
|
|
63
|
+
// Malformed data: keep scanning for an older readable choice.
|
|
34
64
|
}
|
|
35
65
|
return undefined;
|
|
36
66
|
}
|
|
37
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Whether pi-souls reports a mode (`naked` or restricted `tools` `"none"`/`"rw"`) that disables
|
|
70
|
+
* notesoup by default. Ask the loaded pi-souls extension synchronously first; when absent,
|
|
71
|
+
* read its durable entries (`pi-souls:naked`, `pi-souls:tools`).
|
|
72
|
+
*/
|
|
73
|
+
function isDisabledByPiSouls(
|
|
74
|
+
pi: { events?: { emit(channel: string, data: unknown): void } },
|
|
75
|
+
branch: readonly SessionEntry[],
|
|
76
|
+
): boolean {
|
|
77
|
+
const query: { branch: readonly SessionEntry[]; naked?: boolean; tools?: string | null } = { branch };
|
|
78
|
+
pi.events?.emit("pi-souls:state", query);
|
|
79
|
+
if (query.naked === true || query.tools === "none" || query.tools === "rw") return true;
|
|
80
|
+
const checkDurable = (customType: string, disabled: (data: Record<string, unknown>) => boolean | undefined): boolean => {
|
|
81
|
+
for (let i = branch.length - 1; i >= 0; i--) {
|
|
82
|
+
const entry = branch[i]!;
|
|
83
|
+
if (entry.type !== "custom" || entry.customType !== customType) continue;
|
|
84
|
+
if (typeof entry.data !== "object" || entry.data === null) continue;
|
|
85
|
+
const result = disabled(entry.data as Record<string, unknown>);
|
|
86
|
+
if (result !== undefined) return result;
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
89
|
+
};
|
|
90
|
+
const nakedDisabled = typeof query.naked === "boolean"
|
|
91
|
+
? false
|
|
92
|
+
: checkDurable("pi-souls:naked", (data) => data.naked === true ? true : data.naked === false || data.naked === null ? false : undefined);
|
|
93
|
+
if (nakedDisabled) return true;
|
|
94
|
+
return query.tools !== undefined
|
|
95
|
+
? false
|
|
96
|
+
: checkDurable("pi-souls:tools", (data) =>
|
|
97
|
+
data.tools === "none" || data.tools === "rw" ? true
|
|
98
|
+
: data.tools === null ? false : undefined);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Explicit branch choice wins; otherwise the CLI flag and naked/restricted-tools pi-souls runs disable. */
|
|
102
|
+
export function isNotesoupEnabled(
|
|
103
|
+
pi: { getFlag?(name: string): unknown; events?: { emit(channel: string, data: unknown): void } },
|
|
104
|
+
ctx: SessionReader,
|
|
105
|
+
): boolean {
|
|
106
|
+
const branch = ctx.sessionManager.getBranch();
|
|
107
|
+
const explicit = sessionEnabled(branch);
|
|
108
|
+
if (explicit !== undefined) return explicit;
|
|
109
|
+
return pi.getFlag?.("no-notesoup") !== true && !isDisabledByPiSouls(pi, branch);
|
|
110
|
+
}
|
|
111
|
+
|
|
38
112
|
/** A reset is checkpoint-backed only when its marker directly follows a native compaction. */
|
|
39
113
|
export function isCheckpointBackedReset(ctx: SessionReader, marker = currentReset(ctx)): boolean {
|
|
40
114
|
if (!marker?.parentId) return false;
|
|
@@ -50,20 +124,21 @@ export function rootWindowId(sessionId: string): string {
|
|
|
50
124
|
return `pcw:${sessionId.slice(0, 8)}:root`;
|
|
51
125
|
}
|
|
52
126
|
|
|
53
|
-
/** Persisted messages in the active window, excluding earlier windows
|
|
127
|
+
/** Persisted messages in the active window segment, excluding earlier windows and compacted prefixes. */
|
|
54
128
|
export function hasWindowMessage(ctx: SessionReader, customType: string): boolean {
|
|
55
129
|
const branch = ctx.sessionManager.getBranch();
|
|
56
130
|
for (let i = branch.length - 1; i >= 0; i--) {
|
|
57
131
|
const entry = branch[i];
|
|
58
|
-
if (
|
|
132
|
+
if (!entry) continue;
|
|
133
|
+
if (isWindowMarker(entry) || entry.type === "compaction") break;
|
|
59
134
|
if (entry.type === "custom_message" && entry.customType === customType) return true;
|
|
60
135
|
}
|
|
61
136
|
return false;
|
|
62
137
|
}
|
|
63
138
|
|
|
64
|
-
/** The root or latest durable
|
|
139
|
+
/** The root or latest durable window identity on the active branch, matching history windows. */
|
|
65
140
|
export function currentWindowId(ctx: SessionReader): string {
|
|
66
|
-
return
|
|
141
|
+
return lastWindowMarker(ctx.sessionManager.getBranch())?.data.windowId ?? rootWindowId(ctx.sessionManager.getSessionId());
|
|
67
142
|
}
|
|
68
143
|
|
|
69
144
|
/** The durable window active just before the marker: the last earlier marker, else the root window. */
|
|
@@ -145,6 +220,131 @@ export function projectRootWindow(messages: AgentMessage[], windowId: string): A
|
|
|
145
220
|
return [...withoutBoots.slice(0, firstBoot), activeBoot, ...withoutBoots.slice(firstBoot)];
|
|
146
221
|
}
|
|
147
222
|
|
|
223
|
+
/** Every tool the notesoup extension registers. */
|
|
224
|
+
export const NOTESOUP_TOOL_NAMES: ReadonlySet<string> = new Set([
|
|
225
|
+
"empty_brain",
|
|
226
|
+
"get_context_remaining",
|
|
227
|
+
"notes_write",
|
|
228
|
+
"notes_update",
|
|
229
|
+
"notes_read",
|
|
230
|
+
"notes_list",
|
|
231
|
+
"dream_begin",
|
|
232
|
+
"dream_forget",
|
|
233
|
+
"dream_end",
|
|
234
|
+
"history_list",
|
|
235
|
+
"history_search",
|
|
236
|
+
"history_read",
|
|
237
|
+
]);
|
|
238
|
+
|
|
239
|
+
const NOTESOUP_MESSAGE_TYPES: ReadonlySet<string> = new Set([
|
|
240
|
+
BOOT_TYPE,
|
|
241
|
+
GUIDANCE_TYPE,
|
|
242
|
+
WARNING_TYPE,
|
|
243
|
+
MANUAL_WIPE_TYPE,
|
|
244
|
+
TURNOVER_TRIGGER_TYPE,
|
|
245
|
+
CONTINUATION_TYPE,
|
|
246
|
+
RESET_LAST_WORD_TYPE,
|
|
247
|
+
MARKER_TYPE,
|
|
248
|
+
]);
|
|
249
|
+
|
|
250
|
+
function normalizedPath(path: string): string {
|
|
251
|
+
try { return realpathSync(path); }
|
|
252
|
+
catch { return resolve(path); }
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** Whether a skill file lives under notesoup's own `skills/` roots (symlink-resolved). */
|
|
256
|
+
export function isNotesoupSkillPath(filePath: string, skillRoots: readonly string[] = []): boolean {
|
|
257
|
+
if (!filePath || skillRoots.length === 0) return false;
|
|
258
|
+
const candidate = normalizedPath(filePath);
|
|
259
|
+
return skillRoots.some((root) => {
|
|
260
|
+
const base = normalizedPath(root);
|
|
261
|
+
return candidate === base || candidate.startsWith(base.endsWith(sep) ? base : `${base}${sep}`);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** Drop notesoup's own `<skill>` blocks; undefined when no skill block survives. */
|
|
266
|
+
function stripNotesoupSkillBlocks(text: string, skillRoots: readonly string[]): string | undefined {
|
|
267
|
+
const stripped = text.replace(/^[ \t]*<skill>[\s\S]*?<\/skill>[ \t]*$\n?/gm, (block) => {
|
|
268
|
+
const location = /<location>([\s\S]*?)<\/location>/.exec(block)?.[1]?.trim();
|
|
269
|
+
return location !== undefined && isNotesoupSkillPath(location, skillRoots) ? "" : block;
|
|
270
|
+
});
|
|
271
|
+
if (!/<skill>/.test(stripped)) return undefined;
|
|
272
|
+
return stripped.replace(/\n{3,}/g, "\n\n");
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function isEmptyContent(content: string | readonly unknown[]): boolean {
|
|
276
|
+
return content === "" || (Array.isArray(content) && content.length === 0);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Provider projection for `/notesoup off`: erase this extension's custom messages, teaching
|
|
281
|
+
* sections, skills and tool declarations so a disabled session looks like a plain Pi session.
|
|
282
|
+
* `CARRIED_INPUT_TYPE` survives because it is the human's withheld input, not notesoup state.
|
|
283
|
+
*/
|
|
284
|
+
export function stripNotesoupProjection(messages: AgentMessage[], skillRoots: readonly string[] = []): AgentMessage[] {
|
|
285
|
+
const result: AgentMessage[] = [];
|
|
286
|
+
let seenSystem = false;
|
|
287
|
+
let previousSkills: string | undefined;
|
|
288
|
+
for (const message of messages) {
|
|
289
|
+
if (message.role === "custom") {
|
|
290
|
+
if (NOTESOUP_MESSAGE_TYPES.has(message.customType)) continue;
|
|
291
|
+
result.push(message);
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
if (message.role !== "system") {
|
|
295
|
+
result.push(message);
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const cloned: SystemMessage = { ...message };
|
|
300
|
+
if (message.toolsAdded) {
|
|
301
|
+
const kept: Tool[] = message.toolsAdded.filter((tool) => !NOTESOUP_TOOL_NAMES.has(tool.name));
|
|
302
|
+
if (kept.length === 0) delete cloned.toolsAdded;
|
|
303
|
+
else cloned.toolsAdded = kept;
|
|
304
|
+
}
|
|
305
|
+
if (message.toolsRemoved) {
|
|
306
|
+
const kept: ToolReference[] = message.toolsRemoved.filter((tool) => !NOTESOUP_TOOL_NAMES.has(tool.name));
|
|
307
|
+
if (kept.length === 0) delete cloned.toolsRemoved;
|
|
308
|
+
else cloned.toolsRemoved = kept;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
let sections: Record<string, string | null> | undefined;
|
|
312
|
+
if (message.sections) {
|
|
313
|
+
sections = { ...message.sections };
|
|
314
|
+
delete sections.notesoup_tools;
|
|
315
|
+
delete sections.notesoup_protocol;
|
|
316
|
+
const skills = sections.skills;
|
|
317
|
+
if (typeof skills === "string") {
|
|
318
|
+
const cleaned = stripNotesoupSkillBlocks(skills, skillRoots);
|
|
319
|
+
if (cleaned === undefined) {
|
|
320
|
+
if (previousSkills !== undefined) {
|
|
321
|
+
sections.skills = null;
|
|
322
|
+
previousSkills = undefined;
|
|
323
|
+
} else {
|
|
324
|
+
delete sections.skills;
|
|
325
|
+
}
|
|
326
|
+
} else if (cleaned === previousSkills) {
|
|
327
|
+
delete sections.skills;
|
|
328
|
+
} else {
|
|
329
|
+
sections.skills = cleaned;
|
|
330
|
+
previousSkills = cleaned;
|
|
331
|
+
}
|
|
332
|
+
} else if (skills === null) {
|
|
333
|
+
if (previousSkills === undefined) delete sections.skills;
|
|
334
|
+
else previousSkills = undefined;
|
|
335
|
+
}
|
|
336
|
+
if (Object.keys(sections).length === 0) delete cloned.sections;
|
|
337
|
+
else cloned.sections = sections;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const hasTools = Boolean(cloned.toolsAdded?.length || cloned.toolsRemoved?.length);
|
|
341
|
+
if (seenSystem && isEmptyContent(cloned.content) && !hasTools && cloned.sections === undefined) continue;
|
|
342
|
+
result.push(cloned);
|
|
343
|
+
seenSystem = true;
|
|
344
|
+
}
|
|
345
|
+
return result;
|
|
346
|
+
}
|
|
347
|
+
|
|
148
348
|
/** Usage for the selected window, excluding provider usage recorded before its marker. */
|
|
149
349
|
export function windowUsage(ctx: Pick<ExtensionContext, "sessionManager" | "getContextUsage" | "model">) {
|
|
150
350
|
const reset = currentReset(ctx);
|
package/skills/dream/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: Review and consolidate durable notes using notesoup's shared dream
|
|
|
5
5
|
|
|
6
6
|
# Dream
|
|
7
7
|
|
|
8
|
-
Read `../../playbook.md` completely, resolving the path from this skill's directory. It is the shared guide to reviewing and organizing notes. Standing reminders belong in a separate `CHEATSHEET.md
|
|
8
|
+
Read `../../playbook.md` completely, resolving the path from this skill's directory. It is the shared guide to reviewing and organizing notes. Standing reminders belong in a separate compact `CHEATSHEET.md`, the one default-pinned page; it loads every window when live unless explicitly unpinned. Every durable note carries a short one-line `description` saying what it holds and when to open it — boot renders each notebook's index from these, so a missing or stale description is an index defect. Pages carry UTF-8 byte budgets (4 KB for `CHEATSHEET.md`, 8 KB for ordinary notes, overridable in frontmatter); overflow warns, and boot truncates over-budget pinned bodies. Respect soft readonly locks; explicitly unlock with `readonly:false` before changing a locked note.
|
|
9
9
|
|
|
10
10
|
Dream in this agent's current session. Do not start another agent or model unless the human asks.
|
|
11
11
|
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: notesoup-guide
|
|
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
|
+
---
|
|
5
|
+
|
|
6
|
+
# Notesoup Guide
|
|
7
|
+
|
|
8
|
+
Two stores outlive the context window. Anything in neither is lost when the window ends or is wiped.
|
|
9
|
+
|
|
10
|
+
- **Notes** (`notes_*`) — what you choose to keep. Plain markdown, written on purpose.
|
|
11
|
+
- **History** (`history_*`) — recorded messages, tool calls and summaries. Current session by default; other local sessions/harnesses through `session`. Read-only.
|
|
12
|
+
|
|
13
|
+
Each tool's own description covers its parameters and paging. This guide covers what the descriptions cannot: where notes belong, and how the tools work together.
|
|
14
|
+
|
|
15
|
+
## Addresses
|
|
16
|
+
|
|
17
|
+
The address decides who a note belongs to and how long it lasts.
|
|
18
|
+
|
|
19
|
+
| Address | Note | Keep there |
|
|
20
|
+
| --- | --- | --- |
|
|
21
|
+
| `<path>`, no `@` | session note | current task state and loose ends; gone with the session |
|
|
22
|
+
| `@project/<path>` | project note | decisions and constraints future work must respect |
|
|
23
|
+
| `@human/<path>` | human note | how to work with this human, across projects |
|
|
24
|
+
| `@self/<path>` | self note | your reminders; yours alone if you have a name, shared by everyone nameless |
|
|
25
|
+
| `@model/<path>` | model note | what applies to this model only |
|
|
26
|
+
| `@projects/<name>/<path>` | named project, read-only | discover names and root paths with `notes_list` glob `@projects/*/**` |
|
|
27
|
+
| `@sessions/<id>/<path>` | named session, read-only | recover earlier task state; discover with glob `@sessions/*/**` |
|
|
28
|
+
|
|
29
|
+
When notes conflict, the one most relevant to what you're doing applies. If that doesn't settle it, judge the case.
|
|
30
|
+
|
|
31
|
+
Any other `@` prefix is refused. A path is relative and `/`-separated, with no empty, `.` or `..` segments.
|
|
32
|
+
|
|
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
|
+
|
|
35
|
+
`CHEATSHEET.md` at each notebook's root is the default-pinned page you wake up with; absent or crumpled pages are skipped. Set `pinned`, `readonly`, and `description` through `notes_write`/`notes_update` or frontmatter. Explicit `pinned:false` unpins even a default page; each page carries a UTF-8 byte budget (4 KB for root `CHEATSHEET.md`, 8 KB for ordinary notes; overridable in frontmatter). Overflow on body budget or an oversized description warns but still saves; boot truncates over-budget pinned bodies and oversized descriptions. `readonly:true` is a soft lock, not security; explicitly set `readonly:false` to unlock, alone or alongside your changes. Keep `CHEATSHEET.md` compact with short bullets. Give each durable note a short one-line `description`: boot lists every notebook's unpinned pages newest first as address, age, and description, so it is the only index. Do not create empty pages.
|
|
36
|
+
|
|
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
|
+
|
|
39
|
+
## Finding things again
|
|
40
|
+
|
|
41
|
+
### Notes
|
|
42
|
+
|
|
43
|
+
In `notes_list`, omit `glob` for this session and the current shared notebooks. Use `**` for all notebooks or `@sessions/*/**` for all sessions.
|
|
44
|
+
|
|
45
|
+
- **A note**: add `glob` to narrow where `notes_list` looks, and `query` if you remember a phrase. Then use `notes_read` with the address and, for a match, its `offset_chars`.
|
|
46
|
+
- **Older notes**: when `notes_list` ends with `→ older: {…}`, call it again with that object to see older matches. Continue until the line is gone.
|
|
47
|
+
### Shared search and read conventions
|
|
48
|
+
|
|
49
|
+
Queries look for literal text, ignoring case. A list of phrases matches any one of them.
|
|
50
|
+
|
|
51
|
+
Both list tools report omissions and partial previews. A truncated result is not the whole
|
|
52
|
+
record.
|
|
53
|
+
|
|
54
|
+
Read offsets count characters relative to the body or event document, not the
|
|
55
|
+
presentation header.
|
|
56
|
+
|
|
57
|
+
Continue an incomplete read at the offset named in its trailing notice. A concurrent edit can
|
|
58
|
+
change a note's offsets.
|
|
59
|
+
|
|
60
|
+
All shared tools return text. On supported hosts, `notes_read` also returns the note body
|
|
61
|
+
`text` without presentation markers, plus `next_offset_chars`, metadata and warnings.
|
|
62
|
+
|
|
63
|
+
When carrying a reference into another window, save its full address or event identity, not just
|
|
64
|
+
a quotation; you can retrieve the text again.
|
|
65
|
+
|
|
66
|
+
### History
|
|
67
|
+
|
|
68
|
+
- **Browse a known timeline**: `history_list({ before: 190 })` uses exclusive integer seq bounds (see the boot window tree for earlier windows), with optional ISO 8601 `since` / `until`. With `after` (or `since` alone) you page forward; otherwise take the newest events. Follow the older/newer and expand recipes.
|
|
69
|
+
- **List sessions**: pass a wildcard such as `session: "*"` or `"pi:*"` to `history_list` for one representative event per session (default 20 sessions), optionally narrowed with `roles` and `since` / `until`.
|
|
70
|
+
- **Find a passage**: `history_search({ query: "remembered phrase", context: 1 })` searches all roles in the current session, one named session, or a wildcard such as `session: "*"`, with optional neighboring events, `roles`, and ISO 8601 `since` / `until`. `query` is required (an empty query returns no matches).
|
|
71
|
+
- **Target one session**: all three tools accept an ID or prefix, optionally qualified with `pi:`, `claude:`, `codex:` or `dsh:`. Omit `session` for this session. If ambiguous, pass a longer or qualified ID. DSH sessions are available only from DSH.
|
|
72
|
+
- **Open a passage**: `history_read({ seq: 42 })` reads one event. If a session heading is shown above the event, include the full session ID; if a preview offset is shown, pass it as `offset_chars`. Follow the continuation to read more.
|
|
73
|
+
|
|
74
|
+
Save the seq and full session ID together when carrying a cross-session reference into another window. An empty search is not proof an event never happened: wildcard searches skip sessions that cannot be read.
|
|
75
|
+
|
|
76
|
+
## Saving recovery state
|
|
77
|
+
|
|
78
|
+
Before a long or risky step, or when room runs low, keep session notes named for what they hold (not `current.md`) and rewrite them in place with short sections and bullets instead of starting new ones or appending a timeline. Skip standing rules already in `@project`/`@human`/`@self`/`@model` and commit details git can show; record only the live delta:
|
|
79
|
+
|
|
80
|
+
- current status, blockers, and the next action
|
|
81
|
+
- what the human decided (in their words)
|
|
82
|
+
- what failed, and why
|
|
83
|
+
- where half-done work and unrecorded findings live (branches, worktrees, scratch paths, drafts, running tasks, key facts not saved elsewhere)
|
|
84
|
+
- skills, notes, files, or already-found history seqs to reopen
|
|
85
|
+
|
|
86
|
+
`get_context_remaining` reports the room left. `empty_brain` starts a fresh window, so save the note first.
|
|
87
|
+
|
|
88
|
+
## When a tool is missing or refuses
|
|
89
|
+
|
|
90
|
+
A refusal displays `error: <code>: <message>`; read the message before retrying. `notes_read` also supplies `{ error, code }` where structured results are available.
|
|
91
|
+
|
|
92
|
+
If a `notes_*` or `history_*` tool is absent or fails at the host level, do not imitate it: no filesystem tools on `@` addresses, and no reading or editing note storage or session files directly. Use the tools that remain, tell the human which one is missing, and keep essential state in the reply.
|
package/src/boot/render.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NotesNamespace, NotesSnapshot } from "./snapshot.js";
|
|
2
|
-
import { effectiveNotePolicy, MAX_PINNED_NOTES, noteBudgetWarnings, pinnedPageOrder } from "../notes/policy.js";
|
|
3
|
-
import { collapseDescription
|
|
2
|
+
import { effectiveNotePolicy, MAX_DESCRIPTION_CHARS, MAX_PINNED_NOTES, noteBudgetWarnings, pinnedPageOrder, renderWarnings, truncateToUtf8Bytes } from "../notes/policy.js";
|
|
3
|
+
import { collapseDescription } from "../notes/frontmatter.js";
|
|
4
4
|
import type { NoteRow } from "../notes/index.js";
|
|
5
5
|
import { WINDOW_IDENTITY_OPEN_TAG, WINDOW_IDENTITY_CLOSE_TAG, MAPS_BLOCK, NAMELESS_AGENT, renderProtocolBlock, type BootToolNames } from "./text.js";
|
|
6
6
|
|
|
@@ -31,7 +31,7 @@ function feedTitle(body: string): string | undefined {
|
|
|
31
31
|
return raw.length === 0 ? undefined : truncated(raw, FALLBACK_TITLE_MAX_CHARS);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
/**
|
|
34
|
+
/** Oversized descriptions are cut for display in the boot index. */
|
|
35
35
|
function summaryOf(row: NoteRow): string | undefined {
|
|
36
36
|
if (typeof row.meta.description === "string") {
|
|
37
37
|
const collapsed = collapseDescription(row.meta.description);
|
|
@@ -44,12 +44,7 @@ function summaryOf(row: NoteRow): string | undefined {
|
|
|
44
44
|
function indexLine(row: NoteRow, openedAt: number): string {
|
|
45
45
|
const locator = `${row.address} · ${relativeTime(row.meta.updatedAt, openedAt)}`;
|
|
46
46
|
const summary = summaryOf(row);
|
|
47
|
-
return summary === undefined ?
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** Two spaces of indent say "shelved content" without any furniture. */
|
|
51
|
-
function indent(text: string): string {
|
|
52
|
-
return text.split("\n").map((line) => (line.length > 0 ? ` ${line}` : line)).join("\n");
|
|
47
|
+
return summary === undefined ? locator : `${locator} — ${summary}`;
|
|
53
48
|
}
|
|
54
49
|
|
|
55
50
|
/** An underlined header is the classical plain-text document heading: no renderer required. */
|
|
@@ -70,7 +65,7 @@ function notesIndex(snapshot: NotesSnapshot, tools: BootToolNames, agentName: st
|
|
|
70
65
|
const shelves: string[] = [];
|
|
71
66
|
for (const namespace of namespaces) {
|
|
72
67
|
if (snapshot.unavailable.some((failed) => failed.scope === namespace.scope)) {
|
|
73
|
-
shelves.push(section(namespace.label,
|
|
68
|
+
shelves.push(section(namespace.label, `This drawer wouldn't open. Try \`${tools.notesList}\` again.`));
|
|
74
69
|
continue;
|
|
75
70
|
}
|
|
76
71
|
const rows = (snapshot.namespaces.get(namespace.scope) ?? []).filter((row) => row.meta.crumpledAt === undefined);
|
|
@@ -91,14 +86,22 @@ function notesIndex(snapshot: NotesSnapshot, tools: BootToolNames, agentName: st
|
|
|
91
86
|
usedChars = nextChars;
|
|
92
87
|
}
|
|
93
88
|
const omitted = unpinned.length - index.length;
|
|
94
|
-
if (omitted > 0) index.push(
|
|
89
|
+
if (omitted > 0) index.push(`… and ${omitted} more (use ${tools.notesList})`);
|
|
95
90
|
if (pinned.length === 0 && index.length === 0) continue;
|
|
96
91
|
const parts = pinned.map(row => {
|
|
97
|
-
const
|
|
98
|
-
|
|
92
|
+
const policy = effectiveNotePolicy(row.meta, row.path);
|
|
93
|
+
const warnings = noteBudgetWarnings(row.body, policy);
|
|
94
|
+
const cut = truncateToUtf8Bytes(row.body, policy.budget);
|
|
95
|
+
const body = !cut.truncated
|
|
96
|
+
? cut.text
|
|
97
|
+
: `${cut.text === "" ? "" : `${cut.text}\n\n`}[truncated at ${cut.shownChars}/${cut.totalChars}; offset_chars=${cut.shownChars}]`;
|
|
98
|
+
const note = [`── ${row.address} ──`, body, "── end of note ──"].join("\n\n");
|
|
99
|
+
return warnings.length > 0 ? `${renderWarnings(warnings)}\n${note}` : note;
|
|
99
100
|
});
|
|
100
|
-
if (pins.length > MAX_PINNED_NOTES)
|
|
101
|
-
|
|
101
|
+
if (pins.length > MAX_PINNED_NOTES) {
|
|
102
|
+
parts.push(renderWarnings([`only ${MAX_PINNED_NOTES} pinned notes per notebook are injected; omitted pins: ${pins.slice(MAX_PINNED_NOTES).map(row => row.address).join(", ")}. Unpin some notes or read the omitted pages with ${tools.notes}.`]));
|
|
103
|
+
}
|
|
104
|
+
if (index.length > 0) parts.push(pinned.length > 0 ? `── index ──\n\n${index.join("\n")}` : index.join("\n"));
|
|
102
105
|
shelves.push(section(namespace.label, parts.join("\n\n")));
|
|
103
106
|
}
|
|
104
107
|
|
package/src/boot/text.ts
CHANGED
|
@@ -10,6 +10,7 @@ export const NOTES_PROTOCOL_CLOSE_TAG = "</notesoup:notes_protocol>";
|
|
|
10
10
|
export const NAMELESS_AGENT = "anonymous";
|
|
11
11
|
export const PROTOCOL_WIPE_SENTENCE = "If this feels like the right moment, call `empty_brain` and erase yourself with dignity.";
|
|
12
12
|
export const PROTOCOL_HISTORY_SENTENCE = "History can still be dug up, probably: use `history_*` to excavate the mess, from old decisions to yesterday's missing socks. Found something? Write its seq down, or enjoy digging twice.";
|
|
13
|
+
const PROTOCOL_BUDGET_PARAGRAPH = `\`get_context_remaining\` tells you how much room is left. Check it before you do something ambitious. When it reaches zero, your brain gets reset immediately, taking every unwritten brilliant idea with it. ${PROTOCOL_WIPE_SENTENCE}`;
|
|
13
14
|
const PROTOCOL_SELF_NAMED = "- `@self/<path>` — yours. It follows you, not them. Reminders, grudges, who owes you a shoe, whatever.";
|
|
14
15
|
const PROTOCOL_SELF_NAMELESS = `${PROTOCOL_SELF_NAMED} Except you have no name (\`anonymous\`), so this notebook is a public square shared by every nameless nobody out there. Keep it to things any nameless agent can use — don't post your own quirks as everyone's law or dump one-off junk in the town square. Strangers are reading it. Sleep tight~`;
|
|
15
16
|
|
|
@@ -27,14 +28,13 @@ Your loyal notes are kept safe — no one will steal them. Use \`notes_*\` to re
|
|
|
27
28
|
|
|
28
29
|
${PROTOCOL_HISTORY_SENTENCE}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
Your session notes — the ones with no \`@\` — are your live workbench, not an archive. Next-you already wakes up with git, history, and the shared notebooks (\`@project\`, \`@human\`, \`@self\`, \`@model\`), so don't copy what already lives there. Give each active thread a page named for what it is (not \`current.md\` — future-you will kill you), and keep only the live delta: where the work stands, what the human decided (in their words), what's blocked or next, what failed and why, where half-done work and unrecorded findings live (branches, worktrees, scratch paths, drafts, running tasks, key facts not saved elsewhere), and which *skills*, notes, files, or already-found history seqs to reopen. Update that page in place as things move; when the topic shifts, rename it or open a fresh one and crumple the old; when it's done, unpin or crumple it.
|
|
31
32
|
|
|
32
|
-
Notes are for what's true NOW.
|
|
33
|
-
*flips a page* "First I tried this, then that broke, then—" Nobody reads that!
|
|
34
|
-
|
|
35
|
-
*rolls eyes* ...Ugh, fine. If a piece of history *actually* matters — like why Plan A blew up so tomorrow's you doesn't try it again — I'll let it slide. Keep the short version! A few lines, max! *squints at you* Turn it into a blow-by-blow log and you're dead.
|
|
33
|
+
Notes are for what's true NOW — written in short sections and bullets so next-you can scan them in two seconds and edit one section in place. Never pack a note into one giant wall of text, and never pile diary updates onto the bottom!
|
|
34
|
+
*flips a page* "First I tried this, then that broke, then—" Nobody reads that! When a line goes stale or wrong, cross it out and write what's true now.
|
|
35
|
+
*rolls eyes* ...Ugh, fine. If a piece of history *actually* matters — like why Plan A blew up so tomorrow's you doesn't try it again — keep the brief summary. *squints at you* Turn it into a blow-by-blow log and you're dead.
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
${PROTOCOL_BUDGET_PARAGRAPH}
|
|
38
38
|
|
|
39
39
|
An address decides who the note belongs to — and how long it is meant to last. Ask that first; the rest follows.
|
|
40
40
|
|
|
@@ -58,23 +58,23 @@ ${NOTES_PROTOCOL_CLOSE_TAG}`;
|
|
|
58
58
|
export const MAPS_BLOCK = `<notesoup:maps>
|
|
59
59
|
Each notebook has one default pin: \`CHEATSHEET.md\`. Pinned pages get jammed straight into your
|
|
60
60
|
brain the moment you wake up. Whoever wakes up next reads them, and next is you. So keep them
|
|
61
|
-
|
|
61
|
+
compact, keep them true, and unpin or crumple them once they stop earning their wake-up seat.
|
|
62
62
|
|
|
63
63
|
Up to five pages per notebook can be taped inside the cover, CHEATSHEET included. Every page gets
|
|
64
|
-
a
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
- **\`CHEATSHEET.md\`** holds what
|
|
68
|
-
a phone number you'll regret losing.
|
|
69
|
-
|
|
70
|
-
- **\`description\`** is one line saying what's inside a note and when to open it
|
|
71
|
-
|
|
64
|
+
a size budget; if a page outgrows it, trim stale lines or split by topic — and if it's pinned,
|
|
65
|
+
boot cuts the overflow off until you do.
|
|
66
|
+
|
|
67
|
+
- **\`CHEATSHEET.md\`** holds what earns a permanent wake-up seat — a standing rule, a warning,
|
|
68
|
+
a grudge, a name, a phone number you'll regret losing. Keep it tight, or it grows fat and
|
|
69
|
+
everybody pays for it.
|
|
70
|
+
- **\`description\`** is one line saying what's inside a note and when to open it, set through
|
|
71
|
+
your notes tools — keep it short, or boot cuts it off. Boot indexes every shelf from these,
|
|
72
72
|
newest first, address and age beside them. No hand-written map to keep in sync: a stale
|
|
73
73
|
description lies to the next window, so keep it true or crumple the page.
|
|
74
74
|
|
|
75
|
-
Each notebook keeps its own
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
Each notebook keeps its own pins and index. Missing pages are skipped; no need to create empty
|
|
76
|
+
ones. New rule worth remembering, new Cheatsheet bullet. And when a line goes wrong, stale, or
|
|
77
|
+
useless, kill it — tomorrow's you reads that page as fact.
|
|
78
78
|
</notesoup:maps>`;
|
|
79
79
|
|
|
80
80
|
/** Logical tool names are supplied by the composing host, not discovered here. */
|
|
@@ -89,6 +89,8 @@ export type BootToolNames = Readonly<{
|
|
|
89
89
|
* no model-facing reset tool. Absent means the shared tool-driven-reset sentence, byte for byte.
|
|
90
90
|
*/
|
|
91
91
|
wipeSentence?: string;
|
|
92
|
+
/** Replace the whole budget/reset paragraph on hosts without either tool. */
|
|
93
|
+
budgetParagraph?: string;
|
|
92
94
|
/** A host without an authoritative history source replaces the entire history advice. */
|
|
93
95
|
historySentence?: string;
|
|
94
96
|
/**
|
|
@@ -125,7 +127,9 @@ export function renderProtocolBlock(tools: BootToolNames, agentName: string = NA
|
|
|
125
127
|
: base;
|
|
126
128
|
// The sentence is replaced before name substitution, so a replacement may speak the host's
|
|
127
129
|
// own words (a command line, a tool name) instead of any `notes_*`-style token.
|
|
128
|
-
const block =
|
|
130
|
+
const block = tools.budgetParagraph !== undefined
|
|
131
|
+
? hinted.replace(PROTOCOL_BUDGET_PARAGRAPH, () => tools.budgetParagraph!)
|
|
132
|
+
: typeof tools.wipeSentence === "string" && tools.wipeSentence.length > 0
|
|
129
133
|
? hinted.replace(PROTOCOL_WIPE_SENTENCE, () => tools.wipeSentence!)
|
|
130
134
|
: hinted;
|
|
131
135
|
const history = typeof tools.historySentence === "string" && tools.historySentence.length > 0
|