AgentKit
Tài liệuBộ kitTham chiếu CLIỨng dụng Desktop
BetaBạn đang đọc tài liệu kênh beta (3.4.0-beta.1). Tính năng có thể thay đổi trước bản stable tiếp theo.Chuyển sang stable →

host

ak host watch

Giữ một watcher cho toàn máy ghi snapshot trạng thái của máy.

Dùng ak host watch --detach để giữ một watcher cho mỗi máy ghi snapshot mà ak host status, ak host gate và Hook host-pressure-reminder của Engineer Kit đọc. Watcher thứ hai chỉ báo watcher đang chạy rồi thoát. Watcher tự dừng sau --idle-exit khi không còn process runtime agent nào chạy, và --stop sẽ dừng nó. --notify hiện thông báo desktop khi máy vào hoặc ra khỏi hold hay clean.

Phần help nguyên bản dưới đây giữ nguyên thuật ngữ, cú pháp, tác động và điều kiện thực thi của CLI để đối chiếu chính xác.

Contract và help của lệnh

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