LearnNewsExamplesServices
Frontmatter
id9965
titleImplement Map-Reduce Session Summarization Pipeline (Prio 0)
stateClosed
labels
enhancementai
assigneestobiu
createdAtApr 13, 2026, 1:53 PM
updatedAtApr 14, 2026, 12:32 AM
githubUrlhttps://github.com/neomjs/neo/issues/9965
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtApr 13, 2026, 1:59 PM

Implement Map-Reduce Session Summarization Pipeline (Prio 0)

tobiu
tobiu commented on Apr 13, 2026, 1:53 PM

Context

In PR #9964, we implemented a tail-end truncation mechanism (max 10,000 chars) for SessionService to prevent n_ctx token exhaustion crashes during local LLM summarization.

While this stabilizes the REM pipeline and prevents the daemon from crashing, it is mathematically lossy. By truncating the chronological head of the session, we lose critical context regarding the original problem statement, hypotheses, and initial exploratory commands, summarizing only the "resolution".

Required Architecture

To achieve 100% data preservation while remaining strictly within the n_ctx: 4096 local constraints, we must refactor SessionService.summarizeSession() to utilize a Map-Reduce pipeline:

  1. Map (Chunking): Slice the memories.documents array into chronological batches that safely fit within a ~3000 token limit.
  2. Reduce (Sub-Summaries): Iterate over these batches, invoking the local AI provider to generate a sequential sub-summary.
  3. Compress: Feed the array of generated sub-summaries into a final compression prompt to generate the ultimate, all-encompassing SessionSummary object without overflowing the context window.

Graph Links

  • Blocks #9954 (Self-Healing Protocol) by ensuring historical accuracy.
  • Conceptual successor to #9921.
tobiu added the enhancement label on Apr 13, 2026, 1:53 PM
tobiu added the ai label on Apr 13, 2026, 1:53 PM
tobiu referenced in commit 5a4330a - "feat(MemoryCore): Implement lossless Map-Reduce chunking for massive REM sessions (#9965)" on Apr 13, 2026, 1:57 PM
tobiu cross-referenced by PR #9966 on Apr 13, 2026, 1:58 PM
tobiu referenced in commit 670c9a1 - "feat(MemoryCore): Implement lossless Map-Reduce chunking for massive REM sessions (#9965) (#9966)" on Apr 13, 2026, 1:59 PM
tobiu closed this issue on Apr 13, 2026, 1:59 PM
tobiu assigned to @tobiu on Apr 14, 2026, 12:32 AM