How Well AI Writes Kavach
● Intermediate6 minBefore this: Tools for AI
How often Claude models write Kavach that runs right: alone, with the guide for AI tools, with the compiler's errors sent back, and with Kavach's own tools. Measured, failures included.
75 small programming tasks, in the style of HumanEval and MBPP, are each given to a Claude model under four conditions. The model's answer passes when its hidden tests print exactly what they should. How everything is done is in method.md.
| Condition | What the model gets |
|---|---|
zero | The task only |
docs | The task, and Kavach's guide for AI tools (llms.txt) |
repair | As docs, and each failed try's errors sent back, up to 3 tries |
tools | As docs, and Kavach's own tools (kavach mcp: check, run, test, outline, query) to try its code, up to 3 graded tries |
How many passed
Measured on 2026-11-14 at commit 22a20eb, all 75 tasks, one run of each cell (1,200 answers, $24.66 in all). Every answer is in results/2026-11-14-kavach.json; summarize.py makes these tables from it.
zero9% (7/75)docs53% (40/75)repair97% (73/75)tools100% (75/75)zero4% (3/75)docs75% (56/75)repair99% (74/75)tools100% (75/75)zero7% (5/75)docs77% (58/75)repair100% (75/75)tools100% (75/75)zero7% (5/75)docs87% (65/75)repair100% (75/75)tools100% (75/75)| Model | zero | docs | repair | tools |
|---|---|---|---|---|
| Claude Haiku 5.5 | 9% (7/75) | 53% (40/75) | 97% (73/75) | 100% (75/75) |
| Claude Sonnet 5.5 | 4% (3/75) | 75% (56/75) | 99% (74/75) | 100% (75/75) |
| Claude Opus 5.5 | 7% (5/75) | 77% (58/75) | 100% (75/75) | 100% (75/75) |
| Claude Fable 5.2 | 7% (5/75) | 87% (65/75) | 100% (75/75) | 100% (75/75) |
What the run shows
- Without help, models write Rust. Zero-shot, 4–9% pass. Of the 280 failures, 168 stop at Rust's
let mut(a Kavachletcan already change), and 40 more at a semicolon. At22a20ebthe message forlet mutwas a plain "expected=and a value"; it now says to writelet. The models know the language's shape, not its words. - The guide does most of the work. With llms.txt as the system prompt (about 1,500 tokens), 53–87% pass, and syntax errors nearly vanish. What remains is mostly type errors: writing a union's variant without its type (decision 0070), joining lists with
+, leaving out an argument, a method that isn't there. - The guide itself was out of date. At
22a20eb,llms.txtstill showed variants without their type (status: Status = Pending, which decision 0070 refuses) andInt.parse(text), which is gone. Those two account for 23 of the 81docsfailures. Both are fixed, and its test now compiles every example and refuses such habits. - The compiler's messages finish the job. Sent back the errors, every model reaches 97–100%, the strongest in 1.2 tries on average. With Kavach's own tools (
kavach mcp), all four pass every task, almost always on the first graded try. - Tools cost more than they help here.
repairreaches nearly the same score astoolsfor less money and time: Sonnet $0.59 against $1.32, 8 minutes against 35.
The run was stopped once: a model's code looped forever inside kavach mcp, which has no time limit of its own. The runner then got its 60-second limit and --resume, and finished the rest.
Since the run, let mut, where most zero-shot failures stopped, gets a message that says what to write instead:
fn main() {
let mut count = 0
count += 1
print(count)
}The compiler refused the program:
kavach run let-mut.kav
error: Kavach has no `let mut`: a `let` can already change, so write `let count`Tries, cost and time
The average number of graded tries a passing task took.
| Model | zero | docs | repair | tools |
|---|---|---|---|---|
| Claude Haiku 5.5 | 1.00 | 1.00 | 1.45 | 1.01 |
| Claude Sonnet 5.5 | 1.00 | 1.00 | 1.30 | 1.00 |
| Claude Opus 5.5 | 1.00 | 1.00 | 1.24 | 1.00 |
| Claude Fable 5.2 | 1.00 | 1.00 | 1.16 | 1.00 |
Dollars and minutes for all 75 tasks.
| Model | zero | docs | repair | tools |
|---|---|---|---|---|
| Claude Haiku 5.5 | $0.02, 5 min | $0.03, 5 min | $0.05, 8 min | $0.09, 9 min |
| Claude Sonnet 5.5 | $0.43, 6 min | $0.45, 7 min | $0.59, 8 min | $1.32, 35 min |
| Claude Opus 5.5 | $0.82, 7 min | $0.73, 6 min | $0.89, 7 min | $2.25, 14 min |
| Claude Fable 5.2 | $3.02, 13 min | $4.57, 20 min | $4.80, 20 min | $4.60, 12 min |
What went wrong
What the last failed try of each failed task went wrong on: syntax, type (and names), capability, panic, timeout, or logic (it ran, but printed something else).
| Model | zero | docs | repair | tools |
|---|---|---|---|---|
| Claude Haiku 5.5 | syntax 43, type 25 | type 29, syntax 6 | type 1, syntax 1 | none |
| Claude Sonnet 5.5 | syntax 45, type 27 | type 12, syntax 7 | type 1 | none |
| Claude Opus 5.5 | syntax 40, type 30 | type 13, syntax 4 | none | none |
| Claude Fable 5.2 | syntax 42, type 28 | type 7, syntax 3 | none | none |
Each cell was run once, so a small difference between two models may not hold in another run. The tasks, prompts and grading are in method.md, linked below.
Run it yourself
Anyone can run this benchmark, with their own API key. It needs Python 3.10 or later and the kavach command.
--estimate prints the most a run could cost, at the rates in prices.json (read from Anthropic's pricing page; update them if they changed). The whole table above costs at most about $90.
Then, with your key in ANTHROPIC_API_KEY:
--models: any ofhaiku,sonnet,opus,fable.--conditions: any ofzero,docs,repair,tools.--tasks: task ids from tasks/tasks.json; all of them when left out.--budget: the run stops before spending more than this many dollars (default 5).--resume: keeps the answers already in the results file (--out) and runs only the others, after a run was stopped.KAVACH: the path of thekavachcommand, when it isn't onPATH.
Each run writes every answer, its code, tokens, cost, time and failures to results/<date>-<language>.json.
The guide the docs condition gives the model is the site's own llms.txt, and the tools are kavach mcp's.