@nxuss/lemma 1.38.0 → 1.39.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 +3 -4
- package/bin/brain-ingest.js +68 -31
- package/bin/init.js +25 -28
- package/dashboard/dist/assets/index-DNTQXLER.css +1 -0
- package/dashboard/dist/assets/index-DzL_Zu3m.js +452 -0
- package/dashboard/dist/index.html +2 -2
- package/dist/cjs/cli/gitHooks.d.ts +9 -2
- package/dist/cjs/cli/gitHooks.d.ts.map +1 -1
- package/dist/cjs/cli/gitHooks.js +31 -4
- package/dist/cjs/cli/gitHooks.js.map +1 -1
- package/dist/cjs/cli/lemma-proxy.d.ts.map +1 -1
- package/dist/cjs/cli/lemma-proxy.js +21 -1
- package/dist/cjs/cli/lemma-proxy.js.map +1 -1
- package/dist/cjs/infra/analyzers/index.d.ts +0 -2
- package/dist/cjs/infra/analyzers/index.d.ts.map +1 -1
- package/dist/cjs/infra/analyzers/index.js +1 -6
- package/dist/cjs/infra/analyzers/index.js.map +1 -1
- package/dist/cjs/infra/cli.d.ts +4 -0
- package/dist/cjs/infra/cli.d.ts.map +1 -1
- package/dist/cjs/infra/cli.js +6 -199
- package/dist/cjs/infra/cli.js.map +1 -1
- package/dist/cjs/infra/index.d.ts +1 -3
- package/dist/cjs/infra/index.d.ts.map +1 -1
- package/dist/cjs/infra/index.js +1 -16
- package/dist/cjs/infra/index.js.map +1 -1
- package/dist/cjs/infra/mcp-tools.d.ts.map +1 -1
- package/dist/cjs/infra/mcp-tools.js +8 -453
- package/dist/cjs/infra/mcp-tools.js.map +1 -1
- package/dist/cjs/infra/types.d.ts +0 -101
- package/dist/cjs/infra/types.d.ts.map +1 -1
- package/dist/cjs/infra/types.js +2 -1
- package/dist/cjs/infra/types.js.map +1 -1
- package/dist/cjs/mcp/prompts.d.ts +1 -1
- package/dist/cjs/mcp/prompts.d.ts.map +1 -1
- package/dist/cjs/mcp/prompts.js +8 -23
- package/dist/cjs/mcp/prompts.js.map +1 -1
- package/dist/cjs/mcp/tool-profiles.d.ts +8 -3
- package/dist/cjs/mcp/tool-profiles.d.ts.map +1 -1
- package/dist/cjs/mcp/tool-profiles.js +25 -54
- package/dist/cjs/mcp/tool-profiles.js.map +1 -1
- package/dist/cjs/mcp/tools/memory.d.ts +8 -0
- package/dist/cjs/mcp/tools/memory.d.ts.map +1 -1
- package/dist/cjs/mcp/tools/memory.js +154 -125
- package/dist/cjs/mcp/tools/memory.js.map +1 -1
- package/dist/cjs/mcp/tools.d.ts.map +1 -1
- package/dist/cjs/mcp/tools.js +11 -6
- package/dist/cjs/mcp/tools.js.map +1 -1
- package/dist/cjs/mcp/workspaceShared.d.ts.map +1 -1
- package/dist/cjs/mcp/workspaceShared.js +8 -4
- package/dist/cjs/mcp/workspaceShared.js.map +1 -1
- package/dist/cjs/proxy/ProjectRegistry.d.ts +20 -0
- package/dist/cjs/proxy/ProjectRegistry.d.ts.map +1 -1
- package/dist/cjs/proxy/ProjectRegistry.js +46 -4
- package/dist/cjs/proxy/ProjectRegistry.js.map +1 -1
- package/dist/cjs/subconscious/HostRecall.d.ts +26 -2
- package/dist/cjs/subconscious/HostRecall.d.ts.map +1 -1
- package/dist/cjs/subconscious/HostRecall.js +101 -36
- package/dist/cjs/subconscious/HostRecall.js.map +1 -1
- package/dist/cjs/subconscious/NarrowEvidence.d.ts +47 -0
- package/dist/cjs/subconscious/NarrowEvidence.d.ts.map +1 -0
- package/dist/cjs/subconscious/NarrowEvidence.js +252 -0
- package/dist/cjs/subconscious/NarrowEvidence.js.map +1 -0
- package/dist/cjs/subconscious/TheBrainV2.d.ts +37 -0
- package/dist/cjs/subconscious/TheBrainV2.d.ts.map +1 -1
- package/dist/cjs/subconscious/TheBrainV2.js +147 -15
- package/dist/cjs/subconscious/TheBrainV2.js.map +1 -1
- package/dist/cjs/subconscious/freshness/LocalFsResolver.d.ts.map +1 -1
- package/dist/cjs/subconscious/freshness/LocalFsResolver.js +17 -0
- package/dist/cjs/subconscious/freshness/LocalFsResolver.js.map +1 -1
- package/dist/cjs/subconscious/recallDigest.d.ts +8 -0
- package/dist/cjs/subconscious/recallDigest.d.ts.map +1 -1
- package/dist/cjs/subconscious/recallDigest.js +13 -1
- package/dist/cjs/subconscious/recallDigest.js.map +1 -1
- package/dist/cjs/utils/OtherLanguageSymbols.d.ts +31 -0
- package/dist/cjs/utils/OtherLanguageSymbols.d.ts.map +1 -0
- package/dist/cjs/utils/OtherLanguageSymbols.js +283 -0
- package/dist/cjs/utils/OtherLanguageSymbols.js.map +1 -0
- package/dist/cjs/utils/SavingsLedger.d.ts +27 -0
- package/dist/cjs/utils/SavingsLedger.d.ts.map +1 -1
- package/dist/cjs/utils/SavingsLedger.js +51 -0
- package/dist/cjs/utils/SavingsLedger.js.map +1 -1
- package/dist/cjs/utils/StoreDraft.d.ts +12 -0
- package/dist/cjs/utils/StoreDraft.d.ts.map +1 -1
- package/dist/cjs/utils/StoreDraft.js +53 -1
- package/dist/cjs/utils/StoreDraft.js.map +1 -1
- package/dist/cjs/utils/SymbolSurgicalContext.d.ts +2 -0
- package/dist/cjs/utils/SymbolSurgicalContext.d.ts.map +1 -1
- package/dist/cjs/utils/SymbolSurgicalContext.js +1 -0
- package/dist/cjs/utils/SymbolSurgicalContext.js.map +1 -1
- package/dist/cjs/utils/reportSavings.d.ts +17 -4
- package/dist/cjs/utils/reportSavings.d.ts.map +1 -1
- package/dist/cjs/utils/reportSavings.js +67 -22
- package/dist/cjs/utils/reportSavings.js.map +1 -1
- package/dist/esm/cli/gitHooks.d.ts +9 -2
- package/dist/esm/cli/gitHooks.d.ts.map +1 -1
- package/dist/esm/cli/gitHooks.js +31 -4
- package/dist/esm/cli/gitHooks.js.map +1 -1
- package/dist/esm/cli/lemma-proxy.d.ts.map +1 -1
- package/dist/esm/cli/lemma-proxy.js +21 -1
- package/dist/esm/cli/lemma-proxy.js.map +1 -1
- package/dist/esm/infra/analyzers/index.d.ts +0 -2
- package/dist/esm/infra/analyzers/index.d.ts.map +1 -1
- package/dist/esm/infra/analyzers/index.js +0 -2
- package/dist/esm/infra/analyzers/index.js.map +1 -1
- package/dist/esm/infra/cli.d.ts +4 -0
- package/dist/esm/infra/cli.d.ts.map +1 -1
- package/dist/esm/infra/cli.js +6 -199
- package/dist/esm/infra/cli.js.map +1 -1
- package/dist/esm/infra/index.d.ts +1 -3
- package/dist/esm/infra/index.d.ts.map +1 -1
- package/dist/esm/infra/index.js +1 -3
- package/dist/esm/infra/index.js.map +1 -1
- package/dist/esm/infra/mcp-tools.d.ts.map +1 -1
- package/dist/esm/infra/mcp-tools.js +9 -454
- package/dist/esm/infra/mcp-tools.js.map +1 -1
- package/dist/esm/infra/types.d.ts +0 -101
- package/dist/esm/infra/types.d.ts.map +1 -1
- package/dist/esm/infra/types.js +2 -1
- package/dist/esm/infra/types.js.map +1 -1
- package/dist/esm/mcp/prompts.d.ts +1 -1
- package/dist/esm/mcp/prompts.d.ts.map +1 -1
- package/dist/esm/mcp/prompts.js +8 -23
- package/dist/esm/mcp/prompts.js.map +1 -1
- package/dist/esm/mcp/tool-profiles.d.ts +8 -3
- package/dist/esm/mcp/tool-profiles.d.ts.map +1 -1
- package/dist/esm/mcp/tool-profiles.js +25 -54
- package/dist/esm/mcp/tool-profiles.js.map +1 -1
- package/dist/esm/mcp/tools/memory.d.ts +8 -0
- package/dist/esm/mcp/tools/memory.d.ts.map +1 -1
- package/dist/esm/mcp/tools/memory.js +156 -128
- package/dist/esm/mcp/tools/memory.js.map +1 -1
- package/dist/esm/mcp/tools.d.ts.map +1 -1
- package/dist/esm/mcp/tools.js +12 -7
- package/dist/esm/mcp/tools.js.map +1 -1
- package/dist/esm/mcp/workspaceShared.d.ts.map +1 -1
- package/dist/esm/mcp/workspaceShared.js +9 -5
- package/dist/esm/mcp/workspaceShared.js.map +1 -1
- package/dist/esm/proxy/ProjectRegistry.d.ts +20 -0
- package/dist/esm/proxy/ProjectRegistry.d.ts.map +1 -1
- package/dist/esm/proxy/ProjectRegistry.js +45 -3
- package/dist/esm/proxy/ProjectRegistry.js.map +1 -1
- package/dist/esm/subconscious/HostRecall.d.ts +26 -2
- package/dist/esm/subconscious/HostRecall.d.ts.map +1 -1
- package/dist/esm/subconscious/HostRecall.js +99 -37
- package/dist/esm/subconscious/HostRecall.js.map +1 -1
- package/dist/esm/subconscious/NarrowEvidence.d.ts +47 -0
- package/dist/esm/subconscious/NarrowEvidence.d.ts.map +1 -0
- package/dist/esm/subconscious/NarrowEvidence.js +211 -0
- package/dist/esm/subconscious/NarrowEvidence.js.map +1 -0
- package/dist/esm/subconscious/TheBrainV2.d.ts +37 -0
- package/dist/esm/subconscious/TheBrainV2.d.ts.map +1 -1
- package/dist/esm/subconscious/TheBrainV2.js +146 -14
- package/dist/esm/subconscious/TheBrainV2.js.map +1 -1
- package/dist/esm/subconscious/freshness/LocalFsResolver.d.ts.map +1 -1
- package/dist/esm/subconscious/freshness/LocalFsResolver.js +17 -0
- package/dist/esm/subconscious/freshness/LocalFsResolver.js.map +1 -1
- package/dist/esm/subconscious/recallDigest.d.ts +8 -0
- package/dist/esm/subconscious/recallDigest.d.ts.map +1 -1
- package/dist/esm/subconscious/recallDigest.js +12 -1
- package/dist/esm/subconscious/recallDigest.js.map +1 -1
- package/dist/esm/utils/OtherLanguageSymbols.d.ts +31 -0
- package/dist/esm/utils/OtherLanguageSymbols.d.ts.map +1 -0
- package/dist/esm/utils/OtherLanguageSymbols.js +275 -0
- package/dist/esm/utils/OtherLanguageSymbols.js.map +1 -0
- package/dist/esm/utils/SavingsLedger.d.ts +27 -0
- package/dist/esm/utils/SavingsLedger.d.ts.map +1 -1
- package/dist/esm/utils/SavingsLedger.js +51 -0
- package/dist/esm/utils/SavingsLedger.js.map +1 -1
- package/dist/esm/utils/StoreDraft.d.ts +12 -0
- package/dist/esm/utils/StoreDraft.d.ts.map +1 -1
- package/dist/esm/utils/StoreDraft.js +52 -1
- package/dist/esm/utils/StoreDraft.js.map +1 -1
- package/dist/esm/utils/SymbolSurgicalContext.d.ts +2 -0
- package/dist/esm/utils/SymbolSurgicalContext.d.ts.map +1 -1
- package/dist/esm/utils/SymbolSurgicalContext.js +1 -1
- package/dist/esm/utils/SymbolSurgicalContext.js.map +1 -1
- package/dist/esm/utils/reportSavings.d.ts +17 -4
- package/dist/esm/utils/reportSavings.d.ts.map +1 -1
- package/dist/esm/utils/reportSavings.js +65 -22
- package/dist/esm/utils/reportSavings.js.map +1 -1
- package/package.json +2 -1
- package/dashboard/dist/assets/index-CLXWgzTm.css +0 -1
- package/dashboard/dist/assets/index-CoMIMxyC.js +0 -451
- package/dist/cjs/infra/analyzers/DriftDetector.d.ts +0 -4
- package/dist/cjs/infra/analyzers/DriftDetector.d.ts.map +0 -1
- package/dist/cjs/infra/analyzers/DriftDetector.js +0 -88
- package/dist/cjs/infra/analyzers/DriftDetector.js.map +0 -1
- package/dist/cjs/infra/analyzers/InfraAnalyzer.d.ts +0 -3
- package/dist/cjs/infra/analyzers/InfraAnalyzer.d.ts.map +0 -1
- package/dist/cjs/infra/analyzers/InfraAnalyzer.js +0 -73
- package/dist/cjs/infra/analyzers/InfraAnalyzer.js.map +0 -1
- package/dist/cjs/infra/config.d.ts +0 -17
- package/dist/cjs/infra/config.d.ts.map +0 -1
- package/dist/cjs/infra/config.js +0 -111
- package/dist/cjs/infra/config.js.map +0 -1
- package/dist/cjs/infra/errorCause.d.ts +0 -36
- package/dist/cjs/infra/errorCause.d.ts.map +0 -1
- package/dist/cjs/infra/errorCause.js +0 -143
- package/dist/cjs/infra/errorCause.js.map +0 -1
- package/dist/cjs/infra/providers/InfraProvider.d.ts +0 -9
- package/dist/cjs/infra/providers/InfraProvider.d.ts.map +0 -1
- package/dist/cjs/infra/providers/InfraProvider.js +0 -3
- package/dist/cjs/infra/providers/InfraProvider.js.map +0 -1
- package/dist/cjs/infra/providers/JenkinsProvider.d.ts +0 -16
- package/dist/cjs/infra/providers/JenkinsProvider.d.ts.map +0 -1
- package/dist/cjs/infra/providers/JenkinsProvider.js +0 -193
- package/dist/cjs/infra/providers/JenkinsProvider.js.map +0 -1
- package/dist/cjs/infra/providers/OKDProvider.d.ts +0 -24
- package/dist/cjs/infra/providers/OKDProvider.d.ts.map +0 -1
- package/dist/cjs/infra/providers/OKDProvider.js +0 -296
- package/dist/cjs/infra/providers/OKDProvider.js.map +0 -1
- package/dist/cjs/infra/providers/TerraformProvider.d.ts +0 -17
- package/dist/cjs/infra/providers/TerraformProvider.d.ts.map +0 -1
- package/dist/cjs/infra/providers/TerraformProvider.js +0 -111
- package/dist/cjs/infra/providers/TerraformProvider.js.map +0 -1
- package/dist/cjs/infra/providers/index.d.ts +0 -9
- package/dist/cjs/infra/providers/index.d.ts.map +0 -1
- package/dist/cjs/infra/providers/index.js +0 -34
- package/dist/cjs/infra/providers/index.js.map +0 -1
- package/dist/cjs/infra/templates/jenkins/index.d.ts +0 -15
- package/dist/cjs/infra/templates/jenkins/index.d.ts.map +0 -1
- package/dist/cjs/infra/templates/jenkins/index.js +0 -128
- package/dist/cjs/infra/templates/jenkins/index.js.map +0 -1
- package/dist/cjs/infra/templates/okd/index.d.ts +0 -31
- package/dist/cjs/infra/templates/okd/index.d.ts.map +0 -1
- package/dist/cjs/infra/templates/okd/index.js +0 -149
- package/dist/cjs/infra/templates/okd/index.js.map +0 -1
- package/dist/esm/infra/analyzers/DriftDetector.d.ts +0 -4
- package/dist/esm/infra/analyzers/DriftDetector.d.ts.map +0 -1
- package/dist/esm/infra/analyzers/DriftDetector.js +0 -84
- package/dist/esm/infra/analyzers/DriftDetector.js.map +0 -1
- package/dist/esm/infra/analyzers/InfraAnalyzer.d.ts +0 -3
- package/dist/esm/infra/analyzers/InfraAnalyzer.d.ts.map +0 -1
- package/dist/esm/infra/analyzers/InfraAnalyzer.js +0 -70
- package/dist/esm/infra/analyzers/InfraAnalyzer.js.map +0 -1
- package/dist/esm/infra/config.d.ts +0 -17
- package/dist/esm/infra/config.d.ts.map +0 -1
- package/dist/esm/infra/config.js +0 -101
- package/dist/esm/infra/config.js.map +0 -1
- package/dist/esm/infra/errorCause.d.ts +0 -36
- package/dist/esm/infra/errorCause.d.ts.map +0 -1
- package/dist/esm/infra/errorCause.js +0 -138
- package/dist/esm/infra/errorCause.js.map +0 -1
- package/dist/esm/infra/providers/InfraProvider.d.ts +0 -9
- package/dist/esm/infra/providers/InfraProvider.d.ts.map +0 -1
- package/dist/esm/infra/providers/InfraProvider.js +0 -2
- package/dist/esm/infra/providers/InfraProvider.js.map +0 -1
- package/dist/esm/infra/providers/JenkinsProvider.d.ts +0 -16
- package/dist/esm/infra/providers/JenkinsProvider.d.ts.map +0 -1
- package/dist/esm/infra/providers/JenkinsProvider.js +0 -186
- package/dist/esm/infra/providers/JenkinsProvider.js.map +0 -1
- package/dist/esm/infra/providers/OKDProvider.d.ts +0 -24
- package/dist/esm/infra/providers/OKDProvider.d.ts.map +0 -1
- package/dist/esm/infra/providers/OKDProvider.js +0 -292
- package/dist/esm/infra/providers/OKDProvider.js.map +0 -1
- package/dist/esm/infra/providers/TerraformProvider.d.ts +0 -17
- package/dist/esm/infra/providers/TerraformProvider.d.ts.map +0 -1
- package/dist/esm/infra/providers/TerraformProvider.js +0 -107
- package/dist/esm/infra/providers/TerraformProvider.js.map +0 -1
- package/dist/esm/infra/providers/index.d.ts +0 -9
- package/dist/esm/infra/providers/index.d.ts.map +0 -1
- package/dist/esm/infra/providers/index.js +0 -27
- package/dist/esm/infra/providers/index.js.map +0 -1
- package/dist/esm/infra/templates/jenkins/index.d.ts +0 -15
- package/dist/esm/infra/templates/jenkins/index.d.ts.map +0 -1
- package/dist/esm/infra/templates/jenkins/index.js +0 -124
- package/dist/esm/infra/templates/jenkins/index.js.map +0 -1
- package/dist/esm/infra/templates/okd/index.d.ts +0 -31
- package/dist/esm/infra/templates/okd/index.d.ts.map +0 -1
- package/dist/esm/infra/templates/okd/index.js +0 -142
- package/dist/esm/infra/templates/okd/index.js.map +0 -1
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import fs from "fs";
|
|
8
8
|
import path from "path";
|
|
9
|
-
import { getBrain, deriveProjectId, currentGitContext } from "../../subconscious/TheBrainV2.js";
|
|
10
|
-
import { reportSavings } from "../../utils/reportSavings.js";
|
|
9
|
+
import { getBrain, deriveProjectId, currentGitContext, tokenize } from "../../subconscious/TheBrainV2.js";
|
|
10
|
+
import { reportSavings, reportRecall } from "../../utils/reportSavings.js";
|
|
11
11
|
import { netTokensSaved } from "./squeeze-cache.js";
|
|
12
12
|
import { recordReceiptEvent } from "../../utils/TokenReceipt.js";
|
|
13
|
-
import { logError, safeResolvePath,
|
|
13
|
+
import { logError, safeResolvePath, tryElicitConfirmation } from "../utils.js";
|
|
14
14
|
import { deriveDomainForFile } from "../cognitiveMap.js";
|
|
15
15
|
import { getRecentEvidence } from "../../utils/SessionEvidence.js";
|
|
16
|
-
import {
|
|
16
|
+
import { narrowEvidence } from "../../subconscious/NarrowEvidence.js";
|
|
17
17
|
import { ageLabel } from "../../utils/ageLabel.js";
|
|
18
18
|
import { sanitizeRefs, describeRef, checkExternalRefs } from "../../subconscious/ExternalRefs.js";
|
|
19
19
|
import { pushTeamBrain, pullTeamBrain, teamBrainStatus } from "../../subconscious/TeamBrain.js";
|
|
@@ -41,7 +41,7 @@ export const MEMORY_TOOL_DEFINITIONS = [
|
|
|
41
41
|
{
|
|
42
42
|
name: "search_memory",
|
|
43
43
|
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
44
|
-
description: "Search
|
|
44
|
+
description: "Search the Brain before investigating something from scratch: past fixes, traps, failed approaches and decisions from earlier sessions. Returns a ranked shortlist (headline, excerpt, fresh/STALE) — pick the one that answers your question and get_memory it for the body. Never treat a STALE result as current.",
|
|
45
45
|
inputSchema: {
|
|
46
46
|
type: "object",
|
|
47
47
|
properties: {
|
|
@@ -49,8 +49,8 @@ export const MEMORY_TOOL_DEFINITIONS = [
|
|
|
49
49
|
limit: { type: "number", description: "Maximum results to return", default: 5 },
|
|
50
50
|
minSimilarity: {
|
|
51
51
|
type: "number",
|
|
52
|
-
description: "
|
|
53
|
-
default: 0
|
|
52
|
+
description: "Optional floor (0-1) on the ranking score. Off by default: the score ranks well but does not separate relevant from unrelated.",
|
|
53
|
+
default: 0,
|
|
54
54
|
},
|
|
55
55
|
domain: {
|
|
56
56
|
type: "string",
|
|
@@ -58,7 +58,12 @@ export const MEMORY_TOOL_DEFINITIONS = [
|
|
|
58
58
|
},
|
|
59
59
|
semanticDiff: {
|
|
60
60
|
type: "boolean",
|
|
61
|
-
description: "Don't count a comment/whitespace-only change as stale.",
|
|
61
|
+
description: "Don't count a comment/whitespace-only change as stale (default). Pass false to treat any edit to the tracked code as a change.",
|
|
62
|
+
default: true,
|
|
63
|
+
},
|
|
64
|
+
allProjects: {
|
|
65
|
+
type: "boolean",
|
|
66
|
+
description: "Also search memories from your other projects (labelled as such). Off by default: they may be confidential and rarely apply here.",
|
|
62
67
|
default: false,
|
|
63
68
|
},
|
|
64
69
|
},
|
|
@@ -85,7 +90,7 @@ export const MEMORY_TOOL_DEFINITIONS = [
|
|
|
85
90
|
{
|
|
86
91
|
name: "store_memory",
|
|
87
92
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
88
|
-
description: "Save a verified
|
|
93
|
+
description: "Save a verified fix, decision or fact so it needn't be re-investigated: what code and git can't tell the next session (root cause, trap, failed approach, how-to), not a log of what shipped. Pass filePaths (or `symbols`) so it goes stale when that code changes; omitted, Lemma guesses from files this session touched. outcome='failed' records a dead end. To correct a memory use update_memory — a re-store here leaves both versions.",
|
|
89
94
|
inputSchema: {
|
|
90
95
|
type: "object",
|
|
91
96
|
properties: {
|
|
@@ -206,8 +211,8 @@ export const MEMORY_TOOL_DEFINITIONS = [
|
|
|
206
211
|
ids: { type: "array", items: { type: "string" }, description: "Entry and/or claim ids to revalidate, from a prior search_memory/store_memory result." },
|
|
207
212
|
semanticDiff: {
|
|
208
213
|
type: "boolean",
|
|
209
|
-
description: "Don't count a comment/whitespace-only change as stale.",
|
|
210
|
-
default:
|
|
214
|
+
description: "Don't count a comment/whitespace-only change as stale (default). Pass false to treat any edit to the tracked code as a change.",
|
|
215
|
+
default: true,
|
|
211
216
|
},
|
|
212
217
|
},
|
|
213
218
|
required: ["ids"],
|
|
@@ -363,142 +368,113 @@ export const MEMORY_TOOL_DEFINITIONS = [
|
|
|
363
368
|
},
|
|
364
369
|
},
|
|
365
370
|
];
|
|
371
|
+
/**
|
|
372
|
+
* Ids the last search_memory calls put on a shortlist. A get_memory of one of them is the
|
|
373
|
+
* moment a memory was actually reused, so that is where its hit and its saving are booked —
|
|
374
|
+
* listing a headline saves nothing by itself.
|
|
375
|
+
*/
|
|
376
|
+
const _shortlisted = new Set();
|
|
377
|
+
const SHORTLIST_MEMORY = 200;
|
|
378
|
+
const EXCERPT_CHARS = 180;
|
|
379
|
+
function excerpt(text) {
|
|
380
|
+
const flat = String(typeof text === "string" ? text : JSON.stringify(text)).replace(/\s+/g, " ").trim();
|
|
381
|
+
return flat.length > EXCERPT_CHARS ? `${flat.slice(0, EXCERPT_CHARS - 1)}…` : flat;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* search_memory answers with a ranked shortlist, not a verdict.
|
|
385
|
+
*
|
|
386
|
+
* It used to return a memory only above a 0.75 similarity floor and otherwise said
|
|
387
|
+
* "Investigate from scratch — there is nothing safe to reuse". Measured on Lemma's own Brain
|
|
388
|
+
* (18 questions a later session would really ask), the right memory ranked first 15 times and
|
|
389
|
+
* in the top three every time — and cleared the floor zero times. The score can't carry a
|
|
390
|
+
* floor: BM25 is normalized against the best candidate *of the same search*, so the top result
|
|
391
|
+
* of an unrelated question scores 0.54–0.66, the same band as a correct one (0.56–0.73). The
|
|
392
|
+
* ranking is good; deciding relevance from headlines is something the agent does well. So the
|
|
393
|
+
* Brain shortlists and the agent picks, then reads the one that answers with get_memory.
|
|
394
|
+
*/
|
|
366
395
|
async function handleSearchMemory(args) {
|
|
367
|
-
const query = args?.query;
|
|
368
|
-
const limit = args?.limit || 5;
|
|
369
|
-
//
|
|
370
|
-
|
|
371
|
-
// threshold so both paths agree on what counts as a hit.
|
|
372
|
-
const minSimilarity = typeof args?.minSimilarity === "number" ? args.minSimilarity : DEFAULT_MEMORY_SIMILARITY_FLOOR;
|
|
396
|
+
const query = typeof args?.query === "string" ? args.query : "";
|
|
397
|
+
const limit = Math.min(Math.max(Math.floor(args?.limit || 5), 1), 10);
|
|
398
|
+
// Explicit floors are still honoured; by default nothing is cut, for the reason above.
|
|
399
|
+
const minSimilarity = typeof args?.minSimilarity === "number" ? args.minSimilarity : 0;
|
|
373
400
|
const domain = typeof args?.domain === "string" && args.domain.trim() ? args.domain.trim() : undefined;
|
|
374
|
-
const semanticDiff = args?.semanticDiff
|
|
401
|
+
const semanticDiff = args?.semanticDiff !== false;
|
|
375
402
|
if (!query)
|
|
376
403
|
throw new Error("Query is required");
|
|
377
404
|
try {
|
|
378
405
|
const brain = getBrain();
|
|
379
|
-
//
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
const uncapped = brain.search(query, ORIENTATION_LIMIT, 0, { projectId: deriveProjectId(), domain, countStats: false });
|
|
391
|
-
const nearMiss = bucketNearMiss(uncapped[0] ? { id: uncapped[0].id, query: uncapped[0].query, similarity: uncapped[0].similarity } : undefined, minSimilarity);
|
|
392
|
-
// A miss that says nothing cannot tell "nothing related" from "something related at 60%".
|
|
393
|
-
// These are for orientation only: below the floor, never reusable, never credited.
|
|
394
|
-
const related = uncapped
|
|
395
|
-
.filter((r) => r.similarity >= ORIENTATION_MIN)
|
|
396
|
-
.map((r) => ` - ${r.id} (${(r.similarity * 100).toFixed(0)}%, stored ${ageLabel(r.timestamp)}): ${r.query.substring(0, 100)}`);
|
|
397
|
-
const orientation = related.length > 0
|
|
398
|
-
? `\n\nBelow the reuse floor, for orientation only (not cache hits — get_memory to read, then verify against current state before relying on any):\n${related.join("\n")}`
|
|
399
|
-
: "";
|
|
406
|
+
// countStats:false — appearing on a shortlist is not a reuse; get_memory books that.
|
|
407
|
+
const projectId = deriveProjectId();
|
|
408
|
+
adoptOnce(brain, projectId);
|
|
409
|
+
const results = await brain.searchHybrid(query, limit, minSimilarity, {
|
|
410
|
+
projectId,
|
|
411
|
+
allProjects: args?.allProjects === true,
|
|
412
|
+
domain,
|
|
413
|
+
semanticDiff,
|
|
414
|
+
countStats: false,
|
|
415
|
+
});
|
|
416
|
+
if (results.length === 0 && tokenize(query).length === 0) {
|
|
400
417
|
return {
|
|
401
|
-
content: [{
|
|
402
|
-
type: "text",
|
|
403
|
-
text: `No memory in Lemma's Brain scored at or above the ${(minSimilarity * 100).toFixed(0)}% similarity floor for this query. Investigate from scratch — there is nothing safe to reuse.${nearMiss.hint ? ` ${nearMiss.hint}` : ""}${orientation}`,
|
|
404
|
-
}],
|
|
418
|
+
content: [{ type: "text", text: "This query has no searchable words (only stop words or symbols). Search with the error text, a symbol or file name, or the words of the question." }],
|
|
405
419
|
};
|
|
406
420
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
const formatClaims = (r) => {
|
|
414
|
-
if (!Array.isArray(r.claims) || r.claims.length === 0)
|
|
415
|
-
return "";
|
|
416
|
-
const lines = r.claims.map((c) => c.fresh
|
|
417
|
-
? ` ✓ fresh: ${c.text}`
|
|
418
|
-
: ` ✗ STALE (${(c.staleFiles || []).join(", ")}): ${c.text}`);
|
|
419
|
-
const staleCount = r.claims.filter((c) => !c.fresh).length;
|
|
420
|
-
return `\nClaims (${r.claims.length - staleCount}/${r.claims.length} still fresh — trust only the ✓ ones):\n${lines.join("\n")}`;
|
|
421
|
-
};
|
|
422
|
-
const formatResult = (r, i) => `Result ${i + 1} (id: ${r.id}, Similarity: ${(r.similarity * 100).toFixed(1)}%, stored ${ageLabel(r.timestamp)})${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." : ""}${typeof r.tokensSaved === "number" && r.tokensSaved > 0
|
|
423
|
-
? `\n💰 This memory has saved ${r.tokensSaved} tokens across ${r.hits || "?"} reuse(s) — prefer it over re-deriving.`
|
|
424
|
-
: ""}\nPrompt: ${r.query.substring(0, 300)}...\nResponse: ${typeof r.response === "string" ? r.response : JSON.stringify(r.response, null, 2)}${formatClaims(r)}${Array.isArray(r.evidence) && r.evidence.length > 0
|
|
425
|
-
? `\nEvidence: ${r.evidence.map((e) => {
|
|
426
|
-
const sep = e.lastIndexOf("::");
|
|
427
|
-
return sep > 0 ? `${relLabel(e.substring(0, sep))}::${e.substring(sep + 2)}` : relLabel(e);
|
|
428
|
-
}).join(", ")}`
|
|
429
|
-
: ""}${Array.isArray(r.whyShown) && r.whyShown.length > 0
|
|
430
|
-
? `\nWhy shown: ${r.whyShown.join(" · ")}`
|
|
431
|
-
: ""}${Array.isArray(r.cosmeticChanges) && r.cosmeticChanges.length > 0
|
|
432
|
-
? `\n(comment/whitespace-only change, ignored under semanticDiff: ${r.cosmeticChanges.join(", ")})`
|
|
433
|
-
: ""}`;
|
|
434
|
-
if (fresh.length > 0) {
|
|
435
|
-
// Only a fresh hit (or an untracked, purely conceptual entry) counts as a real
|
|
436
|
-
// avoided re-investigation — this is the only case worth crediting as savings.
|
|
437
|
-
const bestFresh = fresh[0];
|
|
438
|
-
const { net: tokensSaved } = netTokensSaved(Math.max(400, String(bestFresh.response).length), query);
|
|
439
|
-
reportSavings({ source: "cache", tokens: tokensSaved, toolName: "search_memory", query: query.substring(0, 100) });
|
|
440
|
-
// Attribute the saving to the memory itself: the per-entry ROI ledger lives on the
|
|
441
|
-
// entry (persisted, merged, imported), booked on the same event as the ledger above
|
|
442
|
-
// so the two can never disagree about whether a reuse happened.
|
|
443
|
-
brain.creditSavings(bestFresh.id, tokensSaved);
|
|
444
|
-
recordReceiptEvent("semantic_cache_hit", query.substring(0, 100), {
|
|
445
|
-
tool: "search_memory",
|
|
446
|
-
similarity: bestFresh.similarity,
|
|
447
|
-
tokensSaved,
|
|
448
|
-
memoryId: bestFresh.id,
|
|
449
|
-
});
|
|
450
|
-
}
|
|
451
|
-
else if (untracked.length > 0) {
|
|
452
|
-
recordReceiptEvent("reasoning", query.substring(0, 100), {
|
|
453
|
-
tool: "search_memory",
|
|
454
|
-
reason: `${untracked.length} similar but UNTRACKED — no evidence to verify, not credited as a cache hit`,
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
else {
|
|
458
|
-
recordReceiptEvent("reasoning", query.substring(0, 100), {
|
|
459
|
-
tool: "search_memory",
|
|
460
|
-
reason: `${stale.length} similar memory/memories found but all stale — must re-verify`,
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
const parts = [];
|
|
464
|
-
if (fresh.length > 0) {
|
|
465
|
-
parts.push(`Lemma found ${fresh.length} fresh ${fresh.length === 1 ? "memory" : "memories"} (from cache — say so if you use this):\n\n${fresh.map(formatResult).join("\n\n---\n\n")}`);
|
|
466
|
-
}
|
|
467
|
-
if (untracked.length > 0) {
|
|
468
|
-
const untrackedText = untracked
|
|
469
|
-
.map((r, i) => formatResult(r, i))
|
|
470
|
-
.join("\n\n---\n\n");
|
|
471
|
-
parts.push(`⚠️ ${untracked.length} ${untracked.length === 1 ? "memory is" : "memories are"} similar but UNTRACKED — ${untracked.length === 1 ? "it tracks" : "they track"} no files or symbols, so nothing was verified against current code (${untracked.length === 1 ? "it is" : "they are"} vacuously "fresh": there was nothing to check). ${untracked.length === 1 ? "It may" : "They may"} describe state that no longer exists — treat as a hint, re-verify against the repo before acting on it, and use update_memory/refresh_memory with filePaths/symbols so it becomes verifiable next time:\n\n${untrackedText}`);
|
|
421
|
+
if (results.length === 0) {
|
|
422
|
+
const why = minSimilarity > 0
|
|
423
|
+
? `scored at or above the ${minSimilarity} floor you set`
|
|
424
|
+
: "shares a term with this query — nothing was learned about it in an earlier session";
|
|
425
|
+
recordReceiptEvent("reasoning", query.substring(0, 100), { tool: "search_memory", reason: `no memory ${why}` });
|
|
426
|
+
return { content: [{ type: "text", text: `No memory in Lemma's Brain ${why}. Investigate from scratch.` }] };
|
|
472
427
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
428
|
+
for (const r of results)
|
|
429
|
+
_shortlisted.add(r.id);
|
|
430
|
+
while (_shortlisted.size > SHORTLIST_MEMORY)
|
|
431
|
+
_shortlisted.delete(_shortlisted.values().next().value);
|
|
432
|
+
void reportRecall({ projectPath: process.cwd(), trigger: "search", memoryIds: results.map((r) => r.id) });
|
|
433
|
+
recordReceiptEvent("reasoning", query.substring(0, 100), { tool: "search_memory", reason: `shortlisted ${results.length} memories` });
|
|
434
|
+
const line = (r, i) => {
|
|
435
|
+
const verdict = !r.fresh
|
|
436
|
+
? r.staleCause === "branch-changed"
|
|
437
|
+
? `STALE — stored on branch ${r.storedOnBranch}, you are on ${currentGitContext().branch || "another branch"}`
|
|
438
|
+
: `STALE — changed since: ${(r.staleFiles || []).map(relLabel).join(", ")}`
|
|
439
|
+
: r.untracked
|
|
440
|
+
? "untracked — tracks no files, nothing to check it against"
|
|
441
|
+
: "fresh";
|
|
442
|
+
const failed = r.outcome === "failed" ? " ⚠️ FAILED APPROACH — tried before and did not work" : "";
|
|
443
|
+
const origin = r.scope === "other-project"
|
|
444
|
+
? ` ⚠️ FROM ANOTHER PROJECT (${r.ownerProject}) — do not assume it applies here`
|
|
445
|
+
: r.scope === "unscoped"
|
|
446
|
+
? " [stored before memories were scoped to a project — may not be from this one]"
|
|
481
447
|
: "";
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
return { content: [{ type: "text", text
|
|
448
|
+
return `${i + 1}. ${r.id} (${ageLabel(r.timestamp)}, ${verdict})${failed}${origin}\n ${r.query.replace(/\s+/g, " ").slice(0, 160)}\n ${excerpt(r.response)}`;
|
|
449
|
+
};
|
|
450
|
+
const text = `Closest memories in Lemma's Brain, best match first. Ranking is lexical: the right memory is usually here, but so are unrelated ones that share words — judge each by its headline.\n\n` +
|
|
451
|
+
`${results.map(line).join("\n\n")}\n\n` +
|
|
452
|
+
`If one answers your question, get_memory <id> for the full body before relying on it (a STALE one must be re-checked against the current code; a FAILED one is a warning, not a suggestion). If none does, investigate from scratch. A memory that turns out wrong: downvote_memory or forget_memory it.`;
|
|
453
|
+
return { content: [{ type: "text", text }] };
|
|
488
454
|
}
|
|
489
455
|
catch (e) {
|
|
490
456
|
logError("search_memory", e);
|
|
491
457
|
return { content: [{ type: "text", text: `Local Search failed: ${e.message}` }] };
|
|
492
458
|
}
|
|
493
459
|
}
|
|
460
|
+
/** Memories from before projects existed are adopted once per process, from the repo root. */
|
|
461
|
+
let _adopted = false;
|
|
462
|
+
function adoptOnce(brain, projectId) {
|
|
463
|
+
if (_adopted)
|
|
464
|
+
return;
|
|
465
|
+
_adopted = true;
|
|
466
|
+
try {
|
|
467
|
+
brain.adoptUnscopedByEvidence(projectId, process.cwd());
|
|
468
|
+
}
|
|
469
|
+
catch (e) {
|
|
470
|
+
logError("adoptUnscopedByEvidence", e);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
494
473
|
/** Relative-to-cwd label for a tracked absolute path, matching how the Brain reports them. */
|
|
495
474
|
function relLabel(abs) {
|
|
496
475
|
const rel = path.relative(process.cwd(), abs);
|
|
497
476
|
return rel.startsWith("..") ? abs : rel;
|
|
498
477
|
}
|
|
499
|
-
/** How many below-floor candidates a miss lists, and the weakest one still worth naming. */
|
|
500
|
-
const ORIENTATION_LIMIT = 3;
|
|
501
|
-
const ORIENTATION_MIN = 0.3;
|
|
502
478
|
/** External refs (commit / MR / issue) an entry carries, as one readable line; "" if none. */
|
|
503
479
|
function refsLine(entry) {
|
|
504
480
|
const refs = Array.isArray(entry.refs) ? entry.refs : [];
|
|
@@ -548,6 +524,18 @@ async function handleGetMemory(args) {
|
|
|
548
524
|
return { content: [{ type: "text", text: `No memory with id "${id}" in the Brain. It may have been deleted with forget_memory, or evicted at capacity — search_memory can find it by content if it is still there under another id.` }] };
|
|
549
525
|
}
|
|
550
526
|
const [status] = brain.verifyByIds([id]);
|
|
527
|
+
// Opened from a search_memory shortlist: this is the reuse. Booked once per shortlisting,
|
|
528
|
+
// and only for a memory that was checked against code and still holds — the same rule the
|
|
529
|
+
// old above-the-floor hit followed.
|
|
530
|
+
if (_shortlisted.delete(id) && includeResponse) {
|
|
531
|
+
brain.recordReuse(id);
|
|
532
|
+
if (status?.status === "fresh") {
|
|
533
|
+
const { net: tokensSaved } = netTokensSaved(Math.max(400, entry.response.length), entry.query);
|
|
534
|
+
reportSavings({ source: "cache", tokens: tokensSaved, toolName: "search_memory", query: entry.query.substring(0, 100) });
|
|
535
|
+
brain.creditSavings(id, tokensSaved);
|
|
536
|
+
recordReceiptEvent("semantic_cache_hit", entry.query.substring(0, 100), { tool: "get_memory", tokensSaved, memoryId: id });
|
|
537
|
+
}
|
|
538
|
+
}
|
|
551
539
|
const facts = [
|
|
552
540
|
`stored ${entry.timestamp}`,
|
|
553
541
|
...(entry.refreshedAt ? [`re-anchored ${entry.refreshedAt}`] : []),
|
|
@@ -620,7 +608,19 @@ async function handleUpdateMemory(args) {
|
|
|
620
608
|
const ok = getBrain().setRefs(id, refs);
|
|
621
609
|
return { content: [{ type: "text", text: ok ? `External refs on "${id}" ${refs.length > 0 ? `set to: ${refs.map(describeRef).join(", ")}` : "cleared"}. Nothing else was changed.` : `No entry with id "${id}" in the Brain.` }] };
|
|
622
610
|
}
|
|
623
|
-
|
|
611
|
+
// New files without symbols: track the symbols the memory names in them instead (see
|
|
612
|
+
// NarrowEvidence) — the text it is judged by is the new one when given, else the stored one.
|
|
613
|
+
let trackFiles = filePaths;
|
|
614
|
+
let trackSymbols = symbols;
|
|
615
|
+
if (filePaths && filePaths.length > 0 && !symbols) {
|
|
616
|
+
const current = getBrain().getEntry(id);
|
|
617
|
+
const narrowed = narrowEvidence(filePaths, `${query ?? current?.query ?? ""}\n${response ?? current?.response ?? ""}`);
|
|
618
|
+
if (narrowed.symbols.length > 0) {
|
|
619
|
+
trackFiles = narrowed.filePaths;
|
|
620
|
+
trackSymbols = narrowed.symbols;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
const result = getBrain().update(id, { query, response, filePaths: trackFiles, symbols: trackSymbols, claims, outcome, domain, derivedFrom, supersededBy, refs });
|
|
624
624
|
if (!result.ok)
|
|
625
625
|
return { content: [{ type: "text", text: result.message }] };
|
|
626
626
|
recordReceiptEvent("tool_call", `update_memory: ${id}`, {
|
|
@@ -646,6 +646,20 @@ async function handleUpdateMemory(args) {
|
|
|
646
646
|
return { content: [{ type: "text", text: `Failed to update memory: ${e.message}` }], isError: true };
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
+
/**
|
|
650
|
+
* A memory that reads as a log of what was done — "release v1.31.0: what shipped", "commit abc123:
|
|
651
|
+
* …", "hito v1.26.0". On Lemma's own repo these were most of the memories written on purpose and
|
|
652
|
+
* none was ever recalled: the next session asks why something breaks or how to do it, never what
|
|
653
|
+
* shipped on a date, and git log / the CHANGELOG answer that anyway. A how/why question is
|
|
654
|
+
* knowledge even when it mentions a release ("how to publish a release"), so it is let through.
|
|
655
|
+
*/
|
|
656
|
+
export function looksLikeLogbook(query) {
|
|
657
|
+
const q = query.toLowerCase();
|
|
658
|
+
if (/^(how|why|cómo|como|por qué|porque)\s/.test(q))
|
|
659
|
+
return false;
|
|
660
|
+
return (/^commit [0-9a-f]{7,}/.test(q) ||
|
|
661
|
+
/(?<![a-z])(what shipped|shipped|released?|milestone|hito|changelog|qué trae|qué se publicó|publicad[oa])(?![a-z])/.test(q));
|
|
662
|
+
}
|
|
649
663
|
async function handleStoreMemory(args) {
|
|
650
664
|
const query = args?.query;
|
|
651
665
|
const responseText = args?.response;
|
|
@@ -668,6 +682,17 @@ async function handleStoreMemory(args) {
|
|
|
668
682
|
autoEvidence = true;
|
|
669
683
|
}
|
|
670
684
|
}
|
|
685
|
+
// A whole file goes stale on any edit anywhere in it; the symbols the memory names in it go
|
|
686
|
+
// stale only when what it talks about changes (see NarrowEvidence).
|
|
687
|
+
let narrowedNote = "";
|
|
688
|
+
if (filePaths && filePaths.length > 0 && (!symbols || symbols.length === 0) && query && responseText) {
|
|
689
|
+
const narrowed = narrowEvidence(filePaths, `${query}\n${responseText}`);
|
|
690
|
+
if (narrowed.symbols.length > 0) {
|
|
691
|
+
filePaths = narrowed.filePaths.length > 0 ? narrowed.filePaths : undefined;
|
|
692
|
+
symbols = narrowed.symbols;
|
|
693
|
+
narrowedNote = ` Tracking the symbols it names instead of their whole file (${narrowed.narrowed.join("; ")}) — an edit elsewhere in those files won't stale it; pass symbols explicitly to choose others.`;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
671
696
|
const claims = Array.isArray(args?.claims)
|
|
672
697
|
? args.claims.filter((c) => c?.text)
|
|
673
698
|
: undefined;
|
|
@@ -720,10 +745,13 @@ async function handleStoreMemory(args) {
|
|
|
720
745
|
// later store, verify_memory, refresh_memory, forget_memory. Without it the caller had
|
|
721
746
|
// to search for the memory it had just written to do anything with it.
|
|
722
747
|
const idNote = storeRes.id ? ` (id: ${storeRes.id})` : "";
|
|
748
|
+
const logbookNote = looksLikeLogbook(query)
|
|
749
|
+
? "\n\n📓 This reads like a log of what was done or shipped. git log and the CHANGELOG already hold that, and log-style memories are the ones that never get recalled. If it contains what they don't — the root cause, the trap, the approach that failed, the non-obvious step — update_memory it so the key and body lead with that; otherwise forget_memory it."
|
|
750
|
+
: "";
|
|
723
751
|
const scrubNote = storeRes.redactions > 0
|
|
724
752
|
? ` 🛡 ${storeRes.redactions} secret(s) redacted before storage — credentials are never persisted, only their placeholders.`
|
|
725
753
|
: "";
|
|
726
|
-
return { content: [{ type: "text", text: `Success: Memory stored${idNote}. ${storeRes.reason}${trackingNote}${symbolNote}${autoEvidenceNote}${outcomeNote}${claimsNote}${domainNote}${refsNote}${derivedFromNote}${conflictsNote}${textConflictsNote}${scrubNote}` }] };
|
|
754
|
+
return { content: [{ type: "text", text: `Success: Memory stored${idNote}. ${storeRes.reason}${trackingNote}${symbolNote}${autoEvidenceNote}${outcomeNote}${claimsNote}${domainNote}${refsNote}${derivedFromNote}${conflictsNote}${narrowedNote}${textConflictsNote}${scrubNote}${logbookNote}` }] };
|
|
727
755
|
}
|
|
728
756
|
catch (e) {
|
|
729
757
|
logError("store_memory", e);
|
|
@@ -1143,7 +1171,7 @@ async function handleBrainTeam(args) {
|
|
|
1143
1171
|
}
|
|
1144
1172
|
async function handleVerifyMemory(args) {
|
|
1145
1173
|
const ids = Array.isArray(args?.ids) ? args.ids.filter((id) => typeof id === "string" && id) : [];
|
|
1146
|
-
const semanticDiff = args?.semanticDiff
|
|
1174
|
+
const semanticDiff = args?.semanticDiff !== false;
|
|
1147
1175
|
if (ids.length === 0)
|
|
1148
1176
|
throw new Error("ids is required and must be a non-empty array");
|
|
1149
1177
|
try {
|