cargo-terse
Concise cargo output for AI-assisted Rust development.
cargo-terse wraps cargo build, check, test, and clippy with condensed output optimized for AI agent consumption. Fewer tokens, same information.
Install
From crates.io
Pre-built binaries (via cargo-binstall)
From source
Usage
Setup
Auto-detects existing agent config files (CLAUDE.md, AGENTS.md, .cursorrules, .github/copilot-instructions.md) and appends usage instructions. Idempotent — won't duplicate if already configured.
Output formats
Verbosity
Drill-down
Each diagnostic gets an ID. Use detail to expand it:
Configuration for AI agents
Add to your project's CLAUDE.md (or equivalent AI agent instructions):
Use `cargo terse` instead of `cargo` for build, check, test, and clippy commands.
Examples:
- `cargo terse check` instead of `cargo check`
- `cargo terse test` instead of `cargo test`
- `cargo terse clippy` instead of `cargo clippy`
When a diagnostic needs more context, use `cargo terse detail <ID>` to expand it.
Example output
Default (terse):
W1 warning[unused_variables] src/lib.rs:4:9 unused variable `extra`
ok (check) 1 warning 0.1s
JSON:
Test output:
ok (test) 36 passed, 0 failed 0.5s
With failures:
F1 FAILED tests::parse_config_missing_field
F2 FAILED tests::handler_timeout
test result: FAILED. 2 passed; 2 failed; 0 ignored 1.2s
Why not --message-format=short?
cargo check --message-format=short has existed since 2018 and reduces diagnostic verbosity. cargo-terse builds beyond it:
- Stable drill-down IDs (W1, E1, F1) let you revisit any diagnostic with
cargo terse detail <ID>without re-running the build - Unified output across
check,test, andclippyin a single consistent format - Multiple output formats (plain, JSON, TOON) suited to different consumers
- Pairs well with RTK for additional token savings on broader cargo output
How it works
cargo-terse spawns cargo with --message-format=json (rather than the simpler --message-format=short), parses the JSON stream in real-time, and re-renders diagnostics in a condensed format. The JSON stream provides enough detail to assign stable IDs and support drill-down. Test results are parsed from stdout text output. A cache file (target/.terse-cache.json) enables the detail drill-down command.
Flags
| Flag | Description |
|---|---|
--format <plain|json|toon> |
Output format (default: plain) |
-v |
Verbose: include code span |
-vv |
Very verbose: full rustc output |
--no-cache |
Disable drill-down cache |
All other flags pass through to cargo.
License
MIT