Why Kōdo? — Comparison with Other Languages

Every language makes trade-offs. This page compares Kōdo with languages that share some of its goals — and explains why AI agents need something different.

The core question

“Why can’t an AI agent just use Rust / Dafny / Ada?”

Short answer: those languages were designed for human programmers solving specific problems. Kōdo is designed for AI agents producing software that must be verifiably correct, traceable, and machine-repairable.


Kōdo vs Rust

Rust is an exceptional language for systems programming. Kōdo borrows its ownership model (own/ref/mut) because it works.

DimensionRustKōdo
OwnershipBorrow checker, lifetimesLinear ownership (own/ref/mut), no lifetimes
SafetyMemory safetyMemory safety + contract safety (Z3-verified requires/ensures)
Error formatHuman-readable diagnosticsStructured JSON + FixPatch with byte offsets — agents parse and auto-apply
Auto-repaircargo fix for lint-level issueskodoc fix applies machine-generated patches for type errors, missing contracts, and more
Authorshipgit blame (external)@authored_by, @confidence, @reviewed_by — in the grammar, checked by the compiler
Modulesmod + Cargo.tomlSelf-describing meta {} blocks — purpose, version, author in every module
IntentN/Aintent blocks — declare what you want, resolver generates the implementation
Target userHuman systems programmersAI agents producing verifiable software

When to use Rust instead: You’re a human writing a kernel, database, or embedded system. Rust’s ecosystem, community, and maturity are unmatched for systems work.

When Kōdo wins: An AI agent needs to generate a service, verify its contracts statically, get structured error feedback, auto-fix issues in a tight loop, and produce a trust certificate — all without human intervention.


Kōdo vs Dafny

Dafny pioneered accessible formal verification with pre/post-conditions. Kōdo shares its belief that contracts should be first-class citizens.

DimensionDafnyKōdo
VerificationBuilt-in Boogie/Z3 proverZ3 for static verification, runtime fallback for undecidable cases
Compilation target.NET, Java, Go, Python, JavaScriptNative binary via Cranelift — no runtime dependency
OwnershipGarbage collectedLinear ownership — no GC, deterministic cleanup
Error outputText diagnosticsStructured JSON with FixPatch — machine-applicable corrections
Authorship trackingNoneCompiler-enforced @confidence scores with transitive propagation
Intent systemNoneDeclarative intent blocks for code generation
EcosystemAcademic, research-focusedPractical — HTTP server, JSON, MCP integration built into stdlib
Agent integrationNot designed for agentsAgent-first: JSON errors, fix patches, confidence certificates

When to use Dafny instead: You’re doing research in formal methods, need to target multiple backends, or want the most mature verification toolchain.

When Kōdo wins: You need verified code that compiles to a native binary, runs without a managed runtime, and integrates into an AI agent’s build-test-deploy pipeline with structured feedback at every step.


Kōdo vs Ada/SPARK

Ada/SPARK is the gold standard for safety-critical systems — avionics, rail, medical devices. Its contract system (Pre/Post) and SPARK subset are battle-tested.

DimensionAda/SPARKKōdo
ContractsPre/Post aspects, SPARK formal proofsrequires/ensures verified by Z3, runtime fallback
Safety levelDO-178C, EN 50128 certifiedNot safety-certified (designed for AI-generated software, not avionics)
SyntaxVerbose, 1980s-eraModern, minimal — optimized for agent generation and human readability
Type systemStrong, ranged types, discriminated recordsStrong, no implicit conversions, generics, traits, pattern matching
Agent supportNone@authored_by, @confidence, transitive trust, JSON error output
Error repairCompiler errors in proseFixPatch with byte offsets — agents apply fixes automatically
ConcurrencyTasks, protected objects (mature)spawn/async/await (v1: sequential execution)
EcosystemAerospace/defense supply chainModern stdlib: HTTP, JSON, testing, MCP

When to use Ada/SPARK instead: You’re building software where human lives depend on correctness — flight control, railway signaling, nuclear systems. Ada/SPARK has decades of certification and tooling that Kōdo doesn’t attempt to replace.

When Kōdo wins: You need AI agents to produce, verify, and maintain software with formal-ish guarantees — but you’re building web services, data pipelines, or automation, not flight controllers. Kōdo gives you contracts and verification without the ceremony.


What makes Kōdo unique

No other language combines all of these:

  1. Contracts in the grammarrequires/ensures verified by Z3, not a library or annotation processor
  2. Agent traceability@authored_by, @confidence, @reviewed_by checked by the compiler
  3. Machine-repairable errors — every error has a JSON representation with FixPatch byte offsets
  4. Transitive trust — confidence scores propagate through call chains; low-confidence code blocks compilation
  5. Intent-driven code — declare intent http_server, get a working implementation
  6. Self-describing modules — mandatory meta {} with purpose, version, author
  7. Native compilation — Cranelift backend, no VM or managed runtime
  8. Closed-loop repairkodoc check --json-errors → parse → kodoc fix → recompile, fully automated

Honest limitations

Kōdo is young. Here’s what it does not do yet:

  • No safety certification — not suitable for DO-178C or similar regulatory contexts
  • Concurrency is sequential in v1spawn/async compile but run on a single thread
  • Ecosystem is small — no package manager, limited third-party libraries
  • Z3 verification is partial — complex contracts may fall back to runtime checks
  • String handling is byte-based — not fully Unicode-aware yet

We believe in being transparent about where we are. Check the roadmap for what’s coming next.