fix(hooks): post-tool-budget-hook records terminal tool to SDK

Smoke-8: the stop-hook still nagged after a successful i_am_idle even
after #145's _TERMINAL_TOOLS rename. Root cause was upstream — nothing
was POSTing to /terminal/tool_recorded, so the SDK's recent_tools
deque stayed empty and had_terminal_recently() always returned False.

The PostToolUse hooks already record every tool call to
/budget/tool_called for the budget/loop tracker. Added a parallel call
to /terminal/tool_recorded so the terminal-tracker sees the same
stream. Fire-and-forget; never blocks Claude.

After the SDK suffix-strip (line ~798 in agent_sdk/server.py),
mcp__roboco-flow__i_am_idle becomes i_am_idle which is in
_TERMINAL_TOOLS (per #145). Stop-hook reads /terminal/stop_attempt
and now sees had_terminal_recently=true on the first attempt → exits 0.
This commit is contained in:
Renn F
2026-05-15 04:54:08 +02:00
parent 0c60d0bf7d
commit 47c674d70e
+7
View File
@@ -39,6 +39,13 @@ except Exception:
PY
)"
# Record the tool name on the SDK so the stop-hook can recognize a
# graceful terminal call (i_am_idle / i_am_done / pass / fail / etc.).
# Fire-and-forget — never block Claude on this.
curl -sf -m 2 -X POST "$SDK_URL/terminal/tool_recorded" \
-H "Content-Type: application/json" \
-d "{\"tool\":\"$TOOL\"}" >/dev/null 2>&1 || true
# Ask the SDK to record + return status. 2s timeout — we never block Claude.
resp=$(curl -sf -m 2 -X POST "$SDK_URL/budget/tool_called" \
-H "Content-Type: application/json" \