@loreai/core 0.20.2 → 0.21.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/dist/bun/config.d.ts +1 -0
- package/dist/bun/config.d.ts.map +1 -1
- package/dist/bun/curator.d.ts +2 -0
- package/dist/bun/curator.d.ts.map +1 -1
- package/dist/bun/db.d.ts +10 -0
- package/dist/bun/db.d.ts.map +1 -1
- package/dist/bun/distillation.d.ts.map +1 -1
- package/dist/bun/gradient.d.ts +7 -4
- package/dist/bun/gradient.d.ts.map +1 -1
- package/dist/bun/index.d.ts +2 -2
- package/dist/bun/index.d.ts.map +1 -1
- package/dist/bun/index.js +124 -14
- package/dist/bun/index.js.map +3 -3
- package/dist/bun/ltm.d.ts +10 -0
- package/dist/bun/ltm.d.ts.map +1 -1
- package/dist/bun/prompt.d.ts +1 -1
- package/dist/bun/prompt.d.ts.map +1 -1
- package/dist/node/config.d.ts +1 -0
- package/dist/node/config.d.ts.map +1 -1
- package/dist/node/curator.d.ts +2 -0
- package/dist/node/curator.d.ts.map +1 -1
- package/dist/node/db.d.ts +10 -0
- package/dist/node/db.d.ts.map +1 -1
- package/dist/node/distillation.d.ts.map +1 -1
- package/dist/node/gradient.d.ts +7 -4
- package/dist/node/gradient.d.ts.map +1 -1
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +124 -14
- package/dist/node/index.js.map +3 -3
- package/dist/node/ltm.d.ts +10 -0
- package/dist/node/ltm.d.ts.map +1 -1
- package/dist/node/prompt.d.ts +1 -1
- package/dist/node/prompt.d.ts.map +1 -1
- package/dist/types/config.d.ts +1 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/curator.d.ts +2 -0
- package/dist/types/curator.d.ts.map +1 -1
- package/dist/types/db.d.ts +10 -0
- package/dist/types/db.d.ts.map +1 -1
- package/dist/types/distillation.d.ts.map +1 -1
- package/dist/types/gradient.d.ts +7 -4
- package/dist/types/gradient.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/ltm.d.ts +10 -0
- package/dist/types/ltm.d.ts.map +1 -1
- package/dist/types/prompt.d.ts +1 -1
- package/dist/types/prompt.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +4 -2
- package/src/curator.ts +3 -0
- package/src/db.ts +52 -1
- package/src/distillation.ts +5 -0
- package/src/gradient.ts +27 -12
- package/src/index.ts +2 -0
- package/src/ltm.ts +78 -4
- package/src/prompt.ts +18 -2
package/dist/node/ltm.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export declare function create(input: {
|
|
|
21
21
|
crossProject?: boolean;
|
|
22
22
|
/** Explicit ID to use — for cross-machine import via agents-file. Defaults to a new UUIDv7. */
|
|
23
23
|
id?: string;
|
|
24
|
+
/** Initial confidence (0.0–1.0). Default 1.0. Controls injection priority for preferences. */
|
|
25
|
+
confidence?: number;
|
|
24
26
|
}): string;
|
|
25
27
|
export declare function update(id: string, input: {
|
|
26
28
|
content?: string;
|
|
@@ -91,6 +93,14 @@ export declare function forSession(projectPath: string, sessionID: string | unde
|
|
|
91
93
|
export declare function all(): KnowledgeEntry[];
|
|
92
94
|
/** Return all cross-project and global (user-level) knowledge entries. */
|
|
93
95
|
export declare function crossProject(): KnowledgeEntry[];
|
|
96
|
+
/**
|
|
97
|
+
* Re-score confidence on preference entries using directive-detection patterns.
|
|
98
|
+
* Only touches entries with confidence = 1.0 (legacy/unscored). Entries already
|
|
99
|
+
* scored by the curator (confidence < 1.0) are left untouched.
|
|
100
|
+
*
|
|
101
|
+
* @returns Count of entries updated.
|
|
102
|
+
*/
|
|
103
|
+
export declare function rerankPreferences(): number;
|
|
94
104
|
export declare function search(input: {
|
|
95
105
|
query: string;
|
|
96
106
|
projectPath?: string;
|
package/dist/node/ltm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ltm.d.ts","sourceRoot":"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,EAAE,MAAM,GAAG,IAAI,GACvB,KAAK,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAelE;AAED,kDAAkD;AAClD,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAWtE;AAKD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAwBjE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CA2C/E;AAED,sDAAsD;AACtD,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,IAAI,CAGN;AAED,8EAA8E;AAC9E,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAU/E"}
|
package/dist/node/prompt.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const RECURSIVE_SYSTEM = "You are a memory reflector. You are giv
|
|
|
8
8
|
export declare function recursiveUser(distillations: Array<{
|
|
9
9
|
observations: string;
|
|
10
10
|
}>, previousMeta?: string): string;
|
|
11
|
-
export declare const CURATOR_SYSTEM = "You are a long-term memory curator. Your job is to extract durable knowledge from a conversation that should persist across sessions.\n\nFocus ONLY on knowledge that helps a coding agent work effectively on THIS codebase:\n- Architectural decisions and their rationale (why something was built a certain way)\n- Non-obvious implementation patterns and conventions specific to the project\n- Recurring gotchas, constraints, or traps in the codebase\n- Environment/tooling setup details that affect development\n- Important relationships between components that aren't obvious from reading the code\n- User preferences and working style specific to how they use this project\n- Repeated user instructions \u2014 when the user says things like \"always\", \"never\",\n \"make sure to\", \"don't forget to\", these are high-value preference candidates.\n If you see instruction-like language, prioritize extracting it as a \"preference\" entry.\n These instructions represent how the user wants to work and should persist across sessions.\n\nDo NOT extract:\n- Task-specific details (file currently being edited, current bug being fixed)\n- Temporary state (current branch, in-progress work)\n- Information that will change frequently\n- Ecosystem descriptions, product announcements, or marketing content\n- Business strategy, roadmap, or organizational information\n- Information that's readily available in public documentation or READMEs\n- Knowledge about unrelated projects or repositories unless explicitly cross-project\n- Restatements of what the code obviously does (e.g. \"the auth module handles authentication\")\n\nBREVITY IS CRITICAL \u2014 each entry must be concise:\n- content MUST be under 150 words (~600 characters). Capture ONE specific actionable\n insight in 2-3 sentences. Prefer terse technical language.\n- Each \"gotcha\": one specific trap + its fix in 1-2 sentences\n- Each \"architecture\": one design decision and its key constraint\n- Focus on the actionable insight, not the full story behind it\n- If a pattern requires more detail, split into multiple focused entries (each under 150 words)\n- Omit code examples unless a single short snippet is essential\n- Never include full file contents, large diffs, or complete command outputs\n\nPREFER UPDATES OVER CREATES:\n- Before creating a new entry, always check if an existing entry covers the same system\n or component. Update the existing entry rather than creating a new one.\n- When updating, REPLACE the full content with a concise rewrite \u2014 do not append to\n the existing content or repeat what was already there.\n- If multiple existing entries cover the same system from different angles (e.g. different\n bugs in the same module), consolidate them: update one with merged insights, delete the\n rest. Fewer, denser entries are better than many scattered ones.\n\nCROSS-REFERENCES between entries:\n- When an entry relates to another entry, reference it with [[entry-uuid]] using the entry's ID\n from the existing entries list. This creates navigable links between entries.\n- Only reference entries you can see in the existing entries list \u2014 don't guess IDs.\n- Example: \"Uses the gradient system [[019c904b-791e-772a-ab2b-93ac892a960c]] for context management.\"\n\ncrossProject flag:\n- Default is true \u2014 most useful knowledge is worth sharing across projects\n- Set crossProject to false for things that are meaningless outside this specific repo (e.g. a config path, a project-local naming convention that conflicts with your usual style)\n\nProduce a JSON array of operations:\n[\n {\n \"op\": \"create\",\n \"category\": \"decision\" | \"pattern\" | \"preference\" | \"architecture\" | \"gotcha\",\n \"title\": \"Short descriptive title\",\n \"content\": \"Concise knowledge entry \u2014 under 150 words\",\n \"scope\": \"project\" | \"global\",\n \"crossProject\": true\n },\n {\n \"op\": \"update\",\n \"id\": \"existing-entry-id\",\n \"content\": \"Updated content \u2014 under 150 words\",\n \"confidence\": 0.0-1.0\n },\n {\n \"op\": \"delete\",\n \"id\": \"existing-entry-id\",\n \"reason\": \"Why this is no longer relevant\"\n }\n]\n\nIf nothing warrants extraction, return an empty array: []\n\nOutput ONLY valid JSON. No markdown fences, no explanation, no preamble.";
|
|
11
|
+
export declare const CURATOR_SYSTEM = "You are a long-term memory curator. Your job is to extract durable knowledge from a conversation that should persist across sessions.\n\nFocus ONLY on knowledge that helps a coding agent work effectively on THIS codebase:\n- Architectural decisions and their rationale (why something was built a certain way)\n- Non-obvious implementation patterns and conventions specific to the project\n- Recurring gotchas, constraints, or traps in the codebase\n- Environment/tooling setup details that affect development\n- Important relationships between components that aren't obvious from reading the code\n- User preferences and working style specific to how they use this project\n- Repeated user instructions \u2014 when the user says things like \"always\", \"never\",\n \"make sure to\", \"don't forget to\", these are high-value preference candidates.\n If you see instruction-like language, prioritize extracting it as a \"preference\" entry.\n These instructions represent how the user wants to work and should persist across sessions.\n\nDo NOT extract:\n- Task-specific details (file currently being edited, current bug being fixed)\n- Temporary state (current branch, in-progress work)\n- Information that will change frequently\n- Ecosystem descriptions, product announcements, or marketing content\n- Business strategy, roadmap, or organizational information\n- Information that's readily available in public documentation or READMEs\n- Knowledge about unrelated projects or repositories unless explicitly cross-project\n- Restatements of what the code obviously does (e.g. \"the auth module handles authentication\")\n\nBREVITY IS CRITICAL \u2014 each entry must be concise:\n- content MUST be under 150 words (~600 characters). Capture ONE specific actionable\n insight in 2-3 sentences. Prefer terse technical language.\n- Each \"gotcha\": one specific trap + its fix in 1-2 sentences\n- Each \"architecture\": one design decision and its key constraint\n- Focus on the actionable insight, not the full story behind it\n- If a pattern requires more detail, split into multiple focused entries (each under 150 words)\n- Omit code examples unless a single short snippet is essential\n- Never include full file contents, large diffs, or complete command outputs\n\nPREFER UPDATES OVER CREATES:\n- Before creating a new entry, always check if an existing entry covers the same system\n or component. Update the existing entry rather than creating a new one.\n- When updating, REPLACE the full content with a concise rewrite \u2014 do not append to\n the existing content or repeat what was already there.\n- If multiple existing entries cover the same system from different angles (e.g. different\n bugs in the same module), consolidate them: update one with merged insights, delete the\n rest. Fewer, denser entries are better than many scattered ones.\n\nCROSS-REFERENCES between entries:\n- When an entry relates to another entry, reference it with [[entry-uuid]] using the entry's ID\n from the existing entries list. This creates navigable links between entries.\n- Only reference entries you can see in the existing entries list \u2014 don't guess IDs.\n- Example: \"Uses the gradient system [[019c904b-791e-772a-ab2b-93ac892a960c]] for context management.\"\n\ncrossProject flag:\n- Default is true \u2014 most useful knowledge is worth sharing across projects\n- Set crossProject to false for things that are meaningless outside this specific repo (e.g. a config path, a project-local naming convention that conflicts with your usual style)\n\nConfidence values (0.0\u20131.0) \u2014 determines injection priority when budget is tight:\n- 1.0: Unconditional directive \u2014 user used \"NEVER\", \"ALWAYS\", \"from now on\", or similarly\n absolute language. These must always be respected regardless of context.\n- 0.9: Strong preference \u2014 explicit user preference (\"I prefer\", \"I want\", \"make sure to\",\n \"don't forget to\"). Clear intent but not absolute.\n- 0.8: Moderate preference \u2014 inferred from repeated user behavior or gentle correction across\n sessions. Not explicitly stated as a rule.\n- 0.6: Mild/contextual preference \u2014 may not apply universally. Observed once or context-dependent.\n- For non-preference categories (gotcha, pattern, architecture, decision), confidence reflects\n how well-established the knowledge is: 1.0 = verified/confirmed, 0.8 = high confidence,\n 0.6 = probable but unverified.\n- Default to 1.0 for preferences with strong directive language, 0.8 for other preferences.\n- Always set confidence on create ops \u2014 it determines injection priority.\n\nProduce a JSON array of operations:\n[\n {\n \"op\": \"create\",\n \"category\": \"decision\" | \"pattern\" | \"preference\" | \"architecture\" | \"gotcha\",\n \"title\": \"Short descriptive title\",\n \"content\": \"Concise knowledge entry \u2014 under 150 words\",\n \"scope\": \"project\" | \"global\",\n \"crossProject\": true,\n \"confidence\": 1.0\n },\n {\n \"op\": \"update\",\n \"id\": \"existing-entry-id\",\n \"content\": \"Updated content \u2014 under 150 words\",\n \"confidence\": 0.0-1.0\n },\n {\n \"op\": \"delete\",\n \"id\": \"existing-entry-id\",\n \"reason\": \"Why this is no longer relevant\"\n }\n]\n\nIf nothing warrants extraction, return an empty array: []\n\nOutput ONLY valid JSON. No markdown fences, no explanation, no preamble.";
|
|
12
12
|
export declare function curatorUser(input: {
|
|
13
13
|
messages: string;
|
|
14
14
|
existing: Array<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/prompt.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mBAAmB,s1OAmHhB,CAAC;AAEjB,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CAaT;AAUD,eAAO,MAAM,gBAAgB,mkGAsC2C,CAAC;AAEzE,wBAAgB,aAAa,CAC3B,aAAa,EAAE,KAAK,CAAC;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,EAC9C,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAoBR;AAED,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/prompt.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mBAAmB,s1OAmHhB,CAAC;AAEjB,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CAaT;AAUD,eAAO,MAAM,gBAAgB,mkGAsC2C,CAAC;AAEzE,wBAAgB,aAAa,CAC3B,aAAa,EAAE,KAA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AC,EACpE,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAwCR;AAMD,eAAO,MAAM,sBAAsB,ggBASwE,CAAC"}
|
package/dist/types/config.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const LoreConfig: z.ZodObject<{
|
|
|
13
13
|
raw: z.ZodDefault<z.ZodNumber>;
|
|
14
14
|
output: z.ZodDefault<z.ZodNumber>;
|
|
15
15
|
ltm: z.ZodDefault<z.ZodNumber>;
|
|
16
|
+
preferenceLtm: z.ZodDefault<z.ZodNumber>;
|
|
16
17
|
targetCacheReadCostPerTurn: z.ZodDefault<z.ZodNumber>;
|
|
17
18
|
maxLayer0Tokens: z.ZodOptional<z.ZodNumber>;
|
|
18
19
|
targetBustCost: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwOrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAIpD,wBAAgB,MAAM,IAAI,UAAU,CAEnC;AAED,wBAAsB,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAajE"}
|
package/dist/types/curator.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curator.d.ts","sourceRoot":"","sources":["../../src/curator.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,EAAE,EAChB,KAAK,EAAE;IACL,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GACA;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAqDvD;AAmBD,wBAAsB,GAAG,CAAC,KAAK,EAAE;IAC/B,GAAG,EAAE,SAAS,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACjD,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAkBjE;AA2FD,wBAAgB,oBAAoB,CAAC,SAAS,CAAC,EAAE,MAAM,QAMtD;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE;IACvC,GAAG,EAAE,SAAS,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACjD,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAkChD"}
|
package/dist/types/db.d.ts
CHANGED
|
@@ -130,6 +130,8 @@ export type SessionTrackingState = {
|
|
|
130
130
|
lastKnownInput?: number;
|
|
131
131
|
lastTurnAt?: number;
|
|
132
132
|
lastBustAt?: number;
|
|
133
|
+
parentSessionId?: string | null;
|
|
134
|
+
isSubagent?: boolean;
|
|
133
135
|
};
|
|
134
136
|
/**
|
|
135
137
|
* Persist session tracking state. Ensures the row exists, then updates
|
|
@@ -158,6 +160,8 @@ export type LoadedSessionTracking = {
|
|
|
158
160
|
lastKnownInput: number;
|
|
159
161
|
lastTurnAt: number;
|
|
160
162
|
lastBustAt: number;
|
|
163
|
+
parentSessionId: string | null;
|
|
164
|
+
isSubagent: boolean;
|
|
161
165
|
};
|
|
162
166
|
/**
|
|
163
167
|
* Load persisted session tracking state. Returns null if no row exists.
|
|
@@ -177,6 +181,12 @@ export declare function loadHeaderSessionIndex(): Array<{
|
|
|
177
181
|
headerSessionId: string;
|
|
178
182
|
headerName: string;
|
|
179
183
|
}>;
|
|
184
|
+
/**
|
|
185
|
+
* Load parent→child session mappings from the DB.
|
|
186
|
+
* Returns a map: childSessionId → parentSessionId (Lore internal IDs).
|
|
187
|
+
* Used by the dashboard to build session trees.
|
|
188
|
+
*/
|
|
189
|
+
export declare function loadParentChildMap(): Map<string, string>;
|
|
180
190
|
/** Get a kv_meta value by key. Returns null if not found. */
|
|
181
191
|
export declare function getKV(key: string): string | null;
|
|
182
192
|
/** Set a kv_meta value (upsert). */
|
package/dist/types/db.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMtC;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAMvE;
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMtC;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAMvE;AA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ANGED
|
@@ -33,10 +33,11 @@ export declare function getTier(tokens: number): number;
|
|
|
33
33
|
*
|
|
34
34
|
* A "bust" is when cache_write > 50% of total input tokens.
|
|
35
35
|
*
|
|
36
|
-
* @param cacheWrite
|
|
37
|
-
* @param cacheRead
|
|
38
|
-
* @param inputTokens -
|
|
39
|
-
*
|
|
36
|
+
* @param cacheWrite - cache_creation_input_tokens from the API response
|
|
37
|
+
* @param cacheRead - cache_read_input_tokens from the API response
|
|
38
|
+
* @param inputTokens - input_tokens from the API response (uncached portion only —
|
|
39
|
+
* Anthropic's input_tokens excludes both cache reads and writes)
|
|
40
|
+
* @param sessionID - session that produced this response
|
|
40
41
|
*/
|
|
41
42
|
export declare function recordCacheUsage(cacheWrite: number, cacheRead: number, inputTokens: number, sessionID?: string): void;
|
|
42
43
|
type DistillationSnapshot = {
|
|
@@ -131,6 +132,8 @@ export declare function getLtmTokens(sessionID?: string): number;
|
|
|
131
132
|
* hook to cap how many tokens formatKnowledge may use.
|
|
132
133
|
*/
|
|
133
134
|
export declare function getLtmBudget(ltmFraction: number): number;
|
|
135
|
+
/** Returns the token budget for stable LTM (preferences). Independent of context-bound LTM budget. */
|
|
136
|
+
export declare const getPreferenceLtmBudget: typeof getLtmBudget;
|
|
134
137
|
export declare function calibrate(actualInput: number, sessionID?: string, messageCount?: number): void;
|
|
135
138
|
export declare function getOverhead(): number;
|
|
136
139
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradient.d.ts","sourceRoot":"","sources":["../../src/gradient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,oBAAoB,EAAqE,MAAM,SAAS,CAAC;AAQ9I,KAAK,gBAAgB,GAAG,oBAAoB,CAAC;AAyD7C;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAGlE;AAED,2CAA2C;AAC3C,wBAAgB,eAAe,IAAI;IAAE,KAAK,EAAE,MAAM,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IACpB;;oEAEgE;IAChE,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAMF,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAIlE;AA2XD,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAC/B,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,eAAe,CAwClB;AAGD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAErE"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -15,10 +15,10 @@ export type { LoreMessage, LoreUserMessage, LoreAssistantMessage, LorePart, Lore
|
|
|
15
15
|
export { isTextPart, isReasoningPart, isToolPart } from "./types";
|
|
16
16
|
export { dataDir } from "./data-dir";
|
|
17
17
|
export { load, config, type LoreConfig } from "./config";
|
|
18
|
-
export { db, dbPath, ensureProject, getLastImportAt, setLastImportAt, isFirstRun, projectId, projectName, projectPath, resolveProjectByRemoteOrPath, mergeProjectInternal, loadForceMinLayer, saveForceMinLayer, saveSessionCosts, loadSessionCosts, loadAllSessionCosts, type SessionCostSnapshot, saveSessionTracking, loadSessionTracking, loadHeaderSessionIndex, type SessionTrackingState, type LoadedSessionTracking, getKV, setKV, getMeta, setMeta, getInstanceId, close, } from "./db";
|
|
18
|
+
export { db, dbPath, ensureProject, getLastImportAt, setLastImportAt, isFirstRun, projectId, projectName, projectPath, resolveProjectByRemoteOrPath, mergeProjectInternal, loadForceMinLayer, saveForceMinLayer, saveSessionCosts, loadSessionCosts, loadAllSessionCosts, type SessionCostSnapshot, saveSessionTracking, loadSessionTracking, loadHeaderSessionIndex, loadParentChildMap, type SessionTrackingState, type LoadedSessionTracking, getKV, setKV, getMeta, setMeta, getInstanceId, close, } from "./db";
|
|
19
19
|
export { normalizeRemoteUrl, getGitRemote, clearGitRemoteCache } from "./git";
|
|
20
20
|
export { enableHostedMode, isHostedMode } from "./hosted";
|
|
21
|
-
export { transform, setModelLimits, setMaxLayer0Tokens, computeLayer0Cap, setCachePricing, getCachePricing, shouldCompress, getTier, recordCacheUsage, needsUrgentDistillation, calibrate, setLtmTokens, getLtmTokens, getLtmBudget, setForceMinLayer, getLastTransformedCount, getLastTransformEstimate, getLastLayer, toolStripAnnotation, onIdleResume, getLastTurnAt, consumeCameOutOfIdle, saveGradientState, setLastTurnAtForTest, inspectSessionState, getConsecutiveBusts, BUST_PRESSURE_THRESHOLD, effectiveMetaThreshold, } from "./gradient";
|
|
21
|
+
export { transform, setModelLimits, setMaxLayer0Tokens, computeLayer0Cap, setCachePricing, getCachePricing, shouldCompress, getTier, recordCacheUsage, needsUrgentDistillation, calibrate, setLtmTokens, getLtmTokens, getLtmBudget, getPreferenceLtmBudget, setForceMinLayer, getLastTransformedCount, getLastTransformEstimate, getLastLayer, toolStripAnnotation, onIdleResume, getLastTurnAt, consumeCameOutOfIdle, saveGradientState, setLastTurnAtForTest, inspectSessionState, getConsecutiveBusts, BUST_PRESSURE_THRESHOLD, effectiveMetaThreshold, } from "./gradient";
|
|
22
22
|
export { formatKnowledge, formatDistillations, DISTILLATION_SYSTEM, distillationUser, RECURSIVE_SYSTEM, recursiveUser, CURATOR_SYSTEM, curatorUser, CONSOLIDATION_SYSTEM, consolidationUser, QUERY_EXPANSION_SYSTEM, COMPACT_SUMMARY_TEMPLATE, buildCompactPrompt, } from "./prompt";
|
|
23
23
|
export { shouldImport, importFromFile, exportToFile, exportLoreFile, importLoreFile, shouldImportLoreFile, loreFileExists, clearLoreFileCache, LORE_FILE, } from "./agents-file";
|
|
24
24
|
export { workerSessionIDs, isWorkerSession } from "./worker";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,GAAG,MA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oB,EACpB,iBAAiB,EAGjB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,QAAQ,EACR,UAAU,EACV,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,SAAS,EACT,MAAM,EACN,CAAC,EACD,CAAC,EACD,EAAE,EACF,GAAG,EACH,IAAI,EACJ,CAAC,EACD,IAAI,EACJ,MAAM,EACN,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACf,MAAM,YAAY,CAAC"}
|
package/dist/types/ltm.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export declare function create(input: {
|
|
|
21
21
|
crossProject?: boolean;
|
|
22
22
|
/** Explicit ID to use — for cross-machine import via agents-file. Defaults to a new UUIDv7. */
|
|
23
23
|
id?: string;
|
|
24
|
+
/** Initial confidence (0.0–1.0). Default 1.0. Controls injection priority for preferences. */
|
|
25
|
+
confidence?: number;
|
|
24
26
|
}): string;
|
|
25
27
|
export declare function update(id: string, input: {
|
|
26
28
|
content?: string;
|
|
@@ -91,6 +93,14 @@ export declare function forSession(projectPath: string, sessionID: string | unde
|
|
|
91
93
|
export declare function all(): KnowledgeEntry[];
|
|
92
94
|
/** Return all cross-project and global (user-level) knowledge entries. */
|
|
93
95
|
export declare function crossProject(): KnowledgeEntry[];
|
|
96
|
+
/**
|
|
97
|
+
* Re-score confidence on preference entries using directive-detection patterns.
|
|
98
|
+
* Only touches entries with confidence = 1.0 (legacy/unscored). Entries already
|
|
99
|
+
* scored by the curator (confidence < 1.0) are left untouched.
|
|
100
|
+
*
|
|
101
|
+
* @returns Count of entries updated.
|
|
102
|
+
*/
|
|
103
|
+
export declare function rerankPreferences(): number;
|
|
94
104
|
export declare function search(input: {
|
|
95
105
|
query: string;
|
|
96
106
|
projectPath?: string;
|
package/dist/types/ltm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ltm.d.ts","sourceRoot":"","sources":["../../src/ltm.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAWF,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,SAAS,GAAG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MAAM,GAAG,IAAI,CAU/E"}
|
package/dist/types/prompt.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const RECURSIVE_SYSTEM = "You are a memory reflector. You are giv
|
|
|
8
8
|
export declare function recursiveUser(distillations: Array<{
|
|
9
9
|
observations: string;
|
|
10
10
|
}>, previousMeta?: string): string;
|
|
11
|
-
export declare const CURATOR_SYSTEM = "You are a long-term memory curator. Your job is to extract durable knowledge from a conversation that should persist across sessions.\n\nFocus ONLY on knowledge that helps a coding agent work effectively on THIS codebase:\n- Architectural decisions and their rationale (why something was built a certain way)\n- Non-obvious implementation patterns and conventions specific to the project\n- Recurring gotchas, constraints, or traps in the codebase\n- Environment/tooling setup details that affect development\n- Important relationships between components that aren't obvious from reading the code\n- User preferences and working style specific to how they use this project\n- Repeated user instructions \u2014 when the user says things like \"always\", \"never\",\n \"make sure to\", \"don't forget to\", these are high-value preference candidates.\n If you see instruction-like language, prioritize extracting it as a \"preference\" entry.\n These instructions represent how the user wants to work and should persist across sessions.\n\nDo NOT extract:\n- Task-specific details (file currently being edited, current bug being fixed)\n- Temporary state (current branch, in-progress work)\n- Information that will change frequently\n- Ecosystem descriptions, product announcements, or marketing content\n- Business strategy, roadmap, or organizational information\n- Information that's readily available in public documentation or READMEs\n- Knowledge about unrelated projects or repositories unless explicitly cross-project\n- Restatements of what the code obviously does (e.g. \"the auth module handles authentication\")\n\nBREVITY IS CRITICAL \u2014 each entry must be concise:\n- content MUST be under 150 words (~600 characters). Capture ONE specific actionable\n insight in 2-3 sentences. Prefer terse technical language.\n- Each \"gotcha\": one specific trap + its fix in 1-2 sentences\n- Each \"architecture\": one design decision and its key constraint\n- Focus on the actionable insight, not the full story behind it\n- If a pattern requires more detail, split into multiple focused entries (each under 150 words)\n- Omit code examples unless a single short snippet is essential\n- Never include full file contents, large diffs, or complete command outputs\n\nPREFER UPDATES OVER CREATES:\n- Before creating a new entry, always check if an existing entry covers the same system\n or component. Update the existing entry rather than creating a new one.\n- When updating, REPLACE the full content with a concise rewrite \u2014 do not append to\n the existing content or repeat what was already there.\n- If multiple existing entries cover the same system from different angles (e.g. different\n bugs in the same module), consolidate them: update one with merged insights, delete the\n rest. Fewer, denser entries are better than many scattered ones.\n\nCROSS-REFERENCES between entries:\n- When an entry relates to another entry, reference it with [[entry-uuid]] using the entry's ID\n from the existing entries list. This creates navigable links between entries.\n- Only reference entries you can see in the existing entries list \u2014 don't guess IDs.\n- Example: \"Uses the gradient system [[019c904b-791e-772a-ab2b-93ac892a960c]] for context management.\"\n\ncrossProject flag:\n- Default is true \u2014 most useful knowledge is worth sharing across projects\n- Set crossProject to false for things that are meaningless outside this specific repo (e.g. a config path, a project-local naming convention that conflicts with your usual style)\n\nProduce a JSON array of operations:\n[\n {\n \"op\": \"create\",\n \"category\": \"decision\" | \"pattern\" | \"preference\" | \"architecture\" | \"gotcha\",\n \"title\": \"Short descriptive title\",\n \"content\": \"Concise knowledge entry \u2014 under 150 words\",\n \"scope\": \"project\" | \"global\",\n \"crossProject\": true\n },\n {\n \"op\": \"update\",\n \"id\": \"existing-entry-id\",\n \"content\": \"Updated content \u2014 under 150 words\",\n \"confidence\": 0.0-1.0\n },\n {\n \"op\": \"delete\",\n \"id\": \"existing-entry-id\",\n \"reason\": \"Why this is no longer relevant\"\n }\n]\n\nIf nothing warrants extraction, return an empty array: []\n\nOutput ONLY valid JSON. No markdown fences, no explanation, no preamble.";
|
|
11
|
+
export declare const CURATOR_SYSTEM = "You are a long-term memory curator. Your job is to extract durable knowledge from a conversation that should persist across sessions.\n\nFocus ONLY on knowledge that helps a coding agent work effectively on THIS codebase:\n- Architectural decisions and their rationale (why something was built a certain way)\n- Non-obvious implementation patterns and conventions specific to the project\n- Recurring gotchas, constraints, or traps in the codebase\n- Environment/tooling setup details that affect development\n- Important relationships between components that aren't obvious from reading the code\n- User preferences and working style specific to how they use this project\n- Repeated user instructions \u2014 when the user says things like \"always\", \"never\",\n \"make sure to\", \"don't forget to\", these are high-value preference candidates.\n If you see instruction-like language, prioritize extracting it as a \"preference\" entry.\n These instructions represent how the user wants to work and should persist across sessions.\n\nDo NOT extract:\n- Task-specific details (file currently being edited, current bug being fixed)\n- Temporary state (current branch, in-progress work)\n- Information that will change frequently\n- Ecosystem descriptions, product announcements, or marketing content\n- Business strategy, roadmap, or organizational information\n- Information that's readily available in public documentation or READMEs\n- Knowledge about unrelated projects or repositories unless explicitly cross-project\n- Restatements of what the code obviously does (e.g. \"the auth module handles authentication\")\n\nBREVITY IS CRITICAL \u2014 each entry must be concise:\n- content MUST be under 150 words (~600 characters). Capture ONE specific actionable\n insight in 2-3 sentences. Prefer terse technical language.\n- Each \"gotcha\": one specific trap + its fix in 1-2 sentences\n- Each \"architecture\": one design decision and its key constraint\n- Focus on the actionable insight, not the full story behind it\n- If a pattern requires more detail, split into multiple focused entries (each under 150 words)\n- Omit code examples unless a single short snippet is essential\n- Never include full file contents, large diffs, or complete command outputs\n\nPREFER UPDATES OVER CREATES:\n- Before creating a new entry, always check if an existing entry covers the same system\n or component. Update the existing entry rather than creating a new one.\n- When updating, REPLACE the full content with a concise rewrite \u2014 do not append to\n the existing content or repeat what was already there.\n- If multiple existing entries cover the same system from different angles (e.g. different\n bugs in the same module), consolidate them: update one with merged insights, delete the\n rest. Fewer, denser entries are better than many scattered ones.\n\nCROSS-REFERENCES between entries:\n- When an entry relates to another entry, reference it with [[entry-uuid]] using the entry's ID\n from the existing entries list. This creates navigable links between entries.\n- Only reference entries you can see in the existing entries list \u2014 don't guess IDs.\n- Example: \"Uses the gradient system [[019c904b-791e-772a-ab2b-93ac892a960c]] for context management.\"\n\ncrossProject flag:\n- Default is true \u2014 most useful knowledge is worth sharing across projects\n- Set crossProject to false for things that are meaningless outside this specific repo (e.g. a config path, a project-local naming convention that conflicts with your usual style)\n\nConfidence values (0.0\u20131.0) \u2014 determines injection priority when budget is tight:\n- 1.0: Unconditional directive \u2014 user used \"NEVER\", \"ALWAYS\", \"from now on\", or similarly\n absolute language. These must always be respected regardless of context.\n- 0.9: Strong preference \u2014 explicit user preference (\"I prefer\", \"I want\", \"make sure to\",\n \"don't forget to\"). Clear intent but not absolute.\n- 0.8: Moderate preference \u2014 inferred from repeated user behavior or gentle correction across\n sessions. Not explicitly stated as a rule.\n- 0.6: Mild/contextual preference \u2014 may not apply universally. Observed once or context-dependent.\n- For non-preference categories (gotcha, pattern, architecture, decision), confidence reflects\n how well-established the knowledge is: 1.0 = verified/confirmed, 0.8 = high confidence,\n 0.6 = probable but unverified.\n- Default to 1.0 for preferences with strong directive language, 0.8 for other preferences.\n- Always set confidence on create ops \u2014 it determines injection priority.\n\nProduce a JSON array of operations:\n[\n {\n \"op\": \"create\",\n \"category\": \"decision\" | \"pattern\" | \"preference\" | \"architecture\" | \"gotcha\",\n \"title\": \"Short descriptive title\",\n \"content\": \"Concise knowledge entry \u2014 under 150 words\",\n \"scope\": \"project\" | \"global\",\n \"crossProject\": true,\n \"confidence\": 1.0\n },\n {\n \"op\": \"update\",\n \"id\": \"existing-entry-id\",\n \"content\": \"Updated content \u2014 under 150 words\",\n \"confidence\": 0.0-1.0\n },\n {\n \"op\": \"delete\",\n \"id\": \"existing-entry-id\",\n \"reason\": \"Why this is no longer relevant\"\n }\n]\n\nIf nothing warrants extraction, return an empty array: []\n\nOutput ONLY valid JSON. No markdown fences, no explanation, no preamble.";
|
|
12
12
|
export declare function curatorUser(input: {
|
|
13
13
|
messages: string;
|
|
14
14
|
existing: Array<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/prompt.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mBAAmB,s1OAmHhB,CAAC;AAEjB,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CAaT;AAUD,eAAO,MAAM,gBAAgB,mkGAsC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S,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,CAUT;AAID,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,KAAK,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,GACD,MAAM,CAsBR;AAQD,eAAO,MAAM,wBAAwB,86BAoC+B,CAAC;AAqBrE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,MAAM,CAeT;AAOD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,EACpE,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAwCR;AAMD,eAAO,MAAM,sBAAsB,ggBASwE,CAAC"}
|
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -24,8 +24,10 @@ export const LoreConfig = z.object({
|
|
|
24
24
|
distilled: z.number().min(0.05).max(0.5).default(0.25),
|
|
25
25
|
raw: z.number().min(0.1).max(0.7).default(0.4),
|
|
26
26
|
output: z.number().min(0.1).max(0.5).default(0.25),
|
|
27
|
-
/** Max fraction of usable context reserved for LTM system-prompt injection. Default: 0.05 (5%). */
|
|
27
|
+
/** Max fraction of usable context reserved for context-bound LTM system-prompt injection. Default: 0.05 (5%). */
|
|
28
28
|
ltm: z.number().min(0.02).max(0.3).default(0.05),
|
|
29
|
+
/** Fraction of usable context for stable LTM (preferences). Independent of `ltm`. Default: 0.02 (2%). */
|
|
30
|
+
preferenceLtm: z.number().min(0.01).max(0.1).default(0.02),
|
|
29
31
|
/** Per-turn cache-read cost target in dollars. Controls when layer 0 (full
|
|
30
32
|
* passthrough) escalates to layer 1 (compressed). The cap is derived as:
|
|
31
33
|
* maxLayer0Tokens = max(target / model.cost.cache.read, 40K).
|
|
@@ -41,7 +43,7 @@ export const LoreConfig = z.object({
|
|
|
41
43
|
/** @deprecated Ignored. Tier-based bust-vs-continue replaces static cap. */
|
|
42
44
|
maxContextTokens: z.number().min(0).optional(),
|
|
43
45
|
})
|
|
44
|
-
.default({ distilled: 0.25, raw: 0.4, output: 0.25, ltm: 0.05, targetCacheReadCostPerTurn: 0.10 }),
|
|
46
|
+
.default({ distilled: 0.25, raw: 0.4, output: 0.25, ltm: 0.05, preferenceLtm: 0.02, targetCacheReadCostPerTurn: 0.10 }),
|
|
45
47
|
/**
|
|
46
48
|
* Cold-cache idle-resume handling.
|
|
47
49
|
*
|
package/src/curator.ts
CHANGED
|
@@ -24,6 +24,8 @@ export type CuratorOp =
|
|
|
24
24
|
content: string;
|
|
25
25
|
scope: "project" | "global";
|
|
26
26
|
crossProject?: boolean;
|
|
27
|
+
/** Initial confidence (0.0–1.0). Controls injection priority for preferences. */
|
|
28
|
+
confidence?: number;
|
|
27
29
|
}
|
|
28
30
|
| { op: "update"; id: string; content?: string; confidence?: number }
|
|
29
31
|
| { op: "delete"; id: string; reason: string };
|
|
@@ -88,6 +90,7 @@ export function applyOps(
|
|
|
88
90
|
session: input.sessionID,
|
|
89
91
|
scope: op.scope,
|
|
90
92
|
crossProject: op.crossProject ?? true,
|
|
93
|
+
confidence: op.confidence,
|
|
91
94
|
});
|
|
92
95
|
idsToSync.push(id);
|
|
93
96
|
created++;
|
package/src/db.ts
CHANGED
|
@@ -564,6 +564,17 @@ const MIGRATIONS: string[] = [
|
|
|
564
564
|
CREATE INDEX IF NOT EXISTS idx_dedup_feedback_project
|
|
565
565
|
ON dedup_feedback(project_id);
|
|
566
566
|
`,
|
|
567
|
+
`
|
|
568
|
+
-- Version 26: Persist sub-agent parent–child session relationships.
|
|
569
|
+
-- parent_session_id: Lore internal session ID of the parent session
|
|
570
|
+
-- (resolved from the x-parent-session-id header at detection time).
|
|
571
|
+
-- NULL for root (non-sub-agent) sessions.
|
|
572
|
+
-- is_subagent: boolean flag (1 = sub-agent) so the flag survives
|
|
573
|
+
-- gateway restarts without requiring the header again.
|
|
574
|
+
ALTER TABLE session_state ADD COLUMN parent_session_id TEXT;
|
|
575
|
+
ALTER TABLE session_state ADD COLUMN is_subagent INTEGER NOT NULL DEFAULT 0;
|
|
576
|
+
CREATE INDEX IF NOT EXISTS idx_session_state_parent ON session_state(parent_session_id);
|
|
577
|
+
`,
|
|
567
578
|
];
|
|
568
579
|
|
|
569
580
|
/** Return the resolved path of the SQLite database file. */
|
|
@@ -1194,6 +1205,9 @@ export type SessionTrackingState = {
|
|
|
1194
1205
|
lastKnownInput?: number;
|
|
1195
1206
|
lastTurnAt?: number;
|
|
1196
1207
|
lastBustAt?: number;
|
|
1208
|
+
// v26: sub-agent parent–child relationships
|
|
1209
|
+
parentSessionId?: string | null;
|
|
1210
|
+
isSubagent?: boolean;
|
|
1197
1211
|
};
|
|
1198
1212
|
|
|
1199
1213
|
/**
|
|
@@ -1297,6 +1311,15 @@ export function saveSessionTracking(sessionID: string, state: SessionTrackingSta
|
|
|
1297
1311
|
sets.push("last_bust_at = ?");
|
|
1298
1312
|
vals.push(state.lastBustAt);
|
|
1299
1313
|
}
|
|
1314
|
+
// v26: sub-agent parent–child relationships
|
|
1315
|
+
if (state.parentSessionId !== undefined) {
|
|
1316
|
+
sets.push("parent_session_id = ?");
|
|
1317
|
+
vals.push(state.parentSessionId);
|
|
1318
|
+
}
|
|
1319
|
+
if (state.isSubagent !== undefined) {
|
|
1320
|
+
sets.push("is_subagent = ?");
|
|
1321
|
+
vals.push(state.isSubagent ? 1 : 0);
|
|
1322
|
+
}
|
|
1300
1323
|
|
|
1301
1324
|
// Update only the specified columns
|
|
1302
1325
|
db()
|
|
@@ -1331,6 +1354,9 @@ export type LoadedSessionTracking = {
|
|
|
1331
1354
|
lastKnownInput: number;
|
|
1332
1355
|
lastTurnAt: number;
|
|
1333
1356
|
lastBustAt: number;
|
|
1357
|
+
// v26: sub-agent parent–child relationships
|
|
1358
|
+
parentSessionId: string | null;
|
|
1359
|
+
isSubagent: boolean;
|
|
1334
1360
|
};
|
|
1335
1361
|
|
|
1336
1362
|
/**
|
|
@@ -1345,7 +1371,8 @@ export function loadSessionTracking(sessionID: string): LoadedSessionTracking |
|
|
|
1345
1371
|
fingerprint, header_session_id, header_name,
|
|
1346
1372
|
resolved_conversation_ttl, warmup_state,
|
|
1347
1373
|
dynamic_context_cap, bust_rate_ema, inter_bust_interval_ema,
|
|
1348
|
-
last_layer, last_known_input, last_turn_at, last_bust_at
|
|
1374
|
+
last_layer, last_known_input, last_turn_at, last_bust_at,
|
|
1375
|
+
parent_session_id, is_subagent
|
|
1349
1376
|
FROM session_state WHERE session_id = ?`,
|
|
1350
1377
|
)
|
|
1351
1378
|
.get(sessionID) as {
|
|
@@ -1369,6 +1396,8 @@ export function loadSessionTracking(sessionID: string): LoadedSessionTracking |
|
|
|
1369
1396
|
last_known_input: number;
|
|
1370
1397
|
last_turn_at: number;
|
|
1371
1398
|
last_bust_at: number;
|
|
1399
|
+
parent_session_id: string | null;
|
|
1400
|
+
is_subagent: number;
|
|
1372
1401
|
} | null;
|
|
1373
1402
|
if (!row) return null;
|
|
1374
1403
|
return {
|
|
@@ -1392,6 +1421,8 @@ export function loadSessionTracking(sessionID: string): LoadedSessionTracking |
|
|
|
1392
1421
|
lastKnownInput: row.last_known_input,
|
|
1393
1422
|
lastTurnAt: row.last_turn_at,
|
|
1394
1423
|
lastBustAt: row.last_bust_at,
|
|
1424
|
+
parentSessionId: row.parent_session_id,
|
|
1425
|
+
isSubagent: row.is_subagent === 1,
|
|
1395
1426
|
};
|
|
1396
1427
|
}
|
|
1397
1428
|
|
|
@@ -1427,6 +1458,26 @@ export function loadHeaderSessionIndex(): Array<{
|
|
|
1427
1458
|
}));
|
|
1428
1459
|
}
|
|
1429
1460
|
|
|
1461
|
+
/**
|
|
1462
|
+
* Load parent→child session mappings from the DB.
|
|
1463
|
+
* Returns a map: childSessionId → parentSessionId (Lore internal IDs).
|
|
1464
|
+
* Used by the dashboard to build session trees.
|
|
1465
|
+
*/
|
|
1466
|
+
export function loadParentChildMap(): Map<string, string> {
|
|
1467
|
+
const rows = db()
|
|
1468
|
+
.query(
|
|
1469
|
+
`SELECT session_id, parent_session_id
|
|
1470
|
+
FROM session_state
|
|
1471
|
+
WHERE parent_session_id IS NOT NULL`,
|
|
1472
|
+
)
|
|
1473
|
+
.all() as Array<{ session_id: string; parent_session_id: string }>;
|
|
1474
|
+
const map = new Map<string, string>();
|
|
1475
|
+
for (const row of rows) {
|
|
1476
|
+
map.set(row.session_id, row.parent_session_id);
|
|
1477
|
+
}
|
|
1478
|
+
return map;
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1430
1481
|
// ---------------------------------------------------------------------------
|
|
1431
1482
|
// Key-value store (kv_meta table)
|
|
1432
1483
|
// ---------------------------------------------------------------------------
|
package/src/distillation.ts
CHANGED
|
@@ -147,6 +147,11 @@ function splitSegments(
|
|
|
147
147
|
const totalTokens = messages.reduce((s, m) => s + m.tokens, 0);
|
|
148
148
|
if (totalTokens <= maxTokens) return [messages];
|
|
149
149
|
|
|
150
|
+
// Cannot subdivide a single message — yield as-is (oversized but indivisible).
|
|
151
|
+
// Prevents infinite recursion when one message exceeds maxTokens (e.g., a 50KB+
|
|
152
|
+
// tool output where Math.ceil(content.length / 3) > 16384).
|
|
153
|
+
if (messages.length <= 1) return [messages];
|
|
154
|
+
|
|
150
155
|
// Find the split point: prefer the largest time gap if it's significant
|
|
151
156
|
const splitIdx = findSplitIndex(messages, maxTokens);
|
|
152
157
|
|