@vedtechsolutions/engram-mcp 1.0.29 → 1.0.30
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/dist/hook.js +21 -9
- package/package.json +1 -1
package/dist/hook.js
CHANGED
|
@@ -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
|
-
|
|
2294
|
-
|
|
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("; ")}`);
|