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

  1. Add both a command hook and an agent hook to SessionEnd in .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..."
          }
        ]
      }
    ]
  }
}
  1. Start a session and run /exit
  2. In a new session, check:
  • cat /tmp/sessionend_test.logfile exists (command hook fired)
  • .claude/session_lessons.mdnot 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 Stop hook with "type": "agent" works correctly, confirming agent hooks function in other events.
  • Workaround: None currently. Stop fires too frequently to be a viable alternative for session-end cleanup logic.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