# SessionStart Hook

> The event when a session starts. It can load notes for Claude.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** SessionStart

## Think of it like

It is like a note on the fridge. You read it as the day starts.

## Definition

SessionStart is the hook event that fires when Claude Code starts a new session or resumes one. The matcher says how it began: startup, resume, clear, compact or fork. Text the hook prints is added to Claude's context, so it is the place to load today's issues or recent changes. Only command and MCP tool hooks run here.

## Example

Jack's SessionStart hook prints the last five commits. Claude starts each session knowing what changed.

## Example code

```bash
#!/bin/bash
# show Claude the last five commits at the start
git log --oneline -5
```

What this prints becomes context for Claude.

## Why it matters

Facts that change each day do not belong in CLAUDE.md. This hook fetches them fresh each time.

## Common mistake

Making it slow. It runs on every start, resume and clear, and Claude's first reply waits for it.

## Three principles

- **Start or resume.** Five sources.
- **Output is context.** Plain text works.
- **Keep it fast.** Each start.

## Related terms

- [SessionEnd Hook](https://learn.benibix.com/term/ai/sessionend-hook)
- [CLAUDE.md](https://learn.benibix.com/term/ai/claude-md)
- [CLAUDE_ENV_FILE](https://learn.benibix.com/term/ai/claude-env-file-variable)

## Told apart from

- [Setup Hook vs SessionStart Hook](https://learn.benibix.com/compare/setup-hook-vs-sessionstart-hook): People think a Setup hook runs each time Claude Code starts. It does not. It runs only when you ask for it with --init-only, --init or --maintenance. SessionStart is the one that runs on every start, resume and clear. Put one-time installs in Setup, and quick context in SessionStart.

---

Source: https://learn.benibix.com/term/ai/sessionstart-hook
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
