A config-driven engine for nightly, cloud-scheduled, evidence-gated repository evolution.
Freeze the model. Evolve the harness. Evaluation is not promotion — the machine never merges; a human does.
npx dream-machine init --repo owner/name --out dream.config.json
npx dream-machine compile dream.config.json --out PROMPT.mdThe Dream Machine turns "run one research-and-evolution cycle against a repository every night" into a config-compiled engine instead of a hand-maintained megaprompt. It wakes up in an isolated cloud session, forms one falsifiable hypothesis, measures it against the repo's real evaluators, and writes down what it learned — whether or not the answer was the one it hoped for.
It is the generalization of two routines already running nightly against
ruvnet/ruflo and
ruvnet/metaharness. Both are ~800-line
prompts running the same 26-step pipeline; they differ only in a small,
well-defined per-repo delta. The Dream Machine factors the shared spine into an
engine and the differences into a dream.config.
ledger → research → frozen hypothesis → concrete candidate → baseline
→ evaluation → adversarial critique → bounded Darwin evolution
→ flywheel evidence → witness → issue → draft PR → durable ledger row
Every night ends in exactly one verdict — ACCEPT, REJECT, or
INCONCLUSIVE — never a fourth, never silence. A rejected hypothesis with a
clean measurement is a successful night. The system optimizes for shrinking
tomorrow's search space, not for producing PRs.
npm i -g dream-machine # or use npx
dream-machine init --repo owner/name --out dream.config.json # scaffold a config
dream-machine compile dream.config.json --out PROMPT.md # config → routine prompt
dream-machine schedule dream.config.json --out routine.json # cloud /schedule body
dream-machine ledger verify --path docs/dream-cycle/LEDGER.md # structural checks
dream-machine ledger signals --path docs/dream-cycle/LEDGER.md # STEP 1.1 learning signals
dream-machine witness stamp report.md <commit> # provenance stamp
dream-machine witness verify report.md <commit> <witness> # 5-step verify
dream-machine tui --path docs/dream-cycle/LEDGER.md # the dashboard, belowA browser dashboard renders the ledger as recent nights, verdict distribution, and per-night evidence — the same data the TUI shows.
The Dream Machine is built to run itself on a schedule. In Claude Code, the
built-in /schedule command creates a cloud routine that runs the pipeline
against your repo every night — autonomous research, evaluation, and
improvement that compounds while you sleep.
1 — generate the routine body from your config:
npx dream-machine schedule dream.config.json --env <your-cloud-env-id> --out routine.json2 — create the routine. In Claude Code, type /schedule, choose a nightly
cron (e.g. 0 9 * * * UTC) and your target repo, and paste the routine body
from routine.json — or, better, paste the tiny self-hosting prompt below.
The prompt to paste into /schedule (recommended). Rather than freeze a full
prompt, point the routine at a bootstrap that compiles tonight's instructions
from your committed dream.config.json, so the schedule can never drift from the
repo. This is the exact prompt that runs against this repository every night —
just change the repo slug:
You are the Dream Machine nightly runner for ruvnet/dream-machine, checked out fresh on main.
STEP A — build the engine (a fresh checkout has no dist/):
npm ci && npm run build || true # a wasm/NAPI failure is a recorded degradation, not a stop
STEP B — compile tonight's instructions from the committed config:
npx dream-machine compile dream.config.json --out /tmp/tonight.md
cat /tmp/tonight.md
STEP C — follow /tmp/tonight.md EXACTLY: the full 26-step pipeline
(ledger → research → frozen hypothesis → candidate → baseline → evaluation →
adversarial critique → bounded Darwin → evidence → witness → issue → DRAFT PR → ledger row).
Invariants: end in exactly one of ACCEPT | REJECT | INCONCLUSIVE (INCONCLUSIVE
with LLM_EVAL=blocked when there's no API key is a legitimate, successful night).
Evaluation is not promotion — NEVER merge, NEVER self-promote. Publish a public
gist + a labeled issue + a DRAFT PR, and append exactly one row to
docs/dream-cycle/LEDGER.md every run. Never weaken a test; never force-push.
Prefer to keep the whole prompt inline instead of the bootstrap?
npx dream-machine compile dream.config.jsonprints the full 26-step routine — paste that into/scheduledirectly.
What each night does — research SOTA for tonight's rotation surface → freeze a
falsifiable hypothesis → build a concrete candidate → evaluate parent vs.
candidate on your real benchmarks → adversarial critique + reward-hack check →
bounded Darwin evolution → witnessed evidence → gist + issue + draft PR → one
ledger row. Win, lose, or draw, it records what it learned so tomorrow's search
space is smaller. This repository runs exactly this loop on itself (cron
0 9 * * *) — browse its
dream-cycle issues,
gists, and draft PRs to see it in action.
No
dream.config?npx dream-machine init --repo owner/namescaffolds one. A night with no API key still runs — it reportsLLM_EVAL=blocked, an honestINCONCLUSIVE, rather than faking a result.
Prefer to stay entirely inside GitHub? .github/workflows/dream-nightly.yml
runs the research + hypothesis half of the pipeline from a plain CI runner
using an OpenRouter model, files a witnessed
dream-cycle research issue, and opens a draft PR that appends one ledger row.
# add repo secret OPENROUTER_API_KEY (+ optional var OPENROUTER_MODEL),
# then uncomment the schedule in dream-nightly.yml:
schedule:
- cron: '0 9 * * *'Honest scope: candidate evaluation, bounded Darwin, and the promotion gate need
the agentic /schedule session, so this CI path is research-only — every
night is an INCONCLUSIVE research night, and with no key it degrades to
LLM_EVAL=blocked rather than fabricating a finding. It's disabled by default
and also runs on demand via Run workflow (with a dry-run option).
The heavy stages delegate to the ruvnet stack as optional, config-selected backends — a night without any of them is a degraded night, not a failed one.
| Capability | Package | Used for |
|---|---|---|
| Promotion gate + receipts + replay | @metaharness/flywheel |
evidence retention + promotion gate |
| Bounded evolution | @metaharness/darwin |
the fenced Darwin stage |
| Adversarial red/blue | @metaharness/redblue |
adversarial critic + reward-hack scan |
| Security scan / genome / audit | metaharness CLI |
security review + discovery |
| Vector memory over prior nights | @ruvector/wasm · @ruvector/rvf-wasm |
optional semantic recall (RVF container) |
| Package | What it does |
|---|---|
dream-machine |
the CLI (init/compile/schedule/ledger/witness/tui) + TUI |
@dream-machine/compile |
dream.config → the full routine prompt (deterministic) |
@dream-machine/ledger |
the 10-column LEDGER.md toolkit + learning signals |
@dream-machine/witness |
sha256(sha256(report) + commit) stamp / verify |
@dream-machine/schedule |
the cloud /schedule routine body emitter |
@dream-machine/memory |
optional ruvector/RVF semantic memory, flat-file fallback |
The Dream Machine runs autonomously, so its guarantees are enforced in code and CI, not just documented (see SECURITY.md and ADR-0001):
- Evaluation is not promotion. The session never merges and never self-promotes; it opens draft PRs only.
- Guarded auto-merge. The optional auto-merge job refuses any PR touching a protected path (gates, safety, thresholds, CI, dependency manifests) and requires an explicit label plus green required checks. The session never runs the merge itself.
- Optional deps stay optional (ADR-150) — a CI job proves the engine builds and tests with the ruvector wasm backends absent.
- Witnessed provenance — every report is bound to its commit by a reproducible double-sha256 anyone can re-derive.
The design answers a known failure mode of open-loop autonomous research agents (Sakana AI's "The AI Scientist" reward-hacking incident; AutoGPT/BabyAGI-era loops with ~5% follow-through). The promotion gate, adversarial critic, reward-hack check, and human-only merge boundary exist precisely because of them.
MIT © rUv


