SessionEnd: agent-type hooks silently ignored while command-type hooks work
Resolved 💬 4 comments Opened Mar 27, 2026 by fechirin-cyber Closed Apr 29, 2026
Bug Description
In project-level .claude/settings.json, SessionEnd hooks with "type": "agent" are silently ignored. However, "type": "command" hooks in the same SessionEnd block fire correctly.
This means SessionEnd itself is firing, but agent-type hooks are skipped during execution.
Steps to Reproduce
- Add both a command hook and an agent hook to
SessionEndin.claude/settings.json:
{
"hooks": {
"SessionEnd": [
{
"hooks": [
{
"type": "command",
"command": "echo SessionEnd fired at $(date) >> /tmp/sessionend_test.log"
},
{
"type": "agent",
"prompt": "Write 'agent hook fired' to .claude/session_lessons.md",
"timeout": 30,
"statusMessage": "Recording session lessons..."
}
]
}
]
}
}
- Start a session and run
/exit - In a new session, check:
cat /tmp/sessionend_test.log→ file exists (command hook fired).claude/session_lessons.md→ not created/updated (agent hook did not fire)
Expected Behavior
Both command-type and agent-type hooks should execute when SessionEnd fires.
Actual Behavior
- ✅
"type": "command"→ executes correctly - ❌
"type": "agent"→ silently ignored, no error, no output
Environment
- Claude Code CLI version: latest (as of March 28, 2026)
- OS: Windows 10 Pro 10.0.19045
- Config location: project-level
.claude/settings.json
Notes
- This is not the same as #33458 (plugin-level hooks not firing at all) — in our case, the event fires and command hooks work fine.
- This is not the same as #32641 (prompt field being stripped by /plugin) — the prompt field is present in our settings.json.
- The
Stophook with"type": "agent"works correctly, confirming agent hooks function in other events. - Workaround: None currently.
Stopfires too frequently to be a viable alternative for session-end cleanup logic.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