You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hooks: include tool_use_id in PreToolUse and PostToolUse input #85
The hooks reference documents PreToolUse and PostToolUse input as session_id, transcript_path, cwd, permission_mode, hook_event_name, tool_name, tool_input (and tool_response), with nothing that names the
tool call (docs/reference/hooks-reference.mdx:279-338).
A hook that handles both events can't tell which PreToolUse a PostToolUse closes. Two identical calls in flight (the
same Read, a retried Execute) look the same. Droid also runs PostToolUse only after a tool succeeds and has no
PostToolUseFailure, so a call that fails, is declined in the permission prompt, or is blocked by another hook leaves a
PreToolUse with nothing after it. A hook that pairs by tool and arguments then hands the next identical call's result
to the wrong call.
Proposed: a tool_use_id field (the model's tool call id, which the transcript also records) on PreToolUse and
PostToolUse input. Droid already uses Claude Code's event names and field names, and Claude Code's PreToolUse and
PostToolUse carry tool_use_id, so hooks written for Claude Code would work unchanged. A PostToolUseFailure event
would close the remaining gap; I can file that separately.
Context: I maintain Tracekit (https://github.com/Cygnux-Labs/Tracekit), which records and gates agent tool calls; this would let it pair each Droid call with its result by id instead of by tool and arguments.
Activity