Budgets and compaction
Memory stays small enough to load every session. Old material is archived, never deleted.
Memory only helps if it is small enough to load. Every memory file has a size budget. doctor
checks them, and compact tidies up.
npx groundwork-ai doctorAlways loaded: ≈510 tokens (budget 2000): AGENTS.md 440, CLAUDE.md 35, skill list 35
Brief: ≈288 tokens (budget 1500), loaded at each session start
Memory files: handoff 166/600 · decisions 87/600 · map 48/800 · lessons 206/1200 · journal 169/2500 tokensThe budgets
In .groundwork/config.json, under budgets, in estimated tokens (characters ÷ 4):
| Key | Default | When it is over |
|---|---|---|
brief | 1,500 | The brief trims itself to fit |
handoff | 600 | Shorten it; compact archives sections Groundwork doesn't define |
map | 800 | Shorten it by hand |
decisions | 600 | compact archives superseded records |
lessons | 1,200 | Merge or drop entries by hand |
journal | 2,500 | compact archives the oldest entries |
doctor exits 1 when a file is over, so it can run in CI. tokenBudget (2,000) is separate: it
covers what your tool always loads, such as AGENTS.md.
Compact
npx groundwork-ai compact --dry-run # preview
npx groundwork-ai compactIt moves things to .groundwork/archive/. It never deletes.
| What | Where it goes |
|---|---|
| Journal entries beyond the budget, oldest first | archive/JOURNAL-<year>.md |
| Superseded decisions, every time | archive/decisions/ |
| Handoff sections Groundwork doesn't define | archive/HANDOFF-<date>.md |
It won't shorten Now, Next or Notes. Only you or the agent can judge those.