Map the Python repository
Codna builds a dependency and blast-radius graph of the repository from its import patterns. No model call, zero tokens.
Codna maps your Python repository for zero tokens, fixes from evidence, and runs pytest in a sandbox until it passes.
The problem
The cause is often two imports away. Codna builds a dependency and blast-radius graph of the repository from its import patterns. No model call, zero tokens. The agent starts from the failing test, the call chain and the suspect functions.
How Codna fixes it
Codna builds a dependency and blast-radius graph of the repository from its import patterns. No model call, zero tokens.
The agent receives an evidence bundle scoped to the issue: the suspect files, the call paths, the failing test. Codna prints the raw-to-bundle token size on every run. Every fix reports root cause, confidence, blast radius and regression risk, and passes a risk gate before it is applied or a pull request opens.
Run codna fix --tests --apply and Codna runs your tests in a sandbox and re-fixes until they pass, up to the iteration limit you set. Set fix.test_command in codna.yaml, or pass --test-cmd, when your runner is not pytest. With --open-pr, or through the GitHub App, the pull request states the issue, the root cause, the symbols touched and a confidence score, and asks for review before merging. Codna never merges.
pip install codna codna fix . --issue "test_split_arg_string fails on trailing backslash" codna fix . --tests --apply --max-iterations 3
What you get
--tests runs pytest in a sandbox and fixes the failures it finds. --from-junit reads a JUnit or pytest XML report instead.
On-device recall indexes Python with the standard library parser. Zero cloud round-trips.
pip install codna, pipx install codna or uv tool install codna. Python 3.10 or newer, macOS or Linux, git.
The proof
Codna builds a dependency and blast-radius graph of the repository from its import patterns. No model call, zero tokens. The agent receives an evidence bundle scoped to the issue: the suspect files, the call paths, the failing test. Codna prints the raw-to-bundle token size on every run.
The map is built from imports, so framework code is part of the graph like any other module. Point --tests at your pytest suite, or set fix.test_command for a manage.py test run.
pytest is the default runner. For unittest or another runner, set fix.test_command in codna.yaml or pass --test-cmd; the command writes JUnit to $CODNA_JUNIT.
On 87 matched bug-fix cases against Cursor, Codna averaged 16,159 total tokens and about $0.02 of model spend per verified fix, 5× fewer tokens and 1.7× faster. With your own key you pay your provider directly.
Codna ships as a CLI, an MCP server for Cursor and Claude, a GitHub Action (thyn-ai/codna-action@v1) and a GitHub App that reviews every pull request and opens fix PRs from a label, a comment or a red check.
Understanding runs on your machine and spends no tokens. Only the evidence bundle or the diff reaches your model provider, with your key from the OS keychain. Set privacy.egress to fail-closed in codna.yaml and Codna runs your tests only under kernel-level network denial. Secret redaction is always on.
Related