-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Closed
Labels
bugSomething isn't workingSomething isn't workingcodexFlagged for Codex pickupFlagged for Codex pickup
Description
Bug
Session files in ~/.claude/sessions/ always contain the empty placeholder [Session context goes here] instead of real session content.
Root Cause
session-end.js reads transcript_path from the hook's stdin JSON payload to parse the JSONL transcript. However, it is registered under the SessionEnd hook, which does not provide transcript_path in its payload.
Only the Stop hook provides transcript_path. So session-end.js always receives null for transcript_path and falls back to writing the empty template.
Fix
Move session-end.js from SessionEnd to Stop hook in hooks/hooks.json:
"Stop": [
{ ... },
{
"matcher": "*",
"hooks": [{
"type": "command",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/session-end.js\"",
"async": true,
"timeout": 10
}],
"description": "Persist session state after each response (Stop hook has transcript_path)"
}
],
"SessionEnd": [
{
"matcher": "*",
"hooks": [{
"type": "command",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/evaluate-session.js\""
}],
"description": "Evaluate session for extractable patterns"
}
]
No changes needed to session-end.js itself — the script logic is correct, only the hook registration is wrong.
Verified
After moving to Stop hook, session files correctly capture user messages, tools used, and modified files.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcodexFlagged for Codex pickupFlagged for Codex pickup