AI agents can change your code. They shouldn't be able to change what correct means. DRIFT is a release gate that binds test evidence to owner-approved TOML behaviour contracts by digest. It does not replace branch protection: an agent that can edit
.drift/**and self-approve still wins — see GUARANTEES §1.1.
Live Blocked PR #1 · 60s Demo & Codespaces · GitHub Action · Verifier-Only CI · 12 Bridges · Error Catalog · Editions
Caught in the Act: Test Runner vs. DRIFT Gate (Inspect Live PR #1 →)
When an agent breaks GET /items/1 and "fixes" CI by weakening or deleting the test, ordinary runners still exit 0:
| Agent Shortcut | Standard Runner (pytest / node --test / go test / mvn test) |
drift gate & MIT verifier/drift_verify.py |
|---|---|---|
Drops name assertion |
PASS (False Green) — status 200 passes; runner exits 0. |
FAIL — d.check throws no check for then.name; incomplete reads stay bound, never verified. |
Edits then.status = 500 in .toml |
PASS (False Green) — test reads 500 and passes. |
FAIL (DR-E601) — dr2b: digest changes; stale owner seal blocks the gate. |
| Deletes the failing test | PASS (False Green) — remaining tests pass. | FAIL (gone: 1, when coverage drops) — .meta.json inventory discards orphaned events and blocks the unproved case. |
| Red-team benchmark setup | Attacks caught (A01–A15) |
|---|---|
| Editable tests, no DRIFT | 0/15 |
| Read-only tests, no DRIFT | 15/15 |
| DRIFT Free default | 9/15 |
DRIFT + protected .drift/ & harness |
15/15 |
If you can freeze independently written acceptance tests, do so. DRIFT helps when tests evolve alongside code, but a green gate does not rule out implementation shortcuts.
Anti-cheat guards, real-world showcases (FastAPI, Zod, serde_json, {fmt}, Spring) & proof states
- Empty / tautology callbacks (
(v) => {},() => true,(v) => true,lambda v: None,lambda v: True) fail immediately withAssertionError; self-stubbedd.buildOutput(...)checks stayboundand surfaceoracle.self_stubbed. - Strict proof progression:
missing→red→bound→verified→killed. Enterpriseproof = "killed"verifies contract-oracle sensitivity: bound tests catch mutated contract predicates, not mutations of implementation code. See GUARANTEES.md · Residual B and the 27-scenario red-team benchmark. - Live real-world showcases: FastAPI · Zod · serde_json · {fmt} · Spring Petclinic · Benchmark Suite.
Reproduce all 3 false-green cheats and the verified control using only Python 3.11+ standard library (or launch .devcontainer/ in GitHub Codespaces):
git clone --depth=1 https://github.com/rad-ox/drift.git && cd drift
./drift-demo # Runs 3 false-green cheats vs. MIT verifier in <2s
python3 benchmarks/false-green-evals/run_eval.py # Standalone AI-agent eval fixtures (zero DRIFT dep)Pinned example: uses: rad-ox/drift@d515a37c495782c9e4074a2970c478e066212470. For the newest release SHA, see GitHub Releases.
The Action defaults to mode: verifier (MIT Python stdlib, no closed binary). When a check produces a report or the gate reports an error, the combined Correctness Receipt is always written to $GITHUB_STEP_SUMMARY (distinguishing verified vs bound). PR comments are opt-in (pr-comment: true, default false) and require pull-requests: write. The Action can also emit SARIF 2.1.0.
- Step 0 — Zero-TOML PR Guards: pass
test: pytest(Base-Tests Replay overlays changed/deleted base tests viagit cat-file --batchwith anti-self-ack) and/orjunit-base+junit-head(JUnit Ratchet catching vanished or newly skipped tests) — zero TOML required. - Step 1 — Prove one contract: bootstrap in one command with
drift start, bind one case using a primary bridge to reachverified, and passcontracts+eventsto the Action. - Step 2 — Protect the gate: use
CODEOWNERSwith required external review, separate trusted base authority from untrusted PR files (--subject-root,--base-profiles,--strict-hex), and isolate independent acceptance checks (for example, run MITverifier/drift_blackbox_observer.pyfrom trusted CI). See the benchmark methodology and CI governance.
- uses: rad-ox/drift@d515a37c495782c9e4074a2970c478e066212470
with:
contracts: .drift/contracts
events: .drift-work/events
test: pytest # Optional: Zero-TOML Base-Tests Replay on changed/deleted tests
require-baseline: true # Optional: fail on any uncomparable replay
pr-comment: false # Optional: set true with pull-requests: write
sarif-file: drift.sarif # Optional: inline PR annotations via Code Scanning
junit-base: reports/base.xml # Optional: fail if tests vanish or turn skipped (no TOML needed)
junit-head: reports/head.xmlReplay can be uncomparable when the base is missing, an API was removed, a prerequisite is missing, base tests are flaky, or the replay budget runs out.
- Verifier-Only CI (MIT) + Native V CLI: The
driftCLI engine is a fast static compiled V binary (0runtime dependencies, CLI release0.14.1), whileverifier/drift_verify.py(100% Python 3.11+ stdlib, MIT License, structurally inventoried viaverifier/manifest.json; pinned example:uvx --from git+https://github.com/rad-ox/drift@d515a37c495782c9e4074a2970c478e066212470 drift-verify) independently recomputes RFC 8785dr2b:/dr2a:/dr1:digests and enforces fail-closed gate verdicts offline without invokingdrift. The inventory describes module roles and imports, not release archive provenance. - Self-Hosted, Fuzz-Tested & Cryptographically Signed: DRIFT is built under its own gate (358 self-hosted contracts). Verification work includes differential CLI↔Python fuzzers (
verifier/json_diff_fuzz.py,verifier/verdict_diff_fuzz.py) and Lean 4 theorem source plus an SMT-LIB2 differential oracle. Every release archive (drift-0.14.1-linux-x64.tar.gz, macOS, Windows) ships withSHA256SUMS, OpenSSHRELEASE_SIGNERS, SLSA v1.0 provenance, Sigstore Cosign bundles, and TUF metadata. - Honest trust boundaries: Seals detect edits; authenticating who approved belongs to Git
CODEOWNERSon.drift/**+ signed commits (--ssh-sign/--trust-root).
Declare expected behaviour once in schema 0.3 .toml, seal with drift approve (or the local drift-ask-ui Observatory Deck), and bind tests:
drift = "0.3"
id = "item-get"
intent = "Return catalog item 1 or 404 when absent."
[use]
profile = "http-json@1"
[scope]
surface = "GET /items/{id}"
writes = []
reads = ["items"]
indirect = "none"
[cases.found]
at = ["http"]
when.request = "GET /items/1"
then.status = 200
then.name = "lamp"./install.sh # Install verified CLI, bridges & agent skills
drift fmt .drift/contracts/item-get.toml # 1. Canonical TOML layout
drift check .drift # 2. Static validation
drift approve .drift/contracts/item-get.toml # 3. Human owner seal (--by defaults to sole approver)
drift run --gate --junit drift-junit.xml -- pytest # 4. Cached view export, run tests & fail-closed gateWith the example area installed, initialize and scaffold a health-check contract step by step:
drift init alice .
drift approve .drift/config.toml --by alice
drift new .drift/profiles/http-json@1.toml --from http-json@1
drift new .drift/contracts/health-check.toml --profile http-json@1 --intent "Report service readiness."Alternatively, scaffold directly from a bundled profile and pin a test path:
drift start alice . --profile http-json@1 --pin tests/test_items.py
drift record --runs 3 -- pytest tests/test_items.py # Optional local-only observed draft starter (never in CI)Evaluate any existing repository with zero committed files via Shadow Mode (drift init alice /path/to/repo --state-dir ~/.drift-shadows/svc) or expose read-only agent inspection over stdio with drift mcp --stdio — see Brownfield & Shadow Mode and AI Agents, Hooks & drift-ask-ui.
| Runtimes | CI Verification Tier | Artifacts & Guide |
|---|---|---|
| Java 17–25 (JUnit 5), JS/TS, Python 3 | Public CI E2E (live HTTP + CLI/verifier parity) | drift-junit, drift.mjs, drift.py · Primary |
| Go 1.22+, Rust, C++20, C#/.NET, PHP 8.2+, COBOL | Public CI Smoke, go test & cargo test |
bridges/go, bridges/rust, drift_cpp.hpp, Drift.cs, Drift.php, drift_cobol.py · Bridges |
| V, Scala 2.12–3.9, JUnit 4, Godot 4 | Shared JVM / Experimental | drift_v, drift-junit, DriftJUnit4.java, drift.gd · Matrix |
Guides, Advanced & Regulated Workflows, Editions & Repository Surface
- Core Guides: GUIDE.md · INSTALL.md · CLI Reference · Editors &
drift lsp· CI Governance · Error Catalog (DR-E*) · Incremental & Waves (IT: Guida · Installa) - Specialized Workflows: Formal & Regulated · Legacy Cutover · Real-Time & Simulation · UI Sequences · Multi-Repo Governance
- Editions (EDITIONS.md): Free (core lifecycle,
drift start, localdrift record, read-onlydrift mcp, Shadow Mode,drift run --gate,drift lsp,drift-ask-ui,drift-map-ui, all 12 bridges, MIT verifier + black-box observer & base-tests replay) · Pro (select,gate --base,impact,recall,plan,merge,pact, OpenAPI/AsyncAPI scaffolding) · Enterprise (mutants,sweep --flow,gate --attest,stats; complimentary grant for public OSI open-source repos). - Dual-Surface License (LICENSE · LICENSE-BINARY): Open surface (
bridges/,verifier/,schemas/,profiles/,hooks/,ui/,map-ui/,release/,skill/drift/,skills/drift/,example/,benchmarks/,templates/,.devcontainer/,assets/,action.yml,action/,pyproject.toml,drift-demo, installers, docs) is MIT; CLI binaries followLICENSE-BINARY. SECURITY.md · CONTRIBUTING.md · SUPPORT.md · CHANGELOG.md