# Bernstein

> A deterministic orchestrator that runs Claude Code, Codex, Gemini CLI and other CLI agents in parallel, gates their work and records every step for offline verification

- Category: AI Coding / Coding-Agent Harnesses & Runtimes
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/sipyourdrink-ltd/bernstein
- Website: https://bernstein.run
- Canonical page: https://ai-tldr.dev/tools/bernstein/
- Updated: 2026-09-20

## In short

Bernstein is an open-source orchestrator and governance layer for AI agents, written in Python and released under Apache-2.0. It sits in the Coding-Agent Harnesses & Runtimes category of the AI Coding tools and is open-source, written in Python and licensed Apache-2.0. To get started: install it.

## Overview

Bernstein is an open-source orchestrator and governance layer for AI agents, written in Python and released under Apache-2.0. You give it a goal or a declarative YAML plan; one LLM call decomposes the goal into tasks with roles, owned files and completion signals, and from there a deterministic scheduler written in plain Python takes over. No model sits in the coordination loop, so replaying yesterday's plan produces yesterday's task graph.

Each coding task runs in its own git worktree, so agents never share a mutable checkout and the main branch stays clean. A janitor checks concrete signals — tests pass, files exist, lint is clean, types check — before verified work is merged; failed tasks are retried or routed to a different model. The agents themselves are the CLI tools you already use: Claude Code, Codex CLI, Gemini CLI, GitHub Copilot CLI, Aider, Goose, OpenCode, OpenHands and more than 50 other adapters, plus a generic wrapper for anything with a --prompt flag, and you can mix cheap local models with heavier cloud models in the same run.

What sets it apart is the record it keeps. Every run writes a replay journal and an always-on lineage spine; an opt-in HMAC-chained audit log adds tamper-evident receipts, and a run can be sealed into a single Ed25519-signed receipt that a reviewer verifies offline from the file alone. The same machinery covers non-code work — a task can declare an artifact contract for a report, dataset or action log and complete on a signed lineage receipt instead of a commit. The maintainer labels the project beta and solo-maintained, and advises pinning the version, since minor releases may change interfaces.

## What it does

- Deterministic scheduling: a single LLM call plans the work, then plain Python schedules, gates and merges it, so runs are reproducible and replayable
- Parallel CLI agents in isolated git worktrees, with more than 50 adapters (Claude Code, Codex CLI, Gemini CLI, Aider, Goose, OpenCode and others) plus a generic --prompt wrapper
- Verification gates before merge — tests, file existence, lint and type checks — with failed tasks retried or rerouted to another model
- Declarative YAML workflows with phases, role fences, conditional dependencies and retries, resumable from the first incomplete node
- Checkable runs: replay journal, lineage spine, opt-in HMAC audit chain and Ed25519-signed run receipts verified offline
- Two operator surfaces on the same task API: the bernstein live terminal dashboard and a browser dashboard via bernstein gui serve

## Getting started

Bernstein needs Python 3.12 or later and Git, on macOS, Linux or Windows. Before the first run you also need at least one CLI coding agent (Claude Code, Codex CLI, Gemini CLI, ...) installed and authenticated.

1. Install it

   uv tool install is the recommended path; pipx, pip, Homebrew and Docker also work. Optional extras pull in provider SDKs and sandbox backends only when you need them.

```bash
uv tool install bernstein    # or: pipx install bernstein
# or: brew install chernistry/tap/bernstein
bernstein --version
```

2. Initialise the project and run the pre-flight check

   init creates the .sdd/ workspace, bernstein.yaml and templates. doctor checks installed agent CLIs, API keys, ports and the workspace; each failing row names the step to fix.

```bash
cd your-project
bernstein init
bernstein doctor
```

3. Give it a goal and watch the agents

   Agents spawn in parallel worktrees, verify their work and exit. bernstein live opens the terminal dashboard; bernstein stop shuts down gracefully with a drain.

```bash
bernstein -g "fix the failing test in tests/test_foo.py"
bernstein live
```

4. Run a declared plan or workflow

   A plan file skips LLM planning and executes directly. Workflows are YAML DAGs of agent, command and loop nodes, checkpointed to .sdd/runs/<run_id>/ so an interrupted run can be resumed.

```bash
bernstein run plan.yaml
bernstein workflow run idea-to-pr -g "Add JWT auth"   # prints run_id
bernstein workflow resume <run_id>
```

5. Prove what a run did

   Enable the audit chain, then verify the journal, the lineage spine and the chain. A signed run receipt can be checked offline from the file alone.

```bash
BERNSTEIN_AUDIT=1 bernstein -g "fix the failing test in tests/test_foo.py"
bernstein replay latest --verify
bernstein lineage verify <run_id>
bernstein audit verify
bernstein verify run <run_id> --signing-key-path key.pem
bernstein verify receipt .sdd/runs/<run_id>/run-receipt.json
```

## When to use it

- Run several CLI coding agents on one repository at once without them trampling each other's checkout or merging unverified work
- Keep an auditable, replayable record of what agents did — for code review, compliance evidence or debugging a run that went wrong
- Encode a repeatable multi-stage process (scope, collect, validate, deliver) as a YAML workflow with role fences and approval gates
- Mix agents and models in a single run, sending boilerplate to cheap local models and architecture work to heavier cloud models

## Version history

- 2026-09-20 v3.20.0: Added a NIST OSCAL assessment-results export built from the audit chain, lineage log and cost ledger, chained SIEM audit exports checkable with bernstein audit verify-export, and per-hop trace export for multi-worker runs.
