Skip to content

Deep Mode (Native Linters)

codeknife check --deep runs the native compiler or linter for each ecosystem it finds at the repository root and merges their diagnostics into the check report as CK_DEEP_* findings. Use it when you want compiler and linter errors to fail the same gate as CodeKnife’s own blades.

The demo repository has one file per ecosystem, each with one problem:

Cargo.toml src/main.rs if v.len() == 0 { ... }
pyproject.toml tool.py import os (unused)
tsconfig.json web/port.ts export const port: string = 8080;
go.mod main.go fmt.Printf("%d\n", "eighty")

All four tools were run for this page: cargo clippy 0.1.97, go vet from Go 1.26.5, TypeScript 5.6.3 installed in the demo with npm i -D typescript@5.6.3, and ruff installed into a virtual environment that was put first on PATH.

Terminal window
codeknife --no-cache --format agent check --deep
echo $?
CODEKNIFE check status=fail files=4 errors=1 warnings=4 infos=0 elapsed_ms=4463
[1] ERROR CK_DEEP_TSC web/port.ts:1-1 sym=TS2322 impact=80 | tsc (TS2322): Type 'number' is not assignable to type 'string'. | fix: Fix the TypeScript type error without `as any` or `@ts-ignore`.
[2] WARNING CK_DEEP_GOVET main.go:6-6 sym=- impact=55 | go vet: fmt.Printf format %d has arg "eighty" of wrong type string | fix: Fix the Go static analyzer warning.
[3] WARNING CK_DEEP_RUFF tool.py:1-1 sym=F401 impact=52 | ruff (F401): `os` imported but unused | fix: Remove unused import: `os`
[4] WARNING CK_DEEP_CLIPPY src/main.rs:3-3 sym=clippy::len_zero impact=50 | clippy (clippy::len_zero): length comparison to zero | fix: Resolve compiler/clippy diagnostic cleanly without suppression attributes.
[5] WARNING CK_DEEP_CLIPPY src/main.rs:3-3 sym=clippy::len_zero impact=50 | clippy (clippy::len_zero): length comparison to zero | fix: Resolve compiler/clippy diagnostic cleanly without suppression attributes.
NOTE no coverage file found (running complexity-only mode); generate one with: cargo llvm-cov --lcov --output-path lcov.info | npx vitest run --coverage | pytest --cov --cov-report=xml:coverage.xml | go test -coverprofile=coverage.out ./...
NOTE no git repository found; skipping churn forensics
NOTE deep: cargo clippy reported 2 finding(s)
NOTE deep: ruff reported 1 finding(s)
NOTE deep: tsc reported 1 finding(s)
NOTE deep: go vet reported 1 finding(s)
1

The clippy diagnostic appears twice. See Known rough edges.

--deep checks for a marker file in the root directory only (--path). Subdirectories are not searched. For each marker found, it runs one command with the root as the working directory, in this order:

Ecosystem Marker file at root Command run Output read
Rust Cargo.toml cargo clippy --message-format=json --all-targets stdout, one JSON message per line
Python pyproject.toml or requirements.txt ruff check --output-format=json . stdout, one JSON array
TypeScript tsconfig.json npx --no-install tsc --noEmit --pretty false stdout and stderr together
Go go.mod go vet ./... stderr and stdout together

The commands are fixed. There are no flags or config keys to change them, add arguments, or add other tools. The tools inherit CodeKnife’s environment, including PATH. A repository with none of these marker files gets no deep findings and no deep notes.

The tools’ exit codes are ignored. Only their output is parsed.

Every deep finding has blade slop. The file path is made relative to the root (a leading ./ and the absolute root prefix are removed). With --changed, findings in files outside the changed set are dropped.

Rule Tool Severity Impact symbol Message
CK_DEEP_CLIPPY cargo clippy error for level error, warning for level warning 80 for errors, 50 for warnings the diagnostic code, for example clippy::len_zero or E0308; rustc if there is none clippy (CODE): TEXT
CK_DEEP_RUFF ruff always warning 52 the ruff code, for example F401 ruff (CODE): MESSAGE
CK_DEEP_TSC tsc error for error TS..., warning for warning TS... 80 the TS code, for example TS2322 tsc (CODE): MESSAGE
CK_DEEP_GOVET go vet always warning 55 none go vet: MESSAGE

