Using Unsnag with your coding agent
Unsnag is built to be driven by the coding agent you already use on your CLI, such as Claude Code, Codex or opencode. The loop it runs is the one you would: draft Scenarios, verify them, run the Benchmark, read the Report, fix the top Finding, check the fix.
Install the skill
unsnag init --skillThis writes Unsnag's own agent skill, SKILL.md, to .claude/skills/unsnag/ (where Claude Code looks) and .agents/skills/unsnag/ (where Codex and opencode look), in the current folder. Commit them with your project, so everyone's agent finds them. unsnag init mycli --skill writes the Benchmark and the skill at once. After upgrading Unsnag, run unsnag init --skill again: it replaces the skill with the one that matches your Unsnag's commands.
The skill is model-invoked: your agent loads it when you ask for something it covers. It teaches the agent to:
- draft Scenarios (
unsnag draft), read and promote them, and verify them (unsnag validate,unsnag scenarios verify); - run the Benchmark (
unsnag run), in the background when a Report outlasts its shell tool's time limit (unsnag run --detach, thenunsnag wait); - read the Report as JSON (
unsnag report --json): the summary, the ranked Findings with their evidence and explanation, and the comparison with the Baseline; - fix a Finding in your CLI's source, then rerun its verify command until the next Report marks it
resolved.
It also tells the agent to leave the budgets alone unless you say otherwise: Runs spend your OpenRouter money.
Ask for the loop
With the skill installed, ask in your own words:
- "Draft five Unsnag Scenarios for the export commands and verify them."
- "Run Unsnag and tell me what the top Findings are."
- "Fix the top Unsnag Finding and check that it's resolved."
Hand over one Finding
Every explained Finding has an agent prompt: a self-contained brief for a coding agent, naming the file, the evidence and the change to make. The HTML Report shows it on the Finding's page, ready to copy; unsnag report --json has it as findings[].explanation.agent_prompt. Paste it into your agent, then run the Finding's verify command (on the same page, and in findings[].verify) to check the fix:
unsnag report --json | jq -r '.data.findings[0].explanation.agent_prompt'
unsnag report --json | jq -r '.data.findings[0].verify'What makes Unsnag easy for an agent to drive
Unsnag holds itself to the rules it measures your CLI by:
--jsonon every command. stdout is exactly one JSON document:{"data": …, "warnings": […]}on success,{"error": {"code", "message", "hint"}}on failure. Progress and warnings go to stderr.- Exit codes 0 and 1 only. The reason is in
error.codeor in the result'sstatus, each described in the statuses and errors reference. - Every error has a hint that says what to do next.
- A JSON Schema for the config.
unsnag schema benchmarkandunsnag schema scenarioprint the schemas forunsnag/benchmark.yamland Scenario files, with every key's description: an agent can read them instead of the docs, and an editor with a YAML language server can validate against them. - The HTML Report's numbers are all in the JSON.
unsnag report --jsonhas every number the pages show, so an agent never parses HTML. Each Run's transcript and Target CLI calls are in itsrun.json.