Topos

the verification layer for agent-written code

Your agent writes the code. Topos checks its structure: complexity, coupling, risky data flows, and nesting depth, each a pass/fail gate with the exact file that failed. Medals run from SLOP to PLATINUM.

Topos pass rates per pillar for the core crates Install Topos MCP in VS Code PyPI License Topos MCP server ClawHub

Install · What it checks · Under the hood · Docs · Issues

--- ## Why Topos Coding agents now produce more code than anyone can read line by line. Trust has to come from layers that work without a human reading every diff: constraints in the architecture, static checks in CI, rules the agent follows, and verification that produces evidence. Topos is the structural layer of that stack. It computes four verdicts from program structure, with no LLM in the loop, and points at the file and the construct behind each failure. It is fast enough to run on every agent edit and stable enough to gate a merge. **[Quality is the new currency.](https://krv.ai/field-notes/evaluating-code-generation)** **Tests tell you the code works. Topos tells you whether the next agent can safely change it.** > Grounded in category theory, written in Rust. The layered-trust framing (architecture, static checks, rules, then verification) follows Lauren Tan's talk "All Code Is Slop (Except Mine)." ## Install and Quick Start One binary. Every supported agent harness. A clean way back out. ### 1. Install the CLI Use the verified release installer: ```bash curl -fsSL https://docs.krv.ai/topos/install.sh | bash ``` Or install with Homebrew: ```bash brew install krv-labs/tap/topos ``` On Homebrew 6+, that fully qualified one-liner auto-taps and trusts only this formula. If you `brew tap krv-labs/tap` first, run `brew trust --formula krv-labs/tap/topos` before `brew install topos`. > [!TIP] > **Prefer an editor-managed install?** In VS Code or Cursor, search `@mcp topos` in the Extensions view or choose [Install MCP server](https://github.com/mcp/Krv-Labs/topos). This is an alternative to `topos install`: your editor installs and manages the Topos MCP server for you. ### 2. Connect your coding agents `topos install` detects every supported MCP harness and lets you configure any—or all—of them from one interactive checklist: ```bash topos install ``` ```text ┌ Which agent integrations do you want to configure? │ │ ↑↓ move · space toggle · a all · enter confirm · esc cancel │ │ ❯ ○ Claude Code (detected) │ ○ Claude Desktop (detected) │ ● Codex CLI (✓ active) │ ● Gemini CLI (✓ active) │ ○ GitHub Copilot CLI (detected) │ ○ Cursor (detected) │ ○ VS Code (detected) │ ○ Google Antigravity (detected) │ ○ pi (detected) │ ○ OpenCode (detected) └ ``` Restart the agents you configured, then ask: > *"Use Topos to find this repository's worst structural problem, make one focused improvement, and verify the result."* > [!IMPORTANT] > Too many tools spray MCP servers across agent JSON files, scatter symlinks around your machine, then leave you to burn half a Claude session untangling the mess—or pull your own hair out doing it. Topos does not play that game. We follow a leave-no-trace policy for harness installation state: `topos status` shows every registration, while **`topos uninstall` opens the same selector, previews exactly what will change, and removes everything it added to your harness configs.** Shared cache bookkeeping and repository-scoped cache leases are not installation state, so uninstall leaves them alone and reports any shared bookkeeping it keeps; generated PR caches are removed only by an explicit `topos cache clean` or `topos cache prune`. If Topos makes it easy to do, it should be just as easy to undo. > > ```bash > topos status > topos uninstall > ``` See the [agent setup guide](https://docs.krv.ai/topos/agents.html) for permissions, manual configuration, and troubleshooting. ### 3. Evaluate from the terminal ```bash topos evaluate . -r ``` Topos discovers Python, Rust, JavaScript, TypeScript, C++, and Go automatically. Pass `--language` only when you want to narrow the run. Reviewing a pull request instead? `topos pr-recap 5` gives a structural before/after card and debt ledger for the PR's changed files — no LLM, fully reproducible, with presets calibrated across 1,609 open-source pull requests ([PR Recap calibration](https://topos.krv.ai/pr-recap.html) · [lab notes](https://github.com/Krv-Labs/topos-leaderboard/blob/main/docs/graphs-for-pr-filtering.md)). See [Installation](https://docs.krv.ai/topos/installation.html) for platform support and alternative install paths. ## What Topos checks Every file gets four independent verdicts: - **SIMPLE** — avoids unnecessary complexity using AST entropy and control-flow complexity. - **COMPOSABLE** — limits a file's outward dependency burden; broader coupling and stability metrics remain available for diagnosis. - **SECURE** — avoids dangerous API reachability and taint paths in the code property graph. - **NAVIGABLE** — stays shallow enough for an agent to read and change in one pass, using depth-weighted nesting divergence over the AST scope tree. Those verdicts roll up into one memorable quality medal without hiding which pillar failed: | Medal | Criteria | | :--- | :--- | | 🏆 **PLATINUM** | Passes all 4 | | 🥇 **GOLD** | Passes 3 of 4 | | 🥈 **SILVER** | Passes 2 of 4 | | 🥉 **BRONZE** | Passes 1 of 4 | | ❌ **SLOP** | Passes 0, or fails to parse | See the [full metrics reference](topos/mcp/docs/content/metrics.md). Refactor guidance also surfaces control-flow cycles, load-bearing dependency edges, and process bottlenecks.
How the medal system is derived The four pillars are pairwise incomparable and form a sixteen-element evaluation lattice (a 4-cube); PLATINUM is their intersection. Labels below abbreviate the pillars as **S**imple, **C**omposable, **Sc** = Secure, **N**avigable.

