A Claude Code PreToolUse hook that prevents background subagents from being killed prematurely in Discord-driven sessions.
When Claude Code runs via a Discord bot (or any system where the session ends when output stops), background subagents get killed immediately. The turn ends as soon as Claude stops emitting output, which sends [Request interrupted by user] to any in-flight background agents.
This affects:
Agenttool calls withrun_in_background: true