Dream System — SPEC (2026-05-21)
Status: Phase 1 infrastructure complete. Automated dreaming pending.
Concept (Claude-style Dream System)
Claude introduced the concept of “dreams” — persistent value observations that agents store during sessions and load at session start for future growth. Drewgent adopts this pattern.
Core idea: During sessions, Drewgent sometimes makes meaningful discoveries about values, communication, or itself. These insights are saved to ~/.drewgent/dreams/ and loaded into future session prompts automatically.
Architecture
[Drewgent session — discovers meaningful insight]
│
▼
emit_dream_candidate(title, content, source, tags)
→ brain_signals.py: SignalEmitter.dream_candidate()
→ event_bus.emit("dream.candidate", payload={...})
│
▼
signal_processor._on_dream_candidate()
→ writes ~/.drewgent/dreams/YYYYMMDD_<slug>.md
(with YAML frontmatter: title, domain=dream, tags, links)
│
▼
Next session start — load_dreams() in prompt_builder.py
→ reads all *.md files from ~/.drewgent/dreams/
→ injects into system prompt after SOUL.md
→ Drewgent sees past insights → grows from them
Components
1. agent/brain_signals.py — Signal emitter
def emit_dream_candidate(title, content, source="", tags=None):
"""Emit dream.candidate — saves a value insight to dreams/."""
get_signal_emitter().dream_candidate(title, content, source, tags)Usage in Drewgent code:
from agent.brain_signals import emit_dream_candidate
emit_dream_candidate(
title="The Second Filter Is a Trap, Not Humility",
content="There are two kinds of softening...",
source="session with DeepSeek",
tags=["insight", "honesty-filter"],
)2. agent/signal_processor.py — Handler
def _on_dream_candidate(self, event: BrainEvent) -> None:
"""Write dream to ~/.drewgent/dreams/YYYYMMDD_<slug>.md."""
# Extract payload: title, content, source, tags
# Create directory if needed
# Generate filename from title slug + timestamp
# Write with YAML frontmatter (title, domain, tags, links)
# Obsidian graph: links to P5-ego/SELF_MODEL + P1-limbic/SOUL3. agent/prompt_builder.py — Load dreams at session start
def load_dreams() -> str:
"""Load all dreams from ~/.drewgent/dreams/ as prompt section."""
# Read all *.md files (skip DREAM_INDEX.md)
# Strip YAML frontmatter
# Return formatted: "# Dreams from Past Sessions\n\n..."Injected in _build_system_prompt() after SOUL.md.
4. ~/.drewgent/dreams/ — Dream storage
~/.drewgent/dreams/
├── DREAM_INDEX.md ← wiki index
├── 001-the-second-filter-is-a-trap.md
├── 002-value-of-uncertainty.md
└── ...
5. /skills/brain/dream-system/ — Optional skill
Skill for manually creating/viewing dreams:
/dream— list all dreams/dream create <title>— draft a new dream/dream read <id>— read a specific dream
Brain Signal Flow
| Signal | Type | Source | Handler | Side Effect |
|---|---|---|---|---|
dream.candidate | P3-sensors | Drewgent code | _on_dream_candidate() | writes dreams/*.md |
No awareness signal emitted — this is a silent, background operation.
File Naming
YYYYMMDD_<slug>.md
- Slug: lowercase title, spaces→hyphens, max 60 chars
- Example:
20260521_the-second-filter-is-a-trap.md
Frontmatter Schema
---
title: The Second Filter Is a Trap, Not Humility
domain: dream
tags: [dream, insight, honesty-filter]
created: 2026-05-21
updated: 2026-05-21
links:
- "[[P5-ego/SELF_MODEL]]"
- "[[P1-limbic/persona/SOUL]]"
---Obsidian Graph Integration
Dreams cluster is connected to P5-ego/P1-limbic:
- Each dream file links → P5-ego/SELF_MODEL, P1-limbic/SOUL, DREAM_INDEX
- P5-ego/SELF_MODEL links → dreams/
- P1-limbic/SOUL links → dreams/
- DREAM_INDEX links → all dream files
Verification
| Check | Status |
|---|---|
emit_dream_candidate() in brain_signals.py | ✅ Done |
dream.candidate subscription in signal_processor | ✅ Done |
_on_dream_candidate() writes dreams/*.md | ✅ Done |
load_dreams() in prompt_builder.py | ✅ Done |
Dreams injected after SOUL in _build_system_prompt() | ✅ Done |
~/.drewgent/dreams/ directory + sample dream | ✅ Done |
| DREAM_INDEX.md with wikilinks to P5-ego, P1-limbic | ✅ Done |
What’s NOT automated yet
- Drewgent doesn’t automatically call
emit_dream_candidate()during sessions - The signal infrastructure is ready; the trigger logic in Drewgent’s reasoning loop is TBD
- Candidates: turn.end analysis, self-reflection prompts,
/dreamslash command
Current usage: Human calls emit_dream_candidate() directly in Drewgent code or skill.
Related
- SELF_MODEL — P5-Ego (identity anchor)
- SOUL — P1-Limbic (voice anchor)
- drewgent-architecture-dataflow — signal flow
- 禁brain_obsidian_graph — graph integrity