The programming language
designed for AI agents
Contracts verified by Z3. Authorship tracked by the compiler.
Intent-driven code generation. Transparent for humans.
Not a framework. Not a linter. A new language where AI code safety is solved at the grammar level.
module hello {
meta {
purpose: "Greet the world"
version: "1.0.0"
}
@authored_by(agent: "claude")
@confidence(0.95)
fn main() {
let msg: String = "Hello from Kōdo!"
println(msg)
}
} The problem
AI agents are writing production code.
In languages that weren't built for them.
Every existing language was designed for humans typing at keyboards. Click any row to see how Kōdo solves it.
Code examples
See Kōdo in action
Real code. Real features. No boilerplate.
module math {
meta {
purpose: "Safe math operations"
version: "1.0.0"
}
fn safe_divide(a: Int, b: Int) -> Int
requires { b != 0 }
{
return a / b
}
fn clamp(value: Int, min: Int, max: Int) -> Int
requires { min <= max }
ensures { result >= min && result <= max }
{
if value < min { return min }
if value > max { return max }
return value
}
} Compiler-as-Reviewer
Trust enforcement that no other language has
Kōdo doesn't just track authorship — it blocks compilation when trust policies are violated. Three mechanisms work together.
Compilation Blocking
@confidence below 0.8 without @reviewed_by? Compilation fails with E0260. This isn't a warning — the binary doesn't get produced.
// This WON'T compile:
@confidence(0.5)
fn risky() { ... }
error[E0260]: confidence 0.50
below threshold 0.80
add: @reviewed_by(human: "...") Transitive Propagation
If fn A (0.95) calls fn B (0.5), A's effective confidence drops to 0.5. You can't hide low-quality code behind a high-confidence wrapper.
@confidence(0.95) // declared
fn process() {
risky() // calls 0.5
}
// effective confidence: 0.5
// kodoc confidence-report
// shows full call graph Build Certificates
Every build produces a .ko.cert.json with SHA-256 hashes, per-function confidence scores, and contract verification status. Deploy policies can gate on this.
// .ko.cert.json
{ "functions": [
{ "name": "validate",
"confidence": 0.95,
"contracts": "static_verified",
"sha256": "a1b2c3..." }
] } Enforced policies — violations are compilation errors, not warnings:
E0260 @confidence < 0.8 without @reviewed_by E0261 Function below module min_confidence E0262 @security_sensitive without contracts Error repair
The closed-loop repair cycle
Agent writes code. Compiler returns structured JSON with machine-applicable patches. kodoc fix applies them automatically — zero guessing, zero human intervention.
{
"code": "E0201",
"message": "undefined type `conter`",
"suggestion": "did you mean `counter`?",
"fix_patch": {
"description": "rename to closest match",
"start_offset": 42,
"end_offset": 48,
"replacement": "counter"
}
} What the compiler gives agents
- Unique error codes (E0001-E0699) with structured JSON — no regex parsing
- Levenshtein suggestions — "did you mean X?" with byte-accurate offsets
- Machine-applicable FixPatch — byte offsets + replacement, apply without parsing prose
- kodoc fix — applies ALL patches automatically in one command
- kodoc explain E0240 — full context for any error code
No ambiguity, no guessing. The agent reads structured data, applies the patch, and recompiles. Fully automated.
A complete language
Built for correctness, not just convenience
Kōdo isn't annotations bolted onto another language. It's a full compiled language with native binary output via Cranelift.
Linear Ownership
own/ref/mut — every value has one owner. Use-after-move (E0240), borrow-escapes-scope (E0241), double-mut-borrow (E0247) caught at compile time.
Zero Implicit Conversions
No silent type coercions. Int stays Int. Agents can't generate subtle type bugs that pass compilation. Every conversion is explicit.
Self-Describing Modules
Mandatory meta blocks. The compiler rejects modules without a declared purpose — every module is instantly comprehensible by agents and humans.
Exhaustive Pattern Matching
match on enums with destructuring. The compiler ensures every variant is handled — no missed cases, no fallthrough, no default swallowing bugs.
Complete Standard Library
Strings, List<T>, Map<K,V>, JSON, HTTP client/server, File I/O, Math, CLI args. Agents can write real programs without external dependencies.
Agent-Centric Developer Tools
LSP with contract-aware completions and FixPatch code actions. MCP server for native AI integration. REPL for exploration. Multi-file imports.
Real programs
Not just hello world
127 examples covering the full language. These are real programs with HTTP servers, JSON APIs, file processing, and data structures.
Todo App
Full CRUD application with struct methods, pattern matching on Options, and list operations.
Config Validator
Validates configuration with contracts ensuring all invariants hold before the system starts.
Health Checker
HTTP health check service with JSON responses, error handling, and structured logging.
URL Shortener
REST API with Map<String, String> storage, HTTP routing, and JSON request/response handling.
Word Counter
File processing with string splitting, map aggregation, and sorted output.
CRUD API
Complete REST API with create, read, update, delete operations and JSON serialization.
Get started in 3 steps
Install the compiler
# macOS (Apple Silicon)
curl -L https://github.com/rfunix/kodo/releases/latest/download/kodoc-macos-aarch64 -o kodoc
chmod +x kodoc && sudo mv kodoc /usr/local/bin/ Write hello.ko
module hello {
meta {
purpose: "My first Kōdo program"
version: "0.1.0"
}
fn main() {
println("Hello from Kōdo!")
}
} Build & run
kodoc build hello.ko -o hello
./hello
Hello from Kōdo! By the numbers