Frontmatter
| id | 7861 |
| title | Improve Session Summarization to Handle Parallel and Recent Sessions |
| state | Closed |
| labels | enhancementai |
| assignees | tobiu |
| createdAt | Nov 22, 2025, 6:39 PM |
| updatedAt | Nov 22, 2025, 7:32 PM |
| githubUrl | https://github.com/neomjs/neo/issues/7861 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Nov 22, 2025, 7:32 PM |
Improve Session Summarization to Handle Parallel and Recent Sessions
tobiu assigned to @tobiu on Nov 22, 2025, 7:30 PM

tobiu
Nov 22, 2025, 7:32 PM
Input from Gemini:
✦ The solution implemented differs from the original proposal to better balance performance and data integrity, specifically addressing the "Parallel Session" and "Crash Recovery" use cases.
Implemented Logic: "Eventual Consistency with 30-Day Scope"
Instead of complex timestamp comparisons or a strict 48-hour window, we implemented a robust "Drift Detection" strategy:
- Scoped Fetch: We fetch all memories and summaries active in the last 30 days (using ChromaDB
$gtfiltering). This caps the dataset size while covering 99% of active work.- Drift Detection: We simply compare the Database Memory Count vs. Summary Metadata Count for each session.
DB Count !== Summary Count-> Re-Summarize.- This handles additions (active parallel sessions adding memories) and deletions (corrections).
- Self-Healing: The system self-corrects on the next startup. If a session crashes or runs in parallel, the next agent session will detect the count mismatch and update the summary, ensuring no context is lost.
Why this is better:
- Simplicity: Removes brittle "time-since-last-update" logic.
- Robustness: Guarantees that any session modified within the last month is accurately summarized.
- Safety: Using pagination and database-side filtering ensures the service scales safely even with a large total history.
Trade-off Accepted: We accept a small token overhead for currently active parallel sessions (they may be re-summarized on each new session startup), but this guarantees that context is always up-to-date for all agents.
tobiu closed this issue on Nov 22, 2025, 7:32 PM
The current
SessionServiceonly summarizes sessions that completely lack a summary. This logic fails in two common scenarios:Goal: Ensure that recent sessions are always fully summarized, even if they were partially summarized previously.
Implementation Plan: Modify
SessionService.mjs->initAsync(and helper methods) to implement the following logic:Fetch Recent Activity:
Analyze Sessions:
sessionIdto calculate the Actual Memory Count for each session.Compare with Summaries:
Actual Memory Count>Summary Metadata.memoryCount-> Re-Summarize.User Constraint:
Technical Changes:
findUnsummarizedSessionstofindSessionsToSummarize.summarizeSession(or the collection upsert logic) to ensure it correctly overwrites existing summaries.