agent-gc sched
An opt-in scheduler for Claude Code. It watches each agent’s tool calls through Claude Code hooks, and warns or stops an agent that is stuck or burning through its budget (the same error again and again, a context that has grown too large, a subscription window nearly used up). It never kills a session: it tells the agent, and for a stop it refuses the next tool calls until the agent has reported back.
Every agent is in one of four states: running (nothing to say), warned (the agent was told to wrap up soon), stopped (new tool calls are refused, except reads, until the stop is lifted), resumed (a stop was lifted and the agent carries on).
A stop is lifted by sending a new message in the session, by agent-gc sched release <id> (a prefix of the session id is enough), or by agent-gc sched off.
agent-gc sched on changes settings.json of every Claude Code installation: it adds PreToolUse, PostToolUse, PostToolUseFailure and UserPromptSubmit hooks and installs agent-gc’s status line, the same one agent-gc limits on installs. Your own status line keeps working (all its lines are shown, the last one followed by 5h 42% · 7d 18%); the status line records the subscription usage per installation, and the hooks read the window of the installation they run in (CLAUDE_CONFIG_DIR, else ~/.claude). Numbers older than 15 minutes, or past their reset, count as unknown (the same rule as top), and then no window warning is given. It asks before doing so, and off removes the hooks. The status line is shared: sched off keeps it while limits is on, and your own line is put back exactly when neither uses it any more. If sched on fails part way (for example on a settings.json that is not valid JSON), run sched off to undo it fully. Running sessions need a restart to pick the change up.