Repository navigation
Description
/resume causes extreme RAM spike (10GB+) before entering any conversation — triggered by AGY's fallback mechanism loading all unindexed conversation SQLite files including bloated gen_metadata Protobuf BLOBs into RAM.
Platform: AGY CLI (Windows)
Version: 1.1.9
Steps to Reproduce
- Use AGY with
view_fileon media/binary files, or run long conversations with heavy tool calls, across several subagent sessions - Allow a number of conversation
.dbfiles to accumulate inbrain/over time (especially ones without entries inconversation_summaries.db) - Start a fresh AGY session and run
/resume - Observe: RAM spikes to several GB before any conversation is selected or entered
Root Cause Analysis
Two compounding issues cause this:
1. Missing Conversation Summaries Index
When /resume is invoked, AGY reads conversation_summaries.db. If any past conversation has no index entry in that database, AGY's fallback mechanism opens every raw .db file under conversations/ and loads it into RAM for parsing.
In the affected installation: 99 total conversation files, 59 unindexed, with those 59 totalling 4.41 GB on disk.
2. Bloated gen_metadata Protobuf BLOBs (Snowballing Size)
For conversations involving view_file on media files or large tool call payloads, AGY serializes the complete Generation Metadata (protobuf object) into a BLOB in the gen_metadata SQLite table after every turn. Critically, each turn stores the cumulative context snapshot up to that point:
- Turn 1: ~50 MB BLOB
- Turn 2: ~150 MB BLOB
- Turn 4–5: single SQLite column BLOB reaches 740 MB
When /resume hits an unindexed conversation, SQLite loads the entire BLOB chain into RAM and attempts full deserialization. With multiple such conversations, this consumes 10 GB+ RAM instantly — before any conversation is even opened.
Expected Behavior
/resumeshould never require loading full blob data to display the conversation list- Missing
conversation_summaries.dbentries should be gracefully skipped or lazy-loaded — not bulk-loaded conversation_summaries.dbshould be automatically maintained as sessions complete, so the fallback path is never triggered under normal use
Workaround Applied (Self-diagnosed and fixed)
Manually applied a two-step fix in a separate clean session:
Step 1 — Rebuilt conversation_summaries.db index:
Parsed all 59 unindexed conversations and inserted their summary records. /resume now only reads the ~50 KB index file and responds in milliseconds.
Step 2 — Cleaned bloated gen_metadata BLOBs + SQLite VACUUM:
Removed oversized generation snapshot BLOBs from completed conversations and ran VACUUM to reclaim disk space.
| Metric | Before | After |
|---|---|---|
| Total conversation storage | 4.68 GB | 0.25 GB |
| Disk space reclaimed | — | 4.43 GB |
/resume load time |
Tens of seconds / crash | < 0.05s |
RAM usage on /resume |
Several GB | ~0 MB overhead |
Prevention Recommendation
The gen_metadata cumulative snapshot design combined with the unindexed-conversation fallback creates a ticking time bomb for any user who:
- Uses
view_fileon media or binary files - Runs long conversations with many tool calls
- Accumulates conversation history over time
Suggested fixes:
- Auto-maintain
conversation_summaries.dbon session end — eliminate the fallback entirely - Cap or prune
gen_metadataBLOBs per conversation (e.g., only keep last N snapshots) - Store large binary payloads as separate files with references in SQLite, rather than inline BLOBs
Activity
[-]/resume causes extreme RAM spike before entering any conversation — unindexed sessions trigger full gen_metadata blob loading[/-][+][Bug]: /resume extreme RAM spike — unindexed conversations trigger full gen_metadata Protobuf BLOB deserialization[/+]rkecodist commentedon Sep 10, 2026
Can you share the script you used for "Step 2 — Cleaned bloated gen_metadata BLOBs + SQLite VACUUM" ?
chandrashakherkamasani commentedon Oct 14, 2026
Hi all, this issue has been resolved in latest releases. Can you please update AGY CLI using
agy updateand let us know if you still see the issue.