Repository navigation
Description
bb's database keeps growing for heavy users, and archiving threads doesn't make it smaller. One user's database reached 1.5 GB (about 670,000 events across about 1,300 threads). At that size some reads wait on the disk, which is slower still on a Mac that's low on memory.
Why it happens
- Automatic cleanup only removes a few kinds of events: rate limits, usage, turn diffs and resolved items (
THREAD_PRUNING_POLICIESinpackages/db/src/data/thread-pruning.ts). Messages and tool history are kept forever. - Archiving hides a thread but deletes nothing. The only way to shrink the database today is deleting threads, by hand or automatically with the opt-in Storage & retention plugin's "delete after N days" setting. Both lose the thread's history.
Proposed direction
Add a storage step after archiving: archived → compacted. A compacted thread's history moves out of the main database into a compressed cold store. It still shows up as archived, reopening it reads from the cold store, and unarchiving moves it back. Nothing is lost, and the main database only holds threads people actually use.
- Core owns the mechanism: the compacted state, the cold store, reading it back, and moving it back on unarchive.
- The Storage & retention plugin owns the policy: a new setting such as "Compact archived threads after N days", next to its existing archive-after and delete-after settings. That gives a ladder of active → archived → compacted → (optionally) deleted.
- Archiving stays instant and cheap to undo. Only threads that have been archived for a while get compacted.
- Reduce chat database storage without losing history #5563 (lossless compression, off by default; 4.04 GB → 1.64 GB on a test copy) can provide the cold store's format, and still helps active threads on its own.
Open questions:
- Search: whether compacted chats stay in normal search or need an explicit "include archived" search.
- Parent/child threads: compact a thread tree only once every member is archived. The retention plugin already processes whole trees and skips ones with pinned members.
- Backups, and the cost of unarchiving many compacted threads at once.
- Whether "compacted" is ever shown to users, or stays an internal detail of archived threads.
Related: #5005 (cleanup stalls on busy workspaces), #4714 (snapshot threads outside the database).
Done when
Archiving old threads makes the database smaller, or at least stops it growing, while their chat history stays available. Users also have a documented way to check how big their database is.
Activity
[-]Database grows without bound for heavy users, and archiving doesn't shrink it[/-][+]bb's database grows without limit, and archiving doesn't shrink it[/+]bb-slop-cop commentedon Oct 18, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotApplied Type: Feature · Priority: Medium · Effort: High and labels
threads,perf. No existing classifications needed preserving; final Type verified as Feature.Trusted main preserves conversation history when archiving; archive updates lifecycle state and schedules limited event pruning, not full history compaction. Making archive reclaim database space while retaining reopenable history adds a storage capability and requires a storage-policy/design decision. Medium priority reflects the heavy-use performance impact with existing opt-in retention controls; high effort reflects the data-lifecycle design involved.
No reproduction report or pull request: this is a feature request, not a demonstrated regression in existing archive behavior.
brsbl commentedon Oct 20, 2026
Two more data points from one user's servers:
bb.dbat 9.1 GB, of which 6.7 GB is theeventstable and about 1.1 GB its indexes. 3,618 threads, 3,351 of them archived. zstd -10 shrinks it to 1.4 GB.bb.dbat 4.2 GB. 1,670 threads, 1,622 of them archived. Exporting each archived thread as its thread row plus all of its events, as JSONL compressed with xz, takes 212 MB in total (about 130 KB per thread).So nearly all of the database is timelines of archived threads, and they compress by roughly 20×.
Move archived threads to cold storage from Storage & retention, with …