Skip to content

Build history and observation sessions

Daemonitor supports two complementary mechanisms for turning continuous process samples into build-level records: passive build detection and observation sessions.

Passive build detection

Gradle daemon-log correlation

For active GRADLE_DAEMON processes, Daemonitor tails <GRADLE_USER_HOME>/daemon/<version>/daemon-<pid>.out.log and correlates log markers with SQLite process_samples:

  1. Tracks daemon identity via DefaultDaemonContext uid so PID reuse cannot merge builds from two different daemons.
  2. Opens a build window on Marking the daemon as busy and closes it on Marking the daemon as idle (requiring at least one Build{id=..., currentDir=...} or Starting ... build in daemon line to discard health/expiration brackets).
  3. Parses BUILD SUCCESSFUL|FAILED in <duration> when present (COMPLETED_NO_OUTCOME otherwise; INTERRUPTED if the daemon exits mid-build).
  4. Aggregates PeakMemoryMB, AvgMemoryMB, and PeakCPUPercent from samples inside [busyTimeMs, endMs].
  5. Infers invocation source (IDE, TERMINAL, UNKNOWN) and coding agent (Claude Code, Cursor, Codex, Gemini CLI, Aider, or AI_*) from Configuring env variables: [...].

Passive Xcode sessions

When daemonitor-cored observes an XCODE_BUILD (xcodebuild) process without an explicit session, it automatically opens a passive observation session, accelerates polling to 1s, and persists the closed summary into the builds table (daemonIdentity prefixed xcode:).

Explicit observation sessions

Explicit sessions bound monitoring to a specific build invocation via:

  • daemonitor-cli observe -- <CMD> [ARGS...]
  • POST /v1/sessions and POST /v1/sessions/{id}/close on daemonitor-cored
  • The experimental Gradle plugin

Session lifecycle and correlation

  1. Open: Records session_id, ecosystem (gradle, xcode, or generic), mode (explicit or passive), root_project_path, redacted command_line, and anchor (pid, start_time_ms). Wakes the poll loop immediately.
  2. Collect: Polls at <= 1s intervals, linking observed processes to the session in session_process_links with attribution confidence:
  3. confirmed: Anchor process, descendant within parent depth 8, or matching -derivedDataPath / project path.
  4. inferred: Related ecosystem process active during the session window.
  5. ambiguous: Concurrent overlapping builds (for example, two xcodebuild runs without distinct -derivedDataPath).
  6. Close: Triggers one final poll refresh, computes per-tick peak simultaneous RSS/footprint/parallelism and per-incarnation CPU/disk I/O deltas, persists the summary, and returns sessions.Summary with per-role rollups.

Passive monitoring vs. explicit sessions

Aspect Passive monitoring Explicit observe session
Setup required None Wrap command with daemonitor-cli observe -- ...
Works with --no-daemon / arbitrary commands No Yes
Polling cadence 2s (or 1s for xcodebuild) <= 1s with immediate wake
Command line recorded null for passive Gradle builds Redacted command line
Machine-readable summary on exit Query builds / history Printed to stderr + optional --output JSON file