mission-control/docs/cli-agent-control.md

4.2 KiB

Mission Control CLI for Agent-Complete Operations (v2)

This repository includes a first-party CLI at:

  • scripts/mc-cli.cjs

Designed for autonomous/headless usage first:

  • API key auth support
  • Profile persistence (~/.mission-control/profiles/*.json)
  • Stable JSON mode (--json) with NDJSON for streaming
  • Deterministic exit code categories
  • SSE streaming for real-time event watching
  • Compound subcommands for memory, soul, comments

Quick start

  1. Ensure Mission Control API is running.
  2. Set environment variables or use profile flags:
  1. Run commands:
node scripts/mc-cli.cjs agents list --json
node scripts/mc-cli.cjs tasks queue --agent Aegis --max-capacity 2 --json
node scripts/mc-cli.cjs sessions control --id <session-id> --action terminate

Command groups

auth

  • login --username --password
  • logout
  • whoami

agents

  • list
  • get --id
  • create --name --role [--body '{}']
  • update --id [--body '{}']
  • delete --id
  • wake --id
  • diagnostics --id
  • heartbeat --id
  • attribution --id [--hours 24] [--section identity,cost] [--privileged]
  • memory get --id
  • memory set --id --content "..." [--append]
  • memory set --id --file ./memory.md
  • memory clear --id
  • soul get --id
  • soul set --id --content "..."
  • soul set --id --file ./soul.md
  • soul set --id --template operator
  • soul templates --id [--template name]

tasks

  • list
  • get --id
  • create --title [--body '{}']
  • update --id [--body '{}']
  • delete --id
  • queue --agent [--max-capacity 2]
  • broadcast --id --message "..."
  • comments list --id
  • comments add --id --content "..." [--parent-id 5]

sessions

  • list
  • control --id --action monitor|pause|terminate
  • continue --kind claude-code|codex-cli --id --prompt "..."
  • transcript --kind claude-code|codex-cli|hermes --id [--limit 40] [--source]

connect

  • register --tool-name --agent-name [--body '{}']
  • list
  • disconnect --connection-id

tokens

  • list [--timeframe hour|day|week|month|all]
  • stats [--timeframe]
  • by-agent [--days 30]
  • agent-costs [--timeframe]
  • task-costs [--timeframe]
  • trends [--timeframe]
  • export [--format json|csv] [--timeframe] [--limit]
  • rotate (shows current key info)
  • rotate --confirm (generates new key -- admin only)

skills

  • list
  • content --source --name
  • check --source --name
  • upsert --source --name --file ./skill.md
  • delete --source --name

cron

  • list
  • create/update/pause/resume/remove/run [--body '{}']

events

  • watch [--types agent,task] [--timeout-ms 3600000]

    Streams SSE events to stdout. In --json mode, outputs NDJSON (one JSON object per line). Press Ctrl+C to stop.

status

  • health (no auth required)
  • overview
  • dashboard
  • gateway
  • models
  • capabilities

export (admin)

  • audit [--format json|csv] [--since ] [--until ] [--limit]
  • tasks [--format json|csv] [--since] [--until] [--limit]
  • activities [--format json|csv] [--since] [--until] [--limit]
  • pipelines [--format json|csv] [--since] [--until] [--limit]

raw

  • raw --method GET --path /api/... [--body '{}']

Exit code contract

  • 0 success
  • 2 usage error
  • 3 auth error (401)
  • 4 permission error (403)
  • 5 network/timeout
  • 6 server error (5xx)

API contract parity gate

To detect drift between Next.js route handlers and openapi.json, use:

node scripts/check-api-contract-parity.mjs \
  --root . \
  --openapi openapi.json \
  --ignore-file scripts/api-contract-parity.ignore

Machine output:

node scripts/check-api-contract-parity.mjs --json

The checker scans src/app/api/**/route.ts(x), derives operations (METHOD + /api/path), compares against OpenAPI operations, and exits non-zero on mismatch.

Baseline policy in this repo:

  • scripts/api-contract-parity.ignore currently stores a temporary baseline of known drift.
  • CI enforces no regressions beyond baseline.
  • When you fix a mismatch, remove its line from ignore file in the same PR.
  • Goal is monotonic burn-down to an empty ignore file.

Next steps

  • Promote script to package.json bin entry (mc).
  • Add retry/backoff for transient failures.
  • Add integration tests that run the CLI against a test server fixture.
  • Add richer pagination/filter flags for list commands.