Skip to content

capture-session-summary.ts doesn't match capture-all-events.ts output format #228

@noxx

Description

@noxx

The capture-session-summary.ts hook generates empty session summaries (no tools, files, or commands recorded) because it reads a different data format than what capture-all-events.ts outputs.

Root Cause

Field name mismatches between the two hooks:

Field capture-session-summary.ts expects capture-all-events.ts outputs
Session ID entry.session entry.session_id
Tool name entry.tool entry.payload.tool_name
Tool input entry.input entry.payload.tool_input
Hook input data.conversation_id data.session_id

How to Reproduce

  1. Run a Claude Code session with tool usage
  2. Exit the session (triggers SessionEnd hook)
  3. Check the generated session file in History/sessions/YYYY-MM/
  4. Observe: "Tools Used: None recorded", "Files Modified: None recorded"

Suggested Fix

Update capture-session-summary.ts to support both formats:

// Support both old and new format
const entrySessionId = entry.session_id || entry.session;
const toolName = entry.payload?.tool_name || entry.tool;
const toolInput = entry.payload?.tool_input || entry.input;
const sessionId = data.session_id || data.conversation_id;

Notes

It appears capture-tool-output.ts (which outputs the old format) exists but is not configured in settings.json. Only capture-all-events.ts is active. The session summary hook was likely written for the older capture system.

This was written by my PAI assistant

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions