Skip to main content
Bernstein: An open-source governance layer for AI agents. Chords: Gm9, C13(♭9), Fmaj9/A, F6/9.

"To achieve great things, two things are needed: a plan and not quite enough time." - attributed to Leonard Bernstein

an open-source governance layer for AI agents

CI PyPI Python 3.12+ License OpenSSF Scorecard built with Bernstein

website · docs · deepwiki · install · first run · glossary · limitations · name policy · discord

简体中文 · 繁體中文 · 日本語 · 한국어 · हिन्दी · বাংলা · Русский · Español · Português · Deutsch · Français · Italiano · Nederlands · Polski · Svenska · Suomi · Українська · Türkçe · العربية · עברית · Bahasa Indonesia · Tiếng Việt · ไทย


Status: beta. Solo-maintained, under active development. The version number counts releases, not maturity - minor versions may change interfaces. Pin the version for anything you depend on; regressions get fixed fast, file them.

Bernstein is an open-source governance layer for AI agents. It runs on policy as code: you write the policy - who may do what, what needs approval, what must be recorded - and Bernstein enforces it and produces the verifiable record. A deterministic scheduler - no model in the coordination loop - runs agents in parallel, gates what they produce, and records every step, so a run can be verified after the fact, offline, from the artifacts alone. CLI coding agents work out of the box (Claude Code, Codex, Gemini CLI and others), and the same layer governs any agent workload: the deliverable can be a diff, a research report, a dataset, or an audit evidence pack. Air-gap install profile included. Apache-2.0.

install in 30 seconds

uv tool install bernstein    # or: pipx install bernstein
bernstein demo               # zero-key local run (4 mock tasks); prints project path & run_id
# Inside the printed demo directory, sign and verify your own receipt offline:
openssl genpkey -algorithm ED25519 -out demo.key && openssl pkey -in demo.key -pubout -out demo.pub
bernstein verify run <run_id> --signing-key-path demo.key
bernstein verify receipt .sdd/runs/<run_id>/run-receipt.json --public-key demo.pub

To run against your own repository with an installed CLI agent, run bernstein init, set goal:, cli:, and internal_llm_provider: none in bernstein.yaml, switch to a working branch (git switch -c bernstein/first-run), check bernstein doctor, and run bernstein run --worker backend. Bernstein merges verified changes into the working branch and refuses merge-capable runs from the default branch.

pipx, pip, brew, dnf, npm, and Docker are covered in the install guide; the air-gapped wheelhouse has its own air-gap guide. Operational checks (doctor --json, worktrees sweep, and declaration quarantine) live in the doctor, worktrees, and quarantine guides.

GHCR · GitHub Codespaces

A real bernstein demo run: mock agents fix four seeded bugs, ending on the run's signed receipt verifying offline

The recording above is a real run, and it ships with its own proof. The cast, the signed run receipt derived from that run's journal, and the public key that pins it all live in docs/assets/demo-run/. Verify the committed sample offline (or test tamper detection by editing a copy — bernstein verify receipt exits 2 with TAMPER DETECTED):

bernstein verify receipt docs/assets/demo-run/run-receipt.json \
    --public-key docs/assets/demo-run/run-receipt.pub.pem

The committed receipt can be re-checked at any time with the command above, and a tampered copy fails the same check. scripts/record_demo.sh regenerates the recording, receipt, and key from a fresh real run; nothing inside the terminal is synthesised.

A run in flight is watchable from either operator surface. Both read the same task API, so neither is a lagging mirror of the other. In bernstein live, the left and right columns scroll independently as whole panes, so widgets below the fold remain reachable in shorter terminals. Per-task progress percentages are clamped to 0-100: a task reporting more completed steps than its total, or a negative count, shows 100% or 0% rather than overshooting the bar.

A two-column terminal dashboard - agents with their live logs on the left, the task board on the right - with a full-width activity feed and a cost line underneath A browser dashboard listing sixty-two tasks with eleven running, one of them opened to its working-tree diff
BERNSTEIN_SERVER_URL="<task-server-url>" bernstein live — the terminal dashboard, including remote cluster workers <task-server-url>/ui/ — browser dashboard already served by bernstein run when GUI assets are installed. Use bernstein gui serve only as a standalone server when no run is active on port 8052.

