Problem
The automated session summarization logic was previously disabled within the memory-core MCP server startup to prevent redundant executions and daemon collisions across multiple agent harnesses. This resulted in "stale context" within the Memory Core, as recent session memories were not being chronologically summarized into the semantic database. This lack of chronological access degrades agent performance and context recall over time.
Solution
Instead of re-enabling auto-summarization at the daemon level (which causes duplication), we need a standalone execution script that administrators or agents can trigger manually.
Implement a Node.js script located at ai/scripts/summarize-sessions.mjs that bypasses the MCP transport layer and leverages ai/services.mjs to directly invoke Memory_SessionService.summarizeSessions. Add an NPM script ai:summarize-sessions to package.json for easy execution.
Architectural Context
- Framework Constraint: MCP servers are instantiated per-agent. If the Memory Core spins up multiple instances, automated background cron jobs or initialization loops will fire multiple times.
- Pattern Alignment: We are moving towards discrete CLI-callable tools for administrative memory tasks, keeping the MCP servers focused purely on the LLM request/response lifecycle.
- Avoided Pitfall: Do NOT re-enable
initAsync summarization logic in the MCP server boot sequence. Doing so will reintroduce the race conditions and duplication.
Acceptance Criteria
Problem
The automated session summarization logic was previously disabled within the
memory-coreMCP server startup to prevent redundant executions and daemon collisions across multiple agent harnesses. This resulted in "stale context" within the Memory Core, as recent session memories were not being chronologically summarized into the semantic database. This lack of chronological access degrades agent performance and context recall over time.Solution
Instead of re-enabling auto-summarization at the daemon level (which causes duplication), we need a standalone execution script that administrators or agents can trigger manually.
Implement a Node.js script located at
ai/scripts/summarize-sessions.mjsthat bypasses the MCP transport layer and leveragesai/services.mjsto directly invokeMemory_SessionService.summarizeSessions. Add an NPM scriptai:summarize-sessionstopackage.jsonfor easy execution.Architectural Context
initAsyncsummarization logic in the MCP server boot sequence. Doing so will reintroduce the race conditions and duplication.Acceptance Criteria
ai/scripts/summarize-sessions.mjs.Memory_SessionService.summarizeSessions().ai:summarize-sessionsinpackage.json.