verify_change. An agent proposes an edit, calls verify_change, and gets back a SAFE / UNSAFE / UNPROVEN verdict with a reproducible report, before it writes anything to your repo.
This is how Refactron fits an agentic workflow: it isn’t a competing code generator, it’s the deterministic gate the generator calls to check its own work.
An agent proposes a change, calls verify_change, and decides whether to land it based on the verdict.
Install (from source)
Prerequisites: Node.js ≥ 18, and for a coverage-backedSAFE verdict, Python 3.8+ with pytest and coverage.py (the same prerequisites as the quickstart).
The MCP server is unreleased; it is not in
refactron@0.2.4 on npm. Build from source until
the next release, which ships a refactron-mcp bin.dist/mcp/server.js. It speaks MCP over stdio and registers itself under the name refactron.
Register it with your client
For Claude Code:node <repo>/dist/mcp/server.js as a stdio server. Use an absolute path; the server resolves your repo from the tool arguments, not its own working directory.
The verify_change tool
Verify a proposed change and get the verdict. The change is supplied as either full-file contents or a unified diff; one of the two is required.
The tool returns the verification report as JSON text content: the same structure
verify-diff --json prints:
verdict and decides: land on SAFE, stop on UNSAFE, and on UNPROVEN either add the test named in missingTests or ask a human.
What it does and doesn’t do
- Runs entirely local. The verification happens on your machine, in a shadow tree. Nothing about your code leaves it.
- Never mutates your repo.
verify_changereads your tree and applies the change in an isolated copy. Landing the change is the agent’s job, after a verdict it trusts. - Deterministic. The same repo state and the same diff produce the same verdict every time.
The
verify-diff CLI is auth-gated (refactron login, or REFACTRON_TOKEN in CI;
unauthenticated exits 7). The MCP verify_change handler runs the same local verification
engine directly and makes no network calls.Next
Verdicts
What SAFE, UNSAFE, and UNPROVEN mean, and how coverage fuses in.
Verify a diff (CLI)
The same engine from the command line and CI.