agent-watchdog

Know when an agent is about to run out of context.

agent-watchdog is a macOS command-line daemon that watches coding-agent sessions running in cmux terminals, alerts before a session runs out of context or its prompt cache expires, and can optionally ask the agent to stop or write a handoff before that happens.

Claude Code is the supported provider today; the provider interface is built to add others (Codex, etc.) later.

Download for macOS

v0.1.0 Apple silicon 430 KB built 18 Sep 2026

Or install from the terminal:

curl -fsSL https://agent-watchdog.pages.dev/downloads/agent-watchdog-darwin-arm64.tar.gz | tar -xz && ./agent-watchdog/install.sh

Needs cmux and Node 26 on your PATH. Checksum, requirements, and what install.sh does

context window58% used
warn 35%critical 75%

cache expires in 3m 40s

How it works

Polls the sessions in your cmux terminals
The daemon reads cmux's session store to find running Claude Code sessions and the terminal surface each one lives in.
Estimates context and cache expiry from each transcript
From a session's own transcript it works out how much of the context window is in use and when the prompt cache will expire.
Notifies you at the thresholds you set
A warning at 35% by default, a critical alert at 75%, and a nudge when a session sits idle with its cache about to expire. Alerts go through cmux notifications, with a macOS notification fallback.
Shows the same status in the sidebar and the menu bar
It keeps a context-percentage pill in the cmux sidebar and writes a status file that the optional menu bar app renders.
Can ask the agent to stop or write a handoff
Only when you turn on message injection, it types a short [agent-watchdog]-prefixed message into the agent's terminal. That is off by default and guarded by safety checks.

The prebuilt download is for Apple silicon Macs with cmux and Node 26; from source it builds on any Mac with Node 26 and Swift. The source is on GitHub; the docs are rendered from the repository's own markdown.