Sanvio Factory

The model is the engine. The factory is what makes it safe to leave running.

Sanvio Labs runs on a factory of AI agents: issues go in, reviewed pull requests come out, and a person decides what merges. Sanvio Factory is the smallest version of it we'd trust, and it's free.

Harness and factory

A harness is what a company knows, written down where every agent has to read it: the rules, the procedures it follows, the checks that stop it, and the other agents it hands work to.

Claude Code, Codex and Kiro are all good out of the box. What a client pays for is the same good result on Tuesday as on Monday. The agent that wrote the code last week isn't the agent working on it today, and nothing it knew comes along unless you write it down somewhere it has to read. The harness is where that gets written down and enforced.

You ask a coding agent to fix a bug. On its own it commits a .env file and the mistake lands in your repo. Then the harness appears around it: instructions it reads, steps it follows, a second reader, and checks that stop it. The same request again: the hook blocks the .env, the agent fixes it, the reader and the checks agree, and only then does it land.
The same request, without a harness and then with one.

A factory is the line a company runs on that harness. Tickets go in, reviewed pull requests come out, and every phase ends at a gate. It's what turns many runs into work you can review.

You label an issue for the loop. A fresh agent plans it, another builds it in a checkout of its own and runs the tests, and a second agent reviews the change. If the tests fail or the review asks for a fix, it goes back to the build with what went wrong. When both pass, the loop opens a pull request and stops. You decide whether it merges.

The loop takes issue #12 through five steps. Discover picks the loop-ready issue and writes the ticket. Shape: a fresh agent writes the plan. Build: another fresh agent makes the change in a worktree outside the clone. Validate: the tests run and a second agent reads the diff; round 1 fails with review FIX, so it goes back to Build. Round 2 passes the tests and the review says PASS. Scale opens a pull request that closes #12 and doesn't merge it, and what went wrong goes to lessons.md.
One issue through the loop, to a pull request a person merges.

What's in Sanvio Factory

Six pieces, plus worked examples: drafting client proposals, because a proposal is where the cheap mistakes live, and a small code project the loop can test. The rules, skills and gates work with Claude Code, Codex and Kiro; the guard needs Claude Code. It needs Python 3.9 and no packages.

Standing rules

One file every session reads first: what the agent may do, what it never does, and what counts as done.

Skills

Named procedures with inputs, steps and an output. The agent follows one when a request matches it.

Gates

Scripts that fail when work isn't ready. The agent runs one, fixes what it names, and runs it again. Git runs them again at every commit, with a secret check.

The guard

Checks every tool call before it runs. Credential files are refused, and anything that would send or delete asks you first.

A review agent

A second reader in a fresh context. It reports what is unclear or over-promised and never edits.

The loop

Takes an issue labelled for it to a pull request: plan, build, test, review, and back again if anything failed. It never merges.

Two smaller loops that do most of the work

The first runs inside a session. The gate fails, the agent fixes what it names, and the gate runs again. Then git runs it at commit and CI on every pull request, so it doesn't depend on the agent's good intentions.

A change goes edit, test, hook. The hook blocks a committed .env, the change goes back to edit, and on the second pass it clears the hook, CI, review and a human merge.
Fix and recheck.

The second runs across sessions. When the agent gets something wrong, the correction goes into the file that governs that behaviour, dated, with the reason. If you only said it out loud, the next session never heard it.

In session 1 the agent pushes to main. You say learn from that, and the rule is written into AGENTS.md with the date. Session 2 starts with fresh context, reads AGENTS.md, and opens a pull request instead.
Mistake to rule.

Set it up

git clone https://github.com/SanvioLabs/sanvio-factory my-factory
cd my-factory
git config core.hooksPath .githooks
python3 scripts/check_setup.py

Don't skip the third line. Git only runs the hook if you point it there, and the setting doesn't survive a clone. Skip it and every check in the hook does nothing, and nothing tells you. Already have your own setup? Run git config core.hooksPath in your clone. If it prints nothing, your hooks aren't running either.

Make your own private copy before any company material goes in.

Where it goes: a factory per client

The goal is a factory that runs itself, 100% autonomous. It isn't there yet.

Inside every factory there's a flywheel, and it's how the factory recognises its own mistakes. Each turn ends at a gate, and what it learned goes into the rules for the next turn.

Five phases on a wheel: Discover, Shape, Build, Validate, Scale. Each gate between them lights as the work passes and shows the question it asks, and the last gate starts turn two.
The flywheel: each turn ends at a gate, and what it learned starts the next one.

Each client gets their own factory, in their own repo, with their gates, their rules and their tests. And one factory can feed another. Sanvio Factory came out of ours, and it's what a new one starts from. What passes between them is the method and the rules, never the material: one client's code and data stay in that client's factory.

Getting to 100% doesn't mean taking the person out on faith. You decide which steps wait for sign-off and which run on their own, and most teams start with every step gated. Today a person still signs off on a run that stops and asks, a production change real users would feel, and anything that leaves the company. Each of those is a gate that hasn't earned trust yet. When a gate proves it catches what the person would have caught, the person steps back from that point.

The full story is on Substack: what broke, what each failure turned into, and the numbers.

Why it's free

We want you building the way we can build, quickly. AI is moving fast enough that the newest working methods have to be shared, or the people without them fall behind. And we'd like some of the people who pick it up to become people we work with.

It's MIT. We're asking for one thing the licence doesn't: if you build on it, keep the line in each file that says where it came from, and link back to it when you write about it. Then tell us what you built. We'd like to see it.

AI Engineering Enablement

Sanvio Factory gets you the shape. We build the one for your codebase.

Your rules, skills and gates in a repo your developers check out, review and release agents built for your code rather than pulled off a shelf, and the same checks running on every pull request. You decide which steps wait for sign-off. We build it with your engineers and stay on while they run it. They own it when we step back.