Claude answers CI in a format a program can read
claude/cli-structured-output@v1
Every headless Claude CLI invocation the build ran asked for structured output.
| Id | claude/cli-structured-output |
| Version | v1 |
| Category | claude |
| Default severity | warning |
| Interpreter | python3 |
| Timeout | 30 seconds |
| Violations tolerated | 0 |
| Collects | commands |
Collectors
This guardrail doesn't gather anything itself. It relies on the collectors below, which the CLI runs once per build before any check, and reads what they found from GUARDRAIL_FACTS. If a collector collects nothing, this guardrail is skipped, not failed.
| Collector | Gathers | Inputs it is given |
|---|---|---|
commands | Every command the build executed, read from the session a running buildnote monitor records on the runner. This is what the job actually ran, not what a pipeline file says it would run. | none |
The inputs above are this guardrail's own inputs, passed straight through to the collector. Setting one in buildnote.json changes what is collected, and two guardrails configured the same way share a single collection.
Configuration
{
"guardrails": {
"failOn": "error",
"checks": [
{
"use": "claude/cli-structured-output@v1",
"severity": "warning",
"with": {
"formats": "json,stream-json"
},
"exemptions": []
}
]
}
}Inputs
| Input | Description | Default | Environment variable |
|---|---|---|---|
formats | Comma separated --output-format values that count as structured. | json,stream-json | GUARDRAIL_INPUT_FORMATS |
How to fix
Add --output-format json to the invocation:
claude -p --output-format json 'summarise what changed' > review.jsonA headless run is read by a program, not a person, and reading prose means guessing: a step that greps the answer for FAIL passes the day the model words it differently. JSON returns the result, the cost and the session id as fields, so your job can branch on a value instead of on a phrasing.
More in claude
claude/cli-safe-flags. No Claude CLI invocation the build ran asked to skip its approval step.claude/instructions-symlinked.CLAUDE.mdis a symbolic link toAGENTS.md, not a second copy of it or missing altogether.