notesoup 0.60.1 → 0.61.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.
Files changed (40) hide show
  1. package/README.md +5 -4
  2. package/dist/src/boot/render.d.ts +5 -0
  3. package/dist/src/boot/render.js +48 -19
  4. package/dist/src/boot/text.d.ts +1 -3
  5. package/dist/src/boot/text.js +10 -11
  6. package/dist/src/budget/text.d.ts +1 -1
  7. package/dist/src/budget/text.js +1 -1
  8. package/dist/src/notes/errors.d.ts +1 -1
  9. package/dist/src/notes/frontmatter.d.ts +6 -0
  10. package/dist/src/notes/frontmatter.js +17 -1
  11. package/dist/src/notes/policy.js +1 -1
  12. package/dist/src/notes/store.d.ts +2 -0
  13. package/dist/src/notes/store.js +30 -5
  14. package/dist/src/tools/dream.d.ts +2 -0
  15. package/dist/src/tools/notes.d.ts +10 -0
  16. package/dist/src/tools/notes.js +14 -8
  17. package/dist/test/host-neutral.test.js +1 -1
  18. package/dist/test/note-policy.test.js +122 -8
  19. package/docs/dsh.md +2 -2
  20. package/docs/notes-library.md +4 -4
  21. package/docs/reset-lifecycle.md +1 -1
  22. package/docs/tool-results.md +1 -1
  23. package/package.json +1 -1
  24. package/playbook.md +3 -3
  25. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  26. package/plugins/claude/dist/claude/helper.js +100 -45
  27. package/plugins/claude/playbook.md +3 -3
  28. package/plugins/claude/skills/dream/SKILL.md +2 -2
  29. package/plugins/claude/skills/memory/SKILL.md +1 -1
  30. package/plugins/codex/dist/codex/notesoup.js +99 -44
  31. package/skills/dream/SKILL.md +2 -2
  32. package/skills/memory/SKILL.md +1 -1
  33. package/src/boot/render.ts +48 -17
  34. package/src/boot/text.ts +10 -11
  35. package/src/budget/text.ts +1 -1
  36. package/src/notes/errors.ts +1 -1
  37. package/src/notes/frontmatter.ts +19 -1
  38. package/src/notes/policy.ts +1 -1
  39. package/src/notes/store.ts +25 -7
  40. package/src/tools/notes.ts +14 -8
