--format agent (or JUGGERNAUT_FORMAT=agent) makes every task write one compact JSON
document to stdout and nothing else there; progress and warnings go to stderr. It is
meant for coding agents and scripts: everything needed to act on a survivor is in the
document, and nothing is cut without saying so.
The document is format 1. Its keys keep the order shown here, and within format 1 a key is never renamed or removed; new keys may be added, so read the keys you need and ignore the rest. Strings are UTF-8 (invalid bytes are replaced with U+FFFD).
Exit codes
| Code | Meaning |
|---|---|
| 0 | The gate passed, or a read-only task succeeded. |
| 1 | The gate failed, or the run is incomplete (--fail-fast, --budget or --max-mutants left mutants unrun). |
| 2 | Usage or configuration error. Nothing was scored. |
| 3 | Infrastructure or harness error. Never a verdict about your tests. |
When several apply, the precedence is 2, then 3, then 1, then 0: a run with any harness error exits 3 even when mutants survived, and its survivors are still reported.
A run (mix juggernaut)
{
"format": 1,
"kind": "run",
"summary": {
"run_id": "20261123T150102Z-7f3a",
"verdict": "fail",
"exit_code": 1,
"advisory": false,
"lane": "gate",
"scope": {"kind": "changed", "base": "main", "files": 3},
"commit": "84d4297",
"dirty": true,
"seed": 412093,
"counts": {"mutants": 412, "killed": 380, "survived": 9, "no_coverage": 1,
"timeout": 2, "ignored": 18, "equivalent": 1, "compile_error": 1,
"harness_error": 0, "pending": 0, "reused": 120, "integration_only": 3},
"kill_kinds": {"assertion": 301, "exception": 70, "timeout": 2, "crash": 1, "boot": 8},
"score": {"run": 97.4, "core": 100.0, "files": {"lib/my_app/client.ex": 83.8}},
"thresholds": {"core": 100, "changed": 80, "per": "file"},
"failures": [{"rule": "changed", "file": "lib/my_app/client.ex", "mutant_id": null,
"score": 78.0, "threshold": 80}],
"new_ignores": [{"file": "lib/x.ex", "filter": ["integer:zero"], "line": 12,
"prefix": "juggernaut:ignore", "reason": "retry count"}],
"triage_claims": [{"id": "Grant.check/2:relational:4be1c09", "core": true,
"acked": false, "state": "unacked", "reason": "...", "by": "agent:x"}],
"weakening": [],
"durations_ms": {"wall": 41230, "phases": {"plan": 210, "sync": 95, "compile": 3120,
"pool_boot": 2600, "probe": 9800, "mutants": 24900, "report": 60}},
"reused": {"results": 120, "recorded_ms": 51200,
"basis": "recorded durations of the reused results"},
"recycles": 0
},
"survivors": [
{
"id": "Client.backoff/1:integer:0a91c3e",
"status": "survived",
"core": false,
"file": "lib/my_app/client.ex",
"line": 106,
"column": 22,
"function": "MyApp.Client.backoff/1",
"operator": "integer",
"variant": "pred",
"diff": "@@ -106 +106 @@\n- min(attempt, 10)\n+ min(attempt, 9)\n",
"excerpt": {"start_line": 104, "lines": [" defp backoff(attempt) do", "..."]},
"selection": "tests",
"selection_reason": null,
"tests_ran": [{"id": "test/my_app/client_test.exs:88",
"name": "test backoff caps at a minute", "ms": 14, "passed": true}],
"nearest_miss": {"test": "test/my_app/client_test.exs:88", "site_hits": 3},
"suggested_test_file": "test/my_app/client_test.exs",
"verify": "mix juggernaut.check 0a91c3e --format agent"
}
],
"not_scored": [],
"integration_only": [],
"page": {"page": 1, "per_page": 20, "total": 10, "more": 0, "next": null}
}summary
verdictispass,fail,incompleteorerror, andexit_codethe code the task exits with.advisoryistruefor theinnerlane: a fast, partial check meant for the edit loop, not a gate (its exit codes are the same).countsholds every status, plusreused(results taken from the cache) andintegration_only(kills only an integration test made; they count inkilledtoo).kill_kindssplits the kills:assertion,exception,timeout,crash(the test process or the VM died) andboot(the application failed to start with the mutant).score.fileshas the score of each file;failureslists every rule that failed. Each entry always has the five keysrule(core,changed,no_coverageorincomplete),file,mutant_id,scoreandthreshold, withnullwhere a key does not apply.new_ignoresare ignore comments that are new in this run, andtriage_claimsthe equivalence claims that apply (stateisapplies,unackedorlapsed). Both are shown to the people who review the run: say so when you add one.weakeninglists tests weakened since a cached result's commit (kind,file,detail,commit); any finding invalidates the cached results of that commit.durations_msare the run's measured phase clocks.reused.recorded_msis what the reused results took when they were recorded, not time measured in this run.
survivors
The survivors on this page: mutants that survived, those with no_coverage (no test
reached them; tests_ran is empty) and, under timeouts: :survived, kills only by
timeout ("status": "timeout"). Core mutants come first, then by file and line.
To kill one: read diff and excerpt (the function's source), look at tests_ran (the
tests that ran with the mutant on and still passed) and nearest_miss (the test that
executed the mutated code most often), and write a test in suggested_test_file that
tells the two versions apart. Then run verify: exit 0 means the mutant is now killed.
selection says how the job's tests were chosen: tests (the tests that reach the
mutated code), file, suite, warm_first, boot (a fresh boot of the app),
reconfirm or none. selection_reason explains a selection other than tests.
not_scored, integration_only and page
not_scoredlists every mutant that could not be judged (harness_error,compile_error, orpending: left unrun), each withid,status,file,line,function,operatorandreason. It is never paged.integration_onlylists every mutant that only an integration test killed (id,core,file,line,function,operator,variant,killed_by): a change no unit test catches. It is never paged.page: survivors come 20 to a page by default (--page,--per-page). Whenmoreis not 0,nextis the command that prints the next page.
Other documents
Every task that offers --format agent writes the same envelope, {"format": 1, "kind": ...}:
| Task | kind | Contents |
|---|---|---|
mix juggernaut --dry-run | plan | the mutants a run would make, by file and operator |
mix juggernaut.check ID... | check | exit_code and mutants: each mutant with its status, kill_kind, test_lane, killed_by, control, the tests that ran, duration_ms, verify, and survivor (whether the gate counts it as one) |
mix juggernaut.explain ID | explain | run_id and mutant: the survivor object above plus key, kill_kind, test_lane, killed_by, duration_ms, reused_from, control, reason, ignore and triage |
mix juggernaut.survivors | survivors | a recorded run's survivors, grouped and paged |
mix juggernaut.history | history | one entry per recorded run |
mix juggernaut.profile | profile | where a run's time went |
mix juggernaut.compare | compare | two runs, or a run and a report, mutant by mutant |
mix juggernaut.advise | advise | mutants by category, test files that behave unlike their lane (misclassified), seams, warm-safe declarations, then next (commands an agent may run) and for_a_person (commands it must not) |
Errors
A usage, configuration or infrastructure error is a document of its own, on stdout:
{"format": 1, "kind": "error", "exit_code": 2,
"error": {"type": "config", "message": "...", "file": ".juggernaut.exs"}}type is usage, config (both exit 2) or infrastructure (exit 3); any further keys
of error are details, sorted by name.
The event stream
--stream writes one JSON object per line as the run goes. Each has v (1), event,
run_id and t_ms (milliseconds since the run started) first. The events are
run_started, phase_started, phase_finished, plan, reuse, worker, mutant,
survivor (the full survivor object, after its mutant line), boot_lane, warning
and run_finished. With --format agent the last line is a report event holding the
agent document as document.
A loop for agents
- Set
JUGGERNAUT_FORMAT=agentandJUGGERNAUT_ACTOR=agent:<name>. - Run
mix juggernaut --lane innerafter an edit, or keepmix juggernaut --watchopen. - Read
summaryfirst, then each survivor, write the missing test, and run itsverifycommand. - Follow
page.nextuntilpage.moreis 0, and readnot_scored. - Run
mix juggernaut.advise --format agentwhen runs are slow or survivors sit behindsuite,fileorbootselections.
Exit 3 is never a verdict about your tests: report it rather than change tests for it.
Do not add ignore comments or triage claims to make a gate pass without saying so.
mix juggernaut.install --agents writes these instructions into AGENTS.md and an agent
skill.