Out-of-band memory consolidation ("dreaming") - review recent session transcripts together with the memory store and CLAUDE.md, find repeated failures and stale or missing knowledge, and propose evidence-backed changes for approval. Use when asked to consolidate, clean up or improve memory, weekly on active projects, or after a large refactor.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Memory Dream?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/alptugince-memory-dream)
---
name: memory-dream
description: Out-of-band memory consolidation ("dreaming") - review recent session transcripts together with the memory store and CLAUDE.md, find repeated failures and stale or missing knowledge, and propose evidence-backed changes for approval. Use when asked to consolidate, clean up or improve memory, weekly on active projects, or after a large refactor.
disable-model-invocation: true
---
# Memory dream
In-session memory writes only see one session. This pass sees many sessions at once and spends its own budget on making future sessions better.
## 1. Locate inputs
Use `memory_tool.py` from this skill's directory:
```bash
python <skill-dir>/memory_tool.py paths
python <skill-dir>/memory_tool.py sessions --days 14
```
If `python` is not found, use `python3` (macOS/Linux) or `py` (Windows).
The memory store is the `memory/` folder (index `MEMORY.md` plus topic files). Also read the project `CLAUDE.md`, `.claude/rules/` and the user `~/.claude/CLAUDE.md`. The harness versions the memory folder with git on every session start and end, so `git -C <memory-dir> log --oneline` shows its history.
## 2. Condense transcripts
For each session in scope:
```bash
python <skill-dir>/memory_tool.py extract <session.jsonl> -o <scratch>/<session-id>.md
```
## 2b. Usage profile
```bash
python <skill-dir>/memory_tool.py usage --days 14
```
Prints per-session context and re-read tokens, harness notes seen, subagent dispatches and suggested `harness.json` values. Add `--json` for raw data.
## 3. Analyse in parallel
Spawn one `transcript-analyst` subagent per batch of about five condensed transcripts. Give each the memory store and CLAUDE.md content plus the batch. Each returns findings in this shape:
- pattern (one sentence), category (repeated mistake / user correction / tool or config failure / missing knowledge / stale memory / contradiction / style preference)
- evidence: session ids with short quotes, including the failing tool calls
- count of occurrences in its batch
## 4. Decide (orchestrator)
Merge findings across batches. Propose a change only when a pattern appears in at least two sessions, or once with an explicit user correction. For each proposal choose the right home:
- Mechanically checkable → recommend `failure-to-guardrail` instead of memory.
- Multi-step procedure → a skill.
- Project fact or convention → project `CLAUDE.md` or a path-scoped rule.
- Personal preference across projects → user `~/.claude/CLAUDE.md`.
- Everything else → memory topic file, linked from `MEMORY.md`.
From the usage profile, propose changes to the keys `context_nudge_tokens`, `turn_nudge_tokens` and `opus_edit_nudge` in the user-level harness config `~/.claude/harness/config.json`, each with its evidence line from the report. Apply them only after the user approves.
Also propose deletions: entries contradicted by the code or by later corrections, duplicates, one-off details, and anything that would be harmful if wrong.
## 5. Present for approval
A table: change (add / edit / delete), target file, exact new text, evidence (session ids and quotes), prevalence (count). Wait for approval of each item; do not apply anything unapproved.
## 6. Apply safely
For each approved change to a memory file:
```bash
python <skill-dir>/memory_tool.py sha <file> # before drafting
python <skill-dir>/memory_tool.py write <file> --expect <sha> --from <draft>
```
Exit code 3 means another session changed the file: re-read, redo the edit, retry. Keep `MEMORY.md` a short index (under 200 lines) pointing to topic files. Never store secrets, credentials or personal data about other people.
## Running it weekly
Self-learning has a switch: "self-learning off" runs `python <skill-dir>/memory_tool.py learning off` (`on` and `status` likewise). Off only stops the automatic reminder; manual `/memory-dream` still works. `usage` records its run time for that reminder; pass `--no-record` for ad-hoc runs.
The user can schedule `/memory-dream` weekly. A scheduled run only writes the report and proposals; it never applies changes, memory or config, without approval.