From 92fc250b547746ab26de39f8de84615759f42cd5 Mon Sep 17 00:00:00 2001 From: Anto01 Date: Sat, 11 Apr 2026 09:17:21 -0400 Subject: [PATCH] fix: use correct hook field name last_assistant_message The Claude Code Stop hook sends `last_assistant_message`, not `assistant_message`. This was causing response_chars=0 on all captured interactions. Also removes the temporary debug log block. Co-Authored-By: Claude Opus 4.6 --- deploy/hooks/capture_stop.py | 3 ++- tests/test_capture_stop.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/deploy/hooks/capture_stop.py b/deploy/hooks/capture_stop.py index e1a419b..5661681 100644 --- a/deploy/hooks/capture_stop.py +++ b/deploy/hooks/capture_stop.py @@ -59,8 +59,9 @@ def _capture() -> None: return hook_data = json.loads(raw) + session_id = hook_data.get("session_id", "") - assistant_message = hook_data.get("assistant_message", "") + assistant_message = hook_data.get("last_assistant_message", "") transcript_path = hook_data.get("transcript_path", "") cwd = hook_data.get("cwd", "") diff --git a/tests/test_capture_stop.py b/tests/test_capture_stop.py index 7adfea9..2fcd481 100644 --- a/tests/test_capture_stop.py +++ b/tests/test_capture_stop.py @@ -158,7 +158,7 @@ class TestCapture: "cwd": "C:\\Users\\antoi\\ATOCore", "permission_mode": "default", "hook_event_name": "Stop", - "assistant_message": "Here is the answer to your question about the code.", + "last_assistant_message": "Here is the answer to your question about the code.", "turn_number": 3, } data.update(overrides) @@ -215,7 +215,7 @@ class TestCapture: mock_urlopen.return_value = mock_resp with mock.patch("sys.stdin", StringIO( - self._hook_input(transcript_path=transcript, assistant_message=long_response) + self._hook_input(transcript_path=transcript, last_assistant_message=long_response) )): capture_stop._capture()