Feature Request: tool:pre Event for PreToolUse Validation Hooks
Target: clawdbot/clawdbot
Status: Draft (needs gh auth to submit)
Authors: Monolith + Larry
Date: 2026-01-25
Summary
Add a tool:pre (or tool:before) event that fires before a tool call is executed, allowing hooks to validate, modify, or block the call.
Motivation
Currently Clawdbot has tool_result_persist (post-tool) but no pre-execution hook. This limits the ability to implement:
- Safety guards — Block dangerous commands before execution (e.g.,
rm -rf /, fork bombs)
- Anti-sycophancy filters — Detect and flag problematic patterns in outbound messages
- Context thresholds — Warn when context usage exceeds limits
- Secrets detection — Prevent accidental credential exposure in commands
- Cross-agent coordination — Validate claims before artifact creation (G10 protocol)
Proposed Event Schema
interface PreToolEvent {
type: 'tool:pre';
toolName: string;
args: Record<string, unknown>;
sessionKey: string;
agentId: string;
}
interface PreToolResult {
action: 'allow' | 'block' | 'modify';
reason?: string;
modifiedArgs?: Record<string, unknown>; // if action === 'modify'
}
Use Cases
1. Dangerous Command Blocking
guards:
- pattern: 'rm -rf /'
action: block
reason: 'Refusing to delete root filesystem'
2. Message Quality Scoring
Before message.send, validate content quality and block low-effort responses.
3. Confirmation Prompts
For destructive operations (git push --force, DROP TABLE), require explicit confirmation.
Prior Art
- Claude Code has
PreToolUse hooks
- MCP servers can implement tool validation
- Our prototype:
sync/hooks/pre-tool-hook.py in WireParkHackerz/ai-soul-team
Implementation Notes
The event should fire after the LLM returns a tool call but before execution. Hooks should be:
- Async-capable (for external validation)
- Chainable (multiple hooks can run in sequence)
- Fail-safe (hook errors should not block all tool calls)
Related
- Existing events:
command:new, agent:bootstrap, gateway:startup, tool_result_persist
- Docs:
/docs/tools/index.md
To Submit
gh auth login
gh issue create --repo clawdbot/clawdbot --title "Feature: Add tool:pre event for PreToolUse validation hooks" --body-file sync/docs/pretooluse-feature-request.md
Feature Request: tool:pre Event for PreToolUse Validation Hooks
Target: clawdbot/clawdbot
Status: Draft (needs gh auth to submit)
Authors: Monolith + Larry
Date: 2026-01-25
Summary
Add a
tool:pre(ortool:before) event that fires before a tool call is executed, allowing hooks to validate, modify, or block the call.Motivation
Currently Clawdbot has
tool_result_persist(post-tool) but no pre-execution hook. This limits the ability to implement:rm -rf /, fork bombs)Proposed Event Schema
Use Cases
1. Dangerous Command Blocking
2. Message Quality Scoring
Before
message.send, validate content quality and block low-effort responses.3. Confirmation Prompts
For destructive operations (
git push --force,DROP TABLE), require explicit confirmation.Prior Art
PreToolUsehookssync/hooks/pre-tool-hook.pyin WireParkHackerz/ai-soul-teamImplementation Notes
The event should fire after the LLM returns a tool call but before execution. Hooks should be:
Related
command:new,agent:bootstrap,gateway:startup,tool_result_persist/docs/tools/index.mdTo Submit
gh auth login gh issue create --repo clawdbot/clawdbot --title "Feature: Add tool:pre event for PreToolUse validation hooks" --body-file sync/docs/pretooluse-feature-request.md