@@ -7893,7 +7893,7 @@ function eventDocument(event) {
7893
7893
  function toolEvent(item, result) {
7894
7894
  const run = result ?? item;
7895
7895
  const status = item.role === "tool_call" && result === void 0 ? "unfinished" : run.recordedStatus ?? (run.toolError === true ? "error" : "ok");
7896
- const truncated = run.outputTruncated === true;
7896
+ const truncated2 = run.outputTruncated === true;
7897
7897
  return {
7898
7898
  seq: item.seq,
7899
7899
  windowId: item.windowId,
@@ -7905,7 +7905,7 @@ function toolEvent(item, result) {
7905
7905
  status,
7906
7906
  // A call records its arguments; a bare result records none, and gets none invented.
7907
7907
  ...item.arguments === void 0 ? {} : { arguments: item.arguments },
7908
- ...truncated ? { outputTruncated: true, ...run.fullOutputPath ? { fullOutputPath: run.fullOutputPath } : {} } : {},
7908
+ ...truncated2 ? { outputTruncated: true, ...run.fullOutputPath ? { fullOutputPath: run.fullOutputPath } : {} } : {},
7909
7909
  ...run.nestedCalls ? { nestedCalls: run.nestedCalls } : {}
7910
7910
  }
7911
7911
  };
@@ -7988,14 +7988,14 @@ function visibleItem(event, maxChars, matchOffset) {
7988
7988
  const chars = Array.from(document);
7989
7989
  const start = matchOffset ?? 0;
7990
7990
  const limit = Math.max(0, maxChars);
7991
- const truncated = start > 0 || start + limit < chars.length;
7991
+ const truncated2 = start > 0 || start + limit < chars.length;
7992
7992
  return {
7993
7993
  seq: event.seq,
7994
7994
  role: event.role,
7995
7995
  created_at: event.createdAt ?? null,
7996
7996
  ...toolSummary(event),
7997
- content: truncated ? chars.slice(start, start + limit).join("") : document,
7998
- truncated,
7997
+ content: truncated2 ? chars.slice(start, start + limit).join("") : document,
7998
+ truncated: truncated2,
7999
7999
  ...matchOffset === void 0 ? {} : { offset_chars: matchOffset }
8000
8000
  };
8001
8001
  }
@@ -8165,7 +8165,7 @@ function addressFor(identity2, scope, path, who) {
8165
8165
  // src/notes/policy.ts
8166
8166
  var DEFAULT_NOTE_BUDGET = 4096;
8167
8167
  var MAX_PINNED_NOTES = 5;
8168
- var DEFAULT_PINNED_PAGES = ["CHEATSHEET.md", "MAP.md"];
8168
+ var DEFAULT_PINNED_PAGES = ["CHEATSHEET.md"];
8169
8169
  function validateNotePolicy(fields) {
8170
8170
  for (const key of ["pinned", "readonly"]) {
8171
8171
  if (fields[key] !== void 0 && typeof fields[key] !== "boolean") throw new NoteError("invalid_policy", `${key} must be a boolean.`);
@@ -8205,7 +8205,12 @@ function applyNotePolicy(target, fields) {
8205
8205
  var SCOPES = ["session", "project", "human", "agent", "model"];
8206
8206
  var ORIGINS = ["user", "self", "external"];
8207
8207
  var TIMESTAMP_KEYS = ["createdAt", "updatedAt", "lastAccessed"];
8208
- var KNOWN_KEYS = ["pinned", "budget", "readonly", "origin", "crumpledAt", "createdAt", "updatedAt", "lastAccessed", "accessCount", "sourceWindow", "supersedes", "recurrenceCount", "recurrenceWindows"];
8208
+ var KNOWN_KEYS = ["pinned", "budget", "readonly", "description", "origin", "crumpledAt", "createdAt", "updatedAt", "lastAccessed", "accessCount", "sourceWindow", "supersedes", "recurrenceCount", "recurrenceWindows"];
8209
+ var MAX_DESCRIPTION_CHARS = 160;
8210
+ function collapseDescription(value) {
8211
+ const collapsed = value.replace(/\s+/g, " ").trim();
8212
+ return collapsed.length === 0 ? void 0 : collapsed;
8213
+ }
8209
8214
  var pad2 = (value) => String(value).padStart(2, "0");
8210
8215
  function localIso(epochMs) {
8211
8216
  const date = new Date(epochMs);
@@ -8281,6 +8286,11 @@ function parseNote(raw, now = Date.now()) {
8281
8286
  meta.origin = isOrigin(meta.origin) ? meta.origin : "self";
8282
8287
  for (const key of TIMESTAMP_KEYS) meta[key] = toEpoch(meta[key], now);
8283
8288
  meta.accessCount = typeof meta.accessCount === "number" && Number.isFinite(meta.accessCount) ? meta.accessCount : 0;
8289
+ if (meta.description !== void 0) {
8290
+ const description = typeof meta.description === "string" ? collapseDescription(meta.description) : void 0;
8291
+ if (description === void 0) delete meta.description;
8292
+ else meta.description = description;
8293
+ }
8284
8294
  return { meta, body };
8285
8295
  }
8286
8296
  function yamlScalar(value) {
@@ -8720,6 +8730,13 @@ function assertOrigin(value) {
8720
8730
  if (!isOrigin(value)) throw new NoteError("invalid_origin", `origin must be one of user, self, external (got ${JSON.stringify(value)})`);
8721
8731
  return value;
8722
8732
  }
8733
+ function normalizeDescription(value) {
8734
+ const collapsed = collapseDescription(value);
8735
+ if (collapsed === void 0) return void 0;
8736
+ const count = Array.from(collapsed).length;
8737
+ if (count > MAX_DESCRIPTION_CHARS) throw new NoteError("invalid_description", `description is ${count} characters; limit is ${MAX_DESCRIPTION_CHARS}.`);
8738
+ return collapsed;
8739
+ }
8723
8740
  function assertWho(value, scope) {
8724
8741
  if (typeof value !== "string" || !(scope === "session" ? isSessionId(value) : SLUG_PATTERN.test(value))) {
8725
8742
  throw new NoteError("invalid_scope", scope === "session" ? "session id must be a safe single directory component" : "who must be a canonical lowercase slug");
@@ -8809,6 +8826,7 @@ function createNotesStore(input) {
8809
8826
  async function write(address, content, options = {}) {
8810
8827
  const stableOptions = { ...options };
8811
8828
  validateNotePolicy(stableOptions);
8829
+ const description = stableOptions.description === void 0 ? void 0 : normalizeDescription(stableOptions.description);
8812
8830
  const destination = assertAddress(address);
8813
8831
  assertWritablePath(destination.path);
8814
8832
  const scope = destination.scope;
@@ -8836,6 +8854,9 @@ function createNotesStore(input) {
8836
8854
  };
8837
8855
  meta.scope = scope;
8838
8856
  applyNotePolicy(meta, stableOptions);
8857
+ if (description === void 0) {
8858
+ if (stableOptions.description !== void 0) delete meta.description;
8859
+ } else meta.description = description;
8839
8860
  if (origin !== void 0) meta.origin = origin;
8840
8861
  delete meta.crumpledAt;
8841
8862
  meta.updatedAt = now;
@@ -8865,14 +8886,15 @@ function createNotesStore(input) {
8865
8886
  const operations = edits === void 0 ? [] : edits.map((operation) => ({ ...operation }));
8866
8887
  const stableOptions = { ...options };
8867
8888
  validateNotePolicy(stableOptions);
8889
+ const description = stableOptions.description === void 0 ? void 0 : normalizeDescription(stableOptions.description);
8868
8890
  const from = assertAddress(address);
8869
8891
  const destination = stableOptions.renameTo === void 0 ? from : assertAddress(stableOptions.renameTo);
8870
8892
  assertWritablePath(destination.path);
8871
8893
  const scope = destination.scope;
8872
8894
  assertWritableNamespace(from.scope, from.who, identity2);
8873
8895
  assertWritableNamespace(scope, destination.who, identity2);
8874
- if (operations.length === 0 && stableOptions.origin === void 0 && stableOptions.crumpled === void 0 && stableOptions.renameTo === void 0 && stableOptions.pinned === void 0 && stableOptions.budget === void 0 && stableOptions.readonly === void 0) {
8875
- throw new NoteError("nothing_to_do", "Nothing to change: provide edits, policy, an origin, a crumpled state, or a new address.");
8896
+ if (operations.length === 0 && stableOptions.origin === void 0 && stableOptions.description === void 0 && stableOptions.crumpled === void 0 && stableOptions.renameTo === void 0 && stableOptions.pinned === void 0 && stableOptions.budget === void 0 && stableOptions.readonly === void 0) {
8897
+ throw new NoteError("nothing_to_do", "Nothing to change: provide edits, a description, policy, an origin, a crumpled state, or a new address.");
8876
8898
  }
8877
8899
  const fromPath = physicalPath(from.scope, from.path, identity2, from.who);
8878
8900
  const path = physicalPath(scope, destination.path, identity2, destination.who);
@@ -8896,6 +8918,9 @@ function createNotesStore(input) {
8896
8918
  if (moved && targetRaw !== void 0) assertNoteUnlocked(parseNote(targetRaw).meta, stableOptions.readonly);
8897
8919
  const beforeMeta = { ...meta };
8898
8920
  applyNotePolicy(meta, stableOptions);
8921
+ if (description === void 0) {
8922
+ if (stableOptions.description !== void 0) delete meta.description;
8923
+ } else meta.description = description;
8899
8924
  meta.scope = scope;
8900
8925
  if (from.scope !== "session" && scope === "session") meta.project = identity2.projectKey;
8901
8926
  if (from.scope === "session" && scope !== "session") delete meta.project;
@@ -8924,10 +8949,11 @@ function createNotesStore(input) {
8924
8949
  const bodyChanged = body !== next;
8925
8950
  const originChanged = beforeMeta.origin !== meta.origin;
8926
8951
  const policyChanged = beforeMeta.pinned !== meta.pinned || beforeMeta.budget !== meta.budget || beforeMeta.readonly !== meta.readonly;
8927
- if (bodyChanged || originChanged || policyChanged || moved) meta.updatedAt = writeStamp();
8952
+ const descriptionChanged = beforeMeta.description !== meta.description;
8953
+ if (bodyChanged || originChanged || policyChanged || descriptionChanged || moved) meta.updatedAt = writeStamp();
8928
8954
  const serialized = serializeNote(meta, next);
8929
8955
  assertSerializedSize(serialized);
8930
- const metadataChanged = originChanged || policyChanged || beforeMeta.crumpledAt !== meta.crumpledAt;
8956
+ const metadataChanged = originChanged || policyChanged || descriptionChanged || beforeMeta.crumpledAt !== meta.crumpledAt;
8931
8957
  let change;
8932
8958
  if (bodyChanged && (metadataChanged || moved)) change = { kind: "body", before: raw, after: serialized };
8933
8959
  else if (bodyChanged) change = { kind: "body", before: body, after: next };
@@ -9154,8 +9180,9 @@ var ORIGIN_VALUES = [typebox_exports.Literal("user"), typebox_exports.Literal("s
9154
9180
  var ORIGIN = typebox_exports.Optional(typebox_exports.Union([...ORIGIN_VALUES], {
9155
9181
  description: "Whose handwriting: user, self, or external. Leave it out to keep what's there."
9156
9182
  }));
9183
+ var DESCRIPTION_PARAMETER = typebox_exports.Optional(typebox_exports.String({ description: "One-line summary of what's inside and when to open it (max 160 chars). Empty string clears it." }));
9157
9184
  var POLICY_PARAMETERS = {
9158
- pinned: typebox_exports.Optional(typebox_exports.Boolean({ description: "Tape the page inside the cover: read whole at every wake-up. Five per notebook, CHEATSHEET and MAP included." })),
9185
+ pinned: typebox_exports.Optional(typebox_exports.Boolean({ description: "Tape the page inside the cover: read whole at every wake-up. Five per notebook, CHEATSHEET included." })),
9159
9186
  budget: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER, description: "How much paper the page gets. Writing past it still saves, with a warning. A page over budget gets boiled down: stale lines out, repeats merged, the rest said shorter. More paper is for a page already boiled down that still needs the room." })),
9160
9187
  readonly: typebox_exports.Optional(typebox_exports.Boolean({ description: "A paperclip that keeps your own hands off. `false` takes it off \u2014 same call is fine." }))
9161
9188
  };
@@ -9177,7 +9204,7 @@ function withWarnings(text, data) {
9177
9204
  var CRUMPLED_PARAMETER = typebox_exports.Optional(typebox_exports.Boolean({ description: "`true` balls the page up: gone from list and search, still readable. `false` smooths it flat again." }));
9178
9205
  var CRUMPLED_LIST_PARAMETER = typebox_exports.Optional(typebox_exports.Boolean({ description: "Only the crumpled balls." }));
9179
9206
  var FILE_LIMIT_PARAMETER = typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, description: "How many pages at most." }));
9180
- var GLOB_PARAMETER = typebox_exports.Optional(typebox_exports.String({ minLength: 1, description: "Which drawers to open. Leave it out for this session and your current notebooks. `@project/**` one shelf \xB7 `MAP.md` that page in every notebook \xB7 `**` everything \xB7 `@sessions/*/**` every session." }));
9207
+ var GLOB_PARAMETER = typebox_exports.Optional(typebox_exports.String({ minLength: 1, description: "Which drawers to open. Leave it out for this session and your current notebooks. `@project/**` one shelf \xB7 `CHEATSHEET.md` that page in every notebook \xB7 `**` everything \xB7 `@sessions/*/**` every session." }));
9181
9208
  var CWD_PARAMETER = typebox_exports.Optional(typebox_exports.String({ minLength: 1, description: "Treat this directory's project as `@project/`." }));
9182
9209
  var ADDRESS_PARAMETER = typebox_exports.String({ description: "Which drawer the page sits in. `plan.md` \u2014 this session's desk, cleared when it ends. `@project/` this project's shelf \xB7 `@human/` your human's file \xB7 `@self/` your own notebook \xB7 `@model/` your brain's. `@projects/<name>/`, `@sessions/<id>/`, `@agents/<name>/`, `@models/<name>/` \u2014 someone else's shelf: read only. Paper, not files: hand one to read/write/edit/bash and a real `@project` folder is born." });
9183
9210
  function failureOf(error) {
@@ -9186,7 +9213,7 @@ function failureOf(error) {
9186
9213
  if (isFilesystemError(error)) return failure("io_error", "notes operation failed");
9187
9214
  throw error;
9188
9215
  }
9189
- var NORMALIZED_META_KEYS = /* @__PURE__ */ new Set(["scope", "origin", "createdAt", "updatedAt", "lastAccessed", "accessCount", "crumpledAt", "project", "pinned", "budget", "readonly"]);
9216
+ var NORMALIZED_META_KEYS = /* @__PURE__ */ new Set(["scope", "origin", "createdAt", "updatedAt", "lastAccessed", "accessCount", "crumpledAt", "project", "pinned", "budget", "readonly", "description"]);
9190
9217
  var MAX_METADATA_ENTRY_BYTES = 1024;
9191
9218
  var MAX_METADATA_VERBATIM_BYTES = 2048;
9192
9219
  var TOO_LARGE_EXTRA_VALUE = "[omitted: too large]";
@@ -9197,6 +9224,7 @@ var NoteMetadataSchema = typebox_exports.Object({
9197
9224
  updated_at: typebox_exports.String(),
9198
9225
  crumpled_at: typebox_exports.Optional(typebox_exports.String()),
9199
9226
  project: typebox_exports.Optional(typebox_exports.String()),
9227
+ description: typebox_exports.Optional(typebox_exports.String()),
9200
9228
  extra: typebox_exports.Record(typebox_exports.String(), typebox_exports.Unknown())
9201
9229
  }, { additionalProperties: false });
9202
9230
  function noteMetadata(meta, address) {
@@ -9223,6 +9251,7 @@ function noteMetadata(meta, address) {
9223
9251
  updated_at: localIso(meta.updatedAt),
9224
9252
  ...typeof meta.crumpledAt === "string" ? { crumpled_at: meta.crumpledAt } : {},
9225
9253
  ...typeof meta.project === "string" ? { project: meta.project } : {},
9254
+ ...typeof meta.description === "string" ? { description: meta.description } : {},
9226
9255
  extra
9227
9256
  };
9228
9257
  }
@@ -9233,7 +9262,8 @@ function renderMetadata(metadata) {
9233
9262
  `created ${metadata.created_at}`,
9234
9263
  `updated ${metadata.updated_at}`,
9235
9264
  ...metadata.crumpled_at === void 0 ? [] : [`crumpled ${metadata.crumpled_at}`],
9236
- ...metadata.project === void 0 ? [] : [`project ${metadata.project}`]
9265
+ ...metadata.project === void 0 ? [] : [`project ${metadata.project}`],
9266
+ ...metadata.description === void 0 ? [] : [`description ${metadata.description}`]
9237
9267
  ];
9238
9268
  const extra = Object.keys(metadata.extra);
9239
9269
  if (extra.length > 0) fields.push(`extra ${JSON.stringify(metadata.extra)}`);
@@ -9260,7 +9290,8 @@ var ListedFileSchema = typebox_exports.Object({
9260
9290
  ...PolicySchema,
9261
9291
  ...WarningsSchema,
9262
9292
  updated_at: typebox_exports.String(),
9263
- crumpled_at: typebox_exports.Optional(typebox_exports.String())
9293
+ crumpled_at: typebox_exports.Optional(typebox_exports.String()),
9294
+ description: typebox_exports.Optional(typebox_exports.String())
9264
9295
  }, { additionalProperties: false });
9265
9296
  var MatchSchema = typebox_exports.Object({
9266
9297
  line: typebox_exports.Integer(),
@@ -9320,9 +9351,9 @@ function snapshot(rows, limit, status, renderData, shrink) {
9320
9351
  }
9321
9352
  function listedFile(row, identity2) {
9322
9353
  const policy = policyAt(row.meta, row.address);
9323
- return { ...noteIdentity(identity2, row.address), ...policy, warnings: row.warnings ?? (row.body === void 0 ? [] : noteBudgetWarnings(row.body, policy)), updated_at: localIso(row.meta.updatedAt), ...row.meta.crumpledAt === void 0 ? {} : { crumpled_at: row.meta.crumpledAt } };
9354
+ return { ...noteIdentity(identity2, row.address), ...policy, warnings: row.warnings ?? (row.body === void 0 ? [] : noteBudgetWarnings(row.body, policy)), updated_at: localIso(row.meta.updatedAt), ...row.meta.crumpledAt === void 0 ? {} : { crumpled_at: row.meta.crumpledAt }, ...typeof row.meta.description === "string" ? { description: row.meta.description } : {} };
9324
9355
  }
9325
- var notesWriteParameters = typebox_exports.Object({ address: ADDRESS_PARAMETER, content: typebox_exports.String({ description: "The whole page." }), origin: ORIGIN, ...POLICY_PARAMETERS, cwd: CWD_PARAMETER }, { additionalProperties: false });
9356
+ var notesWriteParameters = typebox_exports.Object({ address: ADDRESS_PARAMETER, content: typebox_exports.String({ description: "The whole page." }), origin: ORIGIN, description: DESCRIPTION_PARAMETER, ...POLICY_PARAMETERS, cwd: CWD_PARAMETER }, { additionalProperties: false });
9326
9357
  function renderWriteData(data) {
9327
9358
  return withWarnings(`${data.outcome} ${renderIdentity(data)} | ${renderPolicy(data)}`, data);
9328
9359
  }
@@ -9336,7 +9367,7 @@ var notesWrite = {
9336
9367
  async execute(params, context2) {
9337
9368
  try {
9338
9369
  const identity2 = notesIdentityForCall(context2, params.cwd);
9339
- const { outcome, meta, warnings } = await createNotesStore(identity2).write(params.address, params.content, { origin: params.origin, pinned: params.pinned, budget: params.budget, readonly: params.readonly });
9370
+ const { outcome, meta, warnings } = await createNotesStore(identity2).write(params.address, params.content, { origin: params.origin, description: params.description, pinned: params.pinned, budget: params.budget, readonly: params.readonly });
9340
9371
  return success({ ...noteIdentity(identity2, params.address), outcome, ...policyAt(meta, params.address), warnings });
9341
9372
  } catch (error) {
9342
9373
  return failureOf(error);
@@ -9348,6 +9379,7 @@ var notesUpdateParameters = typebox_exports.Object({
9348
9379
  address: ADDRESS_PARAMETER,
9349
9380
  edits: typebox_exports.Optional(typebox_exports.Array(typebox_exports.Object({ oldText: typebox_exports.String({ description: "The passage as it stands on the page." }), newText: typebox_exports.String({ description: "What goes in its place." }) }, { additionalProperties: false }), { description: "Pen strokes, in order. Each `oldText` is the exact passage \u2014 same case, found once \u2014 and `newText` is what goes in its place." })),
9350
9381
  origin: ORIGIN,
9382
+ description: DESCRIPTION_PARAMETER,
9351
9383
  ...POLICY_PARAMETERS,
9352
9384
  crumpled: CRUMPLED_PARAMETER,
9353
9385
  replace_all: typebox_exports.Optional(typebox_exports.Boolean({ description: "Strike every copy of `oldText`, not just one." })),
@@ -9370,7 +9402,7 @@ var notesUpdate = {
9370
9402
  const identity2 = notesIdentityForCall(context2, params.cwd);
9371
9403
  const store = createNotesStore(identity2);
9372
9404
  const renameTo = params.rename_to === "" ? void 0 : params.rename_to;
9373
- const { change, moved, meta, warnings } = await store.update(params.address, params.edits, { origin: params.origin, pinned: params.pinned, budget: params.budget, readonly: params.readonly, crumpled: params.crumpled, replaceAll: params.replace_all, renameTo });
9405
+ const { change, moved, meta, warnings } = await store.update(params.address, params.edits, { origin: params.origin, description: params.description, pinned: params.pinned, budget: params.budget, readonly: params.readonly, crumpled: params.crumpled, replaceAll: params.replace_all, renameTo });
9374
9406
  onChange?.(change);
9375
9407
  const from = noteIdentity(identity2, params.address).address;
9376
9408
  const to = noteIdentity(identity2, renameTo ?? params.address);
@@ -9422,7 +9454,7 @@ var notesListParameters = typebox_exports.Object({
9422
9454
  function renderListData(data) {
9423
9455
  const lines = [`${data.files.length} ${data.files.length === 1 ? "note" : "notes"}`];
9424
9456
  for (const file of data.files) {
9425
- const fields = [`- ${renderIdentity(file)}`, renderPolicy(file), `updated ${file.updated_at}`];
9457
+ const fields = [file.description === void 0 ? `- ${renderIdentity(file)}` : `- ${renderIdentity(file)} \u2014 ${file.description}`, renderPolicy(file), `updated ${file.updated_at}`];
9426
9458
  if (file.last_accessed !== void 0) fields.push(`accessed ${file.last_accessed}`);
9427
9459
  if (file.crumpled_at !== void 0) fields.push(`crumpled ${file.crumpled_at}`);
9428
9460
  if (file.matches) fields.push(`${file.matches.length} ${file.matches.length === 1 ? "match" : "matches"}${file.more_matches ? `, ${file.more_matches} more lines` : ""}`);
@@ -11218,7 +11250,6 @@ async function loadNotesSnapshot(identity2, openedAt, loadNamespace) {
11218
11250
  }
11219
11251
 
11220
11252
  // src/boot/text.ts
11221
- var SHELF_FRESH_LIMIT = 3;
11222
11253
  var WINDOW_IDENTITY_OPEN_TAG = "<notesoup:window_identity>";
11223
11254
  var WINDOW_IDENTITY_CLOSE_TAG = "</notesoup:window_identity>";
11224
11255
  var NOTES_PROTOCOL_OPEN_TAG = "<notesoup:notes_protocol>";
@@ -11260,24 +11291,25 @@ Still a tie? *shrugs* You've got a brain. Use it.
11260
11291
  Any other @ address is fake. End of discussion. @ addresses are not file paths: never pass them to file tools like \`read\`, \`write\`, \`edit\`, or \`bash\`.
11261
11292
  ${NOTES_PROTOCOL_CLOSE_TAG}`;
11262
11293
  var MAPS_BLOCK = `<notesoup:maps>
11263
- Every notebook's root has two default pins: \`CHEATSHEET.md\` and \`MAP.md\`.
11264
- Pinned pages get jammed straight into your brain the moment you wake up. Whoever wakes up next
11265
- reads them, and next is you. So keep them short, and keep them true.
11294
+ Each notebook has one default pin: \`CHEATSHEET.md\`. Pinned pages get jammed straight into your
11295
+ brain the moment you wake up. Whoever wakes up next reads them, and next is you. So keep them
11296
+ short, and keep them true.
11266
11297
 
11267
- Up to five pages per notebook can be taped inside the cover, these two included. Every page gets
11298
+ Up to five pages per notebook can be taped inside the cover, CHEATSHEET included. Every page gets
11268
11299
  a paper budget; when a page outgrows it, boil it down \u2014 stale lines out, repeats merged, the rest
11269
11300
  said shorter \u2014 instead of giving it more paper.
11270
11301
 
11271
11302
  - **\`CHEATSHEET.md\`** holds what you'll want next time \u2014 a rule, a warning, a grudge, a name,
11272
11303
  a phone number you'll regret losing. Nobody grades it. Keep it to five lines, or it grows fat
11273
11304
  and everybody pays for it.
11274
- - **\`MAP.md\`** is only the note index. One line per durable note: the address, then a gist short
11275
- enough to tell whether the thing is worth opening. Rules belong in \`CHEATSHEET.md\`, and note
11276
- contents belong in their own notes \u2014 *taps the sign* not inline here.
11305
+ - **\`description\`** is one line saying what's inside a note and when to open it \u2014 max 160
11306
+ characters, set through your notes tools. Boot indexes every shelf from these,
11307
+ newest first, address and age beside them. No hand-written map to keep in sync: a stale
11308
+ description lies to the next window, so keep it true or crumple the page.
11277
11309
 
11278
11310
  Each notebook keeps its own: \`@project\`, \`@human\`, \`@self\`, \`@model\`. Missing pages are skipped;
11279
- no need to create empty ones. New note, new MAP line. New rule worth remembering, new Cheatsheet
11280
- line. And when a line goes wrong, stale, or useless, kill it \u2014 tomorrow's you reads that page as fact.
11311
+ no need to create empty ones. New rule worth remembering, new Cheatsheet line. And when a line
11312
+ goes wrong, stale, or useless, kill it \u2014 tomorrow's you reads that page as fact.
11281
11313
  </notesoup:maps>`;
11282
11314
  function renderProtocolBlock(tools, agentName = NAMELESS_AGENT) {
11283
11315
  const names = {
@@ -11305,14 +11337,30 @@ function relativeTime(timestamp, now) {
11305
11337
  const amount = `${Math.abs(Math.trunc(seconds / size))}${unit}`;
11306
11338
  return seconds > 0 ? `in ${amount}` : `${amount} ago`;
11307
11339
  }
11308
- var FEED_TITLE_MAX_CHARS = 40;
11340
+ var SHELF_INDEX_MAX_ENTRIES = 25;
11341
+ var SHELF_INDEX_MAX_CHARS = 4096;
11342
+ var FALLBACK_TITLE_MAX_CHARS = 80;
11343
+ function truncated(text, max) {
11344
+ const chars = Array.from(text);
11345
+ return chars.length > max ? `${chars.slice(0, max).join("")}\u2026` : chars.join("");
11346
+ }
11309
11347
  function feedTitle(body) {
11310
11348
  const lines = body.split("\n");
11311
11349
  const heading = lines.find((line) => /^#+\s+\S/.test(line));
11312
11350
  const raw = (heading ? heading.replace(/^#+\s+/, "") : lines.find((line) => line.trim().length > 0) ?? "").trim();
11313
- if (raw.length === 0) return void 0;
11314
- const chars = Array.from(raw);
11315
- return chars.length > FEED_TITLE_MAX_CHARS ? `${chars.slice(0, FEED_TITLE_MAX_CHARS).join("")}\u2026` : chars.join("");
11351
+ return raw.length === 0 ? void 0 : truncated(raw, FALLBACK_TITLE_MAX_CHARS);
11352
+ }
11353
+ function summaryOf(row) {
11354
+ if (typeof row.meta.description === "string") {
11355
+ const collapsed = collapseDescription(row.meta.description);
11356
+ return collapsed === void 0 ? void 0 : truncated(collapsed, MAX_DESCRIPTION_CHARS);
11357
+ }
11358
+ return feedTitle(row.body);
11359
+ }
11360
+ function indexLine(row, openedAt) {
11361
+ const locator = `${row.address} \xB7 ${relativeTime(row.meta.updatedAt, openedAt)}`;
11362
+ const summary = summaryOf(row);
11363
+ return summary === void 0 ? ` ${locator}` : ` ${locator} \u2014 ${summary}`;
11316
11364
  }
11317
11365
  function indent(text) {
11318
11366
  return text.split("\n").map((line) => line.length > 0 ? ` ${line}` : line).join("\n");
@@ -11340,13 +11388,20 @@ function notesIndex(snapshot2, tools, agentName, modelName) {
11340
11388
  const rows = (snapshot2.namespaces.get(namespace.scope) ?? []).filter((row) => row.meta.crumpledAt === void 0);
11341
11389
  const pins = rows.filter((row) => effectiveNotePolicy(row.meta, row.path).pinned).sort((a, b) => pinnedPageOrder(a.path) - pinnedPageOrder(b.path) || a.path.localeCompare(b.path));
11342
11390
  const pinned = pins.slice(0, MAX_PINNED_NOTES);
11343
- const fresh = rows.filter((row) => !effectiveNotePolicy(row.meta, row.path).pinned).slice(0, SHELF_FRESH_LIMIT).map((row) => {
11344
- const locator = `${row.address} \xB7 ${relativeTime(row.meta.updatedAt, snapshot2.openedAt)}`;
11345
- const title = feedTitle(row.body);
11346
- return title === void 0 ? ` ${locator}` : ` ${title}
11347
- ${locator}`;
11348
- });
11349
- if (pinned.length === 0 && fresh.length === 0) continue;
11391
+ const unpinned = rows.filter((row) => !effectiveNotePolicy(row.meta, row.path).pinned);
11392
+ const index = [];
11393
+ let usedChars = 0;
11394
+ for (const row of unpinned) {
11395
+ if (index.length >= SHELF_INDEX_MAX_ENTRIES) break;
11396
+ const line = indexLine(row, snapshot2.openedAt);
11397
+ const nextChars = usedChars + (index.length > 0 ? 1 : 0) + line.length;
11398
+ if (index.length > 0 && nextChars > SHELF_INDEX_MAX_CHARS) break;
11399
+ index.push(line);
11400
+ usedChars = nextChars;
11401
+ }
11402
+ const omitted = unpinned.length - index.length;
11403
+ if (omitted > 0) index.push(` \u2026 and ${omitted} more (use ${tools.notesList})`);
11404
+ if (pinned.length === 0 && index.length === 0) continue;
11350
11405
  const parts = pinned.map((row) => {
11351
11406
  const warnings = noteBudgetWarnings(row.body, effectiveNotePolicy(row.meta, row.path));
11352
11407
  return `${row.address}
@@ -11354,9 +11409,9 @@ function notesIndex(snapshot2, tools, agentName, modelName) {
11354
11409
  ${indent([...warnings, row.body].join("\n"))}`;
11355
11410
  });
11356
11411
  if (pins.length > MAX_PINNED_NOTES) parts.push(indent(`Warning: 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}.`));
11357
- if (fresh.length > 0) parts.push(`recent
11412
+ if (index.length > 0) parts.push(pinned.length > 0 ? `notes
11358
11413
 
11359
- ${fresh.join("\n\n")}`);
11414
+ ${index.join("\n")}` : index.join("\n"));
11360
11415
  shelves.push(section(namespace.label, parts.join("\n\n")));
11361
11416
  }
11362
11417
  return shelves.length > 0 ? ["YOUR NOTES\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500", ...shelves].join("\n\n\n") : "YOUR NOTES\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nNone yet. A blank slate is a fine place to start \u2014 just don't finish there.";
@@ -11405,7 +11460,7 @@ function selectContinuation(origin) {
11405
11460
  return pool[Math.floor(Math.random() * pool.length)];
11406
11461
  }
11407
11462
  var WARNING_TIMING = "The reserve is nearly spent. The wipe lands at the end of whichever turn spends the last of it, possibly this one.";
11408
- var WARNING_BODY = "Stop the task. Write down what git and history can't give back:\n- where you are, and how far you got\n- what the human decided, in their words\n- what's blocked or waiting\n- the next move\n- where the half-done work sits\n- what failed, and why\n- which skills, seqs, notes, or files to reopen\n- anything else worth noting\nThen leave the shelf current: replace what's stale, a whole note or a section inside one, and crumple the dead ones. Update and trim pinned pages (CHEATSHEET.md and MAP.md by default); every new window loads the pins. The next window gets whatever you leave, dead notes and dead sections alike.\nDon't call anything that might return a large output. One big read can spend the rest of the reserve before your notes are saved.";
11463
+ var WARNING_BODY = "Stop the task. Write down what git and history can't give back:\n- where you are, and how far you got\n- what the human decided, in their words\n- what's blocked or waiting\n- the next move\n- where the half-done work sits\n- what failed, and why\n- which skills, seqs, notes, or files to reopen\n- anything else worth noting\nThen leave the shelf current: replace what's stale, a whole note or a section inside one, and crumple the dead ones. Update and trim pinned pages (CHEATSHEET.md by default) and keep each page's one-line `description` true; every new window loads the pins and renders the index. The next window gets whatever you leave, dead notes and dead sections alike.\nDon't call anything that might return a large output. One big read can spend the rest of the reserve before your notes are saved.";
11409
11464
  var WARNING_CALL = "Then call `empty_brain`. Nothing in between.";
11410
11465
  function warningPrompt() {
11411
11466
  return `${WARNING_TIMING}
@@ -22,12 +22,12 @@ Durable notes hold decisions, constraints, and lessons that stay true after the
22
22
 
23
23
  1. **Leave stable notes alone.** Change a note to incorporate new evidence, fix a verified error, retire a stale claim, merge a genuine duplicate, trim diary content, or split an oversized file, not merely to shorten or rephrase it. No change is a valid outcome.
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
- 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. `dream_begin` lists each note's last access; reads during a dream leave no stamp, so reviewing a note does not make it look fresh.
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. Fix its `description` either way. A note's last access is a hint, not evidence: long-unread notes are candidates to check, not to crumple on sight. `dream_begin` lists each note's last access; reads during a dream leave no stamp, 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 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.
27
+ 5. **Relocate misfiled notes.** When a standing ruling or the note's own `description` already names its proper notebook, move it there, preserving its metadata, and keep its `description` true. 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 default to pinned and load every window when live unless explicitly unpinned; do not create empty pages. Each notebook allows five live pins. Ordinary pages default to a 4096-code-point advisory budget (2048 for root `CHEATSHEET.md` and `MAP.md`), 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.
30
+ 8. **Keep wake-up pages useful.** Each writable notebook's `CHEATSHEET.md` holds standing reminders, kept to five lines; it is the one default-pinned page and loads every window when live unless explicitly unpinned. Every durable note gets a one-line `description` (max 160 characters) saying what it holds and when to open it — boot lists each notebook's unpinned notes newest first from these, so a missing, stale, or vague description hides the page. A hand-written `MAP.md` is an ordinary note now; once its lines live in `description`s, crumple it. Do not create empty pages. Each notebook allows five live pins. Ordinary pages default to a 4096-code-point advisory budget (2048 for root `CHEATSHEET.md`), adjustable per note; overflow warns without truncating a pinned body. Preserve standing rules and keep descriptions true as notes are promoted or retired.
31
31
 
32
32
  ## Deleting
33
33
 
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: dream
3
- description: Review and consolidate durable notes using notesoup's shared dream playbook. Use when the human asks to dream over notes, merge genuine duplicates, update maps, or promote durable findings.
3
+ description: Review and consolidate durable notes using notesoup's shared dream playbook. Use when the human asks to dream over notes, merge genuine duplicates, audit descriptions, or promote durable findings.
4
4
  ---
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` (five lines); `MAP.md` holds only the note index. Both default to pinned and load every window when live unless explicitly unpinned. Ordinary notes default to a 4096-code-point advisory budget (2048 for root `CHEATSHEET.md` and `MAP.md`), adjustable per note; pinned bodies load whole with overflow warnings. Respect soft readonly locks; explicitly unlock with `readonly:false` before changing a locked note.
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` (five lines), the one default-pinned page; it loads every window when live unless explicitly unpinned. Every durable note carries a one-line `description` (max 160 characters) 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. Ordinary notes default to a 4096-code-point advisory budget (2048 for root `CHEATSHEET.md`), adjustable per note; pinned bodies load whole with overflow warnings. 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
 
@@ -32,7 +32,7 @@ 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 each notebook's root are separate default-pinned pages you wake up with; absent or crumpled pages are skipped. Set `pinned`, `budget`, and `readonly` through `notes_write`/`notes_update` or frontmatter. Explicit `pinned:false` unpins even a default page. Each notebook allows five live pins; ordinary pages default to a 4096-code-point advisory budget (2048 for root `CHEATSHEET.md` and `MAP.md`), adjustable per note. Overflow warns but saves, and pinned bodies load whole. `readonly:true` is a soft lock, not security; explicitly set `readonly:false` to unlock, alone or alongside your changes. 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.
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`, `budget`, and `readonly` through `notes_write`/`notes_update` or frontmatter. Explicit `pinned:false` unpins even a default page. Each notebook allows five live pins; ordinary pages default to a 4096-code-point advisory budget (2048 for root `CHEATSHEET.md`), adjustable per note. Overflow warns but saves, and pinned bodies load whole. `readonly:true` is a soft lock, not security; explicitly set `readonly:false` to unlock, alone or alongside your changes. Keep standing reminders in `CHEATSHEET.md`, to five lines. Give each durable note a one-line `description` (max 160 characters, set with `notes_write`/`notes_update`): 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
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