How verification works
When Kode generates a patch, it invokes theGate — a Go struct that chains nine checkers in order:
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.
Audit logging
Every verification result is appended as a JSONL entry tologs/kode.log in your project directory:
--log-dir:
Exit codes
Architecture violations downgraded to
WARN do not cause a non-zero exit. Only hard FAIL results exit 1.Related pages
- CLI:
kode verify— full flag reference for the verify command - Troubleshooting gate failures — how to read and resolve each gate’s error messages