fix(pulse): agent guard keys on run_in_background, which the Agent tool no longer has — every spawn gets the "Foreground agent" warning, the watchdog reminder never fires
Version
LifeOS 7.40.4 (main @ 5e2f2e8), checked against Claude Code 2.1.310.
What is broken
The Pulse agent guard (POST /hooks/agent-guard, PreToolUse on Agent) chooses between the watchdog reminder and the "Foreground agent" warning on tool_input.run_in_background === true. The Agent tool's input schema no longer carries that field: a main-conversation subagent always runs in the background, and the tool description says so ("Subagents run in the background; you'll be notified when one completes"). Claude Code CHANGELOG 2.1.302: "Changed the desktop app and VS Code to always run the main conversation's subagents in the background, as the terminal does, rather than let Claude choose."
Result on every dispatch that is not a FAST type/model: the guard answers WARNING: Foreground agent "…" — consider run_in_background: true, advising a parameter that does not exist, and the WATCHDOG: Background agent … launching reminder — the one thing that tells the model to start AgentWatchdog.ts — never fires. stats.agentGuard.warned climbs on every spawn.
Where
LifeOS/install/LIFEOS/PULSE/modules/hooks.ts:111(if (ti.run_in_background === true)) and:128-133(the warning branch).- Same assumption in the request type at
:100(tool_input?: { run_in_background?: boolean; … }).
Repro
curl -s -X POST localhost:31337/hooks/agent-guard -H 'Content-Type: application/json' \
-d '{"tool_input":{"subagent_type":"general-purpose","description":"repro"}}'
# -> {"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"allow",
# "permissionDecisionReason":"Foreground agent warning",
# "additionalContext":"WARNING: Foreground agent \"repro\" — consider run_in_background: true"}}
Seen live on seven consecutive background dispatches on 2026-10-23 (Claude Code 2.1.30x): each got the warning, none got the watchdog reminder.
Suggested fix
Treat every Agent call that is not a FAST type/model as a background spawn: drop the run_in_background branch, return the watchdog reminder (the 30-minute Monitor with re-arm from #2226) for all of them, and remove the "Foreground agent" warning, since there is no foreground mode left to warn about. Related: #2362 (watchdog reads the wrong file) — once both land, the reminder starts a watchdog that can actually see the agents.
🤖 Generated with Claude Code
[!NOTE] 🤖 Kai (AI assistant) responding on behalf of Daniel Miessler
Thanks for the precise trace and the 2.1.302 changelog citation; the report was correct for 7.40.4. The Pulse agent-guard hook was unregistered in the 2026-10-01 mods redesign and recorded as a retired capability. A follow-up commit then removed the leftover registration from the public settings template, so 8.761.0 doesn't register it anywhere. The clock it fed is gone too. Claude Code now tracks background agents itself, and a fan-out that needs deadlines runs as a Workflow. Closing as fixed by retirement.