Skip to content

fix(memory): store Claude Code's tool_response in PostToolUse - #166

Open
KM-IA-Agency wants to merge 1 commit into
elara-labs:mainfrom
KML-C:fix/post-tool-use-tool-response
Open

KM-IA-Agency wants to merge 1 commit into
elara-labs:mainfrom
KML-C:fix/post-tool-use-tool-response

Conversation

@KM-IA-Agency

Copy link
Copy Markdown

Closes #164.

Problem

Claude Code's PostToolUse hook payload names the tool result tool_response, often as an object such as {"stdout": ..., "stderr": ..., "interrupted": ...} for Bash. The installed hook script forwards that payload unchanged, but handle_post_tool_use only read tool_output / tool_output_json. Every live-captured tool event was therefore stored with an empty raw_output, while the request still returned 200.

Fix

Read tool_response as a third fallback. Objects are already JSON-serialized by the existing isinstance(..., str) branch, then go through the same scrub_pii.

Tests

  • New test_post_tool_use_stores_claude_code_tool_response: posts a realistic Claude Code PostToolUse payload and asserts the output reaches raw_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

…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>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory capture stores every tool output empty: PostToolUse reads tool_output, Claude Code sends tool_response

1 participant