Use Kavach with AI agents
Give coding agents a fixture to reproduce and an objective check on their fix. Install the five agent skills and register the MCP server in Claude Code, Codex, OpenCode, Cursor or Antigravity.
A coding agent that fixes production bugs from logs is guessing. With Kavach it has the exact failing input to reproduce, and a check (kavach diff) that tells it, without reasoning, whether its fix holds. A fix the agent only fitted to the recorded event fails on a variant, and the agent sees which one.
Install#
The install script copies the skills into every agent it finds. Or install only the skills:
npx skills add kavachlabs/kavachRegister the MCP server#
kavach mcp serves the same checks as structured JSON over the Model Context Protocol.
claude mcp add kavach -- kavach mcp[mcp_servers.kavach]
command = "kavach"
args = ["mcp"]{
"mcpServers": {
"kavach": { "command": "/Users/you/.local/bin/kavach", "args": ["mcp"] }
}
}Antigravity starts MCP servers without your shell's PATH, so give it the full path that command -v kavach prints. Other MCP clients take the same command: kavach mcp, on stdin and stdout.
Zero-install public Atlas MCP (https://mcp.kavachlabs.dev/mcp)#
To query AST-verified invariants, causal traces, and starter contracts for public GitHub repositories without installing anything locally, connect over Streamable HTTP:
claude mcp add --transport http kavach-atlas https://mcp.kavachlabs.dev/mcpSee the Visual Invariant Atlas for one-click Cursor/VS Code install links and the MCP reference for the full tool list.
The five skills#
| Skill | What it teaches the agent |
|---|---|
/kavach-fix |
Reproduce a .kavach crash, fix the handler, and generalise until kavach diff returns fixed across every incident and regression variant. |
/kavach-implement |
Build a feature contract-first: record traffic, declare invariants from the spec, stop for your approval, then iterate until kavach contract check returns pass. |
/kavach-setup |
Map the service's state boundaries into .kavach/plan/state-map.md, then instrument the handler with the right SDK, or build a host harness, in any of the 12 languages. |
/kavach-invariants |
Propose invariants and planned mutants in .kavach/plan/invariants.md, declare them, and mutation-test each in milliseconds. |
/kavach-verify |
Check another agent's fix or feature and post the verdict without touching the code: the verifier in a multi-agent pipeline. |
The skills write plans (state-map.md, invariants.md, map.json) under .kavach/plan/ for you to review before they change code.
Starter prompts#
/kavach-fix Reproduce the crash in testdata/null-amount.kavach and fix the handler until kavach diff reports verdict: fixed./kavach-setup Map the order-matching handler in internal/matcher/ into .kavach/plan/state-map.md and instrument it with the Kavach Go SDK so it records production failures and runs as a kavach-host for replay./kavach-implement Implement the feature described in docs/spec.md contract-first with Kavach. Stop after kavach contract show so I can approve the contract before you write the implementation./kavach-invariants Write .kavach/plan/invariants.md for the ledger service, declare the invariants on the handler, and falsify each one by mutation-testing it against a recorded journal./kavach-verify Check the ledger worker's fix in #12 against testdata/null-amount.kavach and post the verdict.Agent teams#
In a team of agents, give one the verifier role with /kavach-verify. It never edits code, fixtures or contracts; it builds what the author built, runs Kavach, and posts one result:
@coordinator [done] [kavach] fixed · null-amount.kavach · re #12
old still_failing@32 → new fixed · variants 51/51 · regressions 47/47In an Antigravity /swarm:
/swarm Fix the incident in testdata/null-amount.kavach. Add a worker named verifier whose brief is: load the kavach-verify skill and check every [done] post from the fixer.Rules every agent follows#
These are in the skills; state them in your own agent instructions if you drive Kavach without them.
- Reproduce before fixing. If
kavach replaydoes not reproduce the failure, stop and report it. - Never edit, regenerate or delete a fixture to make a check pass. It is a record of production.
- Never approve a contract. A person runs
kavach contract approve. - A fix counts only at
fixed.unverifiedis notfixed;variant_failed(3)@15is not "mostly works". - Report verdicts exactly as Kavach prints them.
- Generalise; never special-case a variant.
The MCP tools#
| Tool | Does |
|---|---|
kavach_list_incidents |
Finds every *.kavach under a directory, with each failure's kind, seq and message. |
kavach_replay |
Replays a fixture or variant on a host command. |
kavach_time_travel |
Replays up to a seq and sends probe inputs to the live handler. |
kavach_diff |
Verifies a fix across variants and regression variants. |
kavach_contract_show |
Shows a feature contract and its lock. |
kavach_contract_check |
Checks a build against an approved contract. |
kavach_map |
Builds a flow map summary, or writes the HTML. |
There is no tool to approve a contract. Arguments and results are in the MCP reference.
Slash command without skills#
For agents that read Markdown commands but not skills, /kavach-implement also ships as a plain command file with $ARGUMENTS. Copy commands/kavach-implement.md from the Kavach repository into .claude/commands/ (Claude Code) or .opencode/command/ (OpenCode).
Something wrong or missing on this page? Report it on GitHub, or write to hello@thekavachlabs.com.