Skip to main content

Documentation Index

Fetch the complete documentation index at: https://kode-f177b001.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Kode is a verification-first AI coding agent that replaces the “generate-and-pray” paradigm that defines every other AI coding tool on the market. While Cursor, Copilot, and Cline write LLM-generated code directly to your filesystem and leave you to be the verification layer, Kode puts a deterministic, compiled Go pipeline between the model’s output and your disk. Every patch the LLM produces must pass six sequential verification gates — executing in under 50ms — before a single byte is written. If any gate fails, the patch is rejected and the model self-corrects on compiler-grade feedback.

The Core Thesis

No generation without validation. Kode separates concerns that every other AI coding tool conflates. The LLM is a powerful generative engine — excellent at producing plausible-looking code. It is not a compiler, a type-checker, or a security scanner. Kode’s Go engine is the security layer, and it does not negotiate with the model: a failed syntax parse, a hallucinated import, or a blast radius breach is a hard block, not a warning you might notice later in a diff.

The Workflow

Kode enforces a structured software-engineering lifecycle on every task: Plan → Critique → Generate → Verify → Apply → Test
  1. Plan — Kode builds a surgical context graph of the relevant files, symbols, and import relationships in your project, so the LLM receives only the information it needs.
  2. Critique — A pre-generation review layer evaluates the plan and rejects structurally flawed approaches before the LLM wastes tokens generating them.
  3. Generate — The LLM produces structured code hunks (JSON patches) in response to the task prompt.
  4. Verify — Every hunk is applied in memory and driven through the 6-gate pipeline. The real filesystem is never touched until all gates pass.
  5. Apply — Verified hunks are written to disk atomically, with a rollback snapshot already in place.
  6. Test — Kode runs your project’s test suite. If tests fail, the changes are automatically reverted from the pre-apply snapshot.

The 6 Verification Gates

The gate pipeline runs sequentially. A failure at any gate is a hard stop — the remaining gates do not run.
Dual-engine architecture. Kode uses the go-tree-sitter library for full AST validation when a grammar is available, falling back to fast regex heuristics otherwise. Parses Go, TypeScript, JavaScript, Python, and Rust. A parse error is an unconditional hard block — the patch never proceeds further.
Validates every import path in the generated code against your project’s dependency graph. This gate catches hallucinated packages — the most common class of LLM generation error — before the patch ever reaches a compiler or your node_modules.
Checks that every function and method call in the generated code references a symbol that actually exists. Kode walks the context graph built during planning and cross-references every call site. Hallucinated package calls are a hard block; unresolvable local calls produce a warning with feedback sent back to the model.
Walks the dependency graph backward from every modified file and counts the number of downstream files that would be transitively affected. If the count exceeds your configured max_blast_radius threshold (default: 3 files), the patch is blocked. This prevents large, unscoped refactors from slipping through under the guise of a small task.
Enforces declared module boundaries you define in your project config. Prevents the LLM from crossing microservice lines, importing banned internal packages, or violating layer constraints. You can configure this gate to hard-block on violations or to warn and record them for later review.
Powered by Sicario, Kode’s integrated AST-based SAST engine. Scans generated code for high/critical vulnerabilities — including SQL injection, XSS vectors, and hardcoded secrets — before they reach disk. High and critical findings are a hard block. Medium and low findings produce a warning. Install Sicario via kode install sicario or automatically during kode init.

Key Features

Beyond the verification pipeline, Kode introduces capabilities no incumbent AI coding tool offers. Ghost Branches — Instead of running one LLM strategy, Kode spawns multiple parallel git worktrees via kode loop --branches N. Each branch uses a different strategy (Alpha: minimal; Beta: modular; Gamma: performance-optimized). All branches run the full verification and test pipeline concurrently. Kode scores each surviving branch by blast radius, token cost, and execution speed, then merges the highest-scoring winner and discards the rest. Blindfold Mode — Enterprise-grade privacy. When enabled, Kode SHA-256 obfuscates your identifiers — package names, function names, type names — before submitting any code to an external LLM. Your proprietary logic is never exposed in plaintext. The obfuscation mapping is maintained locally and reversed on the output before the patch is applied. TDD Mode — When enabled in your .kode/kode.json, the verification pipeline enforces a test-first policy: production code writes are blocked unless a corresponding test file already exists or is included in the same patch set. A minimal .kode/kode.json to get started:
{
  "max_blast_radius": 3,
  "tdd_mode": true,
  "blindfold": false,
  "security": {
    "engine": "sicario",
    "block_on": ["high", "critical"]
  }
}
Daemon Mode — Run kode daemon to start a silent background process that polls your git history for code health trends. After detecting 3+ new commits, it analyzes blast radius growth, circular dependencies, and repeated patterns. When thresholds are crossed, it speculatively fixes issues on a ghost branch and prompts you to merge. MCP Integration — Kode exposes its full Plan → Verify → Apply pipeline as a Model Context Protocol server (kode mcp), so you can drive Kode’s verification engine from any MCP-compatible host, including Cursor and Claude Desktop. Add Kode to your claude_desktop_config.json:
"mcpServers": {
  "kode": {
    "command": "kode",
    "args": ["mcp"]
  }
}

Language Support

Kode’s verification pipeline has language-aware support for:
  • Go — Tree-sitter AST parsing, import resolution, call graph validation
  • TypeScript and JavaScript — Tree-sitter AST parsing, import resolution
  • Python — Tree-sitter AST parsing, import validation
  • Rust — Tree-sitter AST parsing via query files

AI Provider Support

Kode is a Bring Your Own Key (BYOK) platform. Configure any of 25+ supported providers through the KODE_LLM_API_KEY environment variable or your .kode/kode.json config. First-party integrations include OpenAI, Anthropic, Google Gemini, and Groq, along with Amazon Bedrock, Azure OpenAI, Mistral, Cohere, DeepInfra, TogetherAI, OpenRouter, and a fully compatible custom OpenAI-compatible endpoint option.

Where to Go Next

Quickstart

Install Kode, run kode init, and generate your first verified patch in under five minutes.

Verification Pipeline

Deep dive into how the 6-gate pipeline works, how gates interact, and how to configure each one.

Ghost Branches

Learn how parallel speculative execution works and how Kode scores and merges winning branches.

CLI Overview

Full reference for all Kode commands: run, loop, plan, verify, stats, daemon, and more.