Repository navigation
fix(memory): store Claude Code's tool_response in PostToolUse - #166
Open
KM-IA-Agency wants to merge 1 commit into
Open
KM-IA-Agency wants to merge 1 commit into
KM-IA-Agency wants to merge 1 commit into
Conversation
…labs#164) Claude Code's PostToolUse hook payload carries the tool result as `tool_response` (an object for Bash), and the installed hook script forwards it unchanged, but the handler only read `tool_output` / `tool_output_json`. Every live-captured tool event was stored with an empty raw_output while the request still succeeded. Read `tool_response` as a fallback, and add a handler test with a real Claude Code PostToolUse payload. Closes elara-labs#164 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KM-IA-Agency
requested review from
fazleelahhee and
rajkumarsakthivel
as code owners
October 4, 2026 23:37
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #164.
Problem
Claude Code's
PostToolUsehook payload names the tool resulttool_response, often as an object such as{"stdout": ..., "stderr": ..., "interrupted": ...}for Bash. The installed hook script forwards that payload unchanged, buthandle_post_tool_useonly readtool_output/tool_output_json. Every live-captured tool event was therefore stored with an emptyraw_output, while the request still returned 200.Fix
Read
tool_responseas a third fallback. Objects are already JSON-serialized by the existingisinstance(..., str)branch, then go through the samescrub_pii.Tests
test_post_tool_use_stores_claude_code_tool_response: posts a realistic Claude CodePostToolUsepayload and asserts the output reachesraw_output.tests/memory/test_hooks.py: 29 passed with the fix; the new test fails without it (1 failed, 28 passed). Run locally on Windows / Python 3.13 with-n0; I have not run the full suite locally.Related: #163 (another silent memory-capture loss), #165.
🤖 Generated with Claude Code