When consolidation triggers
Consolidation runs when all three conditions are true simultaneously:- Time gate: At least 24 hours have passed since the last consolidation
- Session gate: At least 5 sessions have accumulated since the last consolidation
- Lock gate: No other consolidation is currently in progress
.agents/.consolidation-lock tracks all three. If a lock is more than 30 minutes old, it is considered stale and consolidation proceeds.
The four-phase process
1
Orient
The agent reads
.agents/local.md (the index) and the existing topic files to understand current organization before making any changes.2
Gather
The agent scans recent daily logs for new signal: patterns that recurred across multiple sessions, gotchas that appeared more than once, stable preferences, and dead ends worth remembering.One-time events, transient debugging state, inline code snippets, and secrets are skipped.
3
Consolidate
For each piece of signal, the agent checks whether it already exists in a topic file. Duplicates are merged into the existing entry. Truly new, recurring items get a new topic entry. All relative dates (“yesterday”, “last week”) are converted to absolute dates.
4
Prune
The index is updated to point to newly important entries. Stale or contradicted pointers are removed. The index stays under 200 lines and ~25KB.
File structure
Daily log format
Daily logs are append-only. Each session appends a new block to the file for that day.Index format
The index file (.agents/local.md) is a pointer, not content storage. Each entry is one line with a link to the relevant topic file and a short hook.
Scripts
Migrating from the old structure
If your project uses the monolithic.agents.local.md file instead of daily logs, the migration script handles the conversion.
1
Run the migration script
.agents/logs/, .agents/topics/, and .agents/local.md in the new index format. Your original .agents.local.md is backed up to .agents.local.md.backup — nothing is deleted.2
Update the memory system section in AGENTS.md
Replace any references to
.agents.local.md in the memory workflow with the new daily log path (.agents/logs/YYYY-MM-DD.md).3
Start logging to daily logs
At each session end, append to
.agents/logs/YYYY-MM-DD.md instead of .agents.local.md.4
Wait for first auto-consolidation
After 24 hours and 5 sessions, consolidation triggers automatically. You can also force it immediately with
--force.5
Review the results
Check
.agents/topics/*.md for curated content and .agents/local.md for the updated index. Verify the compression ratio (target: 5:1 minimum, 9:1 ideal).Lock file reference
The lock file at.agents/.consolidation-lock is a JSON object: