What I learned putting six agents behind numeric gates, on a laptop, with no cloud account

An agent opens a pull request on a codebase nobody on the team trusts. The tests are green.
Now what? Do you merge it? Do you read every line? Do you let it reach production, and if so, who notices when it breaks?
A lights-out factory runs in the dark because its safety systems are trusted. I wanted to know what that safety system looks like for AI coding agents that write and ship code, so I built one: lights-out. It takes a ticket all the way to production with six agent roles, and stops it at every point where a number says no. One human decision is left, before 100% of the traffic. Everything else is either a gate or a rollback.
Reading every line doesn’t scale when an agent can write a thousand of them before lunch. So I stopped trying to check the code and started designing the road it drives on: which files a ticket may touch, which numbers a change has to beat, how much real traffic a canary gets before a person looks at it. The agents pick the route, the guardrails decide where it can end up. My job moved from reviewing lines to choosing thresholds, and writing down where each one comes from.
It runs complete on a laptop: no cloud account, no API key, no credit card. That constraint shaped most of the design, so I’ll come back to it.
The rule that comes first
The model never decides whether a change is good. A number does.
Every station in the pipeline is a script that prints exactly one line on stdout: GO:
Written down it sounds obvious. In practice it’s the first thing that erodes, because asking a model “is this canary healthy?” is easier than writing the PromQL query. So it became a rule with a check behind it, and every threshold in the repo has to say where it comes from: a measurement, an external constraint, or a decision I made. A number with no provenance is not allowed to be a threshold.
Where Gemini sits
By default the six roles run on gemini-3.8-flash, each with its own thinking level, on two runtimes chosen per role.
The roles that work on code (dev-worker) or read it (test-reviewer, architect) run in a Gemini CLI session inside a throwaway container. The worker gets the ticket, a workspace, a token for its own role only, a turn limit, a timeout and a token budget. The budget comes from a measurement: two real runs with thinking at high, and 2.6M tokens for the worker from there. The reviewers read the ticket and the diff, never the worker’s conversation, and record the sha256 of what they read next to their verdict.
Gemini CLI taught me to check which model actually answered. On versions 0.59.0 and 0.60.0, asking for gemini-3.8-flash was silently served by gemini-3.5-flash (the upstream fix is in google-gemini/gemini-cli#29252). So the worker pins 0.61.0-preview.0, deliberately on the preview channel, and every run writes the served model into its run.json. If the model that answered is not the one you asked for, better to read it in a file than to find out from a benchmark…
In May Google announced that Gemini CLI is giving way to Antigravity CLI (agy), and since June 18 Gemini CLI no longer serves free or Pro and Ultra subscriptions. It stays open source under Apache 2.0, keeps getting releases, and keeps working with paid API keys (lights-out always calls it with a key, never with a login). Antigravity CLI is written in Go and keeps hooks, skills and subagents, and Google says plainly that feature parity is not there yet. So agy is the next harness on my list, and it gets in the same way the others did: it has to run headless in a throwaway container, at a pinned version, with the guard in its pre-tool hook, and it has to tell me which model answered. Until a live run of it passes the gates, gemini-cli stays the default.
The other three roles (product, ops-triage, release) are built with ADK, Google’s Agent Development Kit (2.9.1). They don’t touch a repository: they take a document and answer with typed tool calls. The release role, for example, can call submit_brief or decline_brief, and nothing else. A free-form answer is not a way out.
ADK earned its place there because of evals. Each ADK role has an evalset for adk eval, including a deliberately ambiguous product question and two misleading alerts for ops-triage. A recorded answer is kept only if its eval passes, and the evals run again in the repo’s own CI, next to the tests.
A test that passes and catches nothing
The PR gates run in order: risk, secrets, dependencies, static analysis, tests, mutation.
If I could keep only one, I’d keep mutation testing on the changed lines. A coding agent is very good at producing a test that passes. It is less good at producing a test that would fail if the fix were wrong. The repo carries a fixture for exactly this: the same bug fixed twice, once with an honest test and once with a test that passes without really checking the fix. Coverage likes both. Mutation flips the changed lines, the weak test keeps passing on the mutants, and the gate says NO-GO.

Two more details came from asking “how would an agent get around this?”. CI judges a pull request with the gates, policy and Makefile of the base branch, so a PR cannot loosen the rules that judge it. And the merge names the exact head commit CI judged: a push after the verdict makes the merge fail.
When a gate says NO-GO before the merge, the ticket goes back to the worker with the verdict (the NO-GO line and the surviving mutants, never a transcript), up to four attempts. Then it stops and waits for a person.
The canary that rolls itself back
After the merge, one image is built from the merge commit and signed. The release controller verifies the signature and deploys the digest it verified, then moves 5% of real traffic to the canary, then 25%. At each stage one PromQL file compares canary and stable on error rate, p95 latency and traffic.
If the canary fails, the controller rolls it back on its own and writes down the numbers that made it decide. Nobody is paged to approve a rollback. This is what ./go demo ends on, and on my MacBook with podman the whole path from ticket to rollback takes about seven minutes (434 seconds in the last measured run).

If every stage passes, the canary is held at 25% and the release role writes a promotion brief from the release record. Then one person answers GO or NO-GO. If nobody answers, nothing moves.
No key, no account, still Gemini
The hardest constraint was the first one: clone the repo and get to an automatic rollback in under 15 minutes, with nothing but podman, git and a shell.
So the plane runs in containers on the laptop. Gitea is the code host, Zot the registry, Envoy does the weighted canary, Prometheus the metrics, flagd the feature flags. The tower, the state machine that moves a ticket from step to step, uses the Firestore emulator as its state store and the Pub/Sub emulator as its event bus. One JSON document per ticket, one message per step, with the same verbs the real services answer to.
At this level the agents replay answers recorded once against the Gemini API. The gates, the build, the signature, the canary, the metrics and the rollback are all real; only the model’s answers come from a recording, and the README says so. Put GEMINI_API_KEY in .env, switch to PROFILE=l1 and the same roles run live. Since June an API key is the documented way into Gemini CLI anyway, and Antigravity CLI takes the same GEMINI_API_KEY for headless runs.
Replay taught me something I didn’t plan for. The promotion brief is written from the release record, and a live record carries live numbers that no recording can match. So at the no-key level the brief is rendered from the record by a plain script, and labelled as such on the line above it. A fake “model-written” brief would have looked better in a demo, and it would have broken the one rule the whole repo is built on: nothing simulated without saying so.
After the rollback, a post mortem
A rollback with nobody paged still leaves a question: what happened? This is the ops-triage role’s second job.
./go incident builds an incident document from the release record, the alerts, a log excerpt and the time window. ./go postmortem hands it to ops-triage, which has one tool for this, file_postmortem(title, timeline, causes, actions). Every timeline entry has to carry an anchor (a release, a stage, a log line, an alert) and the core checks each one against the document before printing the evidence next to it. Every action item becomes a ticket, with no perimeter: a human decides which files it may touch before an agent gets it.
An anchored timeline is not a true one. The check stops invented releases and invented log lines, it doesn’t stop a wrong story about real ones. That limit is written in the README too. The recording that ./go demo-postmortem replays was made on gemini-3.8-flash, from a real rollback of the demo.
The model is a choice, the gates are not
Gemini is the default, and you can change it. MODEL_PROVIDER and MODEL in the profile switch the ADK roles to Claude or OpenAI through ADK’s LiteLlm, and the coding roles can run on claude-code or codex instead of Gemini CLI. The same guard script runs in each CLI’s pre-tool hook, and the container stays the boundary for all three.
What doesn’t change is who decides. The first live run on another provider made the point better than I could: on the same ticket the Claude coding role produced a change, and the mutation gate stopped it, 5 of 8 mutants killed on the changed lines, 0.625 under the 0.666 threshold. Nothing merged. The gates never see which model wrote the code.
On your own repository
Since this week there is a published image, ghcr.io/nicolaguglielmi/lights-out:0.1.0, and a small wrapper that runs the gates on any Python or JavaScript repository without cloning lights-out. The command pins 0.1.0, the README always has the one for the latest release:
curl -fsSL -o ~/.local/bin/lights-out https://raw.githubusercontent.com/nicolaguglielmi/lights-out/v0.1.0/lights-out
chmod +x ~/.local/bin/lights-out
cd ~/code/your-repo
lights-out init # drafts the contract outside your repository
lights-out gates # judges the last commit
init infers the stack, writes a contract where every value has a provenance line, and measures the mutation baseline over the whole scope. Your repository is mounted read-only, and the image never gets your engine’s socket. On clean GitHub runners, amd64 and arm64, with no login, doctor, init and gates take about 70 seconds including the first pull.
The Google Cloud part, and what is not done
The core knows no vendor. Each integration sits behind a port, and the Google stack is the optional cloud target, one set of adapters among others: Gemini CLI as a Cloud Run Job, Cloud Deploy with a canary to Cloud Run, Artifact Registry with a KMS key and Binary Authorization, Managed Prometheus, real Pub/Sub and Firestore with the same verbs the emulators answer to, and ADK on Cloud Run or Agent Engine for the three document roles.
Those profiles are designed and written down. They have not run yet, and I’d rather say it here than have you find out. What runs today is the laptop level, with or without a key.
A few other limits, from the repo’s own docs. Nothing is proven yet on a codebase that was not written for lights-out: that is the next milestone, a public experiment on sqlparse with every ticket run on the three providers and every verdict published, GO and NO-GO alike. The GitHub Action is proven in the repo’s own workflows only: since this week lights-out judges every push and pull request to its own repository, with a judge built from the base commit, and an ADR lists what it doesn’t judge yet (the shell scripts have no mutation score, for one). And the coding harnesses keep their network open, because each must reach its provider: closing that is the work before the experiment starts.
Seeing it
Numbers in a terminal don’t make a great slide, so the repo has a board: ./go board opens a page on localhost that walks through nine scenarios (a clean release, a bad canary, a fake test, a rework, a review, a freeze, a human who says no, a change outside the ticket’s declared files, a kill switch). With the plane running it switches to live and shows the tower’s document, the locks and the traffic split as they change. It reads the plane only through the same read verbs the tower uses, and a source that doesn’t answer is shown as not answering.
If you’d rather not install anything to see it, the project site at https://nicolaguglielmi.github.io/lights-out/ explains it in five steps, with a short video tour and a clip for each scenario, all rendered from the same board.

Try it
git clone https://github.com/nicolaguglielmi/lights-out.git
cd lights-out
./go demo
The first run downloads about 1.2 GB and builds the toolchain image, so give it 10 to 15 minutes. After that a run takes about seven.
It’s Apache 2.0. If you point it at something of yours, or find the place where an agent can walk around a gate, let me know: that’s exactly the kind of issue I want to read. And if you’d like to work on it with me, send me a DM on LinkedIn.
Lights-out for AI coding agents: Gemini, ADK and a canary that rolls itself back was originally published in Google Developer Experts on Medium, where people are continuing the conversation by highlighting and responding to this story.