GitHub - DreamLab-AI/dream-engine: Evidence-gated nightly repository evolution: manifest freeze, pure gate, protected-path guard, pairwise selection. Rust, MIT OR Apache-2.0. · GitHub
Skip to content

About

Evidence-gated nightly repository evolution: manifest freeze, pure gate, protected-path guard, pairwise selection. Rust, MIT OR Apache-2.0.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

dream-engine

Measured repository improvement, with a deterministic acceptance gate

Licence Rust crates.io crates.io Status

Compare a proposed patch against its baseline using the repository’s own evaluators.

Start · Workflow · Crates · Status · Docs


What is dream-engine?

dream-engine is a Rust library workspace and offline command line for evidence-gated repository improvement. A host freezes an experiment, asks a model for a patch and evaluates the baseline and candidate on the same testbed. The gate returns a verdict from measured evidence without calling a model. The host owns scheduling, model access, notifications and publication.

Use it to build nightly maintenance, compare candidate implementations, replay an experiment or enforce protected paths before applying a patch. An accepted result can become a draft pull request. Acceptance does not establish deployment readiness: that depends on the evaluators you configured and the behaviour they cover.

The design is deliberately cautious about what counts as evidence. An evaluator that is missing, silent, blocked, timed out or failing vetoes the change. A broken testbed is reported as BLOCKED-ENV, which is a different verdict from a bad patch, so infrastructure trouble is never read as a verdict on the model. A candidate may not touch the files that decide whether it passes (ADR-DE-003).

How a night runs

sequenceDiagram
    participant H as Host driver
    participant S as Source reader
    participant M as Model adapter
    participant E as Evaluator runner
    participant G as Pure gate
    participant F as Forge adapter
    H->>H: Freeze manifest and experiment identity
    H->>E: Evaluate baseline
    H->>S: Read tracked source at the selected revision
    S-->>H: Bounded source packet and refusal record
    H->>M: Request one candidate patch
    M-->>H: Patch
    H->>H: Check protected paths before applying
    H->>E: Evaluate candidate on the same testbed
    H->>G: Paired results and bound receipts
    G-->>H: ACCEPT / REJECT / INCONCLUSIVE / BLOCKED-ENV
    opt Accepted and publication configured
        H->>F: Publish through the configured policy
    end
Loading

The engine freezes an experiment manifest (baseline revision, tree hash, the sha256 of each evaluator command, model identity and a digest of the config) atomically before any model call. The run id is a pure function of that manifest, so a restart resumes the same experiment, and a baseline that has diverged is archived rather than overwritten. It then evaluates the baseline, calls the model once, applies the patch, evaluates the candidate on the same testbed, and gates the pair. A run moves through ManifestFrozen, BaselineEvaluated, ModelCalled, CandidateEvaluated, Gated, Persisted and Complete. A finished night is terminal: a restart or a changed HEAD never repeats it (ADR-DE-007). The gate returns ACCEPT, REJECT, INCONCLUSIVE or BLOCKED-ENV. The full account is in docs/concepts.md.

Crates

Crate What it does
pairwise-gate Selection policies over paired candidate and baseline results: Margin, Floor, SignTest, WilsonLower, NoRegression, TrainDev. Faults never count as losses.
failure-fingerprint A 16-hex-character SHA-256 identity for a failure mode, and a New / Persisting / Fixed classification across steps.
dream-gate The pure gate: manifest freezing, typed evaluator receipts, the protected-path guard, config-digest binding and the veto classes that turn evidence into a verdict.
dream-core Evaluator runners, the candidate worktree (guard before apply), the ledger and its signals, per-test output parsers, harness-stall and dry-streak tracking, replay, source reading, night idempotency, automerge policy and the five seams (Llm, MemorySink, EvaluatorRunner, Notifier, Forge). The nightly driver that sequences them belongs to the host.
dream-cli The dream command: offline checks (validate, ledger verify, witness, replay verify, guard check). No network, no model.

The statistics are checked against reference values computed independently in exact arithmetic: nine wins out of ten gives an exact one-sided binomial p of 11/1024, and a Wilson lower bound for eight of ten at z = 1.96 is 0.4902.

Quickstart

Add a library:

cargo add pairwise-gate
cargo add failure-fingerprint

Install the command line and run its checks in a clone:

cargo install dream-cli          # installs the `dream` binary
git clone https://github.com/DreamLab-AI/dream-engine
cd dream-engine
dream validate                   # checks ./dream.config.json
dream guard check --patch my.diff --config dream.config.json
dream witness stamp --report README.md --commit "$(git rev-parse HEAD)"

dream guard check exits 0 when the patch is clear, 1 when it touches a protected path and 2 when it could not run. dream replay verify RUN_DIR re-judges a recorded night and dream ledger verify PATH checks a ledger. There is no dream run: the nightly driver is the host's, built from dream-core.

To build and test from source:

cargo test --workspace --locked

Configuration for a Rust repository is in docs/guide/configuring-a-repo.md.

Working status

Reviewed 21 October 2026 against source 64e8324. The workspace declares version 0.2.0; individual crate versions and consumer pins are separate. Use the crate manifests and your host's lockfile when choosing an API version. This review did not run a live model-to-GitHub experiment.

The 0.2.0 source-reading API adds GatherInput::with_requested: requested files are selected before planner picks and evidence-mentioned paths. Requests can reserve at most half the file slots and half the rendered byte budget. The reader checks them against the tracked tree and denylist and records honoured and refused requests. The host stores and expires requests; the library does not interpret last night's report or ask an operator for files. See ADR-DE-008 and source.rs.

Integration boundaries and unfinished behaviour

What is not here yet: the nightly driver itself (a host supplies it by implementing the seams), TrainDev with held-out dev evaluators wired into the nightly path, and post-publish recheck with ledger-driven rollback. The forge step of automerge is unit-tested against a stub but has not been exercised against real GitHub, and dream_core::persist::publish is the only entry point that applies the automerge policy: a host that opens its pull requests through Forge::publish_draft directly never merges anything, whatever autoMerge says.

A finished night is terminal, but publishing is not an exactly-once distributed transaction: crash recovery does not reconcile every external forge outcome. Read ADR-DE-007 before designing retry policy.

Where it sits in VisionFlow

VisionFlow documents the estate's self-improvement loop. This repository owns the reusable, permissively licensed gate and execution components. Agentbox owns its product-specific host and AGPL integration with identity, relay and notification services. A source pin or published crate does not establish that a running host has been rebuilt with it.

This is an independent Rust implementation. The former TypeScript tracking fork is historical lineage; it is not this workspace's implementation or release identity.

Documentation

docs/README.md is the index. The decisions are in docs/adr/. If you are coming from the TypeScript fork, start with the migration note. A comparison with a related system is in docs/COMPARISON.md.

Origin and credit

The nightly, evidence-gated, config-driven design descends from ruvnet/dream-machine by rUv. This repository is an independent Rust implementation of that design lineage. No source text from that project is copied. Its MIT licence is reproduced in NOTICE as credit and as a precaution.

Licence

MIT OR Apache-2.0, at your option: LICENSE-MIT and LICENSE-APACHE. The adapter that connects the engine to a private forum and Nostr deployment is AGPL-3.0-only, lives in the product that consumes the engine, and is not part of this repository (ADR-DE-002).

Diagram corpus (citation-verified, with a register of tensions and debt): docs/diagrams.

About

Evidence-gated nightly repository evolution: manifest freeze, pure gate, protected-path guard, pairwise selection. Rust, MIT OR Apache-2.0.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages