feat: add session-based context window management#38
Merged
Siddhant-K-code merged 4 commits intomainfrom Feb 24, 2026
Merged
Conversation
Stateful context windows with token budgets for long-running agent sessions. Entries are deduplicated on push, compressed through hierarchical levels as they age, and evicted when the budget is exceeded. Lowest-importance entries are compressed/evicted first. Compression levels: full text -> summary (~20%) -> sentence -> keywords. The preserve_recent setting keeps the N most recent entries at full fidelity. - pkg/session: SQLite-backed session store with 13 tests - CLI: distill session create/push/context/delete - HTTP: /v1/session/* endpoints (opt-in via --session flag) - MCP: create_session, push_session, session_context, delete_session - README: session management docs, updated architecture + roadmap Closes #31 Co-authored-by: Ona <no-reply@ona.com>
Owner
Author
Code Review - PR #38CI green (build + lint). 13 tests pass. 0 lint issues. Verdict: Approve with fixes belowNo blocking issues. Architecture follows the memory store patterns well. Findings
What's Good
|
- P2: Add TODO to isDuplicate noting O(n) scaling limit - P2: Fix Create timestamp consistency (reuse time.Time) - P2: Loop enforceBudget until within budget or no progress - P3: Rename DedupSavings to CompressionSavings - Nit: Remove unused ErrEmptyContent and CompressAge - Nit: Replace insertion sort with sort.Slice - Nit: Merge sessionStoreFromFlags/sessionStoreFromConfig into newSessionStore - Nit: Truncate at word boundary in LevelSentence - Nit: Remove trailing blank line Co-authored-by: Ona <no-reply@ona.com>
Owner
Author
|
All 10 review findings addressed in
All 13 tests pass, 0 lint issues. |
- CHANGELOG: add [Unreleased] section with session management - FAQ: add memory, session, and MCP tools Q&As; update roadmap status - examples/session_api.sh: full API usage example - mcp/README: add memory + session tool docs, config examples, integration patterns (session tracking, cross-session memory) - mcp/claude_desktop_config_full.example.json: config with all features Co-authored-by: Ona <no-reply@ona.com>
- Add memory: and session: sections to distill.yaml config example - Update Quick Start MCP to show --memory --session flags - Add Memory and Session to Pipeline Modules section Co-authored-by: Ona <no-reply@ona.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stateful context windows with token budgets for long-running agent sessions. Entries are deduplicated on push, compressed through hierarchical levels as they age, and evicted when the budget is exceeded. Lowest-importance entries are compressed/evicted first.
Compression levels: full text → summary (~20%) → sentence → keywords. The
preserve_recentsetting keeps the N most recent entries at full fidelity.Closes #31
Added
pkg/session— SQLite-backed session store with 13 testsdistill session create/push/context/delete/v1/session/create,/push,/context,/delete,/get(opt-in via--sessionflag)create_session,push_session,session_context,delete_session(opt-in via--sessionflag)Docs
[Unreleased]section with session managementUsage
Review Findings Addressed
All 10 findings from code review resolved:
isDuplicateTODO,Createtimestamp fix,enforceBudgetloopCompressionSavingsrenameErrEmptyContent/CompressAge,sort.Slice, merged store constructors, word-boundary truncation