Skip to main content
Every LLM-generated patch Kode produces passes through a deterministic, nine-stage verification pipeline before a single byte reaches your filesystem. No file is written speculatively, no diff is applied optimistically — the pipeline runs entirely in-memory (Gates 1–6) and against an isolated sandbox / dev server (Gates 7–9) and rejects anything that cannot be structurally and behaviourally proven correct for your project. If even one gate fails, the write is blocked and the verdict is returned immediately.

How verification works

When Kode generates a patch, it invokes the Gate — a Go struct that chains nine checkers in order:
All content is held in memory throughout. The DiffApplier reconstructs the modified file contents from the patch and the originals. The resulting map[string]string — file path → proposed content — flows through each gate. The first gate to return FAIL stops the chain and returns a Verdict with "overall": "FAIL". Files are only written to disk when the overall status is PASS.

The 9 gates

1

Gate 1 — AST Syntax

Dual-engine AST parsing. Official Tree-sitter bindings when CGo is enabled; zero-dependency regex fallback otherwise. Parses Go, TypeScript, JavaScript, Python, and Rust. Parse errors hard-block the write.
2

Gate 2 — Imports

Cross-references every generated import path against the local dependency graph. Hallucinated packages are rejected and self-corrected.
3

Gate 3 — Calls

Validates that every function and method call references a real, existing symbol with a compatible signature.
4

Gate 4 — Blast Radius

Walks the dependency graph backward from each modified file and counts downstream impact. Exceeds max_blast_radius → block.
5

Gate 5 — Architecture

Enforces architecture_rules.disallowed_imports. Prevents illegal cross-package or cross-microservice imports.
6

Gate 6 — Security (SAST)

Sicario AST-based SAST scanner. High and critical findings block; medium/low warn.
7

Gate 7 — Sandbox Replay

CPU- and memory-bounded sandbox runs the patched code in isolation. Traps infinite loops, memory leaks, and unauthorized system / network socket activity.
8

Gate 8 — QR Code Tunnel

Provisions a secure public dev tunnel for the local web server and renders the URL as a terminal QR code for instant mobile-device testing.
9

Gate 9 — Browser Verification (E2E)

Synthesizes and executes headless Playwright E2E scripts against the running dev server. Captures walkthrough recordings and flags visual regressions, layout failures, and console errors. Rolls back on failure.

Two input modes for kode verify

The verify command supports two JSON input shapes, depending on whether you have a diff or proposed file contents.
In hunk mode, Kode applies the hunks in-memory against the originals first, then passes the resulting content through all nine gates. In file mode, the proposed file contents are verified directly without hunk application — useful when you have already assembled the full file outside of Kode. Run verification:

Audit logging

Every verification result is appended as a JSONL entry to logs/kode.log in your project directory:
Override the log directory with --log-dir:

Exit codes

Architecture violations downgraded to WARN do not cause a non-zero exit. Only hard FAIL results exit 1.