Agent Usage
aimux supports structured output for consumption by AI coding agents (Claude Code, Codex, Gemini CLI) and scripts.
Introspection
Section titled “Introspection”Call once per session to learn the full CLI contract:
aimux agent-contextReturns every command, flag, type, default, and valid enum as JSON. Agents use this to avoid guessing flag names or values.
Structured Output
Section titled “Structured Output”Add --json to any command for machine-parseable JSON output:
aimux agents --jsonaimux sessions --list --jsonaimux version --jsonaimux spawn claude --dry-run --jsonaimux resume <id> --dry-run --jsonaimux profile list --jsonaimux feedback "message" --jsonExit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Usage error (bad flags, missing args) |
| 3 | Not found (no sessions, no agents) |
| 4 | Config error |
Non-Interactive Mode
Section titled “Non-Interactive Mode”When stdin is not a TTY (piped or called by an agent), aimux sessions automatically behaves as aimux sessions --list instead of launching the interactive picker.
Field Selection
Section titled “Field Selection”Use --fields to select specific output columns:
aimux sessions --list --json --fields id,project,costaimux agents --json --fields pid,provider,statusBounded Output
Section titled “Bounded Output”Use --limit to control result count. When results are truncated, JSON output includes a hint:
{"sessions": [...], "count": 10, "total": 142, "truncated": true, "hint": "use --limit to control result count"}Dry Run
Section titled “Dry Run”Preview commands before executing:
aimux spawn claude --dir ./myproject --dry-run --jsonaimux resume <id> --dry-run --jsonProfiles
Section titled “Profiles”Save named configuration bundles for reuse:
aimux profile save work --provider claude --model opus --dir ~/projectaimux spawn --profile workaimux profile list --jsonaimux profile get work --jsonaimux profile delete workExplicit flags override profile values.
Delivery Targets
Section titled “Delivery Targets”Route spawn output to different sinks:
aimux spawn claude --json --deliver=file:./result.jsonaimux spawn claude --json --deliver=webhook:https://hooks.example.com/agentsValid schemes: stdout (default), file:<path>, webhook:<url>.
Waiting for Completion
Section titled “Waiting for Completion”Block until a spawned agent session finishes:
aimux spawn claude --dir ./project --wait --jsonReturns duration on completion. Eliminates the need for agents to write polling loops.
Feedback
Section titled “Feedback”Report CLI friction for maintainer review:
aimux feedback "the --limit flag silently ignores values over 100"Writes to ~/.aimux/feedback.jsonl.
Error Messages
Section titled “Error Messages”Errors include valid values when applicable:
$ aimux spawn gptError: invalid provider "gpt" (must be one of: claude, codex, gemini)With --json, errors go to stderr as structured JSON:
{"error": "invalid provider \"gpt\"", "code": 2, "valid_values": ["claude", "codex", "gemini"]}Configuration
Section titled “Configuration”Add to ~/.aimux/config.yaml:
resume: skip_permissions: true # always pass --dangerously-skip-permissions on resume