None of these rules depend on a threshold, config key or --strict. All rules are also listed on the Rule Catalogue.

Parsing details:

  • Clippy. Only lines whose JSON has "reason": "compiler-message" are read. Messages with a level other than error or warning (for example notes and help) are skipped, as are messages with no spans. The location is the primary span, or the first span if none is primary. The fix hint is always Resolve compiler/clippy diagnostic cleanly without suppression attributes.
  • Ruff. The whole stdout must be one JSON array. Each item needs filename, location.row, code and message. The fix hint is ruff’s own fix.message when present, otherwise Fix the reported ruff diagnostic (or run `ruff check --fix`).
  • tsc. A line is read when it contains ): error TS or ): warning TS. The file is the text before the last (, the line number is the first number inside it.
  • go vet. Lines starting with # and blank lines are skipped. Every other line is split on : as file:line:column:message. A line whose second field is not a number is skipped.

A compile error in Rust comes through as an error:

fn main() {
let n: u8 = "seven";
println!("{n}");
}
CODEKNIFE check status=fail files=1 errors=2 warnings=0 infos=0 elapsed_ms=117
[1] ERROR CK_DEEP_CLIPPY src/main.rs:2-2 sym=E0308 impact=80 | clippy (E0308): mismatched types | fix: Resolve compiler/clippy diagnostic cleanly without suppression attributes.
[2] ERROR CK_DEEP_CLIPPY src/main.rs:2-2 sym=E0308 impact=80 | clippy (E0308): mismatched types | fix: Resolve compiler/clippy diagnostic cleanly without suppression attributes.
NOTE no coverage file found (running complexity-only mode); generate one with: cargo llvm-cov --lcov --output-path lcov.info
NOTE no git repository found; skipping churn forensics
NOTE deep: cargo clippy reported 2 finding(s)

Deep findings are added to the report after the static suite and before --tier full. They then go through the same steps as every other finding: the baseline filter and the pass or fail test. An error or warning deep finding fails the gate. baseline update does not run --deep, so it never records deep findings.

Each tool adds exactly one note:

Situation Note
The tool ran deep: cargo clippy reported N finding(s) (or ruff, tsc, go vet)
cargo could not be started deep: skipped cargo clippy (not available)
ruff could not be started deep: skipped ruff (not installed)
npx could not be started deep: skipped tsc (npx/typescript not installed)
go could not be started deep: skipped go vet (go not installed)

“Could not be started” means the executable was not found or could not be spawned. A missing tool never makes check fail or exit 2.

A tool that starts but fails is not detected. Its error text does not parse as diagnostics, so the note says reported 0 finding(s). This run had no ruff on PATH, no local TypeScript package, and a GOROOT pointing at a directory that does not exist:

Terminal window
codeknife --no-cache --format agent check --deep
...
NOTE deep: cargo clippy reported 2 finding(s)
NOTE deep: skipped ruff (not installed)
NOTE deep: tsc reported 0 finding(s)
NOTE deep: go vet reported 0 finding(s)

npx --no-install refused to download tsc, and go exited with cannot find GOROOT directory. Both are reported as zero findings.

There is no timeout. check --deep waits until each tool exits, one after another. In the run at the top of this page the whole check took about 4.5 seconds, most of it in the tools.

The tools write their usual files. In the demo, --deep with --no-cache still left target/ and Cargo.lock (from clippy) and .ruff_cache/ (from ruff) in the repository. --no-cache only controls CodeKnife’s own .codeknife/ files.

  • Duplicate clippy findings. --all-targets checks the binary and its test target, and clippy prints the same diagnostic for each. CodeKnife does not de-duplicate them, so the count and the baseline value are doubled.
  • Silent tool failures. See Notes and failures. Check the deep: notes for reported 0 when you expect findings.
  • The tsc note is misleading. skipped tsc (npx/typescript not installed) only appears when npx itself is missing. A missing TypeScript package gives tsc reported 0 finding(s).
  • Root only. A monorepo with Cargo.toml or tsconfig.json only in subdirectories gets no deep findings for them.

--deep combines with every other check flag, for example codeknife check --changed --deep. See The Check Gate. There is no MCP tool or other command that runs the deep linters.