Skip to content

CLI commands reference

This reference documents every public command, flag, default value, output format, and exit code implemented in daemonitor-cli (cored/internal/command/command.go and observe.go).

Flags may appear before or after the subcommand (for example, daemonitor-cli ps --json and daemonitor-cli --json ps are equivalent). Arguments after -- are passed verbatim to observe.

Commands

Command Description Supported formats Key defaults & behavior
daemonitor-cli Launch interactive TUI on a TTY (TERM != "dumb"), or fall back to one-shot ps when non-interactive TUI or plain, json, jsonl, csv Auto-starts daemonitor-cored unless --no-autostart is set
daemonitor-cli top Launch interactive TUI explicitly Interactive TUI only (--json exits 2) Requires TTY and TERM != "dumb", else exits 1
daemonitor-cli ps List live build processes plain (compact or --details), json, jsonl, csv Filters: --pid, --ecosystem, --project. Supports --watch, --until, --fail-on-rss. Sanitizes paths unless --include-project-path
daemonitor-cli history Query retained historical process samples plain, json, jsonl, csv Defaults: --since 15m, --limit 200. Filters: --pid, --ecosystem, --project
daemonitor-cli builds Query correlated build history plain, json, jsonl, csv Default --limit 100. Filters: --since, --pid, --project, --status, --include-logs
daemonitor-cli logs List discovered Gradle daemon logs plain, json, jsonl, csv Filter: --pid. Sanitizes log paths unless --include-project-path
daemonitor-cli logs <pid> Tail the redacted Gradle daemon log for <pid> plain, json, jsonl Non-numeric <pid> exits 2
daemonitor-cli health Check daemonitor-cored health, version, socket, and DB path plain, json, jsonl Queries GET /v1/health
daemonitor-cli metrics list Display platform metric availability matrix plain, json, jsonl, csv Queries GET /v1/capabilities
daemonitor-cli metrics Output normalized metric records (schema_version: 1) from process history plain, json, jsonl, csv Defaults: --since 15m, --limit 500 (max 5000). Filters: --pid, --ecosystem, --project
daemonitor-cli events Query process lifecycle events (first_observed, disappearance_detected, configuration_observed) plain, json, jsonl, csv Defaults: --since 15m, --limit 500 (max 5000). Filter: --pid
daemonitor-cli host Display host CPU, memory, swap, load, and OS pressure/thermal/PSI metrics plain, json, jsonl Queries GET /v1/host
daemonitor-cli export --output PATH Write JSONL bundle (metrics + lifecycle events + host record) to PATH (mode 0600) JSONL file --output required (else exit 2). Defaults: --since 15m, --limit 500 (max 5000)
daemonitor-cli observe -- CMD [ARGS...] Run CMD inside an explicit observation session and print summary to stderr plain, json, jsonl (+ optional --output JSON file) Auto-detects --ecosystem and --project; propagates child exit code (127 start error, 130 interrupt)
daemonitor-cli sessions [ID] List persisted observation sessions or inspect one session by ID plain, json, jsonl List mode: --ecosystem, --limit 50. Detail mode: positional ID

Global options

Option Type Default Description & validation
--socket PATH string OS default IPC path Override daemonitor-cored Unix socket or Windows named pipe
--poll-interval DURATION duration 2s Refresh interval for TUI and ps --watch; must be > 0
--no-color bool false (true if NO_COLOR is set) Disable ANSI color output
--no-autostart bool false Do not auto-start daemonitor-cored if not running
--json bool false Shorthand for --format json (invalid with top or conflicting --format)
--details bool false Show full key/value OS and JVM attributes in ps plain output
--format FMT string plain Output format: plain, json, jsonl, or csv
--output PATH string "" Output file path (0600) for export (required) or observe (optional JSON copy)
--since DURATION duration Command default (15m) Lookback window (>= 0 and <= 168h / 7 days)
--limit N int Command default Maximum records returned (>= 0)
--pid PID int64 0 Filter by process ID or daemon PID
--project TEXT string "" Case-insensitive substring match on project basename or command line
--status STATUS string "" Filter builds by final status (SUCCESS, FAILED, COMPLETED_NO_OUTCOME, INTERRUPTED)
--ecosystem NAME string "" Filter processes (ps, history, metrics, export) or sessions by gradle, bazel, xcode, amper, or unknown
--build-system NAME string "" Filter ps, history, metrics, export by build system (gradle, bazel, xcode, amper / kotlin-toolchain, unknown / other)
--runtime NAME string "" Filter by process runtime (jvm, native, unknown)
--toolchain NAME string "" Filter by toolchain (java, kotlin / kt, swift, clang, cpp / c++, go / golang, rust, unknown)
--include-logs bool false Include retained build log snippets in builds output
--include-project-path bool false Retain full local paths instead of sanitizing to basenames
--watch bool false Continuous polling mode for ps (invalid on other commands → exit 2)
--until DURATION duration 0 Stop ps --watch after the given duration
--fail-on-rss MB int64 0 Requires ps --watch; exits 3 if any matching process reaches RSSMemoryMB >= MB
-h, --help bool false Print usage and exit 0
-v, --version bool false Print version and exit 0

Exit codes

Code Meaning
0 Success (or --help / --version, or ps --watch terminated cleanly by --until or signal)
1 Connection, IPC, API, or runtime error (including top without a TTY)
2 Invalid command, unknown flag, or invalid flag combination
3 ps --watch --fail-on-rss memory threshold exceeded
Child exit code Propagated by observe (127 if command failed to start, 130 on interrupt)

Representative JSON output (ps --json)

{
  "sampled_at_ms": 1732550400000,
  "processes": [
    {
      "pid": 48210,
      "parent_pid": 1,
      "start_time_ms": 1732549200000,
      "type": "GRADLE_DAEMON",
      "rss_memory_mb": 1420,
      "resident_bytes": 1488977920,
      "physical_footprint_bytes": 1180696576,
      "cpu_percent": 12.4,
      "heap_used_mb": 612,
      "heap_committed_mb": 1024,
      "max_heap_mb": 4096,
      "gc": "G1GC",
      "young_gc_time_seconds": 1.842,
      "total_gc_time_seconds": 2.105,
      "project_path": null
    }
  ]
}

Unavailable metrics are emitted as null, never fabricated as 0.

Other CLI binaries in the repository

  • daemonitor-corectl (cored/cmd/daemonitor-corectl): Low-level debug client supporting health, processes (ps), history, logs, log-tail <pid>, and builds (JSON=1 for indented JSON).
  • Desktop --headless / JVM CLI (cli/): Continuous ANSI dashboard launched via Daemonitor --headless (supports --plain/--no-color, --collect-only, --db, --poll-interval, --retention, --core-socket, --jvm-collector).