kode golf is a competitive optimization command: you point it at a single source file, and it spins up three isolated git worktrees that each attempt a different optimization strategy in parallel. All three are benchmarked against the original baseline, and the version that shows the most improvement is offered to you for merge. If no strategy beats the baseline, your original code is left completely untouched.
How it works
Usage
Flags
Example output
Best use cases
Code Golf is most effective when you already suspect a specific file is a bottleneck:- Hot paths — a function that is called millions of times per request and shows up in profiles
- Algorithms you know are slow — O(n²) loops, repeated string concatenation, linear searches over large slices
- Memory-intensive data structures — caches, buffers, and pools that allocate on every call
- Parsers and serializers — files that transform large inputs and are called on every request
Benchmark commands for non-Go projects
The default benchmark command isgo test -bench=. -benchmem. For other languages, pass --test-command with an equivalent:
The benchmark command must write results to stdout in a format Kode can parse. For Go this is automatic. For other runtimes, Kode reads raw stdout and compares the numeric throughput figures between runs — any benchmark framework that prints numbers works, but structured output (JSON, TAP) gives cleaner comparisons.
Next steps
Loop Mode
Run the full pipeline with test execution, rollback, and multi-strategy Ghost Branches.
Daemon Mode
Let Kode watch your git history and proactively surface performance regressions as they accumulate.