@vedtechsolutions/engram-mcp 1.0.13 → 1.0.15

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.
Files changed (2) hide show
  1. package/dist/hook.js +20 -8
  2. package/package.json +1 -1
package/dist/hook.js CHANGED
@@ -3250,6 +3250,9 @@ function sanitizeCognitiveState(state) {
3250
3250
  if (cog.recent_discovery && cog.recent_discovery.startsWith("Pre-compaction")) {
3251
3251
  cog.recent_discovery = null;
3252
3252
  }
3253
+ if (state.active_task && state.active_task.startsWith("<")) {
3254
+ state.active_task = null;
3255
+ }
3253
3256
  if (!state.active_task || state.active_task === "unknown task") {
3254
3257
  const editedFiles = state.recent_actions.filter((a) => a.tool === "Edit" || a.tool === "Write").map((a) => a.target.split(/[/\\]/).pop() ?? a.target);
3255
3258
  const uniqueFiles = [...new Set(editedFiles)].slice(-5);
@@ -6298,22 +6301,31 @@ ${distillLines}`
6298
6301
  }
6299
6302
  }
6300
6303
  }
6301
- if (content.length >= 10) {
6304
+ if (content.length >= 10 && !content.startsWith("<")) {
6302
6305
  state.recent_prompts.push(truncate(content, 300));
6303
6306
  if (state.recent_prompts.length > 8) {
6304
6307
  state.recent_prompts = state.recent_prompts.slice(-8);
6305
6308
  }
6306
6309
  }
6307
6310
  try {
6308
- if (content.length >= 20 && !state.cognitive_state.current_approach) {
6311
+ if (content.length >= 20 && !content.startsWith("<")) {
6309
6312
  const approach = extractApproachFromPrompt(content);
6310
6313
  if (approach) {
6311
- state.cognitive_state = updateCognitiveState(
6312
- state.cognitive_state,
6313
- { type: "agent_prompt", prompt: content },
6314
- state.recent_tool_names,
6315
- state.recent_errors
6316
- );
6314
+ const currentLen = state.cognitive_state.current_approach?.length ?? 0;
6315
+ if (!state.cognitive_state.current_approach || approach.length > currentLen * 1.5) {
6316
+ state.cognitive_state = updateCognitiveState(
6317
+ state.cognitive_state,
6318
+ { type: "agent_prompt", prompt: content },
6319
+ state.recent_tool_names,
6320
+ state.recent_errors
6321
+ );
6322
+ }
6323
+ }
6324
+ if (content.length >= 30 && content.length <= 500 && !content.startsWith("<")) {
6325
+ const firstSentence = content.split(/[.!?\n]/)[0]?.trim();
6326
+ if (firstSentence && firstSentence.length >= 15 && firstSentence.length <= 200 && !firstSentence.startsWith("<")) {
6327
+ state.active_task = firstSentence;
6328
+ }
6317
6329
  }
6318
6330
  }
6319
6331
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vedtechsolutions/engram-mcp",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "Cognitive memory system for AI — persistent, cross-session learning via MCP",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",