Summary
Child of #3508 (Windows process-creation tax). This issue covers one hook: block-windows-drive-tmp.sh in the guardrails plugin.
Measured
|
|
| Plugin |
guardrails |
| Hook |
block-windows-drive-tmp.sh |
| Event(s) |
PreToolUse:Bash + PreToolUse:PowerShell |
| Timeouts in window |
49 |
| Average duration |
73.4s |
| Worst observed |
112.6s |
| Configured timeout |
15 s |
Every recorded run exceeded the 15 s timeout, so this guard is killed before it renders a verdict. It currently costs wall-clock without providing protection on this platform.
Context from the parent
Process creation on the affected host costs 0.3-0.9 s per spawn (bash -c true = 661 ms, jq -n 1 = 908 ms, cmd.exe /c exit = 872 ms, against ~3-5 ms on a healthy host). User CPU time is ~1% of wall-clock, so the fix is reducing the number of process spawns, not optimizing script logic. See #3508 for the full measurement and environment detail.
Specific guidance
Only 9 external call sites, yet still averages 73s - evidence that the cost is spawn overhead rather than script work. Good candidate for proving out the builtins-only rewrite pattern.
Acceptance criteria
Method
Counts from ~/.claude/projects/**/*.jsonl hook_cancelled attachments with timedOut: true, across 236 sessions, 2026-08-23 to 2026-08-31.
Summary
Child of #3508 (Windows process-creation tax). This issue covers one hook:
block-windows-drive-tmp.shin theguardrailsplugin.Measured
guardrailsblock-windows-drive-tmp.shPreToolUse:Bash + PreToolUse:PowerShellEvery recorded run exceeded the 15 s timeout, so this guard is killed before it renders a verdict. It currently costs wall-clock without providing protection on this platform.
Context from the parent
Process creation on the affected host costs 0.3-0.9 s per spawn (
bash -c true= 661 ms,jq -n 1= 908 ms,cmd.exe /c exit= 872 ms, against ~3-5 ms on a healthy host). User CPU time is ~1% of wall-clock, so the fix is reducing the number of process spawns, not optimizing script logic. See #3508 for the full measurement and environment detail.Specific guidance
Only 9 external call sites, yet still averages 73s - evidence that the cost is spawn overhead rather than script work. Good candidate for proving out the builtins-only rewrite pattern.
Acceptance criteria
jq).grep/sed/cut/tr/basename/dirnameon the hot path are replaced with bash builtins.Method
Counts from
~/.claude/projects/**/*.jsonlhook_cancelledattachments withtimedOut: true, across 236 sessions, 2026-08-23 to 2026-08-31.