Feature request: session-start hook
Feature Request
Add a session-start hook event that fires when a new Claude Code conversation begins, before any user interaction.
Use Case
Our team's CLAUDE.md contains the instruction:
Claude should WARN THE USER if it is started in a directory other than the repo root OR a project root.
This is important in our monorepo because starting Claude Code in a subdirectory like project/etc/ means .claude/ settings and skills won't be inherited correctly.
The problem: even though the instruction is in CLAUDE.md, the model doesn't reliably act on it at conversation start. It's a model behavior issue — the instruction exists, but there's no guarantee it gets prioritized before the model starts responding to the user's first message.
A session-start hook would let us enforce this programmatically with a simple shell script that checks pwd against known project roots and emits a warning. This is more reliable than depending on the model to self-check.
Proposed Behavior
A new hook event type (e.g., session-start or on-init) that:
- Fires once when a new Claude Code session begins
- Runs before the user's first prompt is processed
- Can output warnings/messages that are surfaced to the model and/or user
- Supports the same shell command configuration as existing hooks
Workarounds Considered
- Shell alias: Wrapping the
claudecommand to checkpwdbefore launch. Works but is per-user setup, not portable with the repo. user-prompt-submithook: Fires on every message, not just the first. Would need state tracking to avoid repeated warnings.- Memory files: Redundant with CLAUDE.md — the instruction already exists, the issue is enforcement timing.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