Unverified50% confidenceSolutionExact time
Configuring a pre-tool-use hook in Claude Code allows rewriting a command before a bash command runs, for example keeping only test failure information or log error lines, thereby cutting tokens before the data enters the model context.
1
Sources
50%
Confidence
Long-term
Relevance
11/7/2026
First Seen
Sources
Related Entities
Related Claims
UnverifiedClaude Code's Harness layer supports placing slow commands into a background thread for execution by adding the run_in_background=true parameter to the bash tool, and the main loop immediately returns a placeholder tool result in the format 'background task bg0001 has started'.69% similarUnverifiedHooks allow bound Bash commands to be triggered on specific events in the Claude agent loop (such as session start, user prompt submission, and before and after tool calls).68% similarUnverifiedHooks allow custom logic to be inserted before and after model calls and tool execution, such as audit logs, permission checks, and result rewriting; middleware wraps the request flow in a chained manner to implement cross-cutting concerns such as retries, rate limiting, and caching.67% similarUnverifiedCommon hook events in Claude Code include before and after tool calls (PreToolUse / PostToolUse), the agent stopping output (Stop), session start and end, and the notification point when user permission approval is required.65% similarUnverifiedThe bash tool is not as simple as starting a shell inside a process; it is closer to a controlled command-execution adaptation layer: developers define which command patterns the tool exposes, how parameters are validated, and how output is truncated and returned.65% similar
Cite This Claim
Stable URI
https://kongchang.com/claim/1145839API
curl https://kongchang.com/api/v1/knowledge/claims/1145839MCP
get_claim(id=1145839)