@reinsjs/brain 0.5.0 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @reinsjs/brain
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 276988e: Resident snapshots in `pins()`: a host spec can be `{ name, snapshot }`, where `snapshot(ctx)` may be async. It is taken when a segment starts — the session's first turn and the first turn after every compaction (model, forced or threshold) — and appended as a host pin only when it differs from the copy in view; within a segment it is not called again. When it changes after a compaction, the old copy is superseded and dropped from that same turn's request, so the model sees exactly one. Snapshot pins carry `meta.pin.snapshot: true` and are not carried through `handoff` (the new session takes its own). Use it for an index of the model's memory or the item it is working on, so compaction folds the work but not the context the model works from; README has a recipe. The segment helpers `modelActedSinceLastCompaction` and `timelineSoFar` moved to a shared file and are still exported from the same place. Also fixes the README example, which passed `pins({ host })` instead of `pins({ pins })`.
8
+
3
9
  ## 0.5.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -18,7 +18,7 @@ const agent = createAgent({
18
18
  sockets: [
19
19
  perception(), // "you have used 61% of your context" — as a note, not an action
20
20
  compact(), // a `compact` tool the model calls when it decides to tidy
21
- pins({ host: ["Never touch prod without approval"] }),
21
+ pins({ pins: ["Never touch prod without approval"] }),
22
22
  spill(), // big tool results go to the BlobStore; the model gets a preview + fetch_blob
23
23
  memory({ namespace: () => "/roles/analyst" }),
24
24
  // a menu of SKILL.md names in the prompt; the model reads one with skill_read.
@@ -36,7 +36,7 @@ const agent = createAgent({
36
36
  | --- | --- | --- |
37
37
  | `perception()` | A `system_note` at the end of the timeline with context usage, history length and budget headroom, in coarse tiers so it does not change every turn (cache-friendly). Calibrated against the last real `budget_usage`. | nothing |
38
38
  | `compact()` | A `compact` tool: the model summarizes a range of old turns itself; the summary carries a manifest of the folded tool results and a `recall({ seq })` tool fetches any of them back verbatim. When the window passes 75% and the model has not compacted since the last fold, it appends a note asking the model to compact first, and asks once more, more bluntly, at 80% (`decidedBy: "forced"`; `force: false` turns this off, `force: { at, render, directive }` tunes it — `at` takes one ratio or an ascending list). The request is marked as a directive, so lowerings deliver it as a tagged user note even where mid-conversation system messages are accepted: some upstreams accept those but do not act on instructions inside them. If the model still does not compact, a threshold fallback at 85% folds the oldest turns down to 60%. **Recommended on** since 2026-09-10: measured on DeepSeek and Claude, recall stayed at 100% while tokens went down. | a `BlobStore` is not required |
39
- | `pins()` | Host-declared constraints (static text or extracted from the conversation) plus a `pin` tool. Pinned notes survive compaction and are re-injected when they scroll out. | nothing |
39
+ | `pins()` | Host-declared constraints (static text or extracted from the conversation) plus a `pin` tool. Pinned notes survive compaction and are re-injected when they scroll out. A host spec can also be a **resident snapshot** (`{ name, snapshot }`, sync or async): taken at the start of each segment — the session's first turn and the first turn after every compaction — and appended only when it differs from the copy in view, so an index of the model's memory stays at hand without being rewritten mid-task (see below). | nothing |
40
40
  | `spill()` | Tool results above a size limit are stored whole in the `BlobStore`; the model sees head + tail + a blob id and pages through with `fetch_blob`. Without a `BlobStore` the module warns once and passes results through unchanged (no silent truncation). | a `BlobStore` |
41
41
  | `handoff()` | A `handoff` tool: the model writes a summary and next steps and moves to a fresh session; visible pins travel along. The mechanics (new session, opening note) are in the core loop. **Off by default** — turn it on when tasks routinely outlive one context window. | host must rebind the UI to the new session (`onHandoff`) |
42
42
  | `memory()` | A `memory` tool shaped like Anthropic's `memory_20250818` (view / create / str_replace / insert / delete / rename under `/memories`). Every operation leaves a `memory_op` event. Isolation is by `namespace`, invisible to the model. **Off by default.** | a `MemoryStore` |
@@ -49,6 +49,26 @@ const agent = createAgent({
49
49
 
50
50
  Any `MemoryStore` (in-memory, `@reinsjs/store-sqlite`, `@reinsjs/store-pg`) is also a `SkillSource`: write `/skills/<name>/SKILL.md` (frontmatter with `name` equal to `<name>` and a `description`) and, optionally, `/skills/<name>/<file>` for supporting files, then pass the same store as `source`. The model's `memory` tool only reaches `/memories`, so one table holds writable private notes and read-only shared skills at once; `memory({ namespace })` prefixes apply to memories only, skills are shared by every principal. `skills()` refuses a `root` that overlaps `/memories` — a skill the model could write itself must never be trusted like the system prompt.
51
51
 
52
+ ### Resident context that survives compaction
53
+
54
+ Compaction folds the conversation, not the system prompt or the tool list, so the model keeps who it is and what it can do. What it loses is context you attached to the conversation — an index of its memory, the item it is working on. Declare that as a resident snapshot instead:
55
+
56
+ ```ts
57
+ /** One line per memory file: the index, not the content. The model opens a file with its `memory` tool. */
58
+ function memoryIndex(store: MemoryStore) {
59
+ return async (): Promise<string | undefined> => {
60
+ const paths = await store.list("/memories/")
61
+ if (paths.length === 0) return undefined
62
+ return ["Your memory files (open one with the memory tool):", ...paths.map((p) => `- ${p}`)].join("\n")
63
+ }
64
+ }
65
+
66
+ const residentContext = (store: MemoryStore) =>
67
+ pins({ pins: [{ name: "memory-index", snapshot: memoryIndex(store) }], tool: false })
68
+ ```
69
+
70
+ The snapshot is taken when a segment starts: the first turn of the session, and the first turn after each compaction (the model's own, a requested one, or the threshold fallback). Within a segment it is not refreshed — whatever the model wrote to memory is already in its context; after a compaction folds that away, the index is taken again and the old copy disappears in the same turn. If nothing changed, nothing is appended. Changes made by someone else mid-segment show up after the next compaction; use `extract` if you need them live. A snapshot is a pin and occupies context permanently: keep it to an index and short status, and let the model open the details. It is not carried through `handoff` — the new session takes its own. If `snapshot` throws, the run fails; catch inside it and return `undefined` to keep the previous copy instead.
71
+
52
72
  ## Things that are deliberate
53
73
 
54
74
  - **Sockets run in order, and order matters.** `approval()` belongs last so it judges the arguments after any `rewrite`; `perception()` appends its note at the end of the visible events so the model reads it last.
package/dist/index.d.ts CHANGED
@@ -282,6 +282,26 @@ declare function segmentTimelineByTurn(timeline: readonly Event[]): Event[][];
282
282
  */
283
283
  declare function trailingCompactionRun(timeline: readonly Event[]): number;
284
284
 
285
+ /**
286
+ * "段"的判据(compact 与 pins 共用,2026-10-31 从 compact/request.ts 挪出):段 = 会话开头或最近一次整理
287
+ * (任何 decidedBy,含本轮投影新造的阈值兜底)之后、到下一次整理之前。全部从时间线读,没有跨轮状态:
288
+ * 续跑、跨实例、多 run 的长期会话都一致。
289
+ *
290
+ * - compact 的整理请求:刚整理完、模型还没动过就不请(`modelActedSinceLastCompaction`)
291
+ * - pins 的常驻快照:段起点取一份(`atSegmentStart`)
292
+ */
293
+
294
+ /**
295
+ * 最后一次整理之后模型有没有动过(正文或工具调用);从没整理过算动过。
296
+ * 刚整理完、折后仍在软线以上时,先让模型干一轮活再请,免得整理一结束就被追着连请、撞上连续整理上限
297
+ */
298
+ declare function modelActedSinceLastCompaction(timeline: readonly Event[]): boolean;
299
+ /**
300
+ * 截至此刻的时间线:本轮开始时的快照 + 本轮新增(投影新造的阈值 compaction、beforeModel 追加的说明)。
301
+ * 后者只在 ctx.events 里、不在 ctx.timeline 里,按 seq 大于快照末尾取出
302
+ */
303
+ declare function timelineSoFar(ctx: TurnContext): Event[];
304
+
285
305
  /**
286
306
  * 到线请模型整理(OPT-261030-3):用量过软线、本段还没请过时,在末尾追加一条说明请模型先 compact 再继续。
287
307
  *
@@ -330,16 +350,7 @@ declare function isCompactRequest(e: Event): boolean;
330
350
  declare function compactRequestedSinceLastCompaction(timeline: readonly Event[]): boolean;
331
351
  /** 最后一次整理之后的整理请求条数 = 本段已用掉几级 */
332
352
  declare function compactRequestsSinceLastCompaction(timeline: readonly Event[]): number;
333
- /**
334
- * 最后一次整理之后模型有没有动过(正文或工具调用);从没整理过算动过。
335
- * 刚整理完、折后仍在软线以上时,先让模型干一轮活再请,免得整理一结束就被追着连请、撞上连续整理上限
336
- */
337
- declare function modelActedSinceLastCompaction(timeline: readonly Event[]): boolean;
338
- /**
339
- * 截至此刻的时间线:本轮开始时的快照 + 本轮新增(投影新造的阈值 compaction、beforeModel 追加的说明)。
340
- * 后者只在 ctx.events 里、不在 ctx.timeline 里,按 seq 大于快照末尾取出
341
- */
342
- declare function timelineSoFar(ctx: TurnContext): Event[];
353
+
343
354
  /** 本轮真实上下文占窗口的比例:投影估算 + 校准出的固定开销,与感知读数、阈值兜底同一把尺 */
344
355
  declare function contextUsageRatio(ctx: TurnContext): number;
345
356
 
@@ -553,7 +564,10 @@ interface HandoffArgs {
553
564
  declare function parseHandoffArgs(raw: unknown): HandoffArgs;
554
565
  /** 新会话 seq 1 的文字(也是旧会话 handoff.summary):摘要 + 编号的下一步 */
555
566
  declare function composeHandoffNote(args: Pick<HandoffArgs, "summary" | "nextSteps">): string;
556
- /** 模型当前可见、未被取代的 pin,按可见顺序复制成新会话的开场草稿 */
567
+ /**
568
+ * 模型当前可见、未被取代的 pin,按可见顺序复制成新会话的开场草稿。
569
+ * 常驻快照(pins 的 `snapshot` spec)不带:新会话是新段,由它自己在段起点取一份当前的,而不是带去旧的再被取代
570
+ */
557
571
  declare function carriedPins(ctx: TurnContext): EventDraft[];
558
572
  /** 模型当前可见的最后一条用户消息的文字;没有则 undefined */
559
573
  declare function lastVisibleUserMessage(events: readonly Event[]): string | undefined;
@@ -1069,6 +1083,11 @@ declare function renderPerception(r: PerceptionReading): string;
1069
1083
  * ToolContext 没有视图),emit `system_note(kind=pin, actor=model, parentId=tool_call)`,再把结果换成回执。
1070
1084
  * `replaces` 只能指向模型自己钉的(meta.pin.source = "model"):宿主钉的是宿主的约束,模型动不了。
1071
1085
  *
1086
+ * 宿主声明还有第三种:**常驻快照** `{ name, snapshot }`(2026-10-31,OnSet 建议 5 改写)。给记忆索引、当前条目这类
1087
+ * "会变、但该一直在手边"的内容一个压缩不掉的位置,口径对齐 Claude Code 的常驻记忆索引:开场取一份;段内不刷新
1088
+ * (模型自己写记忆的过程就在上下文里);每次整理后按当前实际再取一份(写记忆的那段被折走了);没变不追加。
1089
+ * 时机从时间线判(shared/segment.ts 的段起点),内容按数据判(与视图里那份逐字比)。
1090
+ *
1072
1091
  * 说明的 `meta.pin` 记来源与 spec 名(不进模型上下文),判重与 supersede 靠它,回放 / eval 也靠它分辨谁钉的。
1073
1092
  * 没有 unpin:append-only 日志里"撤销"只能表达为"被新说明取代",模型要撤销就钉一条当前有效的说法去替换旧的。
1074
1093
  */
@@ -1078,6 +1097,10 @@ declare function renderPerception(r: PerceptionReading): string;
1078
1097
  * - 字符串:静态文本,名字就是文本本身
1079
1098
  * - `{ name, text }`:静态文本,命名(换措辞时名字不变,旧文字会被取代而不是并存)
1080
1099
  * - `{ name, extract }`:每轮从上下文抽取;返回 undefined / 空串表示"这轮没新说法",上一条继续生效
1100
+ * - `{ name, snapshot }`:常驻快照,只在段起点取(会话开头、每次整理之后模型动手之前;本段取到过就不再取),
1101
+ * 另外时间线里从没有过本 spec 的 pin 时也取(老会话第一次装上)。可以是异步的(读记忆存储)。
1102
+ * 与视图里那份逐字相同不追加;不同则追加并取代旧的。段内别人改了数据本段看不到,要实时用 `extract`。
1103
+ * 它是 pin、永久占上下文:只放索引与简要状态,正文让模型按需读。抛错照常抛出,想降级就在函数里 catch 返回 undefined
1081
1104
  */
1082
1105
  type PinSpec = string | {
1083
1106
  name: string;
@@ -1085,6 +1108,9 @@ type PinSpec = string | {
1085
1108
  } | {
1086
1109
  name: string;
1087
1110
  extract: (ctx: TurnContext) => string | undefined;
1111
+ } | {
1112
+ name: string;
1113
+ snapshot: (ctx: TurnContext) => MaybePromise<string | undefined>;
1088
1114
  };
1089
1115
  interface PinsOptions {
1090
1116
  /** 宿主声明的 pin。名字必须唯一 */
@@ -1105,10 +1131,11 @@ interface PinsOptions {
1105
1131
  declare const PINS_SOCKET_NAME = "pins";
1106
1132
  declare const DEFAULT_MAX_PIN_TEXT_LENGTH = 500;
1107
1133
  declare const DEFAULT_PIN_OVERSHOOT_TOLERANCE = 0.2;
1108
- /** system_note.meta.pin 的形状:谁钉的、宿主 spec 名 */
1134
+ /** system_note.meta.pin 的形状:谁钉的、宿主 spec 名;常驻快照另标 snapshot(handoff 据此不带走) */
1109
1135
  interface PinMeta {
1110
1136
  source: "host" | "model";
1111
1137
  spec?: string;
1138
+ snapshot?: true;
1112
1139
  }
1113
1140
  type PinNote = CoreEventOf<"core.system_note">;
1114
1141
  /** 入参 schema;`maxLength` 随 maxTextLength 变,模型下笔前就看得到上限(E3c) */
@@ -1150,6 +1177,8 @@ interface PinArgs {
1150
1177
  declare function parsePinArgs(raw: unknown, maxTextLength?: number, overshootTolerance?: number): PinArgs;
1151
1178
  declare function isPinNoteEvent(e: Event): e is PinNote;
1152
1179
  declare function pinMetaOf(e: PinNote): PinMeta | undefined;
1180
+ /** 是不是常驻快照 pin(handoff 不带走它:新会话是新段,自己取当前的) */
1181
+ declare function isSnapshotPin(e: Event): boolean;
1153
1182
  /** 某个宿主 spec 最后一条 pin(从后往前找) */
1154
1183
  declare function lastHostPin(events: readonly Event[], spec: string): PinNote | undefined;
1155
1184
  /** 模型钉的、文字完全相同的一条(从后往前找) */
@@ -1483,4 +1512,4 @@ declare function parseFetchBlobArgs(raw: unknown): FetchBlobArgs;
1483
1512
  declare function isTextMime(mime: string): boolean;
1484
1513
  declare function spill(opts?: SpillOptions): Socket;
1485
1514
 
1486
- export { APPROVAL_EXPIRY_RULE, APPROVAL_POLICY_IDS, APPROVAL_RULES, APPROVAL_SOCKET_NAME, type ApprovalOptions, BUDGET_SOCKET_NAME, type BudgetDimension, type BudgetHit, type BudgetLimits, type BudgetOptions, COMPACT_INPUT_SCHEMA, COMPACT_REQUEST_RULE, COMPACT_RULES, COMPACT_SOCKET_NAME, COMPACT_TOOL_DESCRIPTION, COMPACT_TOOL_NAME, type CompactArgs, type CompactOptions, type CompactPlan, type CompactRequestInfo, DEFAULT_FORCE_AT, DEFAULT_HANDOFF_REASON, DEFAULT_LAZY_SUMMARY_CHARS, DEFAULT_MAX_CONSECUTIVE_COMPACTIONS, DEFAULT_MAX_FILE_BYTES, DEFAULT_MAX_PIN_TEXT_LENGTH, DEFAULT_MAX_RESULT_TOKENS, DEFAULT_MAX_SUMMARY_CHARS, DEFAULT_MAX_VIEW_CHARS, DEFAULT_PERCEPTION_THRESHOLDS, DEFAULT_PIN_OVERSHOOT_TOLERANCE, DEFAULT_PREVIEW_CHARS, DEFAULT_PREVIEW_LINES, DEFAULT_SKILLS_ROOT, DEFAULT_SKILL_READ_CHARS, DEFAULT_TOOL_FIND_MAX, type ExpiredApproval, FETCH_BLOB_INPUT_SCHEMA, FETCH_BLOB_TOOL_DESCRIPTION, FETCH_BLOB_TOOL_NAME, type FetchBlobArgs, type ForceOptions, HANDOFF_INPUT_SCHEMA, HANDOFF_RULES, HANDOFF_SOCKET_NAME, HANDOFF_TOOL_DESCRIPTION, HANDOFF_TOOL_NAME, type HandoffArgs, type HandoffOptions, type InlineSkill, type InlineSkillsOptions, LAZY_TOOLS_SOCKET_NAME, LAZY_TOOL_RULES, type LazyToolMenu, type LazyToolMenuEntry, type LazyToolsOptions, type LimitDimension, type LoadedSkill, MANIFEST_DEFAULT_EXCLUDE, MANIFEST_HEADING, MAX_MEMORY_PATH_LENGTH, MAX_SKILL_DESCRIPTION_CHARS, MEMORY_COMMANDS, MEMORY_INPUT_SCHEMA, MEMORY_ROOT, MEMORY_RULES, MEMORY_SOCKET_NAME, MEMORY_TOOL_DESCRIPTION, MEMORY_TOOL_NAME, type ManifestOptions, type MemoryCommand, type MemoryFs, type MemoryLimits, type MemoryOp, type MemoryOptions, type MemoryOutcome, PERCEPTION_SOCKET_NAME, PINS_SOCKET_NAME, PIN_INPUT_SCHEMA, PIN_RULES, PIN_TOOL_DESCRIPTION, PIN_TOOL_NAME, type ParsedSkill, type PerceptionLimits, type PerceptionOptions, type PerceptionReading, type PinArgs, type PinMeta, type PinNote, type PinSpec, type PinsOptions, type PlanOptions, type PolicyCall, type PolicyOutcome, type PolicyRule, type PolicyRuleSpec, type PolicyVerdict, type Preview, type PreviewOptions, RECALL_INPUT_SCHEMA, RECALL_TOOL_DESCRIPTION, RECALL_TOOL_NAME, type ReadingOptions, type ReadingThresholds, type RecallArgs, SKILLS_SOCKET_NAME, SKILL_FILE_NAME, SKILL_NAME_RE, SKILL_READ_INPUT_SCHEMA, SKILL_READ_TOOL_DESCRIPTION, SKILL_READ_TOOL_NAME, SKILL_RULES, SPILL_BLOB_MIME, SPILL_RULES, SPILL_SOCKET_NAME, type SkillFrontmatter, type SkillMenu, type SkillMenuEntry, type SkillReadInput, type SkillsOptions, type SpillOptions, TOOL_FIND_INPUT_SCHEMA, TOOL_FIND_TOOL_DESCRIPTION, TOOL_FIND_TOOL_NAME, type TextMeasure, type TextTokenEstimator, type Tier, type ToolFindInput, approval, assertAscending, assertLimits, assertSkillsRoot, bindMemoryFs, budget, budgetUsedOf, byteLength, carriedPins, checkBudget, clipEndByTokens, compact, compactNumber, compactRequestedSinceLastCompaction, compactRequestsSinceLastCompaction, composeHandoffNote, contextUsageRatio, countLines, countModelTurns, countTier, defaultBudgetNote, defaultSummary, defaultTextTokens, evaluatePolicy, executeMemoryCommand, findExpiredApproval, findModelPin, fmt, globToRegExp, handoff, humanSize, inlineSkills, isCompactRequest, isModelCompaction, isPinNoteEvent, isTextMime, isUnder, lastHostPin, lastVisiblePerceptionNote, lastVisibleUserMessage, lazyMenuOf, lazyTools, loadSkillMenu, measureText, memory, modelActedSinceLastCompaction, normalizeRule, parseCompactArgs, parseFetchBlobArgs, parseHandoffArgs, parseMemoryCommand, parsePinArgs, parseRecallArgs, parseSkillMarkdown, parseSkillReadInput, parseToolFindInput, percent, perception, pinInputSchema, pinMetaOf, pinToolDescription, pins, planCompaction, previewOf, rangeTier, readPerception, recallResult, recallTool, renderCompactRequest, renderCompactionSummary, renderLazyToolMenu, renderLoadedTool, renderPerception, renderSkillMenu, renderToolFindResult, resolveMemoryPath, revealedLazyTools, segmentTimelineByTurn, skills, spill, sumSessionTokens, summarizeTool, timelineSoFar, toolFindResultBound, toolReferenceOf, trailingCompactionRun, unfinishedHandoffArgs };
1515
+ export { APPROVAL_EXPIRY_RULE, APPROVAL_POLICY_IDS, APPROVAL_RULES, APPROVAL_SOCKET_NAME, type ApprovalOptions, BUDGET_SOCKET_NAME, type BudgetDimension, type BudgetHit, type BudgetLimits, type BudgetOptions, COMPACT_INPUT_SCHEMA, COMPACT_REQUEST_RULE, COMPACT_RULES, COMPACT_SOCKET_NAME, COMPACT_TOOL_DESCRIPTION, COMPACT_TOOL_NAME, type CompactArgs, type CompactOptions, type CompactPlan, type CompactRequestInfo, DEFAULT_FORCE_AT, DEFAULT_HANDOFF_REASON, DEFAULT_LAZY_SUMMARY_CHARS, DEFAULT_MAX_CONSECUTIVE_COMPACTIONS, DEFAULT_MAX_FILE_BYTES, DEFAULT_MAX_PIN_TEXT_LENGTH, DEFAULT_MAX_RESULT_TOKENS, DEFAULT_MAX_SUMMARY_CHARS, DEFAULT_MAX_VIEW_CHARS, DEFAULT_PERCEPTION_THRESHOLDS, DEFAULT_PIN_OVERSHOOT_TOLERANCE, DEFAULT_PREVIEW_CHARS, DEFAULT_PREVIEW_LINES, DEFAULT_SKILLS_ROOT, DEFAULT_SKILL_READ_CHARS, DEFAULT_TOOL_FIND_MAX, type ExpiredApproval, FETCH_BLOB_INPUT_SCHEMA, FETCH_BLOB_TOOL_DESCRIPTION, FETCH_BLOB_TOOL_NAME, type FetchBlobArgs, type ForceOptions, HANDOFF_INPUT_SCHEMA, HANDOFF_RULES, HANDOFF_SOCKET_NAME, HANDOFF_TOOL_DESCRIPTION, HANDOFF_TOOL_NAME, type HandoffArgs, type HandoffOptions, type InlineSkill, type InlineSkillsOptions, LAZY_TOOLS_SOCKET_NAME, LAZY_TOOL_RULES, type LazyToolMenu, type LazyToolMenuEntry, type LazyToolsOptions, type LimitDimension, type LoadedSkill, MANIFEST_DEFAULT_EXCLUDE, MANIFEST_HEADING, MAX_MEMORY_PATH_LENGTH, MAX_SKILL_DESCRIPTION_CHARS, MEMORY_COMMANDS, MEMORY_INPUT_SCHEMA, MEMORY_ROOT, MEMORY_RULES, MEMORY_SOCKET_NAME, MEMORY_TOOL_DESCRIPTION, MEMORY_TOOL_NAME, type ManifestOptions, type MemoryCommand, type MemoryFs, type MemoryLimits, type MemoryOp, type MemoryOptions, type MemoryOutcome, PERCEPTION_SOCKET_NAME, PINS_SOCKET_NAME, PIN_INPUT_SCHEMA, PIN_RULES, PIN_TOOL_DESCRIPTION, PIN_TOOL_NAME, type ParsedSkill, type PerceptionLimits, type PerceptionOptions, type PerceptionReading, type PinArgs, type PinMeta, type PinNote, type PinSpec, type PinsOptions, type PlanOptions, type PolicyCall, type PolicyOutcome, type PolicyRule, type PolicyRuleSpec, type PolicyVerdict, type Preview, type PreviewOptions, RECALL_INPUT_SCHEMA, RECALL_TOOL_DESCRIPTION, RECALL_TOOL_NAME, type ReadingOptions, type ReadingThresholds, type RecallArgs, SKILLS_SOCKET_NAME, SKILL_FILE_NAME, SKILL_NAME_RE, SKILL_READ_INPUT_SCHEMA, SKILL_READ_TOOL_DESCRIPTION, SKILL_READ_TOOL_NAME, SKILL_RULES, SPILL_BLOB_MIME, SPILL_RULES, SPILL_SOCKET_NAME, type SkillFrontmatter, type SkillMenu, type SkillMenuEntry, type SkillReadInput, type SkillsOptions, type SpillOptions, TOOL_FIND_INPUT_SCHEMA, TOOL_FIND_TOOL_DESCRIPTION, TOOL_FIND_TOOL_NAME, type TextMeasure, type TextTokenEstimator, type Tier, type ToolFindInput, approval, assertAscending, assertLimits, assertSkillsRoot, bindMemoryFs, budget, budgetUsedOf, byteLength, carriedPins, checkBudget, clipEndByTokens, compact, compactNumber, compactRequestedSinceLastCompaction, compactRequestsSinceLastCompaction, composeHandoffNote, contextUsageRatio, countLines, countModelTurns, countTier, defaultBudgetNote, defaultSummary, defaultTextTokens, evaluatePolicy, executeMemoryCommand, findExpiredApproval, findModelPin, fmt, globToRegExp, handoff, humanSize, inlineSkills, isCompactRequest, isModelCompaction, isPinNoteEvent, isSnapshotPin, isTextMime, isUnder, lastHostPin, lastVisiblePerceptionNote, lastVisibleUserMessage, lazyMenuOf, lazyTools, loadSkillMenu, measureText, memory, modelActedSinceLastCompaction, normalizeRule, parseCompactArgs, parseFetchBlobArgs, parseHandoffArgs, parseMemoryCommand, parsePinArgs, parseRecallArgs, parseSkillMarkdown, parseSkillReadInput, parseToolFindInput, percent, perception, pinInputSchema, pinMetaOf, pinToolDescription, pins, planCompaction, previewOf, rangeTier, readPerception, recallResult, recallTool, renderCompactRequest, renderCompactionSummary, renderLazyToolMenu, renderLoadedTool, renderPerception, renderSkillMenu, renderToolFindResult, resolveMemoryPath, revealedLazyTools, segmentTimelineByTurn, skills, spill, sumSessionTokens, summarizeTool, timelineSoFar, toolFindResultBound, toolReferenceOf, trailingCompactionRun, unfinishedHandoffArgs };