Why codeint · How it works · Quick start · Guide · Reference · Programmatic API · Plugins · llms.txt
Note
Early development: codeint is still pre-1.0 and evolving quickly.
CLI flags, configuration keys, report shapes, and the WebAssembly Plugin contract may change rapidly before 1.0.
Coding agents write locally valid code very quickly. Each pull request can pass tests and linters while quietly adding copied blocks, redundant branches, deeper functions, unused dependencies, and tangled imports. Over dozens of changes, that structural drag compounds until both humans and agents slow down.
codeint measures Software entropy directly from the shape of your source code so you see it grow before it compounds.
It ships with six built-in Language plugins covering TypeScript/JavaScript (including React .jsx/.tsx, Vue, and Svelte <script> blocks), Rust, PHP, Dart, Python, and Go, plus sandboxed WebAssembly Plugins for other languages and custom Metrics.
codeint reports every Metric side by side and never collapses them into one grade or index (ADR 0003). A single score hides regressions when one Metric improves while another worsens.
Four core Metrics are calibrated against pre-2023 human-written repositories:
- Erosion: share of Function mass (
cyclomatic_complexity * sqrt(source_lines)) in functions with cyclomatic complexity over 10, reported with function names. - Duplication: share of source lines in exact Clone groups (at least 75 normalized tokens and 14 distinct normalized tokens, catching renamed copy-paste while ignoring import lists and data tables), grouped into Clone families across three or more locations, with opt-in shingle-based near-clone detection.
- Verbosity: share of source lines in zero-false-positive Flagged lines or exact Clone groups.
- Import cycles: share of modules in at least one runtime Import cycle.
Additional independent Metrics and structural checks run in the same pass:
- Cognitive complexity: share of total nesting-weighted cognitive complexity held by functions scoring over 15.
- Test gap: share of total Production Function mass not executed by tests, read from user-named LCOV or Cobertura XML Coverage reports without running your test suite, listing the heaviest untested functions first (Test gap guide, ADR 0017).
- Orphan files: Production files unreachable from manifest-declared, program-start, and configured
entry_points, classified asunreferencedortest-only. - Dependency hygiene: three independent Metrics (
unused_dependencies,unlisted_dependencies, anddev_in_production_dependencies) comparingpackage.json,Cargo.toml,pyproject.toml,composer.json,pubspec.yaml, andgo.modagainst imported external packages while excluding standard-library built-ins. - Architectural import boundaries: named zones, built-in
layeredandhexagonalpresets,public_filesencapsulation, directionalallow/denyrules, and pre-editcodeint guard <path>checks before a file even exists on disk.
Every file belongs to one Source set (production, test, generated, or vendored), so fixtures and generated code never distort Production ratios.
Budgets cap absolute ratios in codeint check, while codeint diff <base> ratchets every pull request against its Git merge-base.
Beyond static snapshots, codeint helps humans and coding agents understand how files connect and evolve:
codeint trace <from> <to>: find the shortest runtime import paths between two modules.codeint impact <paths...>/--changed <base-ref>: compute the transitive reverse-dependency blast radius, separating Production and Test dependents and listing affected Workspace packages.--package <path>: scopecheck,diff,impact, andtraceto one Workspace package in a monorepo.codeint churn: rank eroded and duplicated files alongside their Git commit churn independently per Metric.codeint coupling: detect pairs of files that repeatedly change together in the same commits and flag whether they share a direct runtime import.CODEOWNERSfiltering (--owner <pattern>): filtercheckanddiffFindings to a specific team or owner.
- JSONC configuration: configure codeint in
codeint.jsoncorcodeint.jsonwith comments and trailing commas (codeint initwrites a startercodeint.jsonc). - Single-scan multi-format reporting: save
codeint check --format jsonorcodeint diff --format jsononce, then re-render losslessly intotext,toon,json,sarif, ormarkdownwithcodeint report. - Introspection and diagnostics: inspect machine-readable CLI/MCP capabilities with
codeint schema, see effective settings withdefault/file/cliprovenance viacodeint config --resolved, and verify repository health offline withcodeint doctor. - First-class MCP integration: run
codeint agent statusandcodeint agent installto register the local stdio MCP server (codeint mcp) for Claude Code, Cursor, and Codex, exposingcheck,diff,trend,guard,impact,trace,churn, andcoupling.
codeint is written in safe Rust (#![forbid(unsafe_code)], ADR 0004) around two clean seams: Language plugins lower source files into a language-neutral Code model, and Metric plugins compute Metrics and Findings over that model.
It reads tracked files and commit history directly from Git objects without modifying your working tree, scanning laravel/framework (132k Production lines) in 0.47s and flutter/packages (434k Production lines) in 3.68s on Apple Silicon.
External WebAssembly Plugins implement the versioned codeint:plugin@0.3.0 WIT contract with mandatory SHA-256 verification, zero host capabilities, and configurable memory and time caps.
Read docs/guide/philosophy-and-architecture.md for the full architecture diagram and design rationale.
10th to 90th percentile across 20 pre-2023 open-source repositories per language or framework (ADR 0008, ADR 0010, ADR 0011, ADR 0012, ADR 0013, ADR 0014, ADR 0015, ADR 0020, ADR 0021):
| Language | Erosion | Duplication | Verbosity | Import cycles |
|---|---|---|---|---|
| TypeScript / JavaScript | 35.2% to 60.0% | 1.7% to 34.6% | 1.8% to 34.7% | 0.0% to 30.8% |
React (.jsx / .tsx) |
10.6% to 54.4% | 4.6% to 36.8% | 4.7% to 36.8% | 0.0% to 14.4% |
Vue 2 (.vue) |
2.0% to 45.2% | 3.6% to 19.2% | 3.6% to 19.2% | 0.0% to 11.4% |
Vue 3 (.vue) |
1.9% to 38.8% | 2.3% to 34.5% | 2.4% to 34.6% | 0.0% to 7.7% |
| Rust | 38.0% to 64.2% | 5.0% to 32.5% | 6.0% to 32.9% | 2.1% to 50.6% |
| PHP | 5.5% to 67.7% | 4.1% to 29.0% | 4.2% to 29.2% | 0.0% to 10.7% |
| Dart | 4.7% to 41.9% | 7.3% to 25.6% | 8.0% to 25.9% | 7.3% to 52.4% |
| Python | 14.4% to 62.4% | 1.2% to 20.1% | 1.4% to 20.4% | 0.0% to 32.1% |
| Go | 37.9% to 69.2% | 4.4% to 18.1% | 4.5% to 18.3% | 0.0% to 0.0% |
See docs/guide/languages.md for per-language rules and sample repository timings.
Install the standalone binary on macOS or Linux, on Windows, or run directly with npx:
curl -fsSL https://github.com/avidianity/codeint/releases/latest/download/install.sh | bashirm https://github.com/avidianity/codeint/releases/latest/download/install.ps1 | iexnpx codeint checkRun codeint inside any Git repository:
codeint init
codeint check
codeint diff main
codeint guard src/domain/order.ts
codeint doctor
codeint agent installcodeint initwrites a startercodeint.jsoncwith a versioned$schema.codeint checkmeasures the working tree and prints each Metric with its Findings.codeint diff maincompares the working tree against the merge-base ofmainand fails on any Budget failure or Regression.codeint guard src/domain/order.tschecks architectural boundary rules for an existing or planned file path.codeint doctorruns offline diagnostics on Git status, config validity, detected languages, workspaces, and Plugins.codeint agent installregisterscodeint mcpin detected local coding agents.
Or call codeint programmatically from JavaScript/TypeScript (npm install codeint) or Rust (codeint-cli):
import { check, diff } from "codeint";
const checked = await check();
const prDiff = await diff("main");use std::path::Path;
use codeint_cli::{CheckOptions, DiffOptions, check, diff};
let checked = check(Path::new("."), &CheckOptions::default())?;
let pr_diff = diff(Path::new("."), "main", &DiffOptions::default())?;- Guide: walkthroughs for Philosophy and Architecture, Getting Started, Configuration, Test gap, Built-in Languages, Go, CI and GitHub Actions, and Coding-Agent Integration (MCP).
- Reference: tested reference for every command, flag, exit code, report format (
toon,json,sarif,markdown,text), and configuration key. - Programmatic API: JavaScript/TypeScript SDK and Rust library API.
- Plugins: build, hash, declare, and test external WebAssembly Language and Metric plugins.
- Glossary: canonical definitions of every domain term on this page.
- llms.txt: compact documentation index for coding agents and LLM tools.
You need Rust through rustup (rust-toolchain.toml), Node.js 24 and npm (package.json), and gitleaks plus lychee on your PATH.
npm ci
npx lefthook install
cargo xtask affected-testsRead CONTRIBUTING.md for the contributor workflow and local setup. Agents and people follow the same repository rules: start with .rules and docs/checks/README.md.
