@vedtechsolutions/engram-mcp 1.0.29 → 1.0.31

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.
@@ -11426,7 +11426,20 @@ function formatBridgeMarkdown(content) {
11426
11426
  if (content.warnings.length > 0) {
11427
11427
  lines.push("## Watch Out For");
11428
11428
  for (const w of content.warnings) {
11429
- const fixHint = w.fix ? ` \u2192 ${w.fix}` : "";
11429
+ const getSignificantWords = (s) => {
11430
+ const stopWords = /* @__PURE__ */ new Set(["the", "a", "an", "is", "are", "was", "to", "of", "in", "for", "and", "or", "this", "that", "it"]);
11431
+ return new Set(s.toLowerCase().split(/\W+/).filter((w2) => w2.length > 3 && !stopWords.has(w2)));
11432
+ };
11433
+ let fixHint = "";
11434
+ if (w.fix) {
11435
+ const textWords = getSignificantWords(w.text);
11436
+ const fixWords = getSignificantWords(w.fix);
11437
+ const shared = [...textWords].filter((w2) => fixWords.has(w2)).length;
11438
+ const overlapRatio = textWords.size > 0 ? shared / textWords.size : 0;
11439
+ if (overlapRatio < 0.5) {
11440
+ fixHint = ` \u2192 ${w.fix}`;
11441
+ }
11442
+ }
11430
11443
  lines.push(`- **[${w.severity.toUpperCase()}]** ${w.text}${fixHint}`);
11431
11444
  }
11432
11445
  lines.push("");
@@ -12706,4 +12719,4 @@ export {
12706
12719
  composeProjectUnderstanding,
12707
12720
  formatMentalModelInjection
12708
12721
  };
12709
- //# sourceMappingURL=chunk-RCPTLHMM.js.map
12722
+ //# sourceMappingURL=chunk-WJAX5KZA.js.map
package/dist/hook.js CHANGED
@@ -174,7 +174,7 @@ import {
174
174
  updateReasoningChain,
175
175
  updateSelfModelFromSession,
176
176
  updateTask
177
- } from "./chunk-RCPTLHMM.js";
177
+ } from "./chunk-WJAX5KZA.js";
178
178
 
179
179
  // src/hook.ts
180
180
  import { readFileSync, writeFileSync, existsSync, renameSync, statSync, readdirSync, unlinkSync, openSync, readSync, closeSync } from "fs";
@@ -2270,28 +2270,40 @@ function composeUnderstandingNarrative(understanding, recovery, sessionOutcomes)
2270
2270
  if (sessionOutcomes && sessionOutcomes.length > 0) {
2271
2271
  lines.push(`Completed: ${sessionOutcomes.join("; ")}`);
2272
2272
  }
2273
+ const isGarbledField = (val) => {
2274
+ if (val.startsWith("<")) return true;
2275
+ if (val.startsWith("Resolve: <")) return true;
2276
+ if (/^\.\s/.test(val) || val.length < 5) return true;
2277
+ if (/^debug:\s\d+\slines/i.test(val)) return true;
2278
+ if (/^\{"type"/.test(val)) return true;
2279
+ if (/^Delegated:/i.test(val)) return true;
2280
+ if (/^Chose\s+[.\s]/.test(val)) return true;
2281
+ if (/^Chose\s+\S{0,3}\s+because\s*$/.test(val)) return true;
2282
+ return false;
2283
+ };
2273
2284
  const cogCtx = recovery.working_state?.cognitive_context;
2274
2285
  if (cogCtx) {
2275
- if (cogCtx.current_approach) {
2286
+ if (cogCtx.current_approach && !isGarbledField(cogCtx.current_approach)) {
2276
2287
  lines.push(`Approach: ${cogCtx.current_approach}`);
2277
- } else if (understanding.key_decisions.length > 0) {
2288
+ } else if (understanding.key_decisions.length > 0 && !isGarbledField(understanding.key_decisions[0])) {
2278
2289
  lines.push(`Approach: ${understanding.key_decisions[0]}`);
2279
2290
  }
2280
- if (cogCtx.active_hypothesis) lines.push(`Hypothesis: ${cogCtx.active_hypothesis}`);
2281
- if (cogCtx.recent_discovery) lines.push(`Discovery: ${cogCtx.recent_discovery}`);
2282
- if (cogCtx.planned_next_step) lines.push(`Intent: ${cogCtx.planned_next_step}`);
2283
- } else if (understanding.key_decisions.length > 0) {
2291
+ if (cogCtx.active_hypothesis && !isGarbledField(cogCtx.active_hypothesis)) lines.push(`Hypothesis: ${cogCtx.active_hypothesis}`);
2292
+ if (cogCtx.recent_discovery && !isGarbledField(cogCtx.recent_discovery)) lines.push(`Discovery: ${cogCtx.recent_discovery}`);
2293
+ if (cogCtx.planned_next_step && !isGarbledField(cogCtx.planned_next_step)) lines.push(`Intent: ${cogCtx.planned_next_step}`);
2294
+ } else if (understanding.key_decisions.length > 0 && !isGarbledField(understanding.key_decisions[0])) {
2284
2295
  lines.push(`Approach: ${understanding.key_decisions[0]}`);
2285
2296
  }
2286
- const extraDecisions = cogCtx?.current_approach ? understanding.key_decisions : understanding.key_decisions.slice(1);
2297
+ const extraDecisions = (cogCtx?.current_approach ? understanding.key_decisions : understanding.key_decisions.slice(1)).filter((d) => !isGarbledField(d) && d.length >= 10);
2287
2298
  if (extraDecisions.length > 0) {
2288
2299
  lines.push(`Also decided: ${extraDecisions.join("; ")}`);
2289
2300
  }
2290
2301
  if (understanding.architecture_delta && understanding.architecture_delta !== cogCtx?.recent_discovery) {
2291
2302
  lines.push(`Discovered: ${understanding.architecture_delta}`);
2292
2303
  }
2293
- if (understanding.active_chains.length > 0) {
2294
- lines.push(`Investigating: ${understanding.active_chains.join("; ")}`);
2304
+ const cleanChains = understanding.active_chains.filter((c) => !isGarbledField(c) && c.length >= 10);
2305
+ if (cleanChains.length > 0) {
2306
+ lines.push(`Investigating: ${cleanChains.join("; ")}`);
2295
2307
  }
2296
2308
  if (recovery.reasoning_trail && recovery.reasoning_trail.length > 0) {
2297
2309
  lines.push(`Reasoning trail: ${recovery.reasoning_trail.slice(0, 5).join("; ")}`);
package/dist/index.js CHANGED
@@ -154,7 +154,7 @@ import {
154
154
  vaccinate,
155
155
  vacuumDatabase,
156
156
  validateMultiPerspective
157
- } from "./chunk-RCPTLHMM.js";
157
+ } from "./chunk-WJAX5KZA.js";
158
158
 
159
159
  // src/index.ts
160
160
  import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vedtechsolutions/engram-mcp",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "Cognitive memory system for AI — persistent, cross-session learning via MCP",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",