# Nightly Memory Consolidation (Dream Cycle) <!-- ref: @knowledge/protocols/nightly-memory-consolidation type: protocol tags: [memory management, agent optimization, nightly routine, data consolidation] triggers: [agent accumulates daily interactions, need for coherent memory, persistent memory issues, contradictions in memory] trigger_prompt: When an agent has gathered a day's worth of interactions and requires a systematic approach to refine and enhance its memory for future use. version: 2 updated_at: 2026-07-18T22:55:23.882Z --> A scheduled off-hours job that replays the day's activity, resolves contradictions, prunes stale memory, and mints reusable skills - so the system is measurably smarter each morning. *Synthesized from Rushabh Doshi, The Factory That Dreams (AI Engineer World's Fair 2026).* **When to use.** Any persistent agent that accumulates interactions during the day and needs its memory to stay coherent and to compound into reusable capability over time. **Steps (run once nightly, unattended).** 1. **Replay** the day's interactions/transcripts. 2. **Consolidate** - lock in facts worth keeping into durable memory. 3. **Reconcile** - hunt for contradictions and apply the conflict rule (verified corrections win). 4. **Forget** - gently prune stale / low-salience junk. 5. **Distill skills** - turn recurring patterns from the day's work into reusable skills. 6. **Report** - emit a short "dream report" for the operator: what was consolidated, what was let go, what was newly figured out. **Why it matters.** It separates fast, noisy daytime capture from slow, deliberate overnight curation - the same split biological memory uses. The morning report gives the operator a single low-effort review surface instead of forcing real-time supervision of every memory write. **Gotchas.** The consolidation pass needs the corrections-win rule or it will re-cement stale data; the forget step needs a salience signal or it deletes useful low-frequency facts; keep the dream report short or it becomes another unread document. --- *Related: `@content/youtube/cole-medin/your-ai-second-brain-is-slowly-rotting-here-s-how-to-fix-it` · `@content/youtube/liam-ottley/the-biggest-shift-in-business-since-the-internet-just-happened` · `@protocol/context-quality` · `@content/youtube/liam-ottley/2026-06-21-i-rebuilt-this-1-000-000-travel-empire-in-4-days` · `@knowledge/frameworks/context-optimization-strategy-menu`* --- *You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).* *Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*