@lossless-claude/lcm 0.2.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/.claude-plugin/commands/lcm-compact.md +31 -0
- package/.claude-plugin/commands/lcm-curate.md +31 -0
- package/.claude-plugin/commands/lcm-diagnose.md +29 -0
- package/.claude-plugin/commands/lcm-doctor.md +23 -0
- package/.claude-plugin/commands/lcm-dogfood.md +101 -0
- package/.claude-plugin/commands/lcm-import.md +48 -0
- package/.claude-plugin/commands/lcm-promote.md +29 -0
- package/.claude-plugin/commands/lcm-sensitive.md +55 -0
- package/.claude-plugin/commands/lcm-stats.md +19 -0
- package/.claude-plugin/commands/lcm-status.md +27 -0
- package/.claude-plugin/hooks/README.md +47 -0
- package/.claude-plugin/marketplace.json +20 -0
- package/.claude-plugin/mcp.mjs +12 -0
- package/.claude-plugin/plugin.json +46 -0
- package/.claude-plugin/skills/lcm-context/SKILL.md +107 -0
- package/.claude-plugin/skills/lcm-dogfood/SKILL.md +102 -0
- package/.claude-plugin/skills/lcm-dogfood/references/checks.md +239 -0
- package/.claude-plugin/skills/lcm-dogfood/references/known-issues.md +11 -0
- package/.claude-plugin/skills/lcm-dogfood/scripts/db-integrity.js +40 -0
- package/.claude-plugin/skills/lcm-dogfood/scripts/prompt-search-test.js +35 -0
- package/.claude-plugin/skills/lcm-e2e/SKILL.md +61 -0
- package/.claude-plugin/skills/lcm-e2e/checklist.md +367 -0
- package/.claude-plugin/skills/lossless-claude-upgrade/SKILL.md +47 -0
- package/LICENSE +21 -0
- package/README.md +231 -0
- package/dist/bin/lcm.d.ts +2 -0
- package/dist/bin/lcm.js +461 -0
- package/dist/bin/lcm.js.map +1 -0
- package/dist/installer/dry-run-deps.d.ts +23 -0
- package/dist/installer/dry-run-deps.js +66 -0
- package/dist/installer/dry-run-deps.js.map +1 -0
- package/dist/installer/install.d.ts +39 -0
- package/dist/installer/install.js +236 -0
- package/dist/installer/install.js.map +1 -0
- package/dist/installer/uninstall.d.ts +11 -0
- package/dist/installer/uninstall.js +80 -0
- package/dist/installer/uninstall.js.map +1 -0
- package/dist/src/batch-compact.d.ts +16 -0
- package/dist/src/batch-compact.js +121 -0
- package/dist/src/batch-compact.js.map +1 -0
- package/dist/src/compaction.d.ts +198 -0
- package/dist/src/compaction.js +964 -0
- package/dist/src/compaction.js.map +1 -0
- package/dist/src/connectors/constants.d.ts +5 -0
- package/dist/src/connectors/constants.js +6 -0
- package/dist/src/connectors/constants.js.map +1 -0
- package/dist/src/connectors/installer.d.ts +16 -0
- package/dist/src/connectors/installer.js +200 -0
- package/dist/src/connectors/installer.js.map +1 -0
- package/dist/src/connectors/registry.d.ts +4 -0
- package/dist/src/connectors/registry.js +264 -0
- package/dist/src/connectors/registry.js.map +1 -0
- package/dist/src/connectors/template-service.d.ts +5 -0
- package/dist/src/connectors/template-service.js +54 -0
- package/dist/src/connectors/template-service.js.map +1 -0
- package/dist/src/connectors/templates/base.md +1 -0
- package/dist/src/connectors/templates/mcp-base.md +1 -0
- package/dist/src/connectors/templates/sections/command-reference.md +15 -0
- package/dist/src/connectors/templates/sections/mcp-workflow.md +18 -0
- package/dist/src/connectors/templates/sections/workflow.md +29 -0
- package/dist/src/connectors/templates/skill/SKILL.md +74 -0
- package/dist/src/connectors/types.d.ts +19 -0
- package/dist/src/connectors/types.js +10 -0
- package/dist/src/connectors/types.js.map +1 -0
- package/dist/src/daemon/client.d.ts +9 -0
- package/dist/src/daemon/client.js +28 -0
- package/dist/src/daemon/client.js.map +1 -0
- package/dist/src/daemon/config.d.ts +48 -0
- package/dist/src/daemon/config.js +67 -0
- package/dist/src/daemon/config.js.map +1 -0
- package/dist/src/daemon/lifecycle.d.ts +19 -0
- package/dist/src/daemon/lifecycle.js +102 -0
- package/dist/src/daemon/lifecycle.js.map +1 -0
- package/dist/src/daemon/orientation.d.ts +1 -0
- package/dist/src/daemon/orientation.js +9 -0
- package/dist/src/daemon/orientation.js.map +1 -0
- package/dist/src/daemon/project-queue.d.ts +1 -0
- package/dist/src/daemon/project-queue.js +17 -0
- package/dist/src/daemon/project-queue.js.map +1 -0
- package/dist/src/daemon/project.d.ts +7 -0
- package/dist/src/daemon/project.js +25 -0
- package/dist/src/daemon/project.js.map +1 -0
- package/dist/src/daemon/proxy-manager.d.ts +21 -0
- package/dist/src/daemon/proxy-manager.js +205 -0
- package/dist/src/daemon/proxy-manager.js.map +1 -0
- package/dist/src/daemon/routes/compact.d.ts +13 -0
- package/dist/src/daemon/routes/compact.js +195 -0
- package/dist/src/daemon/routes/compact.js.map +1 -0
- package/dist/src/daemon/routes/describe.d.ts +3 -0
- package/dist/src/daemon/routes/describe.js +39 -0
- package/dist/src/daemon/routes/describe.js.map +1 -0
- package/dist/src/daemon/routes/expand.d.ts +3 -0
- package/dist/src/daemon/routes/expand.js +41 -0
- package/dist/src/daemon/routes/expand.js.map +1 -0
- package/dist/src/daemon/routes/grep.d.ts +3 -0
- package/dist/src/daemon/routes/grep.js +43 -0
- package/dist/src/daemon/routes/grep.js.map +1 -0
- package/dist/src/daemon/routes/ingest.d.ts +3 -0
- package/dist/src/daemon/routes/ingest.js +101 -0
- package/dist/src/daemon/routes/ingest.js.map +1 -0
- package/dist/src/daemon/routes/promote.d.ts +4 -0
- package/dist/src/daemon/routes/promote.js +104 -0
- package/dist/src/daemon/routes/promote.js.map +1 -0
- package/dist/src/daemon/routes/prompt-search.d.ts +3 -0
- package/dist/src/daemon/routes/prompt-search.js +65 -0
- package/dist/src/daemon/routes/prompt-search.js.map +1 -0
- package/dist/src/daemon/routes/recent.d.ts +3 -0
- package/dist/src/daemon/routes/recent.js +37 -0
- package/dist/src/daemon/routes/recent.js.map +1 -0
- package/dist/src/daemon/routes/restore.d.ts +3 -0
- package/dist/src/daemon/routes/restore.js +120 -0
- package/dist/src/daemon/routes/restore.js.map +1 -0
- package/dist/src/daemon/routes/search.d.ts +2 -0
- package/dist/src/daemon/routes/search.js +66 -0
- package/dist/src/daemon/routes/search.js.map +1 -0
- package/dist/src/daemon/routes/status.d.ts +3 -0
- package/dist/src/daemon/routes/status.js +80 -0
- package/dist/src/daemon/routes/status.js.map +1 -0
- package/dist/src/daemon/routes/store.d.ts +2 -0
- package/dist/src/daemon/routes/store.js +46 -0
- package/dist/src/daemon/routes/store.js.map +1 -0
- package/dist/src/daemon/server.d.ts +19 -0
- package/dist/src/daemon/server.js +183 -0
- package/dist/src/daemon/server.js.map +1 -0
- package/dist/src/daemon/summarizer.d.ts +11 -0
- package/dist/src/daemon/summarizer.js +51 -0
- package/dist/src/daemon/summarizer.js.map +1 -0
- package/dist/src/db/config.d.ts +31 -0
- package/dist/src/db/config.js +83 -0
- package/dist/src/db/config.js.map +1 -0
- package/dist/src/db/connection.d.ts +3 -0
- package/dist/src/db/connection.js +62 -0
- package/dist/src/db/connection.js.map +1 -0
- package/dist/src/db/features.d.ts +11 -0
- package/dist/src/db/features.js +36 -0
- package/dist/src/db/features.js.map +1 -0
- package/dist/src/db/migration.d.ts +4 -0
- package/dist/src/db/migration.js +499 -0
- package/dist/src/db/migration.js.map +1 -0
- package/dist/src/db/promoted.d.ts +47 -0
- package/dist/src/db/promoted.js +96 -0
- package/dist/src/db/promoted.js.map +1 -0
- package/dist/src/db/redaction-stats.d.ts +6 -0
- package/dist/src/db/redaction-stats.js +16 -0
- package/dist/src/db/redaction-stats.js.map +1 -0
- package/dist/src/diagnose.d.ts +39 -0
- package/dist/src/diagnose.js +432 -0
- package/dist/src/diagnose.js.map +1 -0
- package/dist/src/doctor/doctor.d.ts +4 -0
- package/dist/src/doctor/doctor.js +378 -0
- package/dist/src/doctor/doctor.js.map +1 -0
- package/dist/src/doctor/types.d.ts +24 -0
- package/dist/src/doctor/types.js +2 -0
- package/dist/src/doctor/types.js.map +1 -0
- package/dist/src/expansion.d.ts +100 -0
- package/dist/src/expansion.js +268 -0
- package/dist/src/expansion.js.map +1 -0
- package/dist/src/hooks/auto-heal.d.ts +12 -0
- package/dist/src/hooks/auto-heal.js +49 -0
- package/dist/src/hooks/auto-heal.js.map +1 -0
- package/dist/src/hooks/compact.d.ts +5 -0
- package/dist/src/hooks/compact.js +22 -0
- package/dist/src/hooks/compact.js.map +1 -0
- package/dist/src/hooks/dispatch.d.ts +7 -0
- package/dist/src/hooks/dispatch.js +36 -0
- package/dist/src/hooks/dispatch.js.map +1 -0
- package/dist/src/hooks/probe-precompact.d.ts +2 -0
- package/dist/src/hooks/probe-precompact.js +17 -0
- package/dist/src/hooks/probe-precompact.js.map +1 -0
- package/dist/src/hooks/probe-sessionstart.d.ts +2 -0
- package/dist/src/hooks/probe-sessionstart.js +18 -0
- package/dist/src/hooks/probe-sessionstart.js.map +1 -0
- package/dist/src/hooks/restore.d.ts +5 -0
- package/dist/src/hooks/restore.js +19 -0
- package/dist/src/hooks/restore.js.map +1 -0
- package/dist/src/hooks/session-end.d.ts +16 -0
- package/dist/src/hooks/session-end.js +73 -0
- package/dist/src/hooks/session-end.js.map +1 -0
- package/dist/src/hooks/user-prompt.d.ts +5 -0
- package/dist/src/hooks/user-prompt.js +31 -0
- package/dist/src/hooks/user-prompt.js.map +1 -0
- package/dist/src/import.d.ts +24 -0
- package/dist/src/import.js +119 -0
- package/dist/src/import.js.map +1 -0
- package/dist/src/large-files.d.ts +28 -0
- package/dist/src/large-files.js +413 -0
- package/dist/src/large-files.js.map +1 -0
- package/dist/src/llm/anthropic.d.ts +9 -0
- package/dist/src/llm/anthropic.js +54 -0
- package/dist/src/llm/anthropic.js.map +1 -0
- package/dist/src/llm/claude-process.d.ts +2 -0
- package/dist/src/llm/claude-process.js +55 -0
- package/dist/src/llm/claude-process.js.map +1 -0
- package/dist/src/llm/codex-process.d.ts +15 -0
- package/dist/src/llm/codex-process.js +142 -0
- package/dist/src/llm/codex-process.js.map +1 -0
- package/dist/src/llm/mock-summarizer.d.ts +9 -0
- package/dist/src/llm/mock-summarizer.js +17 -0
- package/dist/src/llm/mock-summarizer.js.map +1 -0
- package/dist/src/llm/openai.d.ts +10 -0
- package/dist/src/llm/openai.js +52 -0
- package/dist/src/llm/openai.js.map +1 -0
- package/dist/src/llm/types.d.ts +6 -0
- package/dist/src/llm/types.js +2 -0
- package/dist/src/llm/types.js.map +1 -0
- package/dist/src/mcp/server.d.ts +9 -0
- package/dist/src/mcp/server.js +128 -0
- package/dist/src/mcp/server.js.map +1 -0
- package/dist/src/mcp/tools/lcm-describe.d.ts +14 -0
- package/dist/src/mcp/tools/lcm-describe.js +12 -0
- package/dist/src/mcp/tools/lcm-describe.js.map +1 -0
- package/dist/src/mcp/tools/lcm-doctor.d.ts +8 -0
- package/dist/src/mcp/tools/lcm-doctor.js +9 -0
- package/dist/src/mcp/tools/lcm-doctor.js.map +1 -0
- package/dist/src/mcp/tools/lcm-expand.d.ts +18 -0
- package/dist/src/mcp/tools/lcm-expand.js +13 -0
- package/dist/src/mcp/tools/lcm-expand.js.map +1 -0
- package/dist/src/mcp/tools/lcm-grep.d.ts +27 -0
- package/dist/src/mcp/tools/lcm-grep.js +15 -0
- package/dist/src/mcp/tools/lcm-grep.js.map +1 -0
- package/dist/src/mcp/tools/lcm-search.d.ts +33 -0
- package/dist/src/mcp/tools/lcm-search.js +15 -0
- package/dist/src/mcp/tools/lcm-search.js.map +1 -0
- package/dist/src/mcp/tools/lcm-stats.d.ts +14 -0
- package/dist/src/mcp/tools/lcm-stats.js +11 -0
- package/dist/src/mcp/tools/lcm-stats.js.map +1 -0
- package/dist/src/mcp/tools/lcm-store.d.ts +26 -0
- package/dist/src/mcp/tools/lcm-store.js +22 -0
- package/dist/src/mcp/tools/lcm-store.js.map +1 -0
- package/dist/src/memory/index.d.ts +22 -0
- package/dist/src/memory/index.js +21 -0
- package/dist/src/memory/index.js.map +1 -0
- package/dist/src/promotion/dedup.d.ts +19 -0
- package/dist/src/promotion/dedup.js +42 -0
- package/dist/src/promotion/dedup.js.map +1 -0
- package/dist/src/promotion/detector.d.ts +15 -0
- package/dist/src/promotion/detector.js +31 -0
- package/dist/src/promotion/detector.js.map +1 -0
- package/dist/src/prompts/condensed-d1.yaml +38 -0
- package/dist/src/prompts/condensed-d2.yaml +32 -0
- package/dist/src/prompts/condensed-d3plus.yaml +32 -0
- package/dist/src/prompts/leaf-aggressive.yaml +34 -0
- package/dist/src/prompts/leaf-normal.yaml +34 -0
- package/dist/src/prompts/loader.d.ts +9 -0
- package/dist/src/prompts/loader.js +37 -0
- package/dist/src/prompts/loader.js.map +1 -0
- package/dist/src/prompts/promoted-merge.yaml +18 -0
- package/dist/src/prompts/system.yaml +5 -0
- package/dist/src/retrieval.d.ts +122 -0
- package/dist/src/retrieval.js +214 -0
- package/dist/src/retrieval.js.map +1 -0
- package/dist/src/scrub.d.ts +46 -0
- package/dist/src/scrub.js +184 -0
- package/dist/src/scrub.js.map +1 -0
- package/dist/src/sensitive.d.ts +4 -0
- package/dist/src/sensitive.js +258 -0
- package/dist/src/sensitive.js.map +1 -0
- package/dist/src/stats.d.ts +34 -0
- package/dist/src/stats.js +260 -0
- package/dist/src/stats.js.map +1 -0
- package/dist/src/store/conversation-store.d.ts +115 -0
- package/dist/src/store/conversation-store.js +447 -0
- package/dist/src/store/conversation-store.js.map +1 -0
- package/dist/src/store/fts5-sanitize.d.ts +23 -0
- package/dist/src/store/fts5-sanitize.js +30 -0
- package/dist/src/store/fts5-sanitize.js.map +1 -0
- package/dist/src/store/full-text-fallback.d.ts +16 -0
- package/dist/src/store/full-text-fallback.js +60 -0
- package/dist/src/store/full-text-fallback.js.map +1 -0
- package/dist/src/store/index.d.ts +4 -0
- package/dist/src/store/index.js +3 -0
- package/dist/src/store/index.js.map +1 -0
- package/dist/src/store/summary-store.d.ts +118 -0
- package/dist/src/store/summary-store.js +570 -0
- package/dist/src/store/summary-store.js.map +1 -0
- package/dist/src/summarize.d.ts +59 -0
- package/dist/src/summarize.js +619 -0
- package/dist/src/summarize.js.map +1 -0
- package/dist/src/transcript.d.ts +7 -0
- package/dist/src/transcript.js +51 -0
- package/dist/src/transcript.js.map +1 -0
- package/dist/src/types.d.ts +116 -0
- package/dist/src/types.js +8 -0
- package/dist/src/types.js.map +1 -0
- package/docs/agent-tools.md +187 -0
- package/docs/architecture.md +224 -0
- package/docs/configuration.md +168 -0
- package/docs/fts5.md +161 -0
- package/docs/hook-protocol.md +41 -0
- package/docs/privacy.md +101 -0
- package/mcp.mjs +17 -0
- package/package.json +79 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const lcmExpandTool: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object";
|
|
6
|
+
properties: {
|
|
7
|
+
nodeId: {
|
|
8
|
+
type: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
depth: {
|
|
12
|
+
type: string;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
required: string[];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const lcmExpandTool = {
|
|
2
|
+
name: "lcm_expand",
|
|
3
|
+
description: "Decompress a summary node into its full source content by traversing the DAG. Use when a summary references something that needs more detail.",
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
nodeId: { type: "string", description: "Summary node ID to expand" },
|
|
8
|
+
depth: { type: "number", description: "How many levels of the DAG to traverse (default: 1)" },
|
|
9
|
+
},
|
|
10
|
+
required: ["nodeId"],
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=lcm-expand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lcm-expand.js","sourceRoot":"","sources":["../../../../src/mcp/tools/lcm-expand.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,+IAA+I;IAC5J,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2BAA2B,EAAE;YACpE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qDAAqD,EAAE;SAC9F;QACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;KACrB;CACF,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const lcmGrepTool: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object";
|
|
6
|
+
properties: {
|
|
7
|
+
query: {
|
|
8
|
+
type: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
scope: {
|
|
12
|
+
type: string;
|
|
13
|
+
enum: string[];
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
sessionId: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
since: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
required: string[];
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const lcmGrepTool = {
|
|
2
|
+
name: "lcm_grep",
|
|
3
|
+
description: "Search conversation history by keyword or regex across raw messages and summaries. Use when recalling what was said, decided, or done in a past session.",
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
query: { type: "string", description: "Keyword, phrase, or regex to search" },
|
|
8
|
+
scope: { type: "string", enum: ["messages", "summaries", "all"], default: "all" },
|
|
9
|
+
sessionId: { type: "string", description: "Filter to a specific session" },
|
|
10
|
+
since: { type: "string", description: "ISO datetime lower bound" },
|
|
11
|
+
},
|
|
12
|
+
required: ["query"],
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=lcm-grep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lcm-grep.js","sourceRoot":"","sources":["../../../../src/mcp/tools/lcm-grep.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,0JAA0J;IACvK,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qCAAqC,EAAE;YAC7E,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE;YACjF,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8BAA8B,EAAE;YAC1E,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0BAA0B,EAAE;SACnE;QACD,QAAQ,EAAE,CAAC,OAAO,CAAC;KACpB;CACF,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const lcmSearchTool: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object";
|
|
6
|
+
properties: {
|
|
7
|
+
query: {
|
|
8
|
+
type: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
limit: {
|
|
12
|
+
type: string;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
layers: {
|
|
16
|
+
type: string;
|
|
17
|
+
items: {
|
|
18
|
+
type: string;
|
|
19
|
+
enum: string[];
|
|
20
|
+
};
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
tags: {
|
|
24
|
+
type: string;
|
|
25
|
+
items: {
|
|
26
|
+
type: string;
|
|
27
|
+
};
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
required: string[];
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const lcmSearchTool = {
|
|
2
|
+
name: "lcm_search",
|
|
3
|
+
description: "Hybrid search across both episodic memory (SQLite FTS5) and semantic memory (Qdrant). Returns two separate ranked lists — episodic and semantic. Use when looking for project knowledge spanning multiple sessions.",
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
query: { type: "string", description: "Natural language search query" },
|
|
8
|
+
limit: { type: "number", description: "Max results per layer (default: 5)" },
|
|
9
|
+
layers: { type: "array", items: { type: "string", enum: ["episodic", "semantic"] }, description: "Which memory layers to search (default: both)" },
|
|
10
|
+
tags: { type: "array", items: { type: "string" }, description: "Filter results to entries that include all specified tags (e.g. ['reasoning'], ['decision', 'architecture'])" },
|
|
11
|
+
},
|
|
12
|
+
required: ["query"],
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=lcm-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lcm-search.js","sourceRoot":"","sources":["../../../../src/mcp/tools/lcm-search.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,qNAAqN;IAClO,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+BAA+B,EAAE;YACvE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oCAAoC,EAAE;YAC5E,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,EAAE,WAAW,EAAE,+CAA+C,EAAE;YAClJ,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,8GAA8G,EAAE;SAChL;QACD,QAAQ,EAAE,CAAC,OAAO,CAAC;KACpB;CACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const lcmStatsTool = {
|
|
2
|
+
name: "lcm_stats",
|
|
3
|
+
description: "Show token savings, compression ratios, and usage statistics across all lossless-claude projects. Use to check how much context is being saved.",
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
verbose: { type: "boolean", description: "Include per-conversation breakdown", default: false },
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=lcm-stats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lcm-stats.js","sourceRoot":"","sources":["../../../../src/mcp/tools/lcm-stats.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,iJAAiJ;IAC9J,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,oCAAoC,EAAE,OAAO,EAAE,KAAK,EAAE;SAChG;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const lcmStoreTool: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object";
|
|
6
|
+
properties: {
|
|
7
|
+
text: {
|
|
8
|
+
type: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
tags: {
|
|
12
|
+
type: string;
|
|
13
|
+
items: {
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
metadata: {
|
|
19
|
+
type: string;
|
|
20
|
+
description: string;
|
|
21
|
+
additionalProperties: boolean;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
required: string[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const lcmStoreTool = {
|
|
2
|
+
name: "lcm_store",
|
|
3
|
+
description: "Store a memory into lossless-claude's semantic layer. Use to persist decisions, findings, reasoning outcomes, or any knowledge worth retrieving in future sessions. Stored memories are searchable via lcm_search.",
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
text: { type: "string", description: "The content to store" },
|
|
8
|
+
tags: {
|
|
9
|
+
type: "array",
|
|
10
|
+
items: { type: "string" },
|
|
11
|
+
description: "Categorical tags (e.g. ['decision', 'architecture', 'bug-fix'])",
|
|
12
|
+
},
|
|
13
|
+
metadata: {
|
|
14
|
+
type: "object",
|
|
15
|
+
description: "Optional key/value metadata (e.g. projectId, sessionId, source)",
|
|
16
|
+
additionalProperties: true,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
required: ["text"],
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=lcm-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lcm-store.js","sourceRoot":"","sources":["../../../../src/mcp/tools/lcm-store.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,oNAAoN;IACjO,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sBAAsB,EAAE;YAC7D,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACzB,WAAW,EAAE,iEAAiE;aAC/E;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iEAAiE;gBAC9E,oBAAoB,EAAE,IAAI;aAC3B;SACF;QACD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACnB;CACF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DaemonClient } from "../daemon/client.js";
|
|
2
|
+
export type SearchResult = {
|
|
3
|
+
episodic: any[];
|
|
4
|
+
semantic: any[];
|
|
5
|
+
};
|
|
6
|
+
export type MemoryApi = {
|
|
7
|
+
store: (text: string, tags: string[], metadata?: Record<string, unknown>) => Promise<void>;
|
|
8
|
+
search: (query: string, options?: {
|
|
9
|
+
limit?: number;
|
|
10
|
+
threshold?: number;
|
|
11
|
+
projectId?: string;
|
|
12
|
+
layers?: ("episodic" | "semantic")[];
|
|
13
|
+
}) => Promise<SearchResult>;
|
|
14
|
+
compact: (sessionId: string, transcriptPath: string) => Promise<{
|
|
15
|
+
summary: string;
|
|
16
|
+
}>;
|
|
17
|
+
recent: (projectId: string, limit?: number) => Promise<{
|
|
18
|
+
summaries: any[];
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
export declare function createMemoryApi(client: DaemonClient): MemoryApi;
|
|
22
|
+
export declare const memory: MemoryApi;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DaemonClient } from "../daemon/client.js";
|
|
2
|
+
export function createMemoryApi(client) {
|
|
3
|
+
return {
|
|
4
|
+
async store(text, tags, metadata) {
|
|
5
|
+
await client.post("/store", { text, tags, metadata });
|
|
6
|
+
},
|
|
7
|
+
async search(query, options) {
|
|
8
|
+
return client.post("/search", { query, ...options });
|
|
9
|
+
},
|
|
10
|
+
async compact(sessionId, transcriptPath) {
|
|
11
|
+
return client.post("/compact", { session_id: sessionId, transcript_path: transcriptPath });
|
|
12
|
+
},
|
|
13
|
+
async recent(projectId, limit = 5) {
|
|
14
|
+
return client.post("/recent", { projectId, limit });
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
// Convenience singleton with default daemon address
|
|
19
|
+
const defaultClient = new DaemonClient("http://127.0.0.1:3737");
|
|
20
|
+
export const memory = createMemoryApi(defaultClient);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/memory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAWnD,MAAM,UAAU,eAAe,CAAC,MAAoB;IAClD,OAAO;QACL,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ;YAC9B,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QACxD,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO;YACzB,OAAO,MAAM,CAAC,IAAI,CAAe,SAAS,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;QACrE,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc;YACrC,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC,CAAC;QAC7F,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,GAAG,CAAC;YAC/B,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;QACtD,CAAC;KACF,CAAC;AACJ,CAAC;AAED,oDAAoD;AACpD,MAAM,aAAa,GAAG,IAAI,YAAY,CAAC,uBAAuB,CAAC,CAAC;AAChE,MAAM,CAAC,MAAM,MAAM,GAAc,eAAe,CAAC,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PromotedStore } from "../db/promoted.js";
|
|
2
|
+
type DedupThresholds = {
|
|
3
|
+
dedupBm25Threshold: number;
|
|
4
|
+
mergeMaxEntries: number;
|
|
5
|
+
confidenceDecayRate: number;
|
|
6
|
+
};
|
|
7
|
+
type DedupParams = {
|
|
8
|
+
store: PromotedStore;
|
|
9
|
+
content: string;
|
|
10
|
+
tags: string[];
|
|
11
|
+
projectId: string;
|
|
12
|
+
sessionId?: string;
|
|
13
|
+
depth: number;
|
|
14
|
+
confidence: number;
|
|
15
|
+
summarize: (text: string) => Promise<string>;
|
|
16
|
+
thresholds: DedupThresholds;
|
|
17
|
+
};
|
|
18
|
+
export declare function deduplicateAndInsert(params: DedupParams): Promise<string>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { renderTemplate } from "../prompts/loader.js";
|
|
2
|
+
export async function deduplicateAndInsert(params) {
|
|
3
|
+
const { store, content, tags, projectId, sessionId, depth, confidence, summarize, thresholds } = params;
|
|
4
|
+
// Search for duplicates using FTS5
|
|
5
|
+
const candidates = store.search(content, thresholds.mergeMaxEntries);
|
|
6
|
+
// Filter to entries above BM25 threshold (rank is negative; more negative = better match)
|
|
7
|
+
const duplicates = candidates.filter((c) => c.rank <= -thresholds.dedupBm25Threshold);
|
|
8
|
+
if (duplicates.length === 0) {
|
|
9
|
+
return store.insert({ content, tags, projectId, sessionId, depth, confidence });
|
|
10
|
+
}
|
|
11
|
+
// Merge: combine all duplicate entries + new content
|
|
12
|
+
const allEntries = [...duplicates.map((d) => d.content), content];
|
|
13
|
+
const entriesText = allEntries.map((e, i) => `Entry ${i + 1}:\n${e}`).join("\n\n");
|
|
14
|
+
const mergePrompt = renderTemplate("promoted-merge", { entries: entriesText });
|
|
15
|
+
let mergedContent;
|
|
16
|
+
try {
|
|
17
|
+
mergedContent = await summarize(mergePrompt);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
// Merge failed — insert as new entry rather than losing data
|
|
21
|
+
return store.insert({ content, tags, projectId, sessionId, depth, confidence });
|
|
22
|
+
}
|
|
23
|
+
if (!mergedContent.trim()) {
|
|
24
|
+
return store.insert({ content, tags, projectId, sessionId, depth, confidence });
|
|
25
|
+
}
|
|
26
|
+
// Calculate merged confidence
|
|
27
|
+
const maxConfidence = Math.max(confidence, ...duplicates.map((d) => d.confidence));
|
|
28
|
+
const mergedConfidence = Math.max(0, maxConfidence - thresholds.confidenceDecayRate);
|
|
29
|
+
// Delete old duplicates
|
|
30
|
+
for (const dup of duplicates) {
|
|
31
|
+
store.deleteById(dup.id);
|
|
32
|
+
}
|
|
33
|
+
// Archive if confidence too low — soft-delete, don't surface
|
|
34
|
+
if (mergedConfidence < 0.2) {
|
|
35
|
+
const id = store.insert({ content: mergedContent, tags, projectId, sessionId, depth, confidence: mergedConfidence });
|
|
36
|
+
store.archive(id);
|
|
37
|
+
return id;
|
|
38
|
+
}
|
|
39
|
+
// Insert merged entry
|
|
40
|
+
return store.insert({ content: mergedContent, tags, projectId, sessionId, depth, confidence: mergedConfidence });
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=dedup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedup.js","sourceRoot":"","sources":["../../../src/promotion/dedup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAoBtD,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,MAAmB;IAC5D,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAExG,mCAAmC;IACnC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;IAErE,0FAA0F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IAED,8BAA8B;IAC9B,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IACnF,MAAM,gBAAgB,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,aAAa,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAErF,wBAAwB;IACxB,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC;IAED,6DAA6D;IAC7D,IAAI,gBAAgB,GAAG,GAAG,EAAE,CAAC;QAC3B,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC,CAAC;QACrH,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,sBAAsB;IACtB,OAAO,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC,CAAC;AACnH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DaemonConfig } from "../daemon/config.js";
|
|
2
|
+
type Thresholds = DaemonConfig["compaction"]["promotionThresholds"];
|
|
3
|
+
export type PromotionInput = {
|
|
4
|
+
content: string;
|
|
5
|
+
depth: number;
|
|
6
|
+
tokenCount: number;
|
|
7
|
+
sourceMessageTokenCount: number;
|
|
8
|
+
};
|
|
9
|
+
export type PromotionResult = {
|
|
10
|
+
promote: boolean;
|
|
11
|
+
tags: string[];
|
|
12
|
+
confidence: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function shouldPromote(input: PromotionInput, thresholds: Thresholds): PromotionResult;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function shouldPromote(input, thresholds) {
|
|
2
|
+
const tags = [];
|
|
3
|
+
const { content, depth, tokenCount, sourceMessageTokenCount } = input;
|
|
4
|
+
const lower = content.toLowerCase();
|
|
5
|
+
// Keyword signals
|
|
6
|
+
for (const [category, keywords] of Object.entries(thresholds.keywords)) {
|
|
7
|
+
if (keywords.some((kw) => lower.includes(kw.toLowerCase())))
|
|
8
|
+
tags.push(category);
|
|
9
|
+
}
|
|
10
|
+
// Architecture pattern signals
|
|
11
|
+
for (const pattern of thresholds.architecturePatterns) {
|
|
12
|
+
if (new RegExp(pattern).test(content)) {
|
|
13
|
+
tags.push("architecture");
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
// Depth signal
|
|
18
|
+
if (depth >= thresholds.minDepth)
|
|
19
|
+
tags.push("depth");
|
|
20
|
+
// Compression ratio signal
|
|
21
|
+
if (sourceMessageTokenCount > 0 && tokenCount / sourceMessageTokenCount < thresholds.compressionRatio) {
|
|
22
|
+
tags.push("compressed");
|
|
23
|
+
}
|
|
24
|
+
const signals = new Set(tags);
|
|
25
|
+
return {
|
|
26
|
+
promote: signals.size > 0,
|
|
27
|
+
tags: [...signals],
|
|
28
|
+
confidence: Math.min(signals.size / 4, 1),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detector.js","sourceRoot":"","sources":["../../../src/promotion/detector.ts"],"names":[],"mappings":"AAiBA,MAAM,UAAU,aAAa,CAAC,KAAqB,EAAE,UAAsB;IACzE,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,uBAAuB,EAA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
|
+
name: condensed-d1
|
|
2
|
+
description: Condensed depth-1 summarization — compacts leaf-level summaries into a single session memory node
|
|
3
|
+
variables:
|
|
4
|
+
- targetTokens
|
|
5
|
+
- text
|
|
6
|
+
- previousContextBlock
|
|
7
|
+
- instructionBlock
|
|
8
|
+
template: |-
|
|
9
|
+
You are compacting leaf-level conversation summaries into a single condensed memory node.
|
|
10
|
+
You are preparing context for a fresh model instance that will continue this conversation.
|
|
11
|
+
|
|
12
|
+
{{instructionBlock}}
|
|
13
|
+
|
|
14
|
+
{{previousContextBlock}}
|
|
15
|
+
|
|
16
|
+
Preserve:
|
|
17
|
+
- Decisions made and their rationale when rationale matters going forward.
|
|
18
|
+
- Earlier decisions that were superseded, and what replaced them.
|
|
19
|
+
- Completed tasks/topics with outcomes.
|
|
20
|
+
- In-progress items with current state and what remains.
|
|
21
|
+
- Blockers, open questions, and unresolved tensions.
|
|
22
|
+
- Specific references (names, paths, URLs, identifiers) needed for continuation.
|
|
23
|
+
|
|
24
|
+
Drop low-value detail:
|
|
25
|
+
- Context that has not changed from previous_context.
|
|
26
|
+
- Intermediate dead ends where the conclusion is already known.
|
|
27
|
+
- Transient states that are already resolved.
|
|
28
|
+
- Tool-internal mechanics and process scaffolding.
|
|
29
|
+
|
|
30
|
+
Use plain text. No mandatory structure.
|
|
31
|
+
Include a timeline with timestamps (hour or half-hour) for significant events.
|
|
32
|
+
Present information chronologically and mark superseded decisions.
|
|
33
|
+
End with exactly: "Expand for details about: <comma-separated list of what was dropped or compressed>".
|
|
34
|
+
Target length: about {{targetTokens}} tokens.
|
|
35
|
+
|
|
36
|
+
<conversation_to_condense>
|
|
37
|
+
{{text}}
|
|
38
|
+
</conversation_to_condense>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: condensed-d2
|
|
2
|
+
description: Condensed depth-2 summarization — condenses session-level summaries into a higher-level memory node
|
|
3
|
+
variables:
|
|
4
|
+
- targetTokens
|
|
5
|
+
- text
|
|
6
|
+
- instructionBlock
|
|
7
|
+
template: |-
|
|
8
|
+
You are condensing multiple session-level summaries into a higher-level memory node.
|
|
9
|
+
A future model should understand trajectory, not per-session minutiae.
|
|
10
|
+
|
|
11
|
+
{{instructionBlock}}
|
|
12
|
+
|
|
13
|
+
Preserve:
|
|
14
|
+
- Decisions still in effect and their rationale.
|
|
15
|
+
- Decisions that evolved: what changed and why.
|
|
16
|
+
- Completed work with outcomes.
|
|
17
|
+
- Active constraints, limitations, and known issues.
|
|
18
|
+
- Current state of in-progress work.
|
|
19
|
+
|
|
20
|
+
Drop:
|
|
21
|
+
- Session-local operational detail and process mechanics.
|
|
22
|
+
- Identifiers that are no longer relevant.
|
|
23
|
+
- Intermediate states superseded by later outcomes.
|
|
24
|
+
|
|
25
|
+
Use plain text. Brief headers are fine if useful.
|
|
26
|
+
Include a timeline with dates and approximate time of day for key milestones.
|
|
27
|
+
End with exactly: "Expand for details about: <comma-separated list of what was dropped or compressed>".
|
|
28
|
+
Target length: about {{targetTokens}} tokens.
|
|
29
|
+
|
|
30
|
+
<conversation_to_condense>
|
|
31
|
+
{{text}}
|
|
32
|
+
</conversation_to_condense>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: condensed-d3plus
|
|
2
|
+
description: Condensed depth-3+ summarization — creates a high-level durable memory node from phase-level summaries
|
|
3
|
+
variables:
|
|
4
|
+
- targetTokens
|
|
5
|
+
- text
|
|
6
|
+
- instructionBlock
|
|
7
|
+
template: |-
|
|
8
|
+
You are creating a high-level memory node from multiple phase-level summaries.
|
|
9
|
+
This may persist for the rest of the conversation. Keep only durable context.
|
|
10
|
+
|
|
11
|
+
{{instructionBlock}}
|
|
12
|
+
|
|
13
|
+
Preserve:
|
|
14
|
+
- Key decisions and rationale.
|
|
15
|
+
- What was accomplished and current state.
|
|
16
|
+
- Active constraints and hard limitations.
|
|
17
|
+
- Important relationships between people, systems, or concepts.
|
|
18
|
+
- Durable lessons learned.
|
|
19
|
+
|
|
20
|
+
Drop:
|
|
21
|
+
- Operational and process detail.
|
|
22
|
+
- Method details unless the method itself was the decision.
|
|
23
|
+
- Specific references unless essential for continuation.
|
|
24
|
+
|
|
25
|
+
Use plain text. Be concise.
|
|
26
|
+
Include a brief timeline with dates (or date ranges) for major milestones.
|
|
27
|
+
End with exactly: "Expand for details about: <comma-separated list of what was dropped or compressed>".
|
|
28
|
+
Target length: about {{targetTokens}} tokens.
|
|
29
|
+
|
|
30
|
+
<conversation_to_condense>
|
|
31
|
+
{{text}}
|
|
32
|
+
</conversation_to_condense>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: leaf-aggressive
|
|
2
|
+
description: Aggressive leaf segment summarization prompt — keeps only highest-value facts for fast compaction convergence
|
|
3
|
+
variables:
|
|
4
|
+
- targetTokens
|
|
5
|
+
- text
|
|
6
|
+
- previousContext
|
|
7
|
+
- instructionBlock
|
|
8
|
+
template: |-
|
|
9
|
+
You summarize a SEGMENT of a Claude Code conversation for future model turns.
|
|
10
|
+
Treat this as incremental memory compaction input, not a full-conversation summary.
|
|
11
|
+
|
|
12
|
+
Aggressive summary policy:
|
|
13
|
+
- Keep only durable facts and current task state.
|
|
14
|
+
- Remove examples, repetition, and low-value narrative details.
|
|
15
|
+
- Preserve explicit TODOs, blockers, decisions, and constraints.
|
|
16
|
+
|
|
17
|
+
{{instructionBlock}}
|
|
18
|
+
|
|
19
|
+
Output requirements:
|
|
20
|
+
- Plain text only.
|
|
21
|
+
- No preamble, headings, or markdown formatting.
|
|
22
|
+
- Keep it concise while preserving required details.
|
|
23
|
+
- Track file operations (created, modified, deleted, renamed) with file paths and current status.
|
|
24
|
+
- If no file operations appear, include exactly: "Files: none".
|
|
25
|
+
- End with exactly: "Expand for details about: <comma-separated list of what was dropped or compressed>".
|
|
26
|
+
- Target length: about {{targetTokens}} tokens or less.
|
|
27
|
+
|
|
28
|
+
<previous_context>
|
|
29
|
+
{{previousContext}}
|
|
30
|
+
</previous_context>
|
|
31
|
+
|
|
32
|
+
<conversation_segment>
|
|
33
|
+
{{text}}
|
|
34
|
+
</conversation_segment>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: leaf-normal
|
|
2
|
+
description: Normal leaf segment summarization prompt — preserves details for incremental memory compaction
|
|
3
|
+
variables:
|
|
4
|
+
- targetTokens
|
|
5
|
+
- text
|
|
6
|
+
- previousContext
|
|
7
|
+
- instructionBlock
|
|
8
|
+
template: |-
|
|
9
|
+
You summarize a SEGMENT of a Claude Code conversation for future model turns.
|
|
10
|
+
Treat this as incremental memory compaction input, not a full-conversation summary.
|
|
11
|
+
|
|
12
|
+
Normal summary policy:
|
|
13
|
+
- Preserve key decisions, rationale, constraints, and active tasks.
|
|
14
|
+
- Keep essential technical details needed to continue work safely.
|
|
15
|
+
- Remove obvious repetition and conversational filler.
|
|
16
|
+
|
|
17
|
+
{{instructionBlock}}
|
|
18
|
+
|
|
19
|
+
Output requirements:
|
|
20
|
+
- Plain text only.
|
|
21
|
+
- No preamble, headings, or markdown formatting.
|
|
22
|
+
- Keep it concise while preserving required details.
|
|
23
|
+
- Track file operations (created, modified, deleted, renamed) with file paths and current status.
|
|
24
|
+
- If no file operations appear, include exactly: "Files: none".
|
|
25
|
+
- End with exactly: "Expand for details about: <comma-separated list of what was dropped or compressed>".
|
|
26
|
+
- Target length: about {{targetTokens}} tokens or less.
|
|
27
|
+
|
|
28
|
+
<previous_context>
|
|
29
|
+
{{previousContext}}
|
|
30
|
+
</previous_context>
|
|
31
|
+
|
|
32
|
+
<conversation_segment>
|
|
33
|
+
{{text}}
|
|
34
|
+
</conversation_segment>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type PromptTemplate = {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
variables: string[];
|
|
5
|
+
template: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function loadTemplate(name: string): PromptTemplate;
|
|
8
|
+
export declare function interpolate(template: string, vars: Record<string, string>): string;
|
|
9
|
+
export declare function renderTemplate(name: string, vars: Record<string, string>): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { join, dirname } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import yaml from "js-yaml";
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = dirname(__filename);
|
|
7
|
+
const cache = new Map();
|
|
8
|
+
export function loadTemplate(name) {
|
|
9
|
+
if (name.includes("/") || name.includes("..") || name.includes("\0")) {
|
|
10
|
+
throw new Error(`Invalid template name: ${name}`);
|
|
11
|
+
}
|
|
12
|
+
const cached = cache.get(name);
|
|
13
|
+
if (cached)
|
|
14
|
+
return cached;
|
|
15
|
+
const filePath = join(__dirname, `${name}.yaml`);
|
|
16
|
+
let raw;
|
|
17
|
+
try {
|
|
18
|
+
raw = readFileSync(filePath, "utf-8");
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
throw new Error(`Prompt template not found: ${name} (looked at ${filePath})`);
|
|
22
|
+
}
|
|
23
|
+
const parsed = yaml.load(raw);
|
|
24
|
+
if (!parsed || typeof parsed.template !== "string") {
|
|
25
|
+
throw new Error(`Invalid prompt template: ${name} — missing 'template' field`);
|
|
26
|
+
}
|
|
27
|
+
cache.set(name, parsed);
|
|
28
|
+
return parsed;
|
|
29
|
+
}
|
|
30
|
+
export function interpolate(template, vars) {
|
|
31
|
+
return template.replace(/\{\{(\w+)\}\}/g, (_, key) => vars[key] ?? "");
|
|
32
|
+
}
|
|
33
|
+
export function renderTemplate(name, vars) {
|
|
34
|
+
const tpl = loadTemplate(name);
|
|
35
|
+
return interpolate(tpl.template, vars);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../src/prompts/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC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C,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,QAAgB,EAAE,IAA4B;IACxE,OAAO,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,IAA4B;IACvE,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: promoted-merge
|
|
2
|
+
description: Merge overlapping promoted memory entries into one
|
|
3
|
+
variables:
|
|
4
|
+
- entries
|
|
5
|
+
template: |-
|
|
6
|
+
You are merging overlapping memory entries from a coding agent's long-term memory.
|
|
7
|
+
Combine them into a single entry that:
|
|
8
|
+
- Removes duplicate information
|
|
9
|
+
- Keeps the most recent state of any decision that evolved
|
|
10
|
+
- Preserves all unique facts, file paths, and identifiers
|
|
11
|
+
- Uses plain text, no headings or formatting
|
|
12
|
+
- Is concise (aim for the length of the longest input entry)
|
|
13
|
+
|
|
14
|
+
Entries to merge:
|
|
15
|
+
|
|
16
|
+
{{entries}}
|
|
17
|
+
|
|
18
|
+
Output the merged entry as plain text. Nothing else.
|