For an authenticated server, set BERNSTEIN_AUTH_TOKEN for bernstein live and /api/v1/* requests, or sign in via the browser login screen. GUI authentication.

at a glance

Five things set it apart; everything after is detail.

  • No LLM in the coordination loop. Scheduling is plain Python, so a run is reproducible end to end. Replay yesterday's plan and get yesterday's task graph.
  • Hardware key evidence. Offline PIV custody and FIDO2 approval verifiers share the receipt protocol, with pinned trust and explicit time. Token custody does not raise TRACE trust levels. See hardware key evidence.
  • Checkable after the fact. The replay journal records every run, and the always-on lineage spine records every lineage-bearing step; the opt-in HMAC-chained audit log (BERNSTEIN_AUDIT=1) adds receipts you verify offline. Non-determinism surfaces as a hash mismatch at the exact step, not a flaky re-run. Non-code deliverables get the same treatment: a task can declare an artifact contract (report, dataset, action log, ops result) and completes on a signed lineage receipt rather than a git commit.
  • Isolated by construction. Each coding task gets its own git worktree behind merge gates; artifact-mode tasks get a working directory under .sdd/workspaces/. Agents share no mutable workspace by default; the only shared state is the task backlog, which is claimed atomically. Stricter filesystem enforcement is opt-in, from the sandbox backends. Disable worktrees and every task runs in the shared checkout.
  • Broad and local. 55 selectable CLI agent adapter names (26 listed below; full catalogue via bernstein adapters list), including the generic --prompt wrapper, file-based state, no SaaS hop, no third-party data plane.

The full list is on the capabilities page; the feature matrix is the exhaustive index.

The task server supports a persistent operator-controlled gate for new task claims; see the guide.

Role-adapter policy supports an optional default allow-list for unlisted roles; see the guide.

what a run looks like

One YAML file declares the run: phases, roles, dependencies, and the conditions under which a node runs at all. The scheduler executes it as plain Python - nothing in the file is a prompt, and no model decides what happens next. This graph produces an audit evidence pack; the full file ships at .bernstein/workflows/audit-evidence-pack.yaml.

name: audit-evidence-pack
version: "1.0.0"

phases:
  - name: scope
    allowed_roles: [manager, architect]
  - name: collect
  - name: validate
    allowed_roles: [qa, security]
  - name: deliver
    allowed_roles: [security, manager]

nodes:
  define-control-inventory:
    phase: scope
    role: architect

  collect-audit-logs:
    phase: collect
    role: security
    depends_on: [define-control-inventory]

  # three more evidence streams collect in parallel:
  # collect-sboms-and-attestations, collect-runbooks-and-policies,
  # collect-eval-results

  assemble-pack:
    phase: validate
    role: docs
    depends_on:
      - collect-audit-logs
      - collect-sboms-and-attestations
      - collect-runbooks-and-policies
      - collect-eval-results

  mock-auditor-pass:
    phase: validate
    role: qa
    depends_on: [assemble-pack]

  remediate-findings:
    phase: collect
    role: docs
    depends_on:
      - source: mock-auditor-pass
        condition: "status == 'failed'"
    retry:
      max_attempts: 3
      until: "status == 'done'"

  sign-and-deliver:
    phase: deliver
    role: security
    depends_on:
      - source: mock-auditor-pass
        condition: "status == 'done'"
flowchart LR
    inv[define-control-inventory] --> logs[collect-audit-logs]
    inv --> sbom[collect-sboms-and-attestations]
    inv --> rb[collect-runbooks-and-policies]
    inv --> ev[collect-eval-results]
    logs --> pack[assemble-pack]
    sbom --> pack
    rb --> pack
    ev --> pack
    pack --> gate{mock-auditor-pass}
    gate -->|failed| fix["remediate-findings (retry x3)"]
    gate -->|done| sign[sign-and-deliver]

Each node is claimed by an agent whose role the phase allows; role fences and approval gates hold no matter what the agent does inside the task. A coding node completes behind merge gates in its own git worktree. The nodes above complete differently: an artifact contract names the deliverable (report, dataset, scan, action log), and the node finishes on a signed lineage receipt instead of a commit. Same scheduler, same journal, same offline verification - whether the graph ships code, research, an ops change, or a mix of all three. Ready-made graphs for software, research, docs, enterprise, and contributor workflows live in .bernstein/scenarios/.

Retries preserve dispatch_tier; reopening a task can explicitly select a tier. See the dispatch-tier contract.

prove a run

Determinism here is something you check, not something you take on faith. Run once with audit enabled, then verify what was recorded:

BERNSTEIN_AUDIT=1 bernstein -g "fix the failing test in tests/test_foo.py"
bernstein replay list                 # run ids recorded on disk
bernstein replay latest --verify      # recompute the journal head, name the first divergent step
bernstein lineage verify <run_id>     # recompute the always-on lineage spine
bernstein audit verify                # HMAC chain + Merkle seal (written because audit was enabled)
bernstein audit diagnose <run_id> --signal gate --sign-key KEY
                                      # name the exact step a failure entered the run, as a signed receipt
bernstein verify run <run_id> --signing-key-path key.pem   # sign one portable run receipt
bernstein verify receipt .sdd/runs/<run_id>/run-receipt.json  # verify it offline: file only

The journal is written on every run; the lineage spine is always on and gains an entry for each lineage-bearing step, so a short run can finish with a valid, empty spine. bernstein audit verify only has a chain to check when the run was started with BERNSTEIN_AUDIT=1, a compliance preset, or bernstein run --audit. The --audit flag belongs to bernstein run; on the bernstein -g form above, set the environment variable.

One run receipt binds the journal head, the lineage-spine head when the run wrote spine entries, and, opt-in, an audit-chain range, under a single Ed25519-signed subject with the public key embedded. A reviewer holding that file and the operator's public key can confirm the embedded actions and chains were not changed: no HMAC key, no live .sdd/, and exit 2 naming the first divergent step on tamper. That receipt identifies the journal state it embeds; proving that state is the complete finished journal additionally requires an independent head/count seal. With the file alone and no --public-key pin, the check is integrity-only — it proves the receipt is internally consistent, not who signed it, and the verdict says so. Details in deterministic replay.

In the web UI, open Governance and use Verify a receipt to check a run receipt with the server. The browser shows the integrity-only verdict and the key source. See the Governance operator guide.

The same checkability applies to evaluation numbers. bernstein bench run <suite> --reliability k (also spelled bernstein eval --reliability k) runs every task k times under fixed coordination, then reports a pass^k floor (all k attempts must pass) alongside the pass@1 ceiling. That result is sealed in a signed receipt which bernstein bench reliability-verify recomputes offline, so a fabricated floor fails verification. Details: pass^k reliability floor.

Use bernstein govern audit --format json or --format sarif for machine-readable findings and --strict --quiet for a CI gate. See govern audit. The cosai evidence pack includes the MCP threat classes from the pinned 2026-01-08 paper and states the remaining coverage gaps.

bernstein delegation verify RUN compares the receipt chain with the final head and hop count sealed in the run manifest with the audit-key HMAC, detecting tail deletion, substitution and post-close growth, including keyless rewrites of the declaration. Removing the declaration leaves the run incomplete (exit 3), never valid. This does not detect replay of an older authentic snapshot or protect against a writer holding the audit key. See the delegation verification workflow.

how it works

Each goal moves through four stages:

  1. Decompose. The manager breaks your goal into tasks with roles, owned files, and completion signals. One LLM call, then plain Python from there.
  2. Spawn. Agents start in isolated git worktrees, one per coding task; an artifact-mode task gets a plain working directory instead. Main branch stays clean.
  3. Verify. The janitor checks concrete signals: tests pass, files exist, lint clean, types correct.
  4. Merge. Verified work lands in main. Failed tasks get retried or routed to a different model.

Why the scheduler is plain Python, and what that trades away: why deterministic.

The cost tracker’s can_spawn() check returns False when corrected cumulative spending reaches or exceeds the configured budget stop threshold, even if no new tokens were reported. After a restart, saved token counts alone cannot reconstruct the exact cumulative cost previously reported for a given agent, task and model.

everyday commands

cd your-project
bernstein init                    # creates .sdd/ workspace, bernstein.yaml + templates/
bernstein -g "Add rate limiting"  # agents spawn, work in parallel, verify, exit
bernstein live                    # watch progress in the TUI dashboard
bernstein run plan.yaml           # multi-stage plan: skip LLM planning, execute directly
bernstein stop                    # graceful shutdown with drain

If a task in a detached SSH run exits with a nonzero code, the task and the run fail. The task receipt records the exit code, and later tasks stay pending.

The full operator surface (PR automation, schedules, chat bridges, the autofix daemon) is in operator commands.

bernstein workflow runs declarative YAML DAGs of agent, command, and loop nodes - with resume support for interrupted runs:

bernstein workflow run idea-to-pr -g "Add JWT auth"   # prints run_id
bernstein workflow resume <run_id> -g "Add JWT auth" # picks up at the first non-completed node

Run state checkpoints to .sdd/runs/<run_id>/ on every node. Resume validates the manifest digest at run start, so a spec change is refused rather than silently executing a different manifest. See workflow manifests. Supply the same -g value again on resume so {goal} is substituted in prompts for unfinished nodes.

bernstein compliance controls lists benchmark suites for each control and shows the latest complete measurement, when available. Benchmark coverage

Repository hygiene gates: bernstein readme-l10n verify fails a PR whose translated READMEs drifted from the English source (naming the stale section), bernstein readme-l10n sync rebinds them after an English edit. See readme-l10n.

supported agents

Claude Code, Codex CLI, Gemini CLI, GitHub Copilot CLI, Cursor, Aider, Goose, Muse Code, OpenAI Agents SDK, Amp, Cody, Continue, Devin Terminal, Junie, Kilo, Kiro, AWS Q Developer, Ollama, OpenCode, OpenHands, Open Interpreter, gptme, Plandex, AIChat, Letta Code, Qwen, and more. The adapter index carries install commands for 30 of them. bernstein integrations list enumerates all 57 wired-in integrations from src/bernstein/adapters/registry.py, the single source of truth for what resolves. 55 of them are selectable agent adapters; the other two rows are the mock test stub and the self-hosted-endpoints endpoint profile. bernstein adapters list prints Selectable CLI agent adapter names: 55. This counts selectable registry names, including the agy/antigravity alias pair and generic; it does not count unique upstream tools or prove that binaries are installed or admitted. Anything else with a --prompt flag works through the generic wrapper.

Mix agents in the same run: cheap local models for boilerplate, heavier cloud models for architecture. bernstein integrations list --installed shows what is available on your machine.

beyond the front page

Everything deep lives on the docs site:

page what it covers
capabilities the full capability list: MCP server mode, signed agent cards, sandbox backends, artifact sinks, regulatory mappings
Agent Manifest export bernstein manifest export-agent · composition-only · agent-manifest==0.12.0
bernstein_create_task POST /api/v1/tasks → bernstein_claim → bernstein_complete
MCP server local stdio server, plus a hosted read-only endpoint at mcp.bernstein.run for receipt verification with no install; questions about this repo can be asked over MCP through DeepWiki
who this is for where the value lands, and where Bernstein is the wrong tool
workflows declarative YAML DAGs of agent / command / loop nodes
web UI browser dashboard with task creation and review on the same API the TUI uses
cluster worker health (bernstein worker) workers pause new task claims while their reported disk space, memory use or mesh latency is outside the configured thresholds
datasources read-only query receipts, plus a query driver that binds each result to the schema snapshot it was derived against
agent catalogs point roles at agent definitions outside the built-in templates - a generic YAML/SKILL.md directory, or a Claude Code plugin-layout tree
integrations what Bernstein bridges to, by the name you call it: SCIM, OIDC, Vault, OPA/Cedar, SPIFFE, OpenTelemetry, MCP, A2A - with what is shipped, what is wired, and what is not planned
companion plugins (bernstein-addons) optional companion plugins (role-pack, sandcastle, brand-gate) installed from source after trying core Bernstein
plugins plugin list and installation instructions
security scorecard, fuzzing, hardening
architecture how it works under the hood

why the name?

Bernstein is named after Leonard Bernstein, the American conductor and composer. The orchestrator coordinates a crew of AI agents the way Bernstein conducted the New York Philharmonic: every player on cue, the score deterministic, the conductor accountable for the result. The conductor metaphor describes Bernstein's orchestration capability for agent workloads that produce code, research reports, or datasets.

Bernstein started as a deterministic harness to prevent nondeterministic merges and unverified state across parallel coding agents. Apache-2.0. Releases and documentation: bernstein.run.

contributing, support, license

PRs welcome; CONTRIBUTING.md has setup and code style. Security reports go through SECURITY.md. Contact: forte@bernstein.run.

Citation metadata lives in CITATION.cff. License: Apache-2.0; the project name is covered separately in TRADEMARKS.md.


Alex Chernysh · GitHub · X · bernstein.run · task notifications

Metadata

Release files for bernstein 4.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bernstein 4.0.1
File Size Uploaded Provenance Actions
bernstein-4.0.1.tar.gz 10.7 MB With provenance Details for bernstein-4.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bernstein 4.0.1
File Interpreter ABI Platform Actions
bernstein-4.0.1-py3-none-any.whl Python 3 none any Details for bernstein-4.0.1-py3-none-any.whl

Total release size: 21.6 MB

Release files / bernstein-4.0.1.tar.gz

Download URL bernstein-4.0.1.tar.gz
Size 10.7 MB
Tags Source
SHA-256 checksum
How to use checksums
a58f2648d21ae97061e3fbb33fc41199e26ba6b080b5f74d3a994e710d8417a4
BLAKE2b-256 checksum
How to use checksums
ba3afcb72319ceb114b5ffb642296dcce428344b51a181e551c67d3d919ff2bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / bernstein-4.0.1-py3-none-any.whl

Download URL bernstein-4.0.1-py3-none-any.whl
Size 10.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
afd33c61052eadcb6003dbc2c6f6fa6e69e129d1f7917b18f87b823e5af95d99
BLAKE2b-256 checksum
How to use checksums
bbb715a0ddd40b3e7d1a9880aaff6abfcb3b5ad742bb54657259f6dc4752d07d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for bernstein 4.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bernstein-4.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

4.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page