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.

This guide walks you through installing the Kode CLI, initializing a project, and running your first AI-generated patch through the 6-gate verification pipeline — all without writing a line of configuration by hand. By the end, you’ll have a working Kode setup and an understanding of what happens between your prompt and the first file write.
1

Install Kode

Choose the installation method that matches your platform. All methods install the same compiled Go binary and register kode on your PATH.
curl -fsSL https://raw.githubusercontent.com/sicario-labs/kode/master/script/install.sh | bash
After installation completes, confirm it worked:
kode version
You should see output like kode v3.6.9 (commit: abc1234, date: 2025-07-01).
2

Initialize your project

Run kode init from the root of the project you want to work in. Kode automatically detects your project type (Go, Node.js, Rust, Python, etc.) and scaffolds a sensible configuration.
cd your-project
kode init
This creates .kode/kode.json with the following defaults:
{
  "$schema": "https://trykode.xyz/config.json",
  "version": "3.0.0",
  "model": "anthropic/claude-sonnet-4-6",
  "small_model": "anthropic/claude-haiku-4-5",
  "instructions": ["AGENTS.md"],
  "engine": {
    "tdd_mode": true,
    "test_command": "go test ./...",
    "max_blast_radius": 3,
    "token_budget_usd": 1.50,
    "blindfold_mode": false
  },
  "providers": {
    "primary": "kode",
    "gateway_url": "https://api.trykode.xyz"
  },
  "permission": {
    "edit": "ask",
    "bash": "ask"
  }
}
The init command also attempts to download and install Sicario — Kode’s integrated SAST security scanner — into .kode/. If that step fails (for example, in an offline environment), you can install it later with kode install sicario.
The defaults are deliberately conservative: TDD mode is on (test files must exist before production writes), blast radius is capped at 3 files, and the token budget is $1.50 per loop cycle. Adjust these in .kode/kode.json to match your workflow. See Configuration Reference for all available options.
3

Set your API key

Kode is a Bring Your Own Key platform — you bring the LLM credentials, Kode provides the verification engine. Set your API key as an environment variable:
export KODE_LLM_API_KEY="your-api-key-here"
Kode also reads OPENAI_API_KEY if KODE_LLM_API_KEY is not set. To configure a non-OpenAI provider or override the endpoint, either set the env var directly:
export KODE_LLM_ENDPOINT="https://api.anthropic.com/v1"
export KODE_LLM_MODEL="claude-sonnet-4-6"
Or add a providers block to your .kode/kode.json:
{
  "providers": {
    "primary": "anthropic",
    "gateway_url": "https://api.anthropic.com/v1"
  }
}
Kode supports 25+ providers out of the box, including Anthropic, Google Gemini, Groq, Amazon Bedrock, Azure OpenAI, OpenRouter, and any OpenAI-compatible endpoint.
4

Run your first verified patch

Use kode run to generate, verify, and apply a code change in one step:
kode run "add a hello world function"
You’ll see the pipeline execute in real time:
── Generating patches ───────────────────────────────────────────
  → Sending to anthropic/claude-sonnet-4-6...
  ✓ LLM responded (1.8s)
  ✓ Generated 2 hunk(s). Applying...

KODE_GATE: diff_applier
KODE_GATE: syntax
KODE_GATE: imports
KODE_GATE: calls
KODE_GATE: blast_radius
KODE_GATE: architecture
KODE_GATE: security

  ✓ All 2 hunk(s) verified and applied in 1 round(s)
Each KODE_GATE: line is a gate in the verification pipeline passing. If any gate fails, the patch is rejected and Kode feeds the compiler-grade error back to the model for self-correction before retrying.
kode run is shorthand for kode generate --apply. It generates structured code hunks from the LLM, drives each hunk through the 6-gate verification pipeline (Syntax → Imports → Calls → Blast Radius → Architecture → Security), and writes only passing hunks to disk — all in a single command.
5

Check your verification stats

After running a few tasks, inspect the aggregate verification metrics logged to logs/kode.log:
kode stats
The stats dashboard shows pass/fail rates, average verification duration, most frequently failing files, failure type breakdown by gate, and a daily trend chart for the last 14 days. This is the fastest way to understand whether your project is generating clean patches or fighting the same class of LLM error repeatedly.
Use kode loop instead of kode run when you want the full pipeline including automatic test execution and rollback. kode loop generates and applies the patch, then runs your configured test command. If tests fail, Kode restores your working tree from the pre-apply snapshot automatically. Add --branches 3 to enable Ghost Branch mode, which runs three parallel strategies and merges the winner.

What’s next

Now that you have Kode running, explore the deeper configuration options and concepts:
  • Configuration Reference — Every field in .kode/kode.json explained, including TDD mode, blast radius thresholds, Blindfold mode, and MCP server config.
  • Verification Pipeline — How the 6 gates work, how they interact, and how to tune each one for your project.
  • Ghost Branches — Parallel speculative execution: run multiple strategies simultaneously and merge the highest-scoring survivor.
  • CLI Overview — Full reference for plan, generate, verify, loop, daemon, stats, mcp, and all other commands.