Subagent Fanout Guard
Counts prior Task and Agent tool calls in the supplied Claude Code transcript and blocks delegation after a fixed conservative session budget without invoking a model.
Runs on
Scope
$npx @youdede/toolkit add subagent-fanout-guard --target claude-code
What it does
Cap per-session subagent delegation using a bounded transcript count.
When it fires
- implementation
- pre-commit
How it behaves
Cap per-session subagent delegation using a bounded transcript count.
It does not decide which specialist should be delegated to.
It does not infer concurrency or nesting when the transcript does not encode it.
It does not edit transcripts or terminate already running agents.
Configuration
targets/claude-code/subagent-fanout-guard.mjs
- Version
- 1.0.0
- Requires
- node
- Licence
- RiskThis automatic gate caps per-session subagent delegation using a bounded transcript count; a false denial can interrupt legitimate work, but it does not execute the blocked action.
- Medium
- ModeHow it works: fixed rules, model instructions, or both.
- Deterministic only
- Behaviour
- Enforces, blocks on violation
- On failure
- Denies and blocks
- LatencyThe entrypoint reads and parses up to 4 MiB of transcript before deciding whether to allow delegation.
- Bounded
- Data retentionWhether data remains after use and who manages its storage.
- Not retained
Often used with
All in Operations