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
Orient
The agent reads
.agents/local.md (the index) and the existing topic files to understand current organization before making any changes.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.
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.
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.
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.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).Start logging to daily logs
At each session end, append to
.agents/logs/YYYY-MM-DD.md instead of .agents.local.md.Wait for first auto-consolidation
After 24 hours and 5 sessions, consolidation triggers automatically. You can also force it immediately with
--force.Lock file reference
The lock file at.agents/.consolidation-lock is a JSON object: