Every token an agent spends reading CLI output is a token it can’t spend reasoning. incur defaults to TOON (Terse Object Oriented Notation)—a format that’s as readable as YAML but with no quoting, no braces, and no redundant syntax.
What is TOON?
TOON is a data serialization format designed for LLMs and humans. It uses up to 60% fewer tokens compared to JSON while remaining easy to parse.
Comparison
JSON output (verbose)
TOON output (concise)
Token Savings
The TOON format eliminates:
- Quotation marks around keys and strings
- Braces
{} for objects
- Brackets
[] around arrays (replaced with inline headers)
- Redundant commas between object properties
Result: 40-60% fewer tokens for typical CLI output.
incur supports multiple output formats. Switch between them using global options.
| Format | Description | Use Case |
|---|
toon | Terse Object Oriented Notation (default) | Agent consumption, human readability |
json | Standard JSON with 2-space indentation | Programmatic parsing, debugging |
yaml | YAML format | Human editing, config files |
md | Markdown tables | Documentation, reports |
jsonl | JSON Lines (streaming) | Log aggregation, streaming data |
Using --format
Using --json shorthand
Implementation
TOON output is automatic. Just return data from your command:
Default output (TOON)
JSON output
Markdown Tables
The md format automatically renders objects as tables:
Key-Value Tables
Columnar Tables
Arrays of objects become columnar tables:
JSONL for Streaming
When streaming data, use --format jsonl for line-delimited JSON:
Set a default format for your CLI:
Users can still override with --format or --json.
The formatter implementation is in src/Formatter.ts:
Use TOON (the default) for the best token efficiency and agent experience.