Skip to content

CLI Reference

This page is generated from the --help output of the codeknife 0.2.0 binary. It lists 27 top-level commands and 32 commands in total, counting subcommands. The text in each block is the binary’s own help text.

Help text describes intent. Where a command behaves differently from its help text, the feature page for that command says so. See Output Formats & Exit Codes for the exit code contract.

Every command accepts these options. They are left out of the per-command listings below.

Usage: codeknife [OPTIONS] <COMMAND>
--path <PATH> Repository root path (defaults to current working directory) [default: .]
--format <FORMAT> Output format (auto switches between TTY Human and non-TTY Agent) [default: auto] [possible values: auto, human, agent, json, sarif, markdown]
--strict Enable strict Uncle Bob / greenfield thresholds
--changed Scope findings to files or functions modified in git working tree / since base ref
--since <SINCE> Base git ref for `--changed`, loosening checks, and Diff-CRAP (e.g., HEAD, origin/main)
--no-cache Do not write or update `.codeknife/` cache/IR files (read-only analysis)
--max-items <MAX_ITEMS> Maximum items shown in `--format agent` output
-h, --help Print help
-V, --version Print version
Run the unified quality gate (Tier 0+1 static checks + ratchet + loosening guard)
Usage: codeknife check [OPTIONS]
Options:
--tier <TIER> Run Tier-2 dynamic checks (mutation + HTML map) alongside static checks [default: standard] [possible values: standard, full]
--deep Fuse findings from installed native compiler/linters (clippy, ruff, tsc, go vet)
--coverage <COVERAGE> Coverage file path (auto-discovered when omitted)
--map-out <MAP_OUT> Optional path to write HTML map when running `--tier full`
Emit ranked, token-budgeted agent refactor work orders
Usage: codeknife plan [OPTIONS]
Options:
--top <TOP> Maximum number of top refactor tickets to emit [default: 10]
--grouped Group findings into cross-blade root-cause work orders
--coverage <COVERAGE> Optional coverage report path
Blade 1: Deterministic Comment & Suppression Reaper
Usage: codeknife comments [OPTIONS]
Options:
--strip Preview or apply safe comment stripping (narration, banners, corpses, AI residue)
--write Actually write stripped edits to disk (defaults to dry-run preview without --write)
--strip-pub-docs Include public docstrings when stripping (defaults to preserving pub docs)
Blade 2: Ousterhout depth, complexity, LCOM4 cohesion, arch.toml layers & anti-gaming
Usage: codeknife arch [OPTIONS]
Options:
--layers <LAYERS> Optional Clean Architecture / layer specification file (defaults to arch.toml)
--infer Automatically infer `[[layers]]` and `[[deny]]` rules from existing dependencies
--write Write inferred `arch.toml` (or `--layers` target) to disk instead of stdout only
Blade 3: AST structural clone detector, duplicate DTO shapes & reinvented helper check
Usage: codeknife clones [OPTIONS]
Options:
--threshold <THRESHOLD> Minimum Jaccard similarity threshold (0.0..=1.0)
Blade 4: Whole-repo reachability, dead symbols/files, 1-caller wrappers & single-impl traits
Usage: codeknife dead [OPTIONS]
Options:
--fix Preview or remove strictly private dead functions/imports
--write Write dead-code removals to disk (dry-run preview without --write)
Blade 5: Swallowed errors, type escapes, guard scatter, async leaks & hygiene
Usage: codeknife slop [OPTIONS]
Blade 6: AI-amplified OWASP security footguns & sibling route auth parity
Usage: codeknife sec [OPTIONS]
Blade 7: Test Theater auditor (scrap) + CRAP & Diff-CRAP over coverage reports
Usage: codeknife tests [OPTIONS]
Options:
--coverage <COVERAGE> Coverage report path (lcov, llvm-cov json, go coverprofile, istanbul, cobertura)
Blade 8: Surgical diff-scoped, coverage-gated, CoW-parallel mutation tester
Usage: codeknife mutate [OPTIONS]
Options:
--scan List candidate mutation sites without executing tests
--top <TOP> Mutate top N highest-CRAP functions (in addition to or instead of --changed)
--test-command <TEST_COMMAND> Custom test command override
--coverage <COVERAGE> Optional coverage report path used to skip uncovered lines
--jobs <JOBS> Maximum parallel worker count
--mutate-all Ignore mutation cache and re-run all selected mutants
--no-schemata Disable compile-once mutant schemata and use isolated workers for every mutant
Blade 9: Pure-Rust git forensics (Complexity x Churn hotspots, temporal coupling, thrash)
Usage: codeknife churn [OPTIONS]
Options:
--days <DAYS> History lookback window in days [default: 90]
Blade 10: Transitive caller cone & cross-boundary SQL/HTTP/env contract blast radius
Usage: codeknife blast [OPTIONS]
Options:
--symbol <SYMBOL> Target symbol name to trace (defaults to all `--changed` symbols)
Blade 11: Manifest/lockfile bloat & opt-in registry slopsquatting verifier
Usage: codeknife deps [OPTIONS]
Options:
--verify-registry Query live package registries (crates.io, npm, PyPI, Go proxy) for slopsquatting risk
Blade 12: README, AGENTS.md & docstring drift against real files, symbols & CLI flags
Usage: codeknife docs [OPTIONS]
Blade 13: Generate self-contained offline interactive HTML Garden Map
Usage: codeknife map [OPTIONS]
Options:
--out <OUT> Output HTML file path [default: codeknife-map.html]
--proposal <PROPOSAL> Optional proposed arch.toml to visualize resolved/new layer violations
Initialize starter `codeknife.toml`, git hook integration, and agent rules
Usage: codeknife init [OPTIONS]
Options:
--force Overwrite existing starter files if present
Manage the shrink-only ratcheting `codeknife.baseline`
Usage: codeknife baseline [OPTIONS] <COMMAND>
Capture current findings into `codeknife.baseline`
Usage: codeknife baseline update [OPTIONS]
Shrink-only prune of resolved/improved entries from `codeknife.baseline`
Usage: codeknife baseline prune [OPTIONS]
Three-way git merge driver (`%O %A %B`)
Usage: codeknife baseline merge-driver [OPTIONS] <BASE> <OURS> <THEIRS>
Arguments:
<BASE>
<OURS>
<THEIRS>
AI coding agent PreToolUse anti-tamper hook (`claude` or `cursor`)
Usage: codeknife hook [OPTIONS] <COMMAND>
Handle Claude Code PreToolUse JSON event on stdin
Usage: codeknife hook claude [OPTIONS]
Handle Cursor PreToolUse JSON event on stdin
Usage: codeknife hook cursor [OPTIONS]
Print bundled `SKILL.md` for Claude Code, Cursor, Codex, and Antigravity
Usage: codeknife skill [OPTIONS]
Print the Usage specification (`usage.jdx.dev`) generated from clap metadata
Usage: codeknife usage [OPTIONS]
Deterministic zero-LLM cascading autofix engine (dry-run by default)
Usage: codeknife fix [OPTIONS]
Options:
--write Write deterministic fixes to disk (defaults to dry-run preview without --write)
--verify Run compiler/test verification command after writing and bisect-rollback breaking patches
--verify-cmd <VERIFY_CMD> Custom shell verification command used by `--verify`
--aggressive Enable aggressive fixes (1-caller wrapper inlining, HTTP timeouts, unused dep removal)
--toolchains Also run available native ecosystem formatters/fixers (`cargo fmt`, `ruff`, `biome`, `gofmt`)
--max-passes <MAX_PASSES> Maximum cascading fix passes when `--write` is enabled [default: 3]
Blast-scoped smart test selector and runner targeting only affected tests
Usage: codeknife test [OPTIONS]
Options:
--dry-run Print targeted tests and commands without executing subprocesses
--test-cmd <TEST_CMD> Override test command directly instead of inferred per-ecosystem commands
Focused, token-budgeted repository or target dossier for LLM reasoning
Usage: codeknife dossier [OPTIONS]
Options:
--target <TARGET> Focus target: relative file path, suffix, function name, or qualified symbol
--top <TOP> Maximum root-cause work orders to include [default: 8]
--budget <BUDGET> Character budget ceiling for code excerpts [default: 12000]
--coverage <COVERAGE> Optional coverage report path
Pre-write Reuse Oracle: find existing functions/types matching an intent or snippet
Usage: codeknife reuse [OPTIONS] <QUERY>
Arguments:
<QUERY> Natural-language intent or keyword query describing what you need
Options:
--lang <LANG> Optional language filter (rust, ts, js, python, go)
--snippet <SNIPPET> Optional code snippet for structural similarity matching
--top <TOP> Maximum number of candidates to return [default: 8]
Single-call end-to-end verification pipeline (optional fix -> strict check -> smart test)
Usage: codeknife verify [OPTIONS]
Options:
--fix Apply deterministic zero-LLM fixes (`codeknife fix --write --verify`) before checking
--aggressive Include aggressive fixes when `--fix` is enabled
--toolchains Also invoke native ecosystem formatters/fixers when `--fix` is enabled
--skip-tests Skip running scoped test commands after static checks
--test-cmd <TEST_CMD> Explicit test command override for smart test verification
--coverage <COVERAGE> Optional coverage report path
Start native stdio JSON-RPC 2.0 Model Context Protocol (MCP) server
Usage: codeknife mcp [OPTIONS]
Compute 0–100 repository health scorecard and track `.codeknife/history.jsonl` trends
Usage: codeknife score [OPTIONS]
Options:
--record Record this scorecard snapshot into `.codeknife/history.jsonl`
--history <HISTORY> Number of recent history snapshots to load for delta and sparkline trend [default: 10]
--coverage <COVERAGE> Optional coverage report path