Skip to content

Agent Usage

aimux supports structured output for consumption by AI coding agents (Claude Code, Codex, Gemini CLI) and scripts.

Call once per session to learn the full CLI contract:

Terminal window
aimux agent-context

Returns every command, flag, type, default, and valid enum as JSON. Agents use this to avoid guessing flag names or values.

Add --json to any command for machine-parseable JSON output:

Terminal window
aimux agents --json
aimux sessions --list --json
aimux version --json
aimux spawn claude --dry-run --json
aimux resume <id> --dry-run --json
aimux profile list --json
aimux feedback "message" --json
CodeMeaning
0Success
1General error
2Usage error (bad flags, missing args)
3Not found (no sessions, no agents)
4Config error

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.

Use --fields to select specific output columns:

Terminal window
aimux sessions --list --json --fields id,project,cost
aimux agents --json --fields pid,provider,status

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"}

Preview commands before executing:

Terminal window
aimux spawn claude --dir ./myproject --dry-run --json
aimux resume <id> --dry-run --json

Save named configuration bundles for reuse:

Terminal window
aimux profile save work --provider claude --model opus --dir ~/project
aimux spawn --profile work
aimux profile list --json
aimux profile get work --json
aimux profile delete work

Explicit flags override profile values.

Route spawn output to different sinks:

Terminal window
aimux spawn claude --json --deliver=file:./result.json
aimux spawn claude --json --deliver=webhook:https://hooks.example.com/agents

Valid schemes: stdout (default), file:<path>, webhook:<url>.

Block until a spawned agent session finishes:

Terminal window
aimux spawn claude --dir ./project --wait --json

Returns duration on completion. Eliminates the need for agents to write polling loops.

Report CLI friction for maintainer review:

Terminal window
aimux feedback "the --limit flag silently ignores values over 100"

Writes to ~/.aimux/feedback.jsonl.

Errors include valid values when applicable:

Terminal window
$ aimux spawn gpt
Error: 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"]}

Add to ~/.aimux/config.yaml:

resume:
skip_permissions: true # always pass --dangerously-skip-permissions on resume