Read this to unlock 100% of DreamCode's potential. This guide covers everything: architecture, skills, configuration, workflows, and advanced patterns.
- What DreamCode Actually Is
- Architecture Overview
- Installation & Setup
- Configuration Reference
- The 37-Skill System
- Sensor Gate — How Every Prompt Is Classified
- Dream Thinking — The 6-Phase Engine
- Scoring & Enforcement
- Memory System (SQLite FTS5)
- Model Router — 120+ Models
- Checkpoint & Recovery
- Sandbox Mode
- MCP Servers
- VS Code Integration
- Antigravity IDE Integration
- Skill Chains — How Skills Connect
- Automation & Cron Jobs
- Pieces LTM Integration
- NEURO API — External AI Review
- Troubleshooting
- Power User Patterns
DreamCode is a fork of opencode with three major additions:
| System | What It Does | Where It Lives |
|---|---|---|
| MiMo-Code Memory | SQLite FTS5 memory, dream prompts, actor system | packages/opencode/src/memory/ |
| 37-Skill Graph | Dynamic skill selection, model routing, scoring | .opencode/skills/ |
| Native TypeScript Tools | Skills as first-class tools, not external scripts | packages/opencode/src/tool/skill.ts |
The key insight: Skills are TypeScript tools registered in the agent's tool registry. When the agent runs, the sensor gate classifies your prompt, selects skills from the 37-node graph, and executes them as native tool calls.
User Prompt
↓
┌─────────────────────────────────────────┐
│ SENSOR GATE (chain-orchestrator) │
│ - Classify intent │
│ - Select skills from 37-node graph │
│ - Determine chain execution order │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ DREAM THINKING (6 phases) │
│ 1. Research — what do I know? │
│ 2. Ground — what are constraints? │
│ 3. Reflect — contradictions? │
│ 4. Multi-perspective analysis │
│ 5. Propose — innovations with tests │
│ 6. Build — implement chosen approach │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ SKILL CHAIN EXECUTION │
│ core: context-compactor → exhaustive │
│ → neuro → model-router → │
│ code-hardener → lint-fixer → │
│ pieces-ltm → automated-learning │
│ + task-specific skills (security, │
│ testing, debugging, etc.) │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ SCORING + MEMORY CONSOLIDATION │
│ - Record points for actions │
│ - Persist to SQLite FTS5 │
│ - Checkpoint for recovery │
└─────────────────────────────────────────┘
↓
Response
curl -fsSL https://raw.githubusercontent.com/weebcoder101/dreamcode/stable-release/install.sh | bashgit clone https://github.com/weebcoder101/dreamcode.git
cd dreamcode
bun install
bun run build
cd packages/opencode && npm install -g .dreamcode --versioncd <your-project>
dreamcodeDreamCode will:
- Read
.opencode/config from your project - Load the 37-skill graph
- Initialize SQLite memory at
~/.local/share/dreamcode/ - Start the TUI
~/.config/dreamcode/config.yaml
# ─── Core ───────────────────────────────────────
dream_mode: true # Enable 6-phase dream thinking
scoring: true # Enable scoring enforcement
model_router: true # Enable 120+ model routing
# ─── Sandbox ───────────────────────────────────
sandbox: false # Set to true to enable firejail isolation
# OFF by default — you must opt in
# ─── Models ────────────────────────────────────
models:
default: "anthropic/claude-sonnet-4-20250514"
dream: "anthropic/claude-sonnet-4-20250514" # Model for dream thinking
review: "anthropic/claude-sonnet-4-20250514" # Model for code review
# ─── Skills ────────────────────────────────────
skills:
auto_chain: true # Automatically chain skills
max_chain_length: 16 # Max skills in a chain
scoring: true # Track skill execution scores
# ─── Memory ────────────────────────────────────
memory:
backend: "sqlite" # SQLite FTS5 (default)
max_entries: 10000 # Max memory entries
reconcile_interval: 300 # Seconds between reconciliation
# ─── NEURO API ─────────────────────────────────
neuro:
api_key: "${NEURO_API_KEY}" # Set via env var
base_url: "https://api.neurometric.ai/v1"
max_iterations: 10 # Max NEURO review iterations
# ─── Pieces LTM ────────────────────────────────
pieces:
enabled: true # Enable Pieces long-term memory
auto_persist: true # Auto-persist after skill chainsCreate .opencode/opencode.jsonc in your project:
DreamCode has 37 skills organized in 6 categories:
| Skill | Purpose | Chains With |
|---|---|---|
context-compactor |
Compress context before agent reads it | All chains (Phase 0) |
exhaustive-crosscheck |
LTM cursor decomposition → NEURO → hardener | All non-trivial tasks |
neuro |
External AI architecture review (10 iterations) | code-hardener, lint-fixer |
model-router |
Route to optimal model for task | All chains |
code-hardener |
Logic filter, 5 iterations | lint-fixer |
lint-fixer |
Post-implementation quality, 5 loops | pieces-ltm |
pieces-ltm |
Auto-persist to Pieces LTM | automated-learning |
automated-learning |
Self-evolution, routing patches | All chains (final step) |
chain-orchestrator |
Validate dependencies, enforce order | All chains |
guardian-ai |
Safety supervisor, reviews before execution | All chains |
breakthrough-overdrive-innovation |
Dream-like reflection + innovation | neuro, code-hardener |
automation |
Trigger-driven skill pipelines | scheduled-automations |
| Skill | When To Use |
|---|---|
planning |
Multi-step tasks, feature planning |
architecture |
System design, pattern decisions |
quality |
Linting, type checking, coverage |
security |
Auth, secrets, OWASP patterns |
testing |
Test writing, coverage standards |
debugging |
Fault isolation, root cause |
performance |
Profiling, optimization |
| Skill | Language |
|---|---|
python |
Python 3.12+ |
frontend |
React, TailwindCSS, Vite |
react |
React hooks, components |
api |
REST, Flask patterns |
| Skill | Tool |
|---|---|
git |
Branch strategy, commits |
git-feature-workflow |
start/pr/finish lifecycle |
devops |
Docker, CI/CD |
| Skill | Domain |
|---|---|
quantum |
QAE/QAOA, simulator benchmarking |
data |
Pandas, numpy, statistics |
research |
Codebase exploration |
deep-research |
Multi-step web research |
documentation |
Docstrings, README, API docs |
| Skill | Purpose |
|---|---|
communication |
Audience-appropriate explanation |
product |
User needs, prioritization |
refactoring |
Safe restructuring |
onboarding |
Project orientation |
Every prompt passes through the sensor gate (.opencode/skills/chain-orchestrator/scripts/sensor_gate.py).
python .opencode/skills/chain-orchestrator/scripts/sensor_gate.py --prompt "your prompt"[SENSOR] Intent Classification
- intent: <what the user wants>
- domain_tags: <tags>
- risk_level: low|medium|high
- time_sensitivity: low|medium|high
- requires_tools: none|files|git|web
- deliverable_type: answer|plan|patch|doc|multi
[SENSOR] Skill Resolution
- primary: <skill_id>
- supports: <skill_1>, <skill_2>
- mode: TRIVIAL|STANDARD|DEEP|DREAM_INNOVATION
[GUARDIAN] Safety Review
- decision: APPROVED|REJECTED|HUMAN_REQUIRED
- risk_level: low|medium|high|critical
| Level | Auto-Approve? | Action |
|---|---|---|
low |
Yes | Lint, comments, docs |
medium |
Yes (logged) | Features, refactors |
high |
No → Human | Auth, CI config |
critical |
No → Human | Secrets, destructive ops |
The 6-phase engine that runs on every non-trivial prompt:
- Search LTM for prior context
- Search codebase for relevant code
- Search web if needed
- Identify constraints
- Check what must not break
- Verify assumptions
- Find contradictions in the codebase
- Identify non-obvious connections
- Challenge assumptions
- Security perspective
- Performance perspective
- UX perspective
- Architecture perspective
- 3 innovations with hypotheses
- Experiment plans
- Failure modes
- Choose ONE approach
- Implement it
- Verify it works
| Task Type | Dream Depth |
|---|---|
| Trivial (typo, one-line) | Skip |
| Standard (bug fix, feature) | Phases 1-4 |
| Deep (architecture, novel) | All 6 phases |
| Innovation ("think", "innovate") | All 6 + extra research |
DreamCode tracks every action with points:
| Event | Points | Trigger |
|---|---|---|
sensor_gate_run |
+10 | Gate executed |
skill_executed |
+5 | Skill ran successfully |
chain_completed |
+15 | Full chain finished |
test_passed |
+10 | Tests pass |
lint_clean |
+5 | No lint errors |
pieces_persisted |
+5 | Memory saved |
sensor_gate_skipped |
-25 | Gate was skipped |
dream_skipped |
-30 | Dream thinking skipped |
guardian_rejected |
-50 | Safety check failed |
evolution/agent_score.json
cat evolution/agent_score.json | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'Score: {d[\"total\"]}')"DreamCode uses SQLite FTS5 for full-text search memory:
- Every skill chain result is persisted to SQLite
- FTS5 enables fast full-text search across all memories
- Memory reconciliation runs periodically to update indices
~/.local/share/dreamcode/memory.db # SQLite database
.opencode/chain_log.jsonl # Skill execution log
evolution/agent_score.json # Scoring data
.opencode/checkpoints/store.json # Session checkpoints
sqlite3 ~/.local/share/dreamcode/memory.db "SELECT * FROM memories WHERE memories MATCH 'your query' LIMIT 10"The reconcile-ts.ts module walks your .opencode/ directory, extracts tokens from all .md files, and builds a frequency index. This runs automatically every 5 minutes.
DreamCode can route to 120+ specialized models via the NEURO API:
- The sensor gate classifies your prompt
- The model router selects the best model for the task
- The selected model processes the request
- Results are combined
| Domain | Model Type |
|---|---|
| Code generation | Code-specialized models |
| Architecture review | Reasoning models |
| Security audit | Security-trained models |
| Documentation | Language models |
| Quantum | Quantum-specialized models |
# ~/.config/dreamcode/config.yaml
models:
default: "anthropic/claude-sonnet-4-20250514"
dream: "anthropic/claude-sonnet-4-20250514"
review: "anthropic/claude-sonnet-4-20250514"DreamCode auto-saves session checkpoints:
- After every skill chain, a checkpoint is saved
- Checkpoints include: files changed, skills executed, score
- You can resume from any checkpoint
.opencode/checkpoints/store.json
import { loadCheckpoint } from './packages/opencode/src/session/checkpoint-dreamcode'
const cp = loadCheckpoint() // Latest checkpoint
console.log(cp.files_changed, cp.skills_executed, cp.score)50 checkpoints are kept (oldest auto-deleted).
DreamCode runs without sandbox by default. This means:
- Full filesystem access
- Can run any command
- No isolation
# Temporary (this session only)
export DREAMCODE_SANDBOX=on
# Permanent (add to config)
echo "sandbox: true" >> ~/.config/dreamcode/config.yamlWhen enabled, commands run inside firejail:
- Filesystem isolation (only project dir accessible)
- Network isolation (no internet unless allowed)
- Process isolation (can't see other processes)
dreamcode --sandbox-statusWhen you enable sandbox, DreamCode will warn you:
- What isolation is active
- What access is restricted
- How to disable it
You must explicitly acknowledge the warning before sandbox activates.
DreamCode supports MCP (Model Context Protocol) servers:
| Server | Purpose | Status |
|---|---|---|
github |
GitHub API | Enabled |
filesystem |
File access | Enabled |
pieces-ltm |
Long-term memory | Enabled |
youtube-transcript |
Video transcripts | Enabled |
playwright |
Browser automation | Disabled |
supabase |
Database | Disabled |
Edit .opencode/opencode.jsonc:
{
"mcp": {
"github": { "enabled": true },
"pieces-ltm": { "enabled": true },
"playwright": { "enabled": false }
}
}{
"mcp": {
"my-server": {
"command": "node",
"args": ["path/to/server.js"],
"env": { "API_KEY": "your-key" }
}
}
}Create .vscode/extensions.json:
{
"recommendations": [
"opencode.opencode-vscode",
"ms-vscode.vscode-typescript-next",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"bradlc.vscode-tailwindcss",
"ms-python.python",
"ms-toolsai.jupyter"
]
}Create .vscode/settings.json:
{
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"files.exclude": {
"**/.opencode/checkpoints": true,
"**/evolution": true,
"**/node_modules": true
}
}Create .vscode/tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "DreamCode: Build",
"type": "shell",
"command": "bun run build",
"options": { "cwd": "${workspaceFolder}/packages/opencode" },
"group": "build"
},
{
"label": "DreamCode: Dev",
"type": "shell",
"command": "bun run dev",
"options": { "cwd": "${workspaceFolder}" },
"group": "build"
},
{
"label": "DreamCode: Test",
"type": "shell",
"command": "bun test",
"options": { "cwd": "${workspaceFolder}/packages/opencode" },
"group": "test"
},
{
"label": "DreamCode: Sensor Gate",
"type": "shell",
"command": "python .opencode/skills/chain-orchestrator/scripts/sensor_gate.py --prompt '${input:prompt}'",
"problemMatcher": []
}
],
"inputs": [
{
"id": "prompt",
"type": "promptString",
"description": "Enter prompt for sensor gate"
}
]
}Create .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "DreamCode: Debug",
"type": "node",
"request": "launch",
"runtimeExecutable": "bun",
"args": ["run", "--conditions=browser", "src/index.ts"],
"cwd": "${workspaceFolder}/packages/opencode",
"console": "integratedTerminal"
}
]
}Create .vscode/keybindings.json:
[
{
"key": "ctrl+shift+d",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "dreamcode\n" }
}
]DreamCode is designed to work with Antigravity IDE:
- Install Antigravity IDE
- Open your DreamCode project
- Antigravity will auto-detect
.opencode/config
| Feature | How To Use |
|---|---|
| Skill execution | Ctrl+Shift+P → "DreamCode: Run Skill" |
| Sensor gate | Ctrl+Shift+P → "DreamCode: Sensor Gate" |
| Dream thinking | Ctrl+Shift+P → "DreamCode: Dream" |
| Score view | Ctrl+Shift+P → "DreamCode: Show Score" |
Create .antigravity/config.json:
{
"dreamcode": {
"enabled": true,
"sandbox": false,
"dream_mode": true,
"scoring": true,
"model_router": true,
"skills": {
"auto_chain": true,
"max_chain_length": 16
}
}
}- Open project in Antigravity
- Type prompt in the agent panel
- Sensor gate classifies intent automatically
- Dream thinking analyzes the problem
- Skill chain executes selected skills
- Scoring records points
- Memory persists results to LTM
Skills are connected in chains. Here are the common patterns:
context-compactor → exhaustive-crosscheck → neuro → model-router →
code-hardener → lint-fixer → pieces-ltm → automated-learning
debugging → testing → quality
security → code-hardener → quality
planning → architecture → code-hardener → testing → quality
deep-research → research → documentation
breakthrough-overdrive-innovation → neuro → code-hardener → lint-fixer
| Prompt Pattern | Chain Triggered |
|---|---|
| "fix the bug in..." | debugging → testing → quality |
| "add security to..." | security → code-hardener |
| "optimize the..." | performance → quality |
| "refactor the..." | refactoring → code-hardener → quality |
| "document the..." | documentation → communication |
| "think about..." | breakthrough-overdrive-innovation |
| "research..." | deep-research → research |
| Job | Schedule | What It Does |
|---|---|---|
nightshift-full |
Daily 10 PM | Full codebase improvement |
nightly-audit |
Daily 2 AM | Security + quality audit |
self-improve |
Daily 3 AM | Review past runs, update AGENTS.md |
codebase-health |
Daily 6 AM | Tests + lint + type check |
weekly-deps |
Monday 9 AM | Check outdated deps |
python3 .opencode/skills/scheduled-automations/scripts/scheduler.py add my-job \
--schedule "0 9 * * 1" \
--chain "security → quality → neuro" \
--prompt "Weekly security audit"python3 .opencode/skills/scheduled-automations/scripts/scheduler.py run my-jobpython3 .opencode/skills/scheduled-automations/scripts/scheduler.py listDreamCode integrates with Pieces for long-term memory:
- Every skill chain result
- Architecture decisions
- Bug fixes and their context
- Test results
- Security reviews
# Via MCP tool
pieces_search_memory --query "authentication" --time_ranges '[{"from": "2026-01-01", "to": "2026-12-31"}]'
# Via annotations
pieces_annotations_full_text_search --query "security audit"# Primary (opencode runtime): PiecesLTM.Service.persist({ ... })
# Fallback: python3 .opencode/skills/pieces-ltm/scripts/pieces_persist.py persist \
--chain "neuro → code-hardener" \
--task "Fixed authentication bug" \
--outcome success \
--files "src/auth.ts" \
--decisions "Added rate limiting"DreamCode works best with NEURO — and it's completely free.
The NEURO API gives DreamCode access to 120+ specialized AI models for domain-specific analysis, multi-perspective review, and architectural guidance.
- Visit neurometric.ai and sign up for a free account
- Copy your API key from the dashboard
- Set it in your environment:
export NEURO_API_KEY="your-key"Or add it to .env.secret (DO NOT COMMIT):
echo 'NEURO_API_KEY=your-key' >> .env.secret
set -a; source .env.secret; set +a- The model router selects the best model for your task
- The NEURO API routes to that model
- Results are combined with local analysis
For complex tasks, NEURO runs up to 10 iterations:
- Iteration 1-3: Initial analysis
- Iteration 4-6: Deep review
- Iteration 7-9: Edge cases
- Iteration 10: Final synthesis
| Feature | Without NEURO | With NEURO |
|---|---|---|
| Model routing | Local fallback only | 120+ specialized models |
| Review iterations | 1-2 local passes | Up to 10 NEURO iterations |
| Architecture review | Basic | Multi-perspective analysis |
| Edge case detection | Limited | Comprehensive |
| Cost | Free | Free |
# Trivial tasks skip NEURO automatically
# To force skip:
dreamcode --no-neurocd packages/opencode
bun run buildThis is expected if sandbox is off (default). To enable:
sudo apt-get install -y firejail
export DREAMCODE_SANDBOX=onsudo apt-get install -y unzipCheck packages/opencode/src/tool/registry.ts line 107:
const skilltool = yield* SkillToolexport PATH="$HOME/.bun/bin:$PATH"
# Or reinstall:
cd packages/opencode && npm install -g .DreamCode falls back to local analysis. Set the API key:
export NEURO_API_KEY="your-key"Check SQLite database:
ls -la ~/.local/share/dreamcode/memory.dbdreamcode --prompt "run full security audit on this codebase"This triggers: security → code-hardener → quality → neuro
dreamcode --prompt "think about how to optimize the database layer"This triggers: breakthrough-overdrive-innovation → neuro → code-hardener
dreamcode --prompt "research best practices for Flask rate limiting, then implement"This triggers: deep-research → neuro → code-hardener → testing
# Let DreamCode improve your codebase overnight
python3 .opencode/skills/scheduled-automations/scripts/scheduler.py run nightshift-full# View your score
cat evolution/agent_score.json | python3 -m json.tool
# View chain log
tail -20 .opencode/chain_log.jsonl# Run specific skills
dreamcode --skills "security,testing,quality" --prompt "audit this function"# List checkpoints
cat .opencode/checkpoints/store.json | python3 -m json.tool
# Resume from checkpoint
dreamcode --resume <checkpoint-id>┌─────────────────────────────────────────────────────────┐
│ DreamCode Cheat Sheet │
├─────────────────────────────────────────────────────────┤
│ │
│ INSTALL │
│ curl -fsSL https://raw.githubusercontent.com/ │
│ weebcoder101/dreamcode/stable-release/install.sh | bash │
│ │
│ RUN │
│ cd <project> && dreamcode │
│ │
│ CONFIG │
│ ~/.config/dreamcode/config.yaml │
│ │
│ SANDBOX │
│ OFF by default │
│ export DREAMCODE_SANDBOX=on │
│ │
│ SKILLS (37) │
│ META: 12 skills (always available) │
│ CORE: 7 skills (code changes) │
│ LANG: 4 skills (language-specific) │
│ TOOL: 3 skills (git, devops) │
│ SPEC: 5 skills (domain-specific) │
│ SOFT: 4 skills (cross-cutting) │
│ │
│ CHAINS │
│ Bug: debugging → testing → quality │
│ Security: security → code-hardener → quality │
│ Feature: planning → architecture → testing │
│ Research: deep-research → neuro → code-hardener │
│ Full: context-compactor → exhaustive → neuro → │
│ model-router → code-hardener → lint-fixer → │
│ pieces-ltm → automated-learning │
│ │
│ SCORING │
│ +10 sensor gate +5 skill +15 chain +10 test │
│ -25 gate skipped -30 dream skipped -50 rejected │
│ │
│ FILES │
│ Config: ~/.config/dreamcode/config.yaml │
│ Memory: ~/.local/share/dreamcode/memory.db │
│ Checkpoints: .opencode/checkpoints/store.json │
│ Scores: evolution/agent_score.json │
│ Chain log: .opencode/chain_log.jsonl │
│ │
└─────────────────────────────────────────────────────────┘
Built with dream thinking. Ship with confidence.
{ "$schema": "https://opencode.ai/config.json", "provider": {}, "permission": {}, "mcp": {}, "tools": { "github-triage": false } }