# No machine-readable output flag

> ax-check rule: Help documents no --json, --format json or similar flag, so an agent must parse text meant for people.

Section: ax-check rule · CLI behaviour  
Canonical: https://agentexperience.tech/checks/axc-c006/

Help documents no --json, --format json or similar flag, so an agent must parse text meant for people.

- **How serious**: **warn** A gap that leaves the agent guessing.
- **Kind of check**: **[Heuristic](https://agentexperience.tech/checks/#kinds)** A pattern match: a prompt to look, not a verdict.
- **ax-check command**: `ax-check probe-cli`
- **Where it applies**: Command-line programs, run as a subprocess
- **Topics**: [non-interactive](https://agentexperience.tech/evidence/#pattern-non-interactive), [docs-for-agents](https://agentexperience.tech/evidence/#pattern-docs-for-agents)
- **Rule text from**: ax-check 0.2.0Documented ahead of release

**Fix in one line** Add --json (or --format json) and document it in --help.

The help text documents no flag for JSON output. An agent that wants the result as data has to read text that was laid out for human eyes, which breaks when the layout changes.

## What it checks

ax-check reads the output of the help probe (`--help`, falling back to `-h`, and to `help` with `--probe help-word`). The rule fires when the help text mentions none of: `--json`, `--format json`, `--format=json`, `--output json`, `-o json`, `--jsonl`, `--ndjson` or `--porcelain`, and no documented flag offers `json` as a choice. If no help probe works, this rule does not run, and [Help is not reachable](https://agentexperience.tech/checks/axc-c009/) reports the missing help instead.

## Why it matters

Tables, colours and aligned columns are for people. A script or an agent needs fields it can address by name. The Command Line Interface Guidelines say: “Display output as formatted JSON if –json is passed.” Cloudflare’s documentation for its `cf` CLI says that its output contract puts the result on stdout as JSON (vendor documentation).

Missing machine output is also a documented pain point. cloudflare/cf issue #105 is titled “Output for scripts and agents: empty stdout with exit 0, –version not machine-readable, agent detection changes nothing”. The `--version` part was later fixed. The issue is context, not a measurement of how common the problem is.

## How to fix

Add `--json` (or `--format json`) and list it in `--help`. With the flag, write only JSON to stdout and send all other messages to stderr. See [Documented JSON output does not parse](https://agentexperience.tech/checks/axc-c007/), which checks that the JSON really parses.

## Example

### Before

```console
$ invoicer list --help
Usage: invoicer list [options]

Options:
  --status <s>   Filter by status
  --limit <n>    Maximum rows
$ invoicer list
ID      CUSTOMER      TOTAL     STATUS
1042    Acme Ltd      120.00    paid
1043    Brightside    80.50     open
```

### After

```console
$ invoicer list --help
Usage: invoicer list [options]

Options:
  --status <s>   Filter by status
  --limit <n>    Maximum rows
  --json         Print the result as JSON on stdout
$ invoicer list --json
[{"id":1042,"customer":"Acme Ltd","total":"120.00","status":"paid"},
 {"id":1043,"customer":"Brightside","total":"80.50","status":"open"}]
```

A Node fix:

```js
if (opts.json) {
  process.stdout.write(JSON.stringify(rows) + '\n');
} else {
  printTable(rows);
}
```

## How ax-check detects it

This is a text search over the help output. It looks for the listed flag spellings anywhere in the text, including in prose. It does not check that the flag works. With `--probe json`, [Documented JSON output does not parse](https://agentexperience.tech/checks/axc-c007/) checks that the output parses; without it, [Advertised JSON output not verified](https://agentexperience.tech/checks/axc-c013/) reports that the output was not verified.

Known false positives: a CLI whose output is already machine-readable by default, for example one that always prints JSON, and a CLI that has no meaningful output. Known false negatives: help text that mentions `--json` in an unrelated sentence. Silence the rule with `--disable <rule-id>` when it does not apply.

To reproduce by hand: `invoicer --help </dev/null | grep -Ei 'json|jsonl|ndjson|porcelain'`.

Safety note: This rule reads help text only, from the default `--help` probe. probe-cli executes your program under your own OS account. The temporary working directory and HOME it uses are not a sandbox: the program can still read and write anything your account can, and use the network. Probe a CLI you have not reviewed only inside a container or a throwaway virtual machine. Run `ax-check probe-cli --dry-run -- invoicer` first to see the probes that would run, and see the “Probe safety” section of the ax-check README for what is and is not isolated.

## Sources

- Guideline: Command Line Interface Guidelines, clig.dev. [https://clig.dev/](https://clig.dev/) . Says to display output as formatted JSON if `--json` is passed.
- Vendor documentation: Use cf with coding agents, Cloudflare, updated 2026-09-29. [https://developers.cloudflare.com/cf/agents/](https://developers.cloudflare.com/cf/agents/) . Documents an output contract with the result on stdout as JSON.
- Vendor issue: cloudflare/cf issue #105, “Output for scripts and agents: empty stdout with exit 0, –version not machine-readable, agent detection changes nothing”. [https://github.com/cloudflare/cf/issues/105](https://github.com/cloudflare/cf/issues/105) . Context only; the `--version` part was later fixed.

## Related evidence

Records in the [AX evidence register](https://agentexperience.tech/evidence/) about the same pattern as this rule. They don’t test the rule itself.

- [Coding agents mostly read instruction files, not docs sites](https://agentexperience.tech/evidence/ev-0011/): An observational study of 557 agentic coding sessions (preprint) found that instruction files and working notes made up 60.5% of agents' documentation interactions, against 10.6% for classical technical documentation and 1.3% for API references. Preprint: not yet peer reviewed
- [Compact documentation did not help when the source was present](https://agentexperience.tech/evidence/ev-0012/): Across two model families and ten repositories, with a positive control, a preprint found that neither compact natural-language documentation nor retrieved context helped coding agents resolve issues better than the issue alone when the source code was present. Preprint: not yet peer reviewed
- [A capable agent skipped the index and guessed the page](https://agentexperience.tech/evidence/ev-0027/): A preregistered ablation on a 709-page Markdown wiki (preprint) found that a capable tool-using agent never loaded the compact catalogue index, inferring page paths from the question instead, while retrieval-based access kept answer quality non-inferior and cut cost by about a third to over half. Preprint: not yet peer reviewed
- [A warning that names the failing plan redirected agents; a tip did not](https://agentexperience.tech/evidence/ev-0029/): Microsoft reports that a documentation tip pointing to the right tool got 1 of 5 agent runs to use it, while a warning naming the agent's failing approach ('Manually updating package.json alone will result in build failures') got 5 of 5. Vendor measurement: the vendor’s own, with its method
- [Adding the context7 MCP server gave no lift; its tools went unused](https://agentexperience.tech/evidence/ev-0030/): Microsoft reports that adding the context7 MCP server to an anti-hallucination skill gave no meaningful lift on an SPFx upgrade: its tools did not load in 3 of 5 runs and were not called in the other 2, while telling the agent to use CLI for Microsoft 365 raised configuration correctness from 30/80 to 75/80. Vendor measurement: the vendor’s own, with its method
- [Vendor claim: agents never invoked a docs skill in 56% of eval cases](https://agentexperience.tech/evidence/ev-0032/): Vercel states that in its Next.js 16 evals the docs skill was never invoked in 56% of cases, so the skill matched the 53% pass rate of no docs, while an 8KB docs index in AGENTS.md reached 100%. Vendor claim: a figure with no published method

## Related guides

- [Agent error recovery: design the path back](https://agentexperience.tech/insights/design-for-recovery/): Agent error recovery in practice: what a failure response must say, when a retry is safe, how to handle partial completion, and when to escalate. Guide
- [Write agent-readable documentation](https://agentexperience.tech/insights/make-documentation-legible/): Agent-readable documentation in practice: what documentation for AI agents must answer, how to shape a page around one decision, and how to keep it true. Guide

## Go here next

- [Agent error recovery: design the path back](https://agentexperience.tech/insights/design-for-recovery/): Four fields turn an error into a decision: what failed, whether state changed, whether a retry is safe, and what input would fix it. Guide
- [A CLI exits 0 when a destructive command is refused](https://agentexperience.tech/evidence/ev-0036/): Cloudflare's cf CLI documents that in a non-interactive session a destructive command without --force prints 'Aborted.' and exits with status 0, and a public issue reproduces this for workflows delete. Evidence
- [Documented JSON output does not parse](https://agentexperience.tech/checks/axc-c007/): The command succeeded with the documented JSON flag but stdout was not valid JSON or JSON lines. Rule

## About this rule text

[Unknown command gives no suggestion](https://agentexperience.tech/checks/axc-c005/)

[Documented JSON output does not parse](https://agentexperience.tech/checks/axc-c007/)

[All ax-check rules](https://agentexperience.tech/checks/)

Rule text from ax-check 0.2.0, by Himadri Mishra. The licence will be confirmed before the source repository is published.
