Every Kode task follows the same spine: build a surgical context graph, generate structured JSON hunks via an LLM, pass each hunk through a chain of verification gates, and write only what passes. By the end of this guide you will have initialized a project, run your first task, and read the verification stats that prove what changed — and why.Documentation Index
Fetch the complete documentation index at: https://docs.trykode.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- Kode installed and available on your
PATH(kode --versionshould print a version string) - A code project inside a git repository (Kode reads and writes files relative to the repo root)
- Your API key exported as
KODE_LLM_API_KEYorOPENAI_API_KEY
Steps
Run
kode init from the root of your repository. Kode creates a .kode/ directory and writes a default kode.json configuration file. It also auto-detects your test command and, if the optional security engine is available, installs it as an extra verification gate.── Kode Init ───────────────────────────────────────
✓ Created directory /your/project/.kode
Auto-detected test command: go test ./...
✓ Written /your/project/.kode/kode.json
── Engine Features ──────────────────────────────────
TDD Mode: ON (writes blocked unless test file present)
Test Command: go test ./...
Blast Radius: 3 files max per verify round
Token Budget: $1.50 per loop cycle
Blindfold: OFF (identifier obfuscation before LLM send)
If Kode finds a
.env file in the project root it will template the gateway URL as ${KODE_GATEWAY_URL} so you can rotate endpoints without editing the config file.{
"$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"],
"permission": {
"edit": "ask",
"bash": "ask"
},
"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"
}
}
engine.tdd_modetrueengine.max_blast_radius3engine.token_budget_usd1.50engine.blindfold_modefalsetrue, obfuscates identifier names before sending code to the LLM── Generating patches ───────────────────────────────
Task: add input validation to the user registration handler
LLM: anthropic/claude-sonnet-4-6
✓ Generated (3.2s): 4 hunk(s)
── Verifying patches ────────────────────────────────
✓ Applied 4 hunk(s) (4.1s)
✓ All done (4.1s)
┌─ Kode Gatekeeper Statistics ──────────────────────────────────────────┐
│
│ Total Verifications: 12
│ Passed: 10 (83.3%)
│ Failed: 2 (16.7%)
│ Avg Duration: 312.4ms (total: 3.7s)
│
│ Failure Breakdown (2 total):
│ imports: 1 (50.0%)
│ calls: 1 (50.0%)
│
│ Most Failed Files (top 10):
│ internal/auth/handler.go 2 failures
│
│ Models Used:
│ anthropic/claude-sonnet-4-6: 12 (100.0%)
│
│ Daily Trend (last 14 days):
│ 2025-07-01 ████████████████░░░░ 8/10 (80%)
│ 2025-07-02 ████████████████████ 2/2 (100%)
│
│ Recent Verdicts (last 20):
│ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓
│
└────────────────────────────────────────────────────────────────────────┘
Understanding gate failures
When a hunk fails verification, the log entry records the gate name and a short message. Usekode explain <check> to get a full description of that gate, its common causes, and suggested fixes:
explain command also prints up to five recent examples pulled from logs/kode.log so you can see which files triggered the gate in your own project.
kode run is a shortcut for kode generate --apply. It generates patches and immediately applies verified ones, but it does not run your test suite after applying. Use kode loop when you want the full Plan → Generate → Verify → Apply → Test pipeline with automatic rollback on test failure.Next steps
Loop Mode
Run the full pipeline with test execution and automatic rollback — including Ghost Branch parallel strategies.
Verify CLI
Run the verification gate directly against a JSON hunk file or a set of proposed file contents.