Hooks
Two PostToolUse hooks that fire after every tool use.
What Hooks Are
Hooks are shell scripts that live in .claude/hooks/ and run automatically after every tool use. They are configured in .claude/settings.json as PostToolUse hooks.
Two hooks are active. One monitors session length. The other nudges you to save insights to memory. Both are lightweight. They increment counters in /tmp/ and only surface warnings when thresholds are crossed.
Context Monitor
File: .claude/hooks/context-monitor.sh. Warns when a session is getting long and context quality may start to degrade. Increments a counter in /tmp/claude-session-tool-count after each tool use.
| Tool Uses | Action |
|---|---|
| 50 | Suggest /compact |
| 80 | Recommend /compact or starting a fresh session |
| 100+ | Strongly recommend starting a new session |
Memory Nudge
File: .claude/hooks/memory-nudge.sh. Reminds you to save vault insights during long sessions. Uses a separate counter in /tmp/claude-session-memory-nudge and checks whether .claude/memory/ files were modified in the last 30 minutes.
| Tool Uses | Action |
|---|---|
| 20 (one-time) | Info nudge if no recent memory writes |
| 40 (one-time) | Warning nudge if memory is still stale |
The nudge stays silent if memory was recently written. The counter resets after 6 hours of inactivity, which effectively marks the start of a new session.
