@nxuss/lemma 1.14.0 → 1.15.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 +11 -8
- package/dist/cjs/mcp/tool-profiles.d.ts.map +1 -1
- package/dist/cjs/mcp/tool-profiles.js +1 -0
- package/dist/cjs/mcp/tool-profiles.js.map +1 -1
- package/dist/cjs/mcp/tools.d.ts.map +1 -1
- package/dist/cjs/mcp/tools.js +71 -7
- package/dist/cjs/mcp/tools.js.map +1 -1
- package/dist/cjs/subconscious/TheBrainV2.d.ts +100 -1
- package/dist/cjs/subconscious/TheBrainV2.d.ts.map +1 -1
- package/dist/cjs/subconscious/TheBrainV2.js +166 -26
- package/dist/cjs/subconscious/TheBrainV2.js.map +1 -1
- package/dist/cjs/utils/SymbolSurgicalContext.d.ts +9 -0
- package/dist/cjs/utils/SymbolSurgicalContext.d.ts.map +1 -1
- package/dist/cjs/utils/SymbolSurgicalContext.js +19 -0
- package/dist/cjs/utils/SymbolSurgicalContext.js.map +1 -1
- package/dist/esm/mcp/tool-profiles.d.ts.map +1 -1
- package/dist/esm/mcp/tool-profiles.js +1 -0
- package/dist/esm/mcp/tool-profiles.js.map +1 -1
- package/dist/esm/mcp/tools.d.ts.map +1 -1
- package/dist/esm/mcp/tools.js +71 -7
- package/dist/esm/mcp/tools.js.map +1 -1
- package/dist/esm/subconscious/TheBrainV2.d.ts +100 -1
- package/dist/esm/subconscious/TheBrainV2.d.ts.map +1 -1
- package/dist/esm/subconscious/TheBrainV2.js +162 -26
- package/dist/esm/subconscious/TheBrainV2.js.map +1 -1
- package/dist/esm/utils/SymbolSurgicalContext.d.ts +9 -0
- package/dist/esm/utils/SymbolSurgicalContext.d.ts.map +1 -1
- package/dist/esm/utils/SymbolSurgicalContext.js +18 -0
- package/dist/esm/utils/SymbolSurgicalContext.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,10 +38,13 @@ lemma start # gateway + dashboard on http://localhost:8081
|
|
|
38
38
|
- **Shared Semantic Memory ("The Brain")** — a zero-dependency local index (BM25 + Jaccard, no
|
|
39
39
|
ChromaDB/Ollama required) that persists solutions, fixes, and decisions across every project and
|
|
40
40
|
every session, with claim- and symbol-level freshness so a stale answer can't hide behind a fresh
|
|
41
|
-
one.
|
|
42
|
-
`
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
one. Memories can depend on other memories (`derivedFrom`) and inherit their staleness
|
|
42
|
+
transitively; `verify_memory` batch-revalidates a set of ids by hash-compare alone, no search
|
|
43
|
+
round trip; `semanticDiff` tells a comment/formatting-only edit apart from a real one so
|
|
44
|
+
reformatting a file doesn't falsely invalidate what was learned about it. Ranking factors in
|
|
45
|
+
real usage (`hits`), explicit negative feedback (`downvote_memory`), and `cognitive_map` domain
|
|
46
|
+
tags; a passing `test_oracle` run over an uncommitted diff auto-captures itself; two memories
|
|
47
|
+
about the same symbol that disagree on outcome are flagged, not silently both suggested.
|
|
45
48
|
- **Verifiable caching, not marketing numbers** — `state_hash_cache` only hits when the files an
|
|
46
49
|
answer depends on are byte-identical; `token_receipt` gives a real per-session breakdown of how
|
|
47
50
|
each answer was produced instead of an invented "% saved."
|
|
@@ -56,7 +59,7 @@ lemma start # gateway + dashboard on http://localhost:8081
|
|
|
56
59
|
compiler-verified AST location instead of asking the model to output a full-file rewrite.
|
|
57
60
|
- **Infrastructure Command Center** — 22 free tools for Jenkins, OKD/OpenShift, and Terraform:
|
|
58
61
|
discover, connect, deploy, diagnose, and detect drift, all via MCP.
|
|
59
|
-
- **Scoped tool surface** — of the
|
|
62
|
+
- **Scoped tool surface** — of the 98 registered tools, only the ones your project shows evidence
|
|
60
63
|
of needing are advertised to the model each turn; the rest stay one `lemma_toolbox` call away.
|
|
61
64
|
|
|
62
65
|
See [`CHANGELOG.md`](CHANGELOG.md) for the full, per-version history.
|
|
@@ -65,13 +68,13 @@ See [`CHANGELOG.md`](CHANGELOG.md) for the full, per-version history.
|
|
|
65
68
|
|
|
66
69
|
## 💎 Free vs Pro
|
|
67
70
|
|
|
68
|
-
|
|
71
|
+
48 of the 98 registered tools work with no license; 50 require Pro. Enforced by one allowlist in
|
|
69
72
|
code (`FREE_TOOLS` in `src/mcp/tools.ts`), not by narrative. A session without a license doesn't
|
|
70
73
|
even advertise the Pro tools — they stay registered and discoverable via `lemma_toolbox`.
|
|
71
74
|
|
|
72
|
-
| | Free (
|
|
75
|
+
| | Free (48) | Pro (50) |
|
|
73
76
|
| :--- | :--- | :--- |
|
|
74
|
-
| **Caching & memory** | `smarter_cache`, `state_hash_cache`, `token_receipt`, `search_memory`, `store_memory`, `downvote_memory`, `token_budget` | `get_telepathic_hints`, `query_hybrid_consensus`, `semantic_dedup_guard`, `local_semantic_autofix` |
|
|
77
|
+
| **Caching & memory** | `smarter_cache`, `state_hash_cache`, `token_receipt`, `search_memory`, `store_memory`, `downvote_memory`, `verify_memory`, `token_budget` | `get_telepathic_hints`, `query_hybrid_consensus`, `semantic_dedup_guard`, `local_semantic_autofix` |
|
|
75
78
|
| **Reading & context** | `read_workspace_file`, `scrub_privacy`, `import_tree_context`, `bulk_file_digest`, `auto_context_bundle`, `git_blame_heat`, `type_coverage_report` | `get_ast_hologram`, `smart_file_slice`, `get_symbol_surgical_context`, `diff_only` |
|
|
76
79
|
| **Writing & workspace** | — | `write_workspace_file`, `apply_workspace_patch`, `multi_file_patch`, `search_workspace`, `run_workspace_command`, `validate_patch_sandbox`, `surgical_ast_insert` |
|
|
77
80
|
| **Static analysis** | — | `entropy_score`, `coupling_radar`, `pattern_fossil`, `precrime_static`, `dead_export_necromancer`, `depgraph`, `refactor`, `ast_flow_visualizer`, `cognitive_map` |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-profiles.d.ts","sourceRoot":"","sources":["../../../src/mcp/tool-profiles.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GA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3,"file":"tool-profiles.js","sourceRoot":"","sources":["../../../src/mcp/tool-profiles.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"tool-profiles.js","sourceRoot":"","sources":["../../../src/mcp/tool-profiles.ts"],"names":[],"mappings":";;;;;;AA+KA,gDAyDC;AAMD,kDA0DC;AAxSD,4CAAoB;AACpB,gDAAwB;AACxB,kDAAiD;AAsBjD;;;;GAIG;AACU,QAAA,eAAe,GAAa;IACvC,8BAA8B;IAC9B,qBAAqB;IACrB,oBAAoB;IACpB,kBAAkB;IAClB,kBAAkB;IAClB,uBAAuB;IACvB,eAAe;IACf,oDAAoD;IACpD,uBAAuB;IACvB,sBAAsB;IACtB,uBAAuB;IACvB,qBAAqB;IACrB,wBAAwB;IACxB,wCAAwC;IACxC,kBAAkB;IAClB,6BAA6B;IAC7B,wBAAwB;IACxB,oFAAoF;IACpF,uCAAuC;IACvC,gBAAgB;IAChB,6CAA6C;IAC7C,kBAAkB;IAClB,eAAe;IACf,eAAe;IACf,cAAc;IACd,eAAe;IACf,uBAAuB;IACvB,eAAe;IACf,oBAAoB;CACrB,CAAC;AAaF;;;;;;;;;;GAUG;AACH,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAClC,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAE1C,SAAS,gBAAgB,CAAC,GAAW,EAAE,cAA2B;IAChE,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAA,uBAAW,EAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9C,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,SAAS;YACvC,IAAI,CAAC,CAAC,KAAK,GAAG,uBAAuB;gBAAE,SAAS;YAChD,MAAM,GAAG,GAAG,CAAC,CAAC,WAAW,GAA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IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG,aAAa,CAAC,CAAC;IAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;IAE9C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,MAAM;YACjB,CAAC,CAAC,iCAAiC,KAAK,MAAM,MAAM,CAAC,MAAM,iEAAiE;YAC5H,CAAC,CAAC,2EAA2E,CAAC;IAClF,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QAC5B,iFAAiF;QACjF,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACrE,OAAO,KAAK,CAAC,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,OAAO,CAAC,MAAM,gGAAgG;QACjH,kFAAkF;QAClF,EAAE;QACF,GAAG,KAAK;QACR,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,uCAAuC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACrF,EAAE;QACF,2GAA2G;KAC5G,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAu7CnE,oFAAoF;AACpF,wBAAgB,kBAAkB,IAAI,MAAM,CAM3C;AAED,oEAAoE;AACpE,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAEjD;AAED,iEAAiE;AACjE,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAEjD;AAED,iFAAiF;AACjF,wBAAgB,qBAAqB,IAAI;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAQA;AAwHD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,MAAM,EAAE,IAAI,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAqCD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,GAC1C,IAAI,CAiHN"}
|
package/dist/cjs/mcp/tools.js
CHANGED
|
@@ -111,7 +111,7 @@ function isProUser() {
|
|
|
111
111
|
}
|
|
112
112
|
const FREE_TOOLS = new Set([
|
|
113
113
|
// Cache & Memory — the hook that shows instant value
|
|
114
|
-
"smarter_cache", "state_hash_cache", "token_receipt", "search_memory", "store_memory", "downvote_memory", "get_project_history",
|
|
114
|
+
"smarter_cache", "state_hash_cache", "token_receipt", "search_memory", "store_memory", "downvote_memory", "verify_memory", "get_project_history",
|
|
115
115
|
// Token optimization — shows what they're saving
|
|
116
116
|
"token_budget", "squeeze_prompt", "turbosqueeze",
|
|
117
117
|
// Utility — just enough to function
|
|
@@ -236,7 +236,7 @@ const toolDefinitions = [
|
|
|
236
236
|
{
|
|
237
237
|
name: "search_memory",
|
|
238
238
|
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
239
|
-
description: "Search Lemma's semantic memory (The Brain) before investigating something from scratch — retrieves past solutions, fixes, and context from ALL your projects globally. Results
|
|
239
|
+
description: "Search Lemma's semantic memory (The Brain) before investigating something from scratch — retrieves past solutions, fixes, and context from ALL your projects globally. Results split into 'fresh' (safe to reuse) and 'stale' (a tracked file changed since — re-verify before reusing). Never treat a stale result as current. If a returned memory turns out wrong once acted on, call downvote_memory with its id.",
|
|
240
240
|
inputSchema: {
|
|
241
241
|
type: "object",
|
|
242
242
|
properties: {
|
|
@@ -251,6 +251,11 @@ const toolDefinitions = [
|
|
|
251
251
|
type: "string",
|
|
252
252
|
description: "Prefer memories tagged with this domain (e.g. 'auth', 'billing' — matches cognitive_map domains). Soft preference, not a filter: an untagged or cross-domain memory can still be the best match.",
|
|
253
253
|
},
|
|
254
|
+
semanticDiff: {
|
|
255
|
+
type: "boolean",
|
|
256
|
+
description: "Don't count a comment/whitespace-only change as stale.",
|
|
257
|
+
default: false,
|
|
258
|
+
},
|
|
254
259
|
},
|
|
255
260
|
required: ["query"],
|
|
256
261
|
},
|
|
@@ -258,7 +263,7 @@ const toolDefinitions = [
|
|
|
258
263
|
{
|
|
259
264
|
name: "store_memory",
|
|
260
265
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
261
|
-
description: "Persist a technical solution, bug fix, architecture decision, or key fact into Lemma's Brain — so future questions on the same topic (even phrased differently) don't require re-investigating the repo. Pass filePaths for anything derived from specific files
|
|
266
|
+
description: "Persist a technical solution, bug fix, architecture decision, or key fact into Lemma's Brain — so future questions on the same topic (even phrased differently) don't require re-investigating the repo. Pass filePaths for anything derived from specific files so the memory auto-invalidates the moment those files change. If the answer is really about one function/class, pass `symbols` instead (or in addition) so an unrelated edit elsewhere in that file doesn't stale it out. Pass outcome='failed' for an approach that was tried and did NOT work.",
|
|
262
267
|
inputSchema: {
|
|
263
268
|
type: "object",
|
|
264
269
|
properties: {
|
|
@@ -307,10 +312,32 @@ const toolDefinitions = [
|
|
|
307
312
|
type: "string",
|
|
308
313
|
description: "Tag this memory with a domain (e.g. 'auth', 'billing' — matches cognitive_map domains) so domain-scoped searches prefer it. Optional: when omitted and filePaths is set, Lemma auto-derives a domain from the first file via cognitive_map (or a lightweight path heuristic if the map was never built).",
|
|
309
314
|
},
|
|
315
|
+
derivedFrom: {
|
|
316
|
+
type: "array",
|
|
317
|
+
items: { type: "string" },
|
|
318
|
+
description: "Ids of memories this one depends on; stale if they go stale.",
|
|
319
|
+
},
|
|
310
320
|
},
|
|
311
321
|
required: ["query", "response"],
|
|
312
322
|
},
|
|
313
323
|
},
|
|
324
|
+
{
|
|
325
|
+
name: "verify_memory",
|
|
326
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
|
|
327
|
+
description: "Cheaply revalidate ids from a prior search_memory/store_memory result — batch hash-compare, no BM25/re-search. Each id comes back 'fresh', 'stale', or 'unknown' (purged/renamed, never reported as fresh). Accepts entry ids and claim ids together.",
|
|
328
|
+
inputSchema: {
|
|
329
|
+
type: "object",
|
|
330
|
+
properties: {
|
|
331
|
+
ids: { type: "array", items: { type: "string" }, description: "Entry and/or claim ids to revalidate, from a prior search_memory/store_memory result." },
|
|
332
|
+
semanticDiff: {
|
|
333
|
+
type: "boolean",
|
|
334
|
+
description: "Don't count a comment/whitespace-only change as stale.",
|
|
335
|
+
default: false,
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
required: ["ids"],
|
|
339
|
+
},
|
|
340
|
+
},
|
|
314
341
|
{
|
|
315
342
|
name: "downvote_memory",
|
|
316
343
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
@@ -1452,6 +1479,7 @@ const toolHandlers = {
|
|
|
1452
1479
|
search_memory: handleSearchMemory,
|
|
1453
1480
|
store_memory: handleStoreMemory,
|
|
1454
1481
|
downvote_memory: handleDownvoteMemory,
|
|
1482
|
+
verify_memory: handleVerifyMemory,
|
|
1455
1483
|
get_routing_advice: handleGetRoutingAdvice,
|
|
1456
1484
|
auto_heal: handleAutoHeal,
|
|
1457
1485
|
read_workspace_file: handleReadWorkspaceFile,
|
|
@@ -1725,11 +1753,12 @@ async function handleSearchMemory(args) {
|
|
|
1725
1753
|
// threshold so both paths agree on what counts as a hit.
|
|
1726
1754
|
const minSimilarity = typeof args?.minSimilarity === "number" ? args.minSimilarity : DEFAULT_MEMORY_SIMILARITY_FLOOR;
|
|
1727
1755
|
const domain = typeof args?.domain === "string" && args.domain.trim() ? args.domain.trim() : undefined;
|
|
1756
|
+
const semanticDiff = args?.semanticDiff === true;
|
|
1728
1757
|
if (!query)
|
|
1729
1758
|
throw new Error("Query is required");
|
|
1730
1759
|
try {
|
|
1731
1760
|
const brain = (0, TheBrainV2_1.getBrain)();
|
|
1732
|
-
const results = brain.search(query, limit, minSimilarity, { projectId: (0, TheBrainV2_1.deriveProjectId)(), domain });
|
|
1761
|
+
const results = brain.search(query, limit, minSimilarity, { projectId: (0, TheBrainV2_1.deriveProjectId)(), domain, semanticDiff });
|
|
1733
1762
|
if (results.length === 0) {
|
|
1734
1763
|
(0, TokenReceipt_1.recordReceiptEvent)("reasoning", query.substring(0, 100), {
|
|
1735
1764
|
tool: "search_memory",
|
|
@@ -1753,7 +1782,9 @@ async function handleSearchMemory(args) {
|
|
|
1753
1782
|
const staleCount = r.claims.filter((c) => !c.fresh).length;
|
|
1754
1783
|
return `\nClaims (${r.claims.length - staleCount}/${r.claims.length} still fresh — trust only the ✓ ones):\n${lines.join("\n")}`;
|
|
1755
1784
|
};
|
|
1756
|
-
const formatResult = (r, i) => `Result ${i + 1} (id: ${r.id}, Similarity: ${(r.similarity * 100).toFixed(1)}%)${r.outcome === "failed" ? "\n⚠️ TAGGED AS A FAILED ATTEMPT — this was tried before and did NOT work. Do not repeat it; treat this as a warning, not a suggestion." : ""}\nPrompt: ${r.query.substring(0, 300)}...\nResponse: ${typeof r.response === "string" ? r.response : JSON.stringify(r.response, null, 2)}${formatClaims(r)}
|
|
1785
|
+
const formatResult = (r, i) => `Result ${i + 1} (id: ${r.id}, Similarity: ${(r.similarity * 100).toFixed(1)}%)${r.outcome === "failed" ? "\n⚠️ TAGGED AS A FAILED ATTEMPT — this was tried before and did NOT work. Do not repeat it; treat this as a warning, not a suggestion." : ""}\nPrompt: ${r.query.substring(0, 300)}...\nResponse: ${typeof r.response === "string" ? r.response : JSON.stringify(r.response, null, 2)}${formatClaims(r)}${Array.isArray(r.cosmeticChanges) && r.cosmeticChanges.length > 0
|
|
1786
|
+
? `\n(comment/whitespace-only change, ignored under semanticDiff: ${r.cosmeticChanges.join(", ")})`
|
|
1787
|
+
: ""}`;
|
|
1757
1788
|
if (fresh.length > 0) {
|
|
1758
1789
|
// Only a fresh hit (or an untracked, purely conceptual entry) counts as a real
|
|
1759
1790
|
// avoided re-investigation — this is the only case worth crediting as savings.
|
|
@@ -1805,11 +1836,14 @@ async function handleStoreMemory(args) {
|
|
|
1805
1836
|
// Auto-derive from the first tracked file when the caller didn't say — see
|
|
1806
1837
|
// deriveDomainForFile for why this is a best-effort tag, not a hard classification.
|
|
1807
1838
|
const domain = explicitDomain || (filePaths && filePaths.length > 0 ? deriveDomainForFile(filePaths[0]) : undefined);
|
|
1839
|
+
const derivedFrom = Array.isArray(args?.derivedFrom)
|
|
1840
|
+
? args.derivedFrom.filter((id) => typeof id === "string" && id)
|
|
1841
|
+
: undefined;
|
|
1808
1842
|
if (!query || !responseText)
|
|
1809
1843
|
throw new Error("Query and response are required");
|
|
1810
1844
|
try {
|
|
1811
1845
|
const brain = (0, TheBrainV2_1.getBrain)();
|
|
1812
|
-
const storeRes = brain.store(query, responseText, provider, 0.92, filePaths, undefined, outcome, symbols, claims, domain);
|
|
1846
|
+
const storeRes = brain.store(query, responseText, provider, 0.92, filePaths, undefined, outcome, symbols, claims, domain, derivedFrom);
|
|
1813
1847
|
// Storing a memory saves nothing — it only creates the chance of a saving later.
|
|
1814
1848
|
// Crediting tokens here inflated the ledger on write and then credited the same
|
|
1815
1849
|
// answer again on every read. The saving is booked by search_memory on a fresh hit.
|
|
@@ -1825,11 +1859,14 @@ async function handleStoreMemory(args) {
|
|
|
1825
1859
|
const domainNote = domain
|
|
1826
1860
|
? ` Tagged with domain '${domain}'${explicitDomain ? "" : " (auto-derived from filePaths)"} — domain-scoped searches will prefer it.`
|
|
1827
1861
|
: "";
|
|
1862
|
+
const derivedFromNote = derivedFrom && derivedFrom.length > 0
|
|
1863
|
+
? ` Derived from ${derivedFrom.length} prior memor${derivedFrom.length === 1 ? "y" : "ies"} — this one goes stale too if any of those do.`
|
|
1864
|
+
: "";
|
|
1828
1865
|
const conflictsNote = storeRes.conflicts && storeRes.conflicts.length > 0
|
|
1829
1866
|
? `\n\n⚠️ ${storeRes.conflicts.length} existing ${storeRes.conflicts.length === 1 ? "memory shares" : "memories share"} a symbol with this one but disagree on outcome — review before trusting either:\n` +
|
|
1830
1867
|
storeRes.conflicts.map((c) => ` - [${c.outcome}] ${c.id}: ${c.query.substring(0, 120)}`).join("\n")
|
|
1831
1868
|
: "";
|
|
1832
|
-
return { content: [{ type: "text", text: `Success: Memory stored. ${storeRes.reason}${trackingNote}${symbolNote}${outcomeNote}${claimsNote}${domainNote}${conflictsNote}` }] };
|
|
1869
|
+
return { content: [{ type: "text", text: `Success: Memory stored. ${storeRes.reason}${trackingNote}${symbolNote}${outcomeNote}${claimsNote}${domainNote}${derivedFromNote}${conflictsNote}` }] };
|
|
1833
1870
|
}
|
|
1834
1871
|
catch (e) {
|
|
1835
1872
|
(0, utils_1.logError)("store_memory", e);
|
|
@@ -1849,6 +1886,33 @@ async function handleDownvoteMemory(args) {
|
|
|
1849
1886
|
return { content: [{ type: "text", text: `Failed to downvote memory: ${e.message}` }] };
|
|
1850
1887
|
}
|
|
1851
1888
|
}
|
|
1889
|
+
async function handleVerifyMemory(args) {
|
|
1890
|
+
const ids = Array.isArray(args?.ids) ? args.ids.filter((id) => typeof id === "string" && id) : [];
|
|
1891
|
+
const semanticDiff = args?.semanticDiff === true;
|
|
1892
|
+
if (ids.length === 0)
|
|
1893
|
+
throw new Error("ids is required and must be a non-empty array");
|
|
1894
|
+
try {
|
|
1895
|
+
const results = (0, TheBrainV2_1.getBrain)().verifyByIds(ids, { semanticDiff });
|
|
1896
|
+
const fresh = results.filter((r) => r.status === "fresh");
|
|
1897
|
+
const stale = results.filter((r) => r.status === "stale");
|
|
1898
|
+
const unknown = results.filter((r) => r.status === "unknown");
|
|
1899
|
+
const formatOne = (r) => {
|
|
1900
|
+
const staleNote = r.staleFiles && r.staleFiles.length > 0 ? ` (changed: ${r.staleFiles.join(", ")})` : "";
|
|
1901
|
+
const cosmeticNote = r.cosmeticChanges && r.cosmeticChanges.length > 0 ? ` (cosmetic only, ignored: ${r.cosmeticChanges.join(", ")})` : "";
|
|
1902
|
+
const claimsNote = r.claimBreakdown && r.claimBreakdown.length > 0
|
|
1903
|
+
? `\n Claims: ${r.claimBreakdown.map((c) => `${c.fresh ? "✓" : "✗"} ${c.text}`).join(" | ")}`
|
|
1904
|
+
: "";
|
|
1905
|
+
return `${r.id}: ${r.status}${staleNote}${cosmeticNote}${claimsNote}`;
|
|
1906
|
+
};
|
|
1907
|
+
const summary = `${fresh.length} fresh, ${stale.length} stale, ${unknown.length} unknown (of ${results.length} checked).`;
|
|
1908
|
+
const lines = results.map(formatOne).join("\n");
|
|
1909
|
+
return { content: [{ type: "text", text: `${summary}\n${lines}` }] };
|
|
1910
|
+
}
|
|
1911
|
+
catch (e) {
|
|
1912
|
+
(0, utils_1.logError)("verify_memory", e);
|
|
1913
|
+
return { content: [{ type: "text", text: `Failed to verify memory: ${e.message}` }] };
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1852
1916
|
async function handleGetRoutingAdvice(args) {
|
|
1853
1917
|
const prompt = args?.prompt;
|
|
1854
1918
|
const intendedModel = args?.intended_model;
|