Tool Output Budget Guard
On PostToolUse for shell calls, measure the observed output bytes and emit bounded guidance when it exceeds the 64 KiB budget, so context pressure becomes visible. Never rewrites output, never echoes content, never blocks.
Runs on
Scope
$npx @youdede/toolkit add tool-output-budget-guard --target claude-code
What it does
Warn when a shell tool call returns output beyond the declared byte budget, with pagination guidance.
When it fires
- operations
- handoff
How it behaves
Measure tool output against the byte budget and emit guidance.
It does not block, delay, or alter the observed event; it records or reports only.
It does not execute submitted content, call an LLM, or transmit any data off the machine.
It does not measure the output of tools other than shell commands.
Configuration
targets/claude-code/tool-output-budget-guard.mjs
- Version
- 1.0.0
- Requires
- node
- Licence
- RiskThis observer warns when a shell tool call returns output beyond the declared byte budget, with pagination guidance; it cannot block the event or mutate the inspected state.
- Low
- ModeHow it works: fixed rules, model instructions, or both.
- Deterministic only
- Behaviour
- Observes, does not intervene
- On failure
- Allows and continues
- LatencyThe entrypoint counts one tool response against a fixed byte budget and returns guidance in the same event.
- Immediate
- Data retentionWhether data remains after use and who manages its storage.
- Not retained
Often used with
All in Development