The full evaluation lattice — SLOP at the bottom, four single-pillar BRONZE states, six two-pillar SILVER states, four three-pillar GOLD states, and IDEAL (PLATINUM) at the top.

[Measures](https://docs.krv.ai/topos/measures.html) · [Category-theory foundations](https://docs.krv.ai/topos/concepts.html)
## Under the hood Topos is a self-contained Rust CLI and MCP server. Analysis runs locally; your source code is not sent to an external model or hosted analysis service. | Component | Role | | :--- | :--- | | [tree-sitter](https://tree-sitter.github.io/tree-sitter/) | Parses six languages and powers the native AST, CFG, CPG, PDG, and UAST representations. | | [GitNexus](https://github.com/abhigyanpatwari/GitNexus) | Supplies the repository dependency graph scored by COMPOSABLE (`topos depgraph generate`). Requires `npm install -g gitnexus@1.6.8`. | | [Sighthound](https://github.com/Corgea/Sighthound) | Embedded in the MCP server for supplementary security findings; native CPG probes remain the SECURE scoring source. | The result is one verdict that an agent, a reviewer, or CI can all act on: four gates, explicit evidence for each failure, and a before/after check that tells a real improvement from cosmetic churn. ## More ways to use Topos - **OpenClaw / ClawHub:** [`openclaw skills install @Krv-Labs/topos`](https://clawhub.ai/krv-labs/skills/topos) - **Hermes:** `hermes skills tap add Krv-Labs/topos` then `hermes skills install Krv-Labs/topos/topos` - **Agent Plugins:** point a [compatible client](https://agent-plugins.org/compatible-clients) at [`agent-plugin/`](agent-plugin/) ([spec](https://agent-plugins.org/)) - **MCP Registry name:** `io.github.Krv-Labs/topos` - **CLI reference:** [docs.krv.ai/topos/cli](https://docs.krv.ai/topos/cli.html) ## Distribution Topos ships four ways: - **GitHub Releases** — the `topos` CLI binary (macOS/Linux), via `install.sh` or a direct release download. - **PyPI** — `topos-mcp`, a thin `bin`-wheel bundling the MCP server binary (`pip install topos-mcp` / `uvx topos-mcp`), zero Python runtime. - **VS Code Marketplace** — the Topos extension, bundling platform binaries. - **Docker** — a container image for Glama and other MCP-registry hosting. Crate layout and adapter details: **[docs.krv.ai/topos/architecture](https://docs.krv.ai/topos/architecture.html)**. ## Contributing Topos is used internally at [Krv Labs](https://krv.ai) to manage AI-agent code output. We welcome bugs, ideas, and contributions. - **Bug?** Open an [issue](https://github.com/Krv-Labs/topos/issues) - **Idea?** Start a [discussion](https://github.com/Krv-Labs/topos/discussions) or open a PR - **Collaborate?** [team@krv.ai](mailto:team@krv.ai) --- [Full documentation](https://docs.krv.ai/topos/) · [Measures and metrics](https://docs.krv.ai/topos/measures.html) · [Engineering notes](docs/)

Made by Krv Labs