Skip to content

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

Open

Description

@KM-IA-Agency

Summary

handle_post_tool_use (src/context_engine/memory/hooks.py) reads the tool result from tool_output or tool_output_json only:

tool_output = data.get("tool_output") or data.get("tool_output_json") or ""

Claude Code's PostToolUse hook payload names that field tool_response, and the installed hook script forwards stdin unchanged. Every live-captured tool event is therefore stored with an empty raw_output. The request succeeds, so nothing signals the loss.

Evidence

On one project's memory.db, every tool_event_payloads.raw_output written between 2026-09-23 and 2026-10-04 by the live hooks, and by a transcript-replay script that also used Claude Code's tool_response name, is empty (~11,000 rows). The only non-empty rows are ones replayed after that script switched to sending tool_output.

Checked against v0.4.26 and current main (7507115). A code search finds no mapping of tool_response anywhere.

Suggested fix

Accept Claude Code's field name as well, e.g. data.get("tool_output") or data.get("tool_output_json") or data.get("tool_response") or "", plus a handler test that posts a real Claude Code PostToolUse payload.

Related: #163 (another silent memory-capture loss, the serve.port rendezvous).

🤖 Generated with Claude Code

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions