-
Notifications
You must be signed in to change notification settings - Fork 431
Description
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
- Run a Claude Code session with tool usage
- Exit the session (triggers SessionEnd hook)
- Check the generated session file in History/sessions/YYYY-MM/
- 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