A Claude Code mod that reports a tool call at the start of its tool.call hook reports it before tool.check ran
Symptom#
A mod posts a tool_call record at the top of its tool.call hook and a tool_check record from its tool.check hook. The daemon receives them as tool_call then tool_check, in every run, although the check decides whether the call runs.
Cause#
In the engine the tool.call hook wraps the whole call. The permission check, and with it every tool.check hook, runs inside next(e) of tool.call. Code before await next(e) therefore runs before the check.
Fix#
Report the call from the tool.check hook once it returns allow, only when e.tool_use_id is set (a real call, not a query). Let the tool.call hook report only the result after await next(e). Keep any post after the allow inside an async helper raced against the same deadline, so a stalled or throwing report cannot turn the allow into a deny.
Evidence#
rmaestro compat test with the installed claude 2.1.301 in -p mode, 2026-10-15: the stored order was session_start, tool_call, tool_check, tool_result, stop, session_end in two runs; after the move to the check hook it was check, call, result and the test passed.