feat(session): add batch memory compression CLI command#1112
Open
mvanhorn wants to merge 1 commit intovolcengine:mainfrom
Open
feat(session): add batch memory compression CLI command#1112mvanhorn wants to merge 1 commit intovolcengine:mainfrom
mvanhorn wants to merge 1 commit intovolcengine:mainfrom
Conversation
Add `ov compress` command that scans a directory for memories with verbose abstracts and truncates them to a target length. - CompressService: scans directory, filters by abstract length, truncates excess (or dry-run preview) - POST /v1/content/compress endpoint following reindex pattern - `ov compress viking://user/memories/ --max-abstract-length 128 --dry-run` - Returns stats: files_scanned, files_compressed, chars_saved Relates to volcengine#350, volcengine#578 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Matt Van Horn seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
Failed to generate code suggestions for PR |
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.
Problem Statement
Memory directories grow without bound as agents run over time. Verbose abstracts waste tokens during overview generation. A user in #350 reported 150K tokens for a single overview because abstracts are longer than the source memories themselves.
Related: #350 (decoupling ingestion), #578 (custom prompts), RFC #712 (memory templating).
Proposed Solution
Add
ov compressCLI command that scans a directory for memories with verbose abstracts and truncates them to a target length.Evidence
Changes
openviking/utils/compress_service.py(new):CompressServicescans directory, filters memories by abstract length, truncates excessopenviking/server/routers/content.py:POST /v1/content/compressendpoint following thereindexpatterncrates/ov_cli/src/client.rs:compress()HTTP client methodcrates/ov_cli/src/commands/content.rs:compresscommand handlercrates/ov_cli/src/main.rs:Compresssubcommand with--max-abstract-lengthand--dry-runflagsUsage
Returns:
files_scanned,files_compressed,chars_saved, and a list of verbose files.Testing
3 Python unit tests covering CompressService init and error handling.
Implementation Notes
ov reindex(merged in PR feat(cli): add reindex command to trigger content re-indexing #795)--dry-runreturns stats without modifying anything, safe to run anytimeFeature Area
Session Management
This contribution was developed with AI assistance (Claude Code).