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, and reports Hazards next to Software entropy (ADR 0016).
It ships with eight built-in Language plugins covering TypeScript/JavaScript (with built-in react, vue2, vue3, svelte, nextjs, nuxt, sveltekit, angular, and nestjs Framework profiles plus framework-blind .vue and .svelte <script> lowering), Rust, PHP, Dart, Python, Go, SQL, and Shell (.sh, .bash, .zsh), 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.
Five core Metrics are calibrated against stratified panels of current public repositories (ADR 0035):
- Erosion: share of Function mass (
cyclomatic_complexity * sqrt(source_lines)) in functions with cyclomatic complexity over 10, reported with function names. - Cognitive complexity: share of total nesting-weighted cognitive complexity held by functions scoring over 15.
- Duplication: share of source lines in per-language 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 anchor-checked near-clone detection (ADR 0037).
- Verbosity: share of source lines in Flagged lines matching narrow redundant-construct rules (independent of Duplication, ADR 0024).
The 2026-12-02 agent-reviewed audit (commit
9e3f53053618) recorded 10 false positives in 88 reviewed Flagged lines (of 100 sampled). - Import cycles: share of modules in at least one runtime Import cycle.
Additional independent Metrics and structural checks run in the same pass:
- 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).
Set
new_file_budgets.production.test_gapto enforce the ratio on newly added Production files incodeint diff. - Orphan files: Production files unreachable from manifest-declared, program-start, and configured
entry_points, classified asunreferencedortest-only. - File size (opt-in): the share of Production source lines beyond the File size limit set in
file_size.max_source_lines, with one Oversized file Finding per file over the limit. - 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, directional internalallow/denyrules, external-packageallow_external/deny_externalglob rules, and pre-editcodeint guard <path>checks before a file even exists on disk (Import boundaries guide). - Hazards: share of source lines matching AST-only Hazard line rules for patterns likely to cause wrong results, slow execution, or a security exposure, reported next to Software entropy with strict non-leakage (path, line, and rule name only, never source text), 32 built-in SQL rules including 5 schema-backed rules, and 10 built-in Shell rules (Hazards guide, SQL guide, Shell guide, ADR 0016).
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, .codeint/ratchet.json (Ratchet, managed with codeint ratchet update) locks in whole-repository ceilings with Metric version tracking, and codeint diff <base> checks every pull request against its Git merge-base (ADR 0026).
.codeint/baseline.json (Baseline, managed with codeint baseline update) freezes existing Findings with hashed surrounding-line context anchors, so codeint check hides them, holds new Findings to every Budget, and shrinks the Baseline as legacy Findings are fixed (ADR 0030, ADR 0032).
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.
- JSON, JSONC, TOML, and YAML configuration with
.codeint/state: configure codeint incodeint.{json,jsonc,toml,yaml,yml}or.codeint/config.{json,jsonc,toml,yaml,yml}(codeint initwritescodeint.jsoncby default, or pass--format json|toml|yaml), set an optional default outputformat(toon,text,json,sarif, ormarkdown) for analysis and report commands, lock in monotonic whole-repository ceilings in.codeint/ratchet.jsonviacodeint ratchet update, and freeze existing Findings in.codeint/baseline.jsonviacodeint baseline update. - Single-scan multi-format reporting and Checks API annotations: save
codeint check --format jsonorcodeint diff --format jsononce, then re-render losslessly into concise monochrometext,toon,json,sarif, ormarkdownor publish inline pull-request line annotations via the GitHub Checks API withcodeint report(orcheck-run: truein the GitHub Action, with no code scanning required). - Introspection and diagnostics: inspect machine-readable CLI/MCP capabilities with
codeint schema, see effective settings withdefault/file/cliprovenance viacodeint config --resolved, verify repository health offline withcodeint doctor, and check an external Wasm Plugin against the Plugin contract withcodeint plugin test. - 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, andcouplingwith compact TOON output by default and optionalformat: "json".
codeint is written in safe Rust (#![forbid(unsafe_code)] on every host, core, CLI, and built-in Plugin crate, 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.6.0 WIT contract with mandatory SHA-256 verification, zero host capabilities, and configurable memory and time caps, using codeint-plugin-sdk for safe Rust builds on wasm32-wasip2 (no_std, zero extra tools) or wasm32-unknown-unknown (std plus wasm-tools component new) with zero WASI imports (ADR 0027).
Read docs/guide/philosophy-and-architecture.md for the full architecture diagram and design rationale.
10th to 90th percentile across stratified panels of up to 100 current public repositories per built-in language (77 for SQL under the 200+-star floor) and 50 current public repositories per calibrated Framework profile, sampled round-robin across three star bands (ADR 0035):
| Language | Erosion | Cognitive complexity | Duplication | Verbosity | Import cycles | Docs |
|---|---|---|---|---|---|---|
| TypeScript / JavaScript | 18.7% to 67.1% | 12.1% to 53.2% | 1.8% to 25.2% | 0.0% to 0.2% | 0.0% to 18.2% | ADR 0035 |
React (.jsx / .tsx) |
5.4% to 56.6% | 3.8% to 39.9% | 2.6% to 31.5% | 0.0% to 0.1% | 0.0% to 20.2% | ADR 0035 |
Vue 2 (.vue) |
2.5% to 47.9% | 3.3% to 40.6% | 2.3% to 26.7% | 0.0% to 0.3% | 0.0% to 12.8% | ADR 0035 |
Vue 3 (.vue) |
4.2% to 43.8% | 2.2% to 29.7% | 2.1% to 29.7% | 0.0% to 0.2% | 0.0% to 32.5% | ADR 0035 |
| Rust | 24.5% to 70.4% | 17.6% to 58.5% | 4.7% to 37.7% | 0.0% to 0.5% | 0.0% to 61.1% | ADR 0035 |
| PHP | 6.4% to 59.1% | 4.4% to 54.2% | 2.5% to 20.9% | 0.0% to 0.4% | 0.0% to 13.3% | ADR 0035 |
| Dart | 3.9% to 49.5% | 0.0% to 37.8% | 2.7% to 25.7% | 0.0% to 1.1% | 6.1% to 60.0% | ADR 0035 |
| Python | 23.9% to 71.7% | 24.9% to 63.7% | 1.1% to 22.0% | 0.0% to 1.1% | 0.0% to 49.2% | ADR 0035 |
| Go | 30.4% to 74.6% | 30.6% to 67.1% | 3.4% to 24.3% | 0.0% to 0.4% | 0.0% to 0.0% | ADR 0035 |
| SQL | 0.0% to 91.8% | 0.0% to 90.2% | 0.0% to 90.9% | 0.0% to 0.0% | N/A | ADR 0035 |
| Shell | 36.4% to 93.0% | 21.8% to 82.8% | 0.3% to 71.3% | 0.0% to 3.1% | N/A | ADR 0035 |
See the calibration provenance for the dataset and measured binary for each Metric.
See docs/guide/languages.md for per-language rules and sample repository timings.
See docs/evaluation.md for the published calibration report (eval/panels.json: 927 panel entries across 918 unique repositories), native-parser recall, and agent-reviewed audit; corpus-eval CI validates the separate 40-repository eval/corpus.json manifest.
Install the standalone binary on macOS or Linux, on Windows, via Cargo, or run directly with npx or dart run:
curl -fsSL https://github.com/avidianity/codeint/releases/latest/download/install.sh | bashirm https://github.com/avidianity/codeint/releases/latest/download/install.ps1 | iexcargo install codeintnpx codeint checkdart pub add --dev codeint
dart run codeint checkRun codeint inside any Git repository:
codeint init
codeint init --adopt
codeint check
codeint diff main
codeint ratchet update
codeint baseline update
codeint guard src/domain/order.ts
codeint doctor
codeint plugin test plugins/my-plugin.wasm
codeint agent installcodeint initwrites a startercodeint.jsoncwith a versioned$schema(pass--format json,--format toml, or--format yamlforcodeint.json,codeint.toml, orcodeint.yaml).codeint init --adoptonboards an existing codebase in one step: it writes the startercodeint.jsoncwithper_file: true, zero Budgets for each recorded Metric, and commentednew_file_budgets, writes.codeint/ratchet.jsonand.codeint/baseline.jsonfrom the current state, and prints a pull-request workflow, without replacing any existing file (adoption guide).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, Ratchet, or Regression failure.codeint ratchet updatecreates or monotonically tightens.codeint/ratchet.jsonceilings for whole-repository runs.codeint baseline updatecreates.codeint/baseline.json, or removes fixed Findings from it, socodeint checkhides existing Findings and reports only new ones.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 plugin test plugins/my-plugin.wasmruns the Conformance runner against an external Wasm Plugin and prints each violated rule with a fix hint.codeint agent installregisterscodeint mcpin detected local coding agents.
Or call codeint programmatically from JavaScript/TypeScript (npm install codeint), Rust (cargo add codeint), or Dart (codeint on pub.dev):
import { check, diff } from "codeint";
const checked = await check();
const prDiff = await diff("main");use std::path::Path;
use codeint::{CheckOptions, DiffOptions, check, diff};
let checked = check(Path::new("."), &CheckOptions::default())?;
let pr_diff = diff(Path::new("."), "main", &DiffOptions::default())?;import 'package:codeint/codeint.dart';
const client = CodeintClient(cwd: '.');
final checked = await client.check();
final prDiff = await client.diff('main');- Guide: walkthroughs for Philosophy and Architecture, Getting Started, Configuration, Import boundaries, Test gap, Hazards, Built-in Languages, CI and GitHub Actions, Adopting codeint on an existing codebase, 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: Wave 1 client SDKs for JavaScript/TypeScript (
codeinton npm), Rust (codeinton crates.io), and Dart (codeinton pub.dev anddart run codeint). - Plugins: build external WebAssembly Language and Metric plugins with
codeint-plugin-sdk(wasm32-wasip2no_stdorwasm32-unknown-unknownstd), pin SHA-256 digests, and test them. - 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), gitleaks plus lychee on your PATH, and cargo-nextest 0.9.152 for cargo xtask affected-tests.
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.
