auto-dream
Background memory consolidation and learning graduation — overnight knowledge lifecycle.
Best use case
auto-dream is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Background memory consolidation and learning graduation — overnight knowledge lifecycle.
Teams using auto-dream should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/auto-dream/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How auto-dream Compares
| Feature / Agent | auto-dream | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Background memory consolidation and learning graduation — overnight knowledge lifecycle.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
Background memory consolidation cycle. Scans memory files, finds stale/duplicate/conflicting entries, consolidates, synthesizes cross-session insights, builds an injection-ready payload for next session start, and writes a dated dream report.
## When to invoke
- User says "run dream", "consolidate memories", "clean up memories", "memory maintenance", "deduplicate memories"
- Cron job at 2 AM nightly via wrapper script: `scripts/auto-dream-cron.sh --execute`
- Manual trigger for testing: `./scripts/auto-dream-cron.sh` (dry-run by default)
## Instructions
When invoked interactively (not via cron), read `skills/auto-dream/dream-prompt.md` and execute its phases directly. The prompt is self-contained — it describes the full seven-phase cycle including safety constraints, file paths, and output formats.
For cron invocation: the dream prompt is passed directly to `claude -p` and runs as a standalone headless session with no CLAUDE.md, no hooks, no project context. All instructions are embedded in the prompt.
## Phases
1. **SCAN** — Read all memory files, query learning.db sessions (last 7 days), read recent git log. Write scan document to `~/.claude/state/dream-scan-{date}.md`.
2. **ANALYZE** — Identify stale, duplicate, conflicting memories and cross-session patterns. Write analysis to `~/.claude/state/dream-analysis-{date}.md`.
3. **CONSOLIDATE** — Apply consolidation actions (max 5 changes). Archive stale/merged files, update MEMORY.md atomically.
4. **SYNTHESIZE** — Create insight memories from cross-session patterns (max 2 new memories per cycle).
5. **GRADUATE** — Promote mature learning DB entries (confidence >= 0.9, 3+ observations) into agent/skill files as permanent anti-patterns. Commits on `dream/graduate-YYYY-MM-DD` branch for human review. Max 3 per cycle. (ADR-159)
6. **SELECT** — Build injection-ready payload for session start. Write to `~/.claude/state/dream-injection-{project-hash}.md`.
7. **REPORT** — Write dream summary to `~/.claude/state/last-dream.md`.
## Safety constraints (always enforced)
- Never delete files — archive to `memory/archive/`, never `rm`
- Write the REPORT before executing any CONSOLIDATE filesystem operations
- Maximum 5 memory changes per cycle — excess items deferred to next cycle
- Flag conflicts for human review, never auto-resolve
- Preserve YAML frontmatter when merging; use `merged_from` field for provenance
- In dry-run mode (the default), CONSOLIDATE, SYNTHESIZE, and GRADUATE describe proposed changes only — no filesystem writes or git operations. The wrapper script sets `DREAM_DRY_RUN_MODE=yes` which is substituted into the prompt at runtime.
- GRADUATE commits on a feature branch (`dream/graduate-*`), never on main — user reviews and merges
- Maximum 3 graduations per cycle — only entries with confidence >= 0.9 and 3+ observations
## Testing
```bash
# Dry run (read-only, no filesystem changes — dry-run is the default)
./scripts/auto-dream-cron.sh
# Full run (execute consolidation)
./scripts/auto-dream-cron.sh --execute
# Check output
cat ~/.claude/state/last-dream.md
# Check graduation candidates (what dream would graduate)
python3 -c "
import sys; sys.path.insert(0, 'hooks/lib')
from learning_db_v2 import query_graduation_candidates
import json
candidates = query_graduation_candidates()
print(json.dumps(candidates, indent=2))
"
# Check if a graduation branch exists
git branch --list 'dream/graduate-*'
# Verify cron registration
python3 ~/.claude/scripts/crontab-manager.py list
```
## Cost estimate
~$0.09 per nightly run with 50 memory files (~20-30K input tokens at Sonnet pricing). ~$33/year for automated overnight operation. Budget capped at $3.00/run via wrapper script.
## Cron setup
Use `crontab-manager.py` (not raw `crontab -e`) to install. The wrapper script handles PATH, lockfile, logging, budget cap, and dry-run/execute toggle.
```bash
# Preview the cron entry
python3 ~/.claude/scripts/crontab-manager.py add \
--tag "auto-dream" \
--schedule "7 2 * * *" \
--command "/home/feedgen/claude-code-toolkit/scripts/auto-dream-cron.sh --execute >> /home/feedgen/claude-code-toolkit/cron-logs/auto-dream/cron.log 2>&1" \
--dry-run
# Install (after dry-run testing passes)
python3 ~/.claude/scripts/crontab-manager.py add \
--tag "auto-dream" \
--schedule "7 2 * * *" \
--command "/home/feedgen/claude-code-toolkit/scripts/auto-dream-cron.sh --execute >> /home/feedgen/claude-code-toolkit/cron-logs/auto-dream/cron.log 2>&1"
# Verify
python3 ~/.claude/scripts/crontab-manager.py verify --tag auto-dream
```
Note: schedule uses 2:07 AM (off-minute) per cron best practice — avoids load spikes from jobs firing at :00.
## Wrapper script details
`scripts/auto-dream-cron.sh` follows the established headless cron pattern (see `scripts/reddit-automod-cron.sh`):
- `flock` lockfile prevents concurrent runs
- `--permission-mode auto` (never `--dangerously-skip-permissions`)
- `--max-budget-usd 3.00` caps spend per run
- `--no-session-persistence` for clean headless operation
- `envsubst` templates `dream-prompt.md` with project-specific paths at runtime
- `tee` to timestamped per-run log file
- Dry-run by default, `--execute` for live runs
- Exit code propagation via `PIPESTATUS[0]`Related Skills
x-api
Post tweets, build threads, upload media via the X API.
worktree-agent
Mandatory rules for agents in git worktree isolation.
workflow
Structured multi-phase workflows: review, debug, refactor, deploy, create, research, and more.
workflow-help
Interactive guide to workflow system: agents, skills, routing, execution patterns.
wordpress-uploader
WordPress REST API integration for posts and media uploads.
wordpress-live-validation
Validate published WordPress posts in browser via Playwright.
with-anti-rationalization
Anti-rationalization enforcement for maximum-rigor task execution.
voice-writer
Unified voice content generation pipeline with mandatory validation and joy-check. 8-phase pipeline: LOAD, GROUND, GENERATE, VALIDATE, REFINE, JOY-CHECK, OUTPUT, CLEANUP. Use when writing articles, blog posts, or any content that uses a voice profile. Use for "write article", "blog post", "write in voice", "generate content", "draft article", "write about".
voice-validator
Critique-and-rewrite loop for voice fidelity validation.
vitest-runner
Run Vitest tests and parse results into actionable output.
video-editing
Video editing pipeline: cut footage, assemble clips via FFmpeg and Remotion.
verification-before-completion
Defense-in-depth verification before declaring any task complete.