Expand description
Memory consolidation (“dreaming”).
Background process that reviews memory files and consolidates them: merging duplicates, resolving contradictions, converting relative dates to absolute, pruning stale entries, and keeping the index under limits.
Uses a lock file to prevent concurrent consolidation across multiple agent sessions.
Functions§
- build_
consolidation_ prompt - Build the consolidation prompt for the dream agent.
- release_
lock - Release the consolidation lock by updating its mtime to now. This marks the consolidation as complete (mtime = last consolidated time).
- rollback_
lock - Roll back the lock on failure (rewind mtime so next session retries).
- run_
consolidation - Run the full consolidation pipeline via LLM.
- should_
consolidate - Check if consolidation should run.
- try_
acquire_ lock - Try to acquire the consolidation lock. Returns the lock path if acquired, None if another process holds it.