Scripts and --json
tria behaves well outside the terminal: no colors or animations when nobody’s watching, JSON for reading from another program, and exit codes that tell you what happened.
No questions
| Command | So it doesn’t ask |
|---|---|
tria sort | --auto applies what’s clear; --dry-run and --json, on their own, don’t move anything. |
tria init | --template with its template; with --learn, add -y. |
tria rules ask | -y applies the change without asking. |
tria rules learn and tria eval | -y accepts the cost without asking. |
Without them, tria says “No interactive terminal: use --yes, --auto, --dry-run or --json depending on the command.” and exits with 2. With tria init --template and no terminal, the profile is created empty.
Clean output
If the output isn’t a terminal, tria writes plain text. The waiting animation goes to standard error, so whatever you save to a file comes out clean:
tria sort --dry-run > proposals.txttria sort --dry-run --json > proposals.jsonWith --json --show-prompt, what’s sent to the AI goes to standard error and standard output stays pure JSON.
The tria sort JSON
{ "applied": [ { "from": "99-Inbox/Scan_20261011_0012.pdf", "to": "2-Invoices Received/2026/Q4/Invoice Bay Stationery - 2026-10-11.pdf" } ], "cost": 0.00936, "failed": [], "items": [ { "confidence": "high", "destination": "2-Invoices Received/2026/Q4/Invoice Bay Stationery - 2026-10-11.pdf", "file": "99-Inbox/Scan_20261011_0012.pdf", "reason": "Invoice from Bay Stationery dated October 11, 2026.", "status": "proposal" } ], "model": "claude-sonnet-5-5", "usage": { "cacheReadTokens": 5800, "cacheWriteTokens": 0, "inputTokens": 2100, "outputTokens": 400 }}| Field | What it is |
|---|---|
items | Each document in the inbox: file, status (proposal, duplicate or pending), destination, confidence (high, medium or low), reason and, if there is one, doubt. |
applied | What was moved, from from to to. |
failed | What couldn’t be moved, with the reason. |
model, usage, cost | The model, the tokens and the approximate cost in USD. |
interrupted | Only if the batch was cut short, with the reason. |
Fields with no value are left out. tria eval --json writes the evaluation report along the same lines.
Exit codes
| Code | When |
|---|---|
0 | All good. For tria sort, nothing left pending; with --dry-run, as long as there’s no error. |
1 | tria sort leaves documents in the inbox; tria rules ask doesn’t make the change; tria eval --baseline scores lower. |
2 | Something went wrong. |
130 | Interrupted with Ctrl-C. |
tria sort --auto --json > today.jsonif [ $? -eq 1 ]; then echo "Documents left in the inbox"; fiEnvironment variables
| Variable | Effect |
|---|---|
ANTHROPIC_API_KEY, OPENAI_API_KEY | The key, instead of the one in the Keychain. |
NO_COLOR | No colors or animations, with any non-empty value. |
CLICOLOR_FORCE=1 | Colors even when the output isn’t a terminal. NO_COLOR wins. |
TERM=dumb | Plain text, no animations or full screen. |
TRIA_LANG | The language of the messages and the help: ca, es or en. |
XDG_CONFIG_HOME | Where to look for tria/config.toml. |
Only one process sorts a space at a time. If the app or another tria is sorting it, tria sort exits with 2 and says so: try again when it finishes.