What is Refactron?
Refactron is the verification layer for AI code change. As agents write more of your code, the bottleneck moves from generating changes to trusting them. Refactron is the deterministic gate that answers one question about any diff (your AI agent’s, a codemod’s, or your own):Did this change preserve behavior, and can you prove it?It applies the change in an isolated shadow tree, runs three gates against it (syntax, then imports, then your real test suite) and checks whether your tests actually exercise the lines that changed. It returns one of three verdicts. Your working tree is never touched.
A diff enters, the gates run in an isolated shadow tree, and one of three verdicts comes out.
The three-way verdict
SAFE
Every gate passed and your tests exercised every changed statement they could reach. Proven
safe.
UNSAFE
A gate failed: the change broke something. Exit
1.UNPROVEN
Tests pass, but the changed code isn’t exercised, so it isn’t proven.
UNPROVEN is the verdict that makes the other two trustworthy. “Tests pass” is not the same as “this change is proven safe”: if nothing runs the lines you changed, a green suite proves nothing about them. Most tools hand-wave this. Refactron says it out loud and tells you which test to add. See Verdicts for the full model.
Verify your first change
Install the CLI andlogin first (both are in the quickstart; an unauthenticated run exits 7):
Where it plugs in
verify-diff (CLI + CI)
Verify a diff from the command line or as a CI merge gate.
UNSAFE fails the build.MCP server
A
verify_change tool your AI agent calls before it lands a change.Verdicts
SAFE, UNSAFE, UNPROVEN: coverage fusion and the Python-only limitation, in depth.
Deterministic, on purpose
The verification engine is 100% deterministic: no model, no temperature, no statistical inference decides whether your change is safe. Read the same repo state and the same diff twice, get the same verdict. That determinism is exactly what makes Refactron the gate an LLM agent can call: the agent proposes, Refactron proves. See Deterministic by design.Next steps
Quickstart
Install from npm and verify your first diff end to end.
Safety model
The shadow tree, the three gates, and the atomic-write contract.