> ## Documentation Index
> Fetch the complete documentation index at: https://docs.refactron.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Prove that any change, your AI agent's, a codemod's, or your own, preserves the behavior your tests check, or find out it can't be proven. Refactron runs your real tests in an isolated shadow tree and returns a reproducible SAFE, UNSAFE, or UNPROVEN verdict.

## 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 the behavior your tests check, 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 code diff flows into Refactron, through the syntax, imports, and test gates in an isolated shadow tree, and out to a SAFE, UNSAFE, or UNPROVEN verdict](https://mintcdn.com/refactron-aaa9076d/tQw4iZ6fQIqjI0gZ/assets/verify-flow.svg?fit=max\&auto=format\&n=tQw4iZ6fQIqjI0gZ\&q=85\&s=838c7fe33a2cecd1325ecc5b10f2961d)

A diff enters, the gates run in an isolated shadow tree, and one of three verdicts comes out.

## The three-way verdict

> [card] SAFE
>
> Every gate passed **and** your tests exercised every changed statement they could reach. Proven
> safe.

> [card] UNSAFE
>
> A gate failed: the change broke something. Exit `1`.

> [card] 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](https://docs.refactron.dev/verification/verdicts.md) for the full model.

## Verify your first change

Install the CLI and `login` first (both are in the [quickstart](https://docs.refactron.dev/quickstart.md); an unauthenticated run exits `7`):

```bash theme={null}
npm install -g refactron
refactron verify-diff . --diff change.diff --test-cmd "python3 -m pytest -q"
```

```text theme={null}
[UNPROVEN] Tests pass, but the changed code is not exercised by any test.
  uncovered: calc.py:14
```

## Where it plugs in

> [card] [verify-diff (CLI + CI)](https://docs.refactron.dev/verification/verify-diff.md)
>
> Verify a diff from the command line or as a CI merge gate. `UNSAFE` fails the build.

> [card] [MCP server](https://docs.refactron.dev/mcp/overview.md)
>
> A `verify_change` tool your AI agent calls before it lands a change.

> [card] [Verdicts](https://docs.refactron.dev/verification/verdicts.md)
>
> SAFE, UNSAFE, UNPROVEN: coverage fusion and the Python-only limitation, in depth.

> [!WARNING]
>
> Coverage is **Python-only** (via `coverage.py`). A TypeScript or mixed-language diff can never
> earn `SAFE` today; it returns `UNPROVEN` ("coverage of the changed code could not be determined").
> The gates still run; only the coverage half is Python-only.

## 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](https://docs.refactron.dev/concepts/why-no-llm.md).

## Next steps

> [card] [Quickstart](https://docs.refactron.dev/quickstart.md)
>
> Install from npm and verify your first diff end to end.

> [card] [Safety model](https://docs.refactron.dev/concepts/safety-model.md)
>
> The shadow tree, the three gates, and the atomic-write contract.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.