> For the complete documentation index, see [llms.txt](https://docs.codna.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.codna.ai/getting-started/readme.md). Agents can also search and read this documentation through its [MCP server](https://docs.codna.ai/~gitbook/mcp).

# Overview

Codna understands a repository before it acts. It maps the code for about zero model tokens, then fixes, reviews and secures from the evidence. Runs on your machine or your cloud.

<figure><img src="https://2818771022-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDuFbRKjfy5RJalcukhbG%2Fuploads%2Fgit-blob-43a6669e66380045a69ba3f79423f1ad4a62e02b%2Fcodna-hero.png?alt=media" alt="Codna"><figcaption></figcaption></figure>

Agents read your code. Codna understands it.

Codna maps your repository deterministically before it spends a model token. It hands the agent the evidence for this issue, not the whole tree, and reports the bundle size on every run. Point it at a local checkout or a git URL.

{% hint style="info" %}
New to Codna? Start with the [Quickstart](https://docs.codna.ai/getting-started/quickstart.md): install, add a model key, triage a repository, and open your first fix PR.
{% endhint %}

## Start here

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Quickstart</strong></td><td>Install, add a key, triage, and open a fix PR.</td><td><a href="https://docs.codna.ai/getting-started/quickstart.md">Quickstart</a></td></tr><tr><td><strong>Installation</strong></td><td>One pip command. No Node, Bun, Docker, or engine.</td><td><a href="https://docs.codna.ai/getting-started/installation.md">Installation</a></td></tr><tr><td><strong>CLI Reference</strong></td><td>Every command, argument, and flag.</td><td><a href="https://docs.codna.ai/reference/cli.md">CLI Reference</a></td></tr></tbody></table>

## Choose an outcome

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Fix a failing test</strong></td><td><code>codna fix</code> finds the root cause and opens a pull request you review.</td><td><a href="https://docs.codna.ai/getting-started/quickstart.md">Quickstart</a></td></tr><tr><td><strong>Review every pull request</strong></td><td><code>codna review</code> posts findings with severity, category and confidence, and approves a clean diff.</td><td><a href="https://docs.codna.ai/guides/review.md">codna review</a></td></tr><tr><td><strong>Prove a scanner finding</strong></td><td><code>codna secure</code> reads SARIF and proves which findings are reachable, for zero model tokens.</td><td><a href="https://docs.codna.ai/guides/security-autofix.md">Security Autofix</a></td></tr></tbody></table>

## Connect Codna

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>GitHub App</strong></td><td>Reviews pull requests when they open, answers <code>@codna review</code>, and opens fixes on request.</td><td><a href="https://docs.codna.ai/guides/github-app.md">GitHub App</a></td></tr><tr><td><strong>GitHub Action</strong></td><td><code>thyn-ai/codna-action@v1</code>: fix, review or secure from your own CI.</td><td><a href="https://docs.codna.ai/guides/github-action.md">GitHub Action</a></td></tr><tr><td><strong>MCP Server</strong></td><td>Five tools for Cursor, Claude Desktop, or your own agent.</td><td><a href="https://docs.codna.ai/guides/mcp.md">MCP Server</a></td></tr></tbody></table>

## Understand and explore

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>How It Works</strong></td><td>Snapshots, evidence bundles, blast radius, and the reduction ratio.</td><td><a href="https://docs.codna.ai/concepts/concepts.md">How It Works</a></td></tr><tr><td><strong>Privacy and data</strong></td><td>What leaves your machine, and what never does.</td><td><a href="https://docs.codna.ai/concepts/privacy.md">Privacy and data</a></td></tr><tr><td><strong>Configuration</strong></td><td>Environment variables and the <code>codna.yaml</code> file.</td><td><a href="https://docs.codna.ai/reference/configuration.md">Configuration</a></td></tr><tr><td><strong>Hooks</strong></td><td>Lifecycle scripts that can observe, annotate or block an agent turn.</td><td><a href="https://docs.codna.ai/guides/hooks.md">Hooks</a></td></tr><tr><td><strong>Troubleshooting</strong></td><td>Every message and its one-line fix.</td><td><a href="https://docs.codna.ai/reference/troubleshooting.md">Troubleshooting</a></td></tr></tbody></table>

## What Codna does

You run one command, `codna`. Everything it needs ships inside the package. There is no server to start.

| Capability     | Command                                     | What it does                                                                                                                                                                                            | Model tokens  |
| -------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
| Understand     | `codna triage`                              | Maps the repository and locates the code relevant to an issue. Deterministic.                                                                                                                           | 0             |
| Fix            | `codna fix`                                 | Finds the root cause and plans a patch. With `--apply` it writes a local branch; with `--open-pr` it opens a pull request. Every fix reports root cause, impacted symbols, confidence and blast radius. | On the patch  |
| Review         | `codna review`                              | Reviews a pull request read-only. Posts findings with severity, category and confidence. Approves a clean diff.                                                                                         | On the review |
| Secure         | `codna secure`                              | Reads SARIF from CodeQL, Semgrep, Snyk or Trivy and proves which findings are reachable.                                                                                                                | 0 to classify |
| Test selection | `codna impact`                              | Prints the tests a diff can affect. Offline.                                                                                                                                                            | 0             |
| Code memory    | `codna_recall` (MCP), `codna memory export` | On-device recall of the symbols relevant to a query.                                                                                                                                                    | 0             |
| Report         | `codna report`                              | Files a bug, request or question to [thyn-ai/feedback](https://github.com/thyn-ai/feedback).                                                                                                            | 0             |

The [GitHub App](https://docs.codna.ai/guides/github-app.md) and the [GitHub Action](https://docs.codna.ai/guides/github-action.md) run the same `codna` commands you run on your machine. A review posted by the App, by the Action, or by `codna review --post` reads the same way.

## Install

```bash
pip install codna
```

{% hint style="success" %}
No Node, Bun, Docker, or engine to install or start. Python 3.12 to 3.13 on macOS or Linux, with `git` on your `PATH`.
{% endhint %}

For pipx, uv, optional extras and offline use, see [Installation](https://docs.codna.ai/getting-started/installation.md). For keys and model selection, see [Models & BYOK](https://docs.codna.ai/concepts/models-and-byok.md).

## A first look

Point Codna at a directory to understand it. Triage spends no model tokens.

```bash
codna triage .
```

The values below show the format. Codna prints the measured values for your repository.

```
codna: understanding . …

✓ codna understood 412 files in 1.8s
  suspect files : src/checkout/total.py, src/checkout/cart.py
  context        : 1,840,000 → 9,400 tokens  (196× smaller for the agent)
```

Then fix a bug. Without `--apply` or `--open-pr`, `fix` reports its analysis and a patch reference and changes nothing.

```bash
codna fix . --issue "tests/test_checkout.py::test_total returns the pre-tax amount"
```

```
codna: fixing . …

✓ codna analyzed .
  root cause   : total() sums line items but never applies the tax_rate field
  symbol       : checkout.total.compute_total  (blast radius: 3)
  confidence   : 91%
  context      : 1,840,000 → 9,400 tokens  (196× smaller)
  agent        : repository.verified_agentic_v1 via codna  ·  cost: $0.021
  patch        : $PATCH_REF   (--apply for a local branch · --open-pr to open a PR)
```

Next: the [Quickstart](https://docs.codna.ai/getting-started/quickstart.md) walks install, triage, fix and PR end to end. The [CLI Reference](https://docs.codna.ai/reference/cli.md) documents every command.

## Community

Questions or feedback? File them with `codna report`, or join us on [Discord](https://discord.gg/w8NDsph9an). Security reports go to <security@codna.ai> and are acknowledged within two business days.
