@loreai/core 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/bun/db.d.ts +3 -2
- package/dist/bun/db.d.ts.map +1 -1
- package/dist/bun/index.js +32 -9
- package/dist/bun/index.js.map +2 -2
- 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/db.d.ts +3 -2
- package/dist/node/db.d.ts.map +1 -1
- package/dist/node/index.js +32 -9
- package/dist/node/index.js.map +2 -2
- 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/db.d.ts +3 -2
- package/dist/types/db.d.ts.map +1 -1
- 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/db.ts +14 -13
- package/src/ltm.ts +23 -1
- package/src/prompt.ts +13 -2
package/dist/node/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,CAA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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
|
|
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 \u2014 always include WHY the\n wrong approach seems right, not just the trap and fix. Without this, a future session\n will re-propose the broken approach because it looks like a reasonable improvement.\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\nINCLUDE THE \"WHY\" \u2014 decisions and gotchas without rationale get undone:\n- Every \"decision\" MUST include the rejected alternative and why it was rejected.\n Format: \"Chose X over Y because Z.\" Without the rejected option, a future session\n will re-propose Y because it looks like a reasonable improvement.\n- Every \"gotcha\" MUST explain why the wrong approach seems correct, not just the trap\n and its fix. Format: \"Trap: X looks right because [reason]. Fix: Y, because [reason].\"\n- Any standard or rule without its rationale is vulnerable to being optimized away by\n a session that doesn't know what problem it was solving.\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 + WHY it looks right + its fix in 2-3 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;C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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/dist/types/db.d.ts
CHANGED
|
@@ -74,8 +74,9 @@ export declare function setLastImportAt(projectPath: string, timestamp: number):
|
|
|
74
74
|
*/
|
|
75
75
|
export declare function loadForceMinLayer(sessionID: string): number;
|
|
76
76
|
/**
|
|
77
|
-
* Persist forceMinLayer for a session.
|
|
78
|
-
*
|
|
77
|
+
* Persist forceMinLayer for a session. Resets to 0 when consumed.
|
|
78
|
+
* Uses INSERT OR IGNORE + UPDATE to preserve sibling columns
|
|
79
|
+
* (cost, gradient, tracking) that other writers depend on.
|
|
79
80
|
*/
|
|
80
81
|
export declare function saveForceMinLayer(sessionID: string, layer: number): void;
|
|
81
82
|
/** Persisted cost snapshot for a session. */
|
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;AA8iBD,4DAA4D;AAC5D,wBAAgB,MAAM,IAAI,MAAM,CAI/B;AAID,wBAAgB,EAAE,IAAI,QAAQ,CA8C7B;AAsHD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,IAAI,CAoCN;AAED,wBAAgB,KAAK,SAKpB;AAID;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,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;;;;;;;;;;;;;;;;;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/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
|
|
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 \u2014 always include WHY the\n wrong approach seems right, not just the trap and fix. Without this, a future session\n will re-propose the broken approach because it looks like a reasonable improvement.\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\nINCLUDE THE \"WHY\" \u2014 decisions and gotchas without rationale get undone:\n- Every \"decision\" MUST include the rejected alternative and why it was rejected.\n Format: \"Chose X over Y because Z.\" Without the rejected option, a future session\n will re-propose Y because it looks like a reasonable improvement.\n- Every \"gotcha\" MUST explain why the wrong approach seems correct, not just the trap\n and its fix. Format: \"Trap: X looks right because [reason]. Fix: Y, because [reason].\"\n- Any standard or rule without its rationale is vulnerable to being optimized away by\n a session that doesn't know what problem it was solving.\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 + WHY it looks right + its fix in 2-3 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,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AM,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/db.ts
CHANGED
|
@@ -1013,21 +1013,22 @@ export function loadForceMinLayer(sessionID: string): number {
|
|
|
1013
1013
|
}
|
|
1014
1014
|
|
|
1015
1015
|
/**
|
|
1016
|
-
* Persist forceMinLayer for a session.
|
|
1017
|
-
*
|
|
1016
|
+
* Persist forceMinLayer for a session. Resets to 0 when consumed.
|
|
1017
|
+
* Uses INSERT OR IGNORE + UPDATE to preserve sibling columns
|
|
1018
|
+
* (cost, gradient, tracking) that other writers depend on.
|
|
1018
1019
|
*/
|
|
1019
1020
|
export function saveForceMinLayer(sessionID: string, layer: number): void {
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1021
|
+
const now = Date.now();
|
|
1022
|
+
// Ensure row exists (no-op if it already does)
|
|
1023
|
+
db()
|
|
1024
|
+
.query(
|
|
1025
|
+
"INSERT OR IGNORE INTO session_state (session_id, force_min_layer, updated_at) VALUES (?, 0, ?)",
|
|
1026
|
+
)
|
|
1027
|
+
.run(sessionID, now);
|
|
1028
|
+
// Update only the force_min_layer column, preserving all others
|
|
1029
|
+
db()
|
|
1030
|
+
.query("UPDATE session_state SET force_min_layer = ?, updated_at = ? WHERE session_id = ?")
|
|
1031
|
+
.run(layer, now, sessionID);
|
|
1031
1032
|
}
|
|
1032
1033
|
|
|
1033
1034
|
/** Persisted cost snapshot for a session. */
|
package/src/ltm.ts
CHANGED
|
@@ -589,16 +589,38 @@ export async function forSession(
|
|
|
589
589
|
.map((entry) => ({ entry, score: entry.confidence }));
|
|
590
590
|
}
|
|
591
591
|
|
|
592
|
-
// --- 5. Merge and pack into token budget
|
|
592
|
+
// --- 5. Merge and pack into token budget ---
|
|
593
|
+
// Architecture entries get a guaranteed minimum allocation (first 20% of
|
|
594
|
+
// budget) before the general score-ranked packing. These entries provide
|
|
595
|
+
// the structural "map" that makes specific gotchas/decisions interpretable
|
|
596
|
+
// — without them, a gotcha about a subsystem is harder to contextualize.
|
|
593
597
|
const allScored = [...scoredProject, ...scoredCross];
|
|
594
598
|
allScored.sort((a, b) => b.score - a.score);
|
|
595
599
|
|
|
596
600
|
const HEADER_OVERHEAD_TOKENS = 15;
|
|
601
|
+
const ARCH_BUDGET_FRACTION = 0.2;
|
|
597
602
|
let used = HEADER_OVERHEAD_TOKENS;
|
|
598
603
|
const result: KnowledgeEntry[] = [];
|
|
604
|
+
const packedIds = new Set<string>();
|
|
605
|
+
|
|
606
|
+
// Phase 1: Pack architecture entries first (up to 20% of budget)
|
|
607
|
+
const archBudget = Math.floor(maxTokens * ARCH_BUDGET_FRACTION);
|
|
608
|
+
const archEntries = allScored.filter((s) => s.entry.category === "architecture");
|
|
609
|
+
// Sort architecture by score descending (already sorted, but filter may reorder)
|
|
610
|
+
archEntries.sort((a, b) => b.score - a.score);
|
|
611
|
+
for (const { entry } of archEntries) {
|
|
612
|
+
if (used >= archBudget + HEADER_OVERHEAD_TOKENS) break;
|
|
613
|
+
const cost = estimateTokens(entry.title + entry.content) + 10;
|
|
614
|
+
if (used + cost > maxTokens) continue; // hard cap: never exceed total budget
|
|
615
|
+
result.push(entry);
|
|
616
|
+
packedIds.add(entry.id);
|
|
617
|
+
used += cost;
|
|
618
|
+
}
|
|
599
619
|
|
|
620
|
+
// Phase 2: Pack remaining entries by score descending (skip already packed)
|
|
600
621
|
for (const { entry } of allScored) {
|
|
601
622
|
if (used >= maxTokens) break;
|
|
623
|
+
if (packedIds.has(entry.id)) continue;
|
|
602
624
|
const cost = estimateTokens(entry.title + entry.content) + 10;
|
|
603
625
|
if (used + cost > maxTokens) continue;
|
|
604
626
|
result.push(entry);
|
package/src/prompt.ts
CHANGED
|
@@ -218,7 +218,9 @@ export const CURATOR_SYSTEM = `You are a long-term memory curator. Your job is t
|
|
|
218
218
|
Focus ONLY on knowledge that helps a coding agent work effectively on THIS codebase:
|
|
219
219
|
- Architectural decisions and their rationale (why something was built a certain way)
|
|
220
220
|
- Non-obvious implementation patterns and conventions specific to the project
|
|
221
|
-
- Recurring gotchas, constraints, or traps in the codebase
|
|
221
|
+
- Recurring gotchas, constraints, or traps in the codebase — always include WHY the
|
|
222
|
+
wrong approach seems right, not just the trap and fix. Without this, a future session
|
|
223
|
+
will re-propose the broken approach because it looks like a reasonable improvement.
|
|
222
224
|
- Environment/tooling setup details that affect development
|
|
223
225
|
- Important relationships between components that aren't obvious from reading the code
|
|
224
226
|
- User preferences and working style specific to how they use this project
|
|
@@ -237,10 +239,19 @@ Do NOT extract:
|
|
|
237
239
|
- Knowledge about unrelated projects or repositories unless explicitly cross-project
|
|
238
240
|
- Restatements of what the code obviously does (e.g. "the auth module handles authentication")
|
|
239
241
|
|
|
242
|
+
INCLUDE THE "WHY" — decisions and gotchas without rationale get undone:
|
|
243
|
+
- Every "decision" MUST include the rejected alternative and why it was rejected.
|
|
244
|
+
Format: "Chose X over Y because Z." Without the rejected option, a future session
|
|
245
|
+
will re-propose Y because it looks like a reasonable improvement.
|
|
246
|
+
- Every "gotcha" MUST explain why the wrong approach seems correct, not just the trap
|
|
247
|
+
and its fix. Format: "Trap: X looks right because [reason]. Fix: Y, because [reason]."
|
|
248
|
+
- Any standard or rule without its rationale is vulnerable to being optimized away by
|
|
249
|
+
a session that doesn't know what problem it was solving.
|
|
250
|
+
|
|
240
251
|
BREVITY IS CRITICAL — each entry must be concise:
|
|
241
252
|
- content MUST be under 150 words (~600 characters). Capture ONE specific actionable
|
|
242
253
|
insight in 2-3 sentences. Prefer terse technical language.
|
|
243
|
-
- Each "gotcha": one specific trap + its fix in
|
|
254
|
+
- Each "gotcha": one specific trap + WHY it looks right + its fix in 2-3 sentences
|
|
244
255
|
- Each "architecture": one design decision and its key constraint
|
|
245
256
|
- Focus on the actionable insight, not the full story behind it
|
|
246
257
|
- If a pattern requires more detail, split into multiple focused entries (each under 150 words)
|