@vedtechsolutions/engram-mcp 1.0.12 → 1.0.14

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 +21 -11
  2. package/package.json +1 -1
package/dist/hook.js CHANGED
@@ -3313,18 +3313,19 @@ function writeSessionHandoff(state, narrative) {
3313
3313
  const queries = state.search_queries.slice(-5);
3314
3314
  reasoningTrail.push(`Investigated: ${queries.join(" \u2192 ")}`);
3315
3315
  }
3316
+ const brief = state.continuation_brief ?? buildContinuationBrief(state);
3316
3317
  const handoff = {
3317
3318
  ended_at: (/* @__PURE__ */ new Date()).toISOString(),
3318
3319
  project: state.active_project,
3319
3320
  domain: state.active_domain,
3320
- task: state.active_task,
3321
+ task: brief.task !== "unknown task" ? brief.task : state.active_task,
3321
3322
  approach: (state.cognitive_state.current_approach ?? narrative?.approach ?? null)?.substring(0, SESSION_HANDOFF.MAX_APPROACH_LENGTH) ?? null,
3322
3323
  hypothesis: state.cognitive_state.active_hypothesis?.substring(0, SESSION_HANDOFF.MAX_APPROACH_LENGTH) ?? null,
3323
3324
  discoveries: state.cognitive_state.recent_discovery ? [state.cognitive_state.recent_discovery.substring(0, SESSION_HANDOFF.MAX_LESSON_LENGTH)] : [],
3324
- decisions,
3325
- unfinished: narrative?.unfinished && narrative.unfinished.length > 0 ? narrative.unfinished.join("; ").substring(0, SESSION_HANDOFF.MAX_UNFINISHED_LENGTH) : null,
3325
+ decisions: decisions.length > 0 ? decisions : brief.decisions,
3326
+ unfinished: narrative?.unfinished && narrative.unfinished.length > 0 ? narrative.unfinished.join("; ").substring(0, SESSION_HANDOFF.MAX_UNFINISHED_LENGTH) : brief.next_steps.length > 0 ? brief.next_steps.join("; ").substring(0, SESSION_HANDOFF.MAX_UNFINISHED_LENGTH) : null,
3326
3327
  blockers: state.recent_errors.slice(0, SESSION_HANDOFF.MAX_BLOCKERS).map((e) => e.substring(0, 200)),
3327
- files: state.session_files.slice(-SESSION_HANDOFF.MAX_FILES).map((f) => f.split(/[/\\]/).pop() ?? f),
3328
+ files: brief.key_files.length > 0 ? brief.key_files.slice(-SESSION_HANDOFF.MAX_FILES) : state.session_files.slice(-SESSION_HANDOFF.MAX_FILES).map((f) => f.split(/[/\\]/).pop() ?? f),
3328
3329
  lessons,
3329
3330
  phase: state.cognitive_state.session_phase ?? null,
3330
3331
  turns: state.total_turns,
@@ -6304,15 +6305,24 @@ ${distillLines}`
6304
6305
  }
6305
6306
  }
6306
6307
  try {
6307
- if (content.length >= 20 && !state.cognitive_state.current_approach) {
6308
+ if (content.length >= 20) {
6308
6309
  const approach = extractApproachFromPrompt(content);
6309
6310
  if (approach) {
6310
- state.cognitive_state = updateCognitiveState(
6311
- state.cognitive_state,
6312
- { type: "agent_prompt", prompt: content },
6313
- state.recent_tool_names,
6314
- state.recent_errors
6315
- );
6311
+ const currentLen = state.cognitive_state.current_approach?.length ?? 0;
6312
+ if (!state.cognitive_state.current_approach || approach.length > currentLen * 1.5) {
6313
+ state.cognitive_state = updateCognitiveState(
6314
+ state.cognitive_state,
6315
+ { type: "agent_prompt", prompt: content },
6316
+ state.recent_tool_names,
6317
+ state.recent_errors
6318
+ );
6319
+ }
6320
+ }
6321
+ if (content.length >= 30 && content.length <= 500) {
6322
+ const firstSentence = content.split(/[.!?\n]/)[0]?.trim();
6323
+ if (firstSentence && firstSentence.length >= 15 && firstSentence.length <= 200) {
6324
+ state.active_task = firstSentence;
6325
+ }
6316
6326
  }
6317
6327
  }
6318
6328
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vedtechsolutions/engram-mcp",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Cognitive memory system for AI — persistent, cross-session learning via MCP",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",