Sessionend Hook Timeout 1500ms
What Happened

The PeonNotify Obsidian flush hook makes a claude -p call to extract vault notes, then writes the results to disk. The whole operation takes 5-10 seconds. Claude Code’s default SessionEnd hook timeout is 1.5 seconds. Every session ended with the hook killed mid-execution : manifests lost, Obsidian notes never written, no error reported.
Root Cause
Claude Code enforces a hard 1.5-second timeout on SessionEnd hooks by default. There is no warning when a hook is killed: the session simply ends, and the hook’s partial work is discarded. Hooks that make AI calls or perform network I/O will almost always exceed this budget.
The Stop hook (fires per-turn) is not a valid alternative: flushing on Stop resets the manifest after every single turn, producing scores of 2-3 (below the publish threshold). The Obsidian integration needs per-session flush semantics, which means SessionEnd is the only option.
How to Avoid
Set the timeout before launching Claude Code:
export CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS=10000
The peon-claude wrapper sets this automatically so every session launched through it has a 10-second window.
Related
- projects/peon-notify/_index : parent project
- unset-claudecode-nested-cli : companion HOOKS pitfall in the same project
- peonnotify-obsidian-integration
- peon-notify