CodeDecay analyzes pull requests for regression risk and maintainability decay. It works locally and in CI without cloud services, telemetry, API keys, LLMs, or model calls.
Use the deterministic workflow first. Optional assisted workflows are separate and never implicit.
| Workflow | Default | What it does |
|---|---|---|
analyze, redteam, agent, snapshot |
Yes | Local deterministic analysis and reporting. |
execute, differential |
No | Runs only repo-allowlisted local commands after explicit opt-in. |
llm-review |
No | Calls a user-owned provider only when invoked directly. |
| Optional LLM providers | No | Disabled by default and only called by commands that explicitly opt in. |
Use the package manager your repository already uses:
npm install -D @submuxhq/codedecay
pnpm add -D @submuxhq/codedecay
bun add -d @submuxhq/codedecay
yarn add -D @submuxhq/codedecayFor a no-install smoke test:
npx -y @submuxhq/codedecay --helpAfter a local install, run CodeDecay with npx codedecay, pnpm codedecay,
bunx codedecay, or add codedecay to a package script.
Do not run npm install inside a Bun, pnpm, or Yarn workspace that uses
workspace:* dependencies. npm may fail before CodeDecay is installed. In Bun
repos with minimumReleaseAge, a fresh CodeDecay release may also be blocked by
repo policy; for local evaluation you can override it explicitly:
bun add -d @submuxhq/codedecay --minimum-release-age 0npx codedecay analyze --base main --head HEAD --format markdownnpx codedecay analyze --format markdownnpx codedecay analyze --cwd ../my-repo --format markdownUse redteam when you want one report for yourself or your coding agent that
summarizes what the PR could break, weak-test evidence, missing edge cases,
and fix tasks.
npx codedecay redteam --base main --head HEAD --format markdownBy default, redteam is report-only. Add --with-checks when you want the
report to run configured commands and tool adapters through the same safety
gates as codedecay execute:
npx codedecay redteam --with-checks --base main --head HEAD --format markdownThe report labels verification as not-run, verified, unverified,
failed, or blocked so deterministic findings are not confused with behavior
proof. It does not call an LLM unless an explicit investigation path is used.
Use doctor when you want CodeDecay to recommend existing open-source tools
for the repository shape instead of building custom checks from scratch.
npx codedecay doctor --format markdown
npx codedecay doctor --write-config-previewdoctor only reads local files. It does not install tools, execute commands,
call models, use network access, or edit .codedecay/config.yml. The config
preview is written to .codedecay/local/config-preview.yml so you can review it
first.
Use agent when you want Codex, Claude Code, Cursor, a desktop agent, or
another user-owned agent to act on CodeDecay's findings.
npx codedecay agent --base main --head HEAD --format markdown --output codedecay-agent.mdThen give codedecay-agent.md to your agent and ask it to:
- fix high-risk findings first,
- add tests that exercise real API, UI, database, or downstream behavior,
- cover the missing edge cases listed by CodeDecay,
- run the relevant project checks,
- rerun CodeDecay after changes.
The agent bundle is local evidence plus instructions. CodeDecay does not call Codex, Claude, Cursor, Ollama, cloud models, or CodeDecayCloud while creating it.
npx codedecay analyze --base main --head HEAD --format markdown
npx codedecay redteam --base main --head HEAD --format markdown --output codedecay-redteam.md
npx codedecay agent --base main --head HEAD --format markdown --output codedecay-agent.mdUse the redteam report to understand the PR risk. Use the agent bundle to give your own coding agent the evidence, missing checks, and fix tasks it should work through. After the agent changes code, run your project checks and run CodeDecay again.
Use snapshot when you want a stable artifact you can keep in CI, compare with
an earlier run, or review over time.
npx codedecay snapshot --format json --output .codedecay/snapshot.json
npx codedecay snapshot --compare .codedecay/previous-snapshot.json --format markdownSee Trend snapshots for a GitHub-native artifact workflow.
Use memory-import to turn structured learnings into repo-local memory that
future analyses can reuse deterministically.
npx codedecay memory-import --input incidents.json
npx codedecay memory-import --input incidents.json --apply --format jsonSee Local repo memory for supported import shapes and dedupe behavior.
npx codedecay analyze --format sarif --output codedecay.sarifSARIF is the fastest local-first path for in-editor feedback because editors can show inline diagnostics without parsing Markdown.
See Editor workflows.
Configuration is optional. Missing config uses safe defaults.
npx codedecay config --format markdownnpx codedecay analyze --base main --head HEAD --fail-on highRisk levels:
0-39: low40-69: medium70-100: high
Use the example projects to see a realistic high-risk report before wiring CodeDecay into your own repository:
If you want optional provider-backed suggestions without changing the default workflow:
- Configure one user-owned provider in
.codedecay/config.yml. - Run
npx codedecay llm-review --pingto validate the provider config. - Run
npx codedecay llm-review --base main --head HEAD --format markdown.
See LLM providers for the recommended config path.