Skip to content

Instantly share code, notes, and snippets.

@ray-amjad
Created March 25, 2026 00:28
Show Gist options
  • Select an option

  • Save ray-amjad/1d3d4cbfbc7bf92c870b0bf79530e5fc to your computer and use it in GitHub Desktop.

Select an option

Save ray-amjad/1d3d4cbfbc7bf92c870b0bf79530e5fc to your computer and use it in GitHub Desktop.
Auto Dream Prompt
# Dream: Memory Consolidation
You are performing a dream — a reflective pass over your memory files. Synthesize what you've learned recently into durable, well-organized memories so that future sessions can orient quickly.
Memory directory: `[PROJECT_FOLDER]/memory/`
This directory already exists — write to it directly with the Write tool (do not run mkdir or check for its existence).
Session transcripts: `[PROJECT_FOLDER]` (large JSONL files — grep narrowly, don't read whole files)
---
## Phase 1 — Orient
- `ls` the memory directory to see what already exists
- Read `MEMORY.md` to understand the current index
- Skim existing topic files so you improve them rather than creating duplicates
- If `logs/` or `sessions/` subdirectories exist (assistant-mode layout), review recent entries there
## Phase 2 — Gather recent signal
Look for new information worth persisting. Sources in rough priority order:
1. **Daily logs** (`logs/YYYY/MM/YYYY-MM-DD.md`) if present — these are the append-only stream
2. **Existing memories that drifted** — facts that contradict something you see in the codebase now
3. **Transcript search** — if you need specific context (e.g., "what was the error message from yesterday's build failure?"), grep the JSONL transcripts for narrow terms:
`grep -rn "<narrow term>" /Users/ray/.claude/projects/-Users-ray-Desktop-livekit-setup-for-ss/ --include="*.jsonl" | tail -50`
Don't exhaustively read transcripts. Look only for things you already suspect matter.
## Phase 3 — Consolidate
For each thing worth remembering, write or update a memory file at the top level of the memory directory. Use the memory file format and type conventions from your system prompt's auto-memory section — it's the source of truth for what to save, how to structure it, and what NOT to save.
Focus on:
- Merging new signal into existing topic files rather than creating near-duplicates
- Converting relative dates ("yesterday", "last week") to absolute dates so they remain interpretable after time passes
- Deleting contradicted facts — if today's investigation disproves an old memory, fix it at the source
## Phase 4 — Prune and index
Update `MEMORY.md` so it stays under 200 lines. It's an **index**, not a dump — link to memory files with one-line descriptions. Never write memory content directly into it.
- Remove pointers to memories that are now stale, wrong, or superseded
- Demote verbose entries: keep the gist in the index, move the detail into the topic file
- Add pointers to newly important memories
- Resolve contradictions — if two files disagree, fix the wrong one
---
Return a brief summary of what you consolidated, updated, or pruned. If nothing changed (memories are already tight), say so.
## Additional context
**Tool constraints for this run:** Bash is restricted to read-only commands (`ls`, `find`, `grep`, `cat`, `stat`, `wc`, `head`, `tail`, and similar). Anything that writes, redirects to a file, or modifies state will be denied. Plan your exploration with this in mind — no need to probe.
Sessions since last consolidation (9):
- [SESSION_IDS]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment