AgentKit
DocsKitsCLI ReferenceDesktop App
BetaYou are reading docs for the beta channel (3.4.0-beta.1). Features may change before the next stable release.Switch to stable →

host

ak host watch

Keep one machine-wide watcher writing the host status snapshot

Use ak host watch --detach to keep one watcher per machine writing the snapshot that ak host status, ak host gate, and the Engineer Kit's host-pressure-reminder Hook read. A second watcher reports the running one and exits. The watcher stops by itself after --idle-exit with no agent runtime process alive, and --stop ends it. --notify shows a desktop notification when the host enters or leaves hold or clean.

Command contract

Keep one machine-wide watcher writing the host status snapshot

Synopsis

Runs one watcher per machine. Every --interval it samples the host (one interval, including the top five I/O processes with their worktree and agent runtime) and atomically replaces <AgentKit home>/host/status.json with the same envelope ak host status --json prints, so status, hooks and gates in any runtime read it instantly. When the verdict is throttle, hold or clean it leaves a notice in <AgentKit home>/host/inbox/<worktree-hash>.json for each worktree whose processes are in top_io; a notice is rewritten only when severity rises or after 5 minutes, and notices older than 10 minutes are removed. AgentKit home is AGENTKIT_HOME or ~/.agentkit.

A second watcher is a no-op that reports the running pid. --detach starts the watcher in the background (detached from this terminal and session) and returns once its first snapshot is written. --stop asks the running watcher to exit and waits for it; only if it does not exit in 20 s is its process ended. The watcher exits by itself after --idle-exit with no agent runtime process alive (Claude Code, Codex, OpenCode, Pi, Cursor, or node, bun or deno running one).

--notify shows a desktop notification when the verdict enters hold or clean (repeated at most every 5 minutes while it lasts) and when it recovers: a toast on Windows, Notification Center via osascript on macOS, notify-send on Linux. A failure is logged once and never stops the watcher.

Effects: Writes only its own files under <AgentKit home>/host: watch.lock, watch.pid, watch.stop, status.json and inbox/*.json. Reads OS counters and the process table; never reaches the network. --stop may end the recorded watcher process if it ignores the stop request.

Exit status: 0 the watcher ran, started, was already running, stopped, or was not running 1 the watcher could not start, write its files, or stop 2 invalid flags or arguments

ak host watch [flags]

Examples

  ak host watch --detach
  ak host watch --stop
  ak host watch --detach --notify
  ak host watch --interval 10s --idle-exit 1h

Options

      --detach               Start the watcher in the background and return
  -h, --help                 help for watch
      --idle-exit duration   Exit after this long with no agent runtime process alive (at least 1m) (default 30m0s)
      --interval duration    Time between snapshots (1s-5m) (default 5s)
      --json                 Emit machine-readable JSON (implies --no-interactive)
      --no-interactive       Disable interactive prompts (CI-safe)
      --notify               Show a desktop notification when the host enters or leaves hold or clean
  -q, --quiet                Suppress non-error output on stderr
      --stop                 Stop the running watcher
  -V, --verbose              Extra diagnostic output on stderr (loses to --quiet)
  -y, --yes                  Assume yes for all prompts

SEE ALSO

  • ak host - Inspect host pressure before starting parallel work