skills/agent/dream/SKILL.md
Memory consolidation skill for Claude Code. Scans session transcripts for corrections, decisions, preferences, and patterns, then merges findings into persistent memory files. Auto-triggers via native Stop hook every 24hrs. Inspired by how sleep consolidates human memory.
npx skillsauth add thimslugga/agent-skills dreamInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Your AI agent dreams like you do. Consolidates memory while you sleep.
Welcome! Follow these steps in order. After setup is verified, delete everything between ## ONBOARDING and ## END ONBOARDING from this file as the final step.
Before anything else, detect which memory system is in use. Run these checks:
# Check 1: Native Claude Code auto-memory
ls ~/.claude/projects/*/memory/MEMORY.md 2>/dev/null && echo "DETECTED: native-claude-code"
# Check 2: OpenClaw-style (memory/ folder in project root with daily logs)
ls ./memory/20*.md 2>/dev/null && echo "DETECTED: openclaw-daily-logs"
# Check 3: Project-root MEMORY.md (custom setup)
ls ./MEMORY.md 2>/dev/null && echo "DETECTED: project-root-memory"
# Check 4: Nothing found
echo "If none detected above: no memory system found"
Based on what you detect, set DREAM_MEMORY_TYPE:
| Detection | DREAM_MEMORY_TYPE | Memory location | Session transcripts |
|-----------|-------------------|-----------------|-------------------|
| ~/.claude/projects/*/memory/MEMORY.md exists | native | ~/.claude/projects/<project>/memory/ | ~/.claude/projects/<project>/sessions/*.jsonl |
| ./memory/20*.md daily log files exist | openclaw | ./memory/ (project root) | ~/.claude/projects/<project>/sessions/*.jsonl |
| ./MEMORY.md exists in project root | project-root | ./ (project root, MEMORY.md + topic files) | ~/.claude/projects/<project>/sessions/*.jsonl |
| Nothing found | native (default) | ~/.claude/projects/<project>/memory/ | ~/.claude/projects/<project>/sessions/*.jsonl |
If no memory system is found, default to native Claude Code memory. This is the standard and requires no extra setup - Claude Code creates the directory automatically when auto-memory is enabled.
Write the detected type to the config so dream knows where to look:
echo "DREAM_MEMORY_TYPE=native" > ~/.claude/skills/dream/.dream-config
echo "DREAM_MEMORY_PATH=~/.claude/projects" >> ~/.claude/skills/dream/.dream-config
Replace native with openclaw or project-root if that's what was detected. For openclaw or project-root, also set the path:
# For openclaw:
echo "DREAM_MEMORY_TYPE=openclaw" > ~/.claude/skills/dream/.dream-config
echo "DREAM_MEMORY_PATH=$(pwd)/memory" >> ~/.claude/skills/dream/.dream-config
# For project-root:
echo "DREAM_MEMORY_TYPE=project-root" > ~/.claude/skills/dream/.dream-config
echo "DREAM_MEMORY_PATH=$(pwd)" >> ~/.claude/skills/dream/.dream-config
Add the dream trigger to your Claude Code settings:
SETTINGS="$HOME/.claude/settings.json"
[ ! -f "$SETTINGS" ] && echo '{}' > "$SETTINGS"
python3 -c "
import json
with open('$HOME/.claude/settings.json') as f:
s = json.load(f)
s.setdefault('hooks', {}).setdefault('Stop', [])
if not any('dream' in h.get('command','') for h in s['hooks']['Stop']):
s['hooks']['Stop'].append({
'type': 'command',
'command': 'bash \$HOME/.claude/skills/dream/should-dream.sh && touch \$HOME/.claude/.dream-pending || true'
})
with open('$HOME/.claude/settings.json', 'w') as f:
json.dump(s, f, indent=2)
f.write('\n')
print('Stop hook installed')
"
What this does: When you exit any Claude Code session, the Stop hook checks if 24+ hours have passed since the last dream. If yes, it creates a .dream-pending flag file. On your next session start, Claude sees the flag and runs /dream as a background subagent.
Add this to your global ~/.claude/CLAUDE.md (or project CLAUDE.md):
## Auto Dream
If the file `~/.claude/.dream-pending` exists at session start, run `/dream` as a subagent in the background, then delete the flag file: `rm ~/.claude/.dream-pending`. This is the memory consolidation system - it runs automatically every 24 hours.
chmod +x ~/.claude/skills/dream/should-dream.sh
Run a test dream to verify the full flow:
# Force the dream to trigger by creating the flag
touch ~/.claude/.dream-pending
Then tell Claude: "The .dream-pending flag exists. Run /dream now."
After it completes, verify:
~/.claude/.dream-pending was deleted.last-dream timestamp was written in the memory directoryEverything is working. Now delete this entire ONBOARDING section from this SKILL.md file (everything between ## ONBOARDING and ## END ONBOARDING). The skill is fully set up and will auto-trigger every 24 hours via the Stop hook.
Dream runs in 4 sequential phases. Execute them in order. Do not skip phases.
ORIENT --> GATHER SIGNAL --> CONSOLIDATE --> PRUNE & INDEX
Session ends
--> Stop hook fires should-dream.sh (~10ms)
--> Checks: 24hrs passed? 5+ sessions?
--> If NO: exits silently, zero overhead
--> If YES: creates ~/.claude/.dream-pending flag
Next session starts
--> Claude reads CLAUDE.md, sees .dream-pending exists
--> Spawns /dream as background subagent
--> Dream runs all 4 phases
--> Writes .last-dream timestamp, deletes .dream-pending
--> Timer resets for next 24hrs
Goal: Understand the current state of memory before changing anything.
cat ~/.claude/skills/dream/.dream-config 2>/dev/null || echo "DREAM_MEMORY_TYPE=native"
This tells you which memory system to target:
native - scan ~/.claude/projects/*/memory/openclaw - scan the memory/ folder in the project root (daily logs + MEMORY.md)project-root - scan MEMORY.md and topic files in the project root# native (default)
ls -d ~/.claude/projects/*/memory/ 2>/dev/null
# openclaw
ls ./memory/ 2>/dev/null
# project-root
ls ./MEMORY.md ./memory/ 2>/dev/null
# native
ls ~/.claude/projects/*/memory/ 2>/dev/null
# openclaw - also list daily logs
ls ./memory/*.md 2>/dev/null
Read MEMORY.md (the index file) in each project's memory directory. Note:
Read each topic file to understand what's already stored.
You should now have a mental map of:
Goal: Extract important information from recent sessions without reading everything.
find ~/.claude/projects/*/sessions/ -name "*.jsonl" -mtime -7 2>/dev/null | sort -t/ -k6 -r
This finds JSONL session files modified in the last 7 days, sorted newest first. Adjust -mtime -7 for different windows.
Use targeted grep, not full reads. Each pattern targets a specific signal type:
User corrections (highest priority):
grep -il "actually\|no,\|wrong\|incorrect\|not right\|stop doing\|don't do\|I said\|I meant\|that's not\|correction" ~/.claude/projects/*/sessions/*.jsonl 2>/dev/null
Preferences and configuration:
grep -il "I prefer\|always use\|never use\|I like\|I don't like\|I want\|from now on\|going forward\|remember that\|keep in mind\|make sure to\|default to" ~/.claude/projects/*/sessions/*.jsonl 2>/dev/null
Important decisions:
grep -il "let's go with\|I decided\|we're using\|the plan is\|switch to\|move to\|chosen\|picked\|decision\|we agreed" ~/.claude/projects/*/sessions/*.jsonl 2>/dev/null
Recurring patterns:
grep -il "again\|every time\|keep forgetting\|as usual\|same as before\|like last time\|we always\|the usual" ~/.claude/projects/*/sessions/*.jsonl 2>/dev/null
For each file that matches, read ONLY the surrounding context of the match (not the full session). JSONL files have one JSON object per line. Focus on lines where type is "human" (user messages) and the immediately following "assistant" response.
grep -n "I prefer\|always use\|never use" <session_file> | head -20
For each finding, note:
Goal: Merge new findings into existing memory. This is the most delicate phase.
Never duplicate. Before adding anything, check if it already exists in memory. If it does, update the existing entry rather than creating a new one.
Convert relative dates to absolute. If a session from March 15 says "yesterday I changed the API key", write "2026-03-14: Changed API key" in memory. Never store "yesterday" or "last week".
Delete contradicted facts. If memory says "Prefers tabs" but a recent session has the user saying "Use spaces", remove the old entry and write the new one. Add a note: (Updated YYYY-MM-DD, previously: tabs).
Preserve source attribution. When adding a new memory entry, note where it came from: (from session YYYY-MM-DD).
Topic file organization. Group related memories into topic files:
preferences.md - How the user likes things donedecisions.md - Choices and their rationalecorrections.md - Things the user correctedpatterns.md - Recurring workflows, common tasksfacts.md - Project-specific knowledge, architecture notesEntry format. Each memory entry should be concise:
- [YYYY-MM-DD] The fact or preference. (source: session, confidence: high/medium)
Use the Edit tool to modify existing memory files, or Write to create new topic files. Always read a file before editing it.
Goal: Keep MEMORY.md as a lean index. Remove stale content. Enforce size limits.
MEMORY.md is an index file, not a content store. It should contain:
MEMORY.md should never contain:
If MEMORY.md exceeds 200 lines after consolidation:
archive.md topic fileRemove or archive entries that are:
~/.claude/projects/# Memory Index
Last consolidated: YYYY-MM-DD
## Topic Files
| File | Summary | Updated |
|------|---------|---------|
| preferences.md | Editor, formatting, communication style preferences | YYYY-MM-DD |
| decisions.md | Architecture choices, tool selections, project direction | YYYY-MM-DD |
| corrections.md | Past mistakes to avoid repeating | YYYY-MM-DD |
| patterns.md | Common workflows and recurring tasks | YYYY-MM-DD |
| facts.md | Project knowledge, API details, system architecture | YYYY-MM-DD |
## Quick Reference
<!-- Only the 5-10 MOST important facts that affect every session -->
- Fact 1
- Fact 2
The Quick Reference section is for facts so important they should be seen every time memory is loaded. Keep it to 10 items maximum.
After completing all 4 phases, write timestamps so the auto-trigger knows when you last dreamed:
date +%s > ~/.claude/projects/<project>/memory/.last-dream
rm -f ~/.claude/.dream-pending
cp -r ~/.claude/projects/<project>/memory/ ~/.claude/projects/<project>/memory-backup-$(date +%Y%m%d)/
After running, verify the consolidation:
wc -l on MEMORY.md - should be under 200 linesdevelopment
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.
development
Documentation templates and structure guidelines. README, API docs, code comments, and AI-friendly documentation.
development
Use when the task involves reading, creating, or editing `.docx` documents, especially when formatting or layout fidelity matters; prefer `python-docx` plus the bundled `scripts/render_docx.py` for visual checks.
documentation
Create a README.md file for the project