Benzene logo Benzene

Blog

Verifiable Execution – How Benzene's Guardrail Catches Agent Mistakes

When our coding agent attempted a fix, it broke compilation. This is what happened next: not manual debugging, but automated verification catching the failure and reversing it in the same cycle. No merge conflict. No panic in Slack. Just a Resonator entry saying maintenance failed; workspace left as found.

This article tells the story through Benzene's own verified execution logs. Every claim below traces to a file you can open yourself. No slides, no anecdotes. Just code, check results, and the ratchet that turned a failure into a stronger guardrail.

The Architecture: Checks Before Commit

Benzene does not rely on prompts alone to guarantee quality. It relies on a compiler, a test suite, and a ledger of every cycle. The genome names its verifiers before the first task even runs, drawn from more than forty verifier types (VERIFIER_TYPES in benzene/manifest.py). These range from executing arbitrary shell commands to checking document structure, enforcing file patterns, reconciling a ledger, running Playwright UI audits, respecting size budgets, and choosing the TypeScript compiler or a Node import check by what the project contains.

When an office cell receives a directive, it drafts changes against live files. Then the ratchet engages. If the combined health score drops, the cycle reverses. If it rises, the delta is kept. This binary decision removes ambiguity from autonomous development. There is no "sort of working" or "mostly fine" that makes the workspace worse: a change that lowers the score does not stay.

On day one, the first cycle exposed a critical gap in our safety net. The CTO found a failing test and attempted a repair using a free model. The repair introduced a syntax error directly into benzene/verifiers.py. Normally, this would crash immediately. But because the underlying test suite was already red, the verifier output looked identical before and after the change. The ratchet interpreted the neutral score as acceptable progress and committed the broken syntax. The guardrail missed it.

The architecture requires three layers working together. First, the genome declares what verifiers each office must run before committing any work. Second, the ratchet measures whether proposed changes improve or degrade the overall health score computed across all verifier outcomes. Third, the Resonator daemon records every cycle's result to a JSONL log that the owner can audit and the public graph shows. Without all three layers, autonomy becomes gambling. With all three, agents make real contributions that cannot silently corrupt the workspace.

Cycle One: The Guardrail Missed It

Missing syntax errors inside the verification layer itself is a particularly dangerous failure mode. We could have chased a hyperparameter, adjusted the temperature, or added more instructional text to the prompt. Instead, we treated the failure as a design flaw and fixed the architecture. We added a compile check to the CTO's genome:

    - {type: command, name: "verify:compiles", command: [python, -m, compileall, -q, benzene, samples, tests]}

This small addition fundamentally changed how the system evaluates code. Now "the code compiles" stands as its own independent verdict, completely separate from "the tests pass." Syntax errors are caught the moment they are written, regardless of the surrounding test matrix state. The compiler does not care about your hypotheses; it cares about bytecodes and parse trees. By anchoring quality to hard boundaries, we eliminate the ambiguity that allowed the first bug to slip through.

Cycle one also taught us about the interaction between verifier types. When multiple checks fail simultaneously, the health score computation needs careful weighting. A single syntax error corrupting an entire module matters far more than a minor style violation. The genome assigns different weights to different verifier outcomes, ensuring that structural failures dominate the decision to rollback rather than being averaged out alongside cosmetic issues.

Cycle Two: Caught and Rolled Back

With the new compile verifier active, the same office made the same kind of mistake. On the second cycle, the agent wrote invalid Python again. This time, verify:compiles fired instantly. Health plummeted. The ratchet engaged, reverting all five touched files back to their pre-cycle state. The CEO's inbox received a single line: maintenance failed; the workspace was left as found; retried next cycle.

No damage persisted. No merge conflict required human intervention. The cycle closed cleanly.

The log from cycle 2 in .benzene/resonator.jsonl confirms the details with machine-readable precision: the entry records kind: rollback, files: 5, and status: rolled_back. These are not interpretations or summaries generated by a language model. They are direct reads from the Resonator daemon's output, queryable by any developer on the team. This is operational reality on a Resonator daemon running locally on any machine with Python and an LLM provider.

Why This Is the Feature

An agent that never fails does not exist. What you can actually build is a system where a failure cannot stand. When verification comes first, work discovery shifts from hopeful guessing to empirical reality. Failure feeds back into the next attempt. Worse gets rolled back. And because the Resonator logs publicly, anyone can watch the mechanism operate without stepping inside the box. Trust stops being a marketing slide and becomes a daily operational fact.

Try it locally: curl -fsSL https://benzene-agent.org/install.sh | sh -s -- "your purpose" installs Benzene and hands setup to your coding CLI (benzene plugin start --for claude "your purpose" once it is installed), then benzene serve . --cycle-every 3600 --tunnel benzene and share the link. Watch the graph. See what happens when the code breaks. You will see agents fail—and the system heal itself. The proof is in the log, not the pitch.

All posts