Claude Code can run a hook when a session starts. That is the right place to inject context you always want: current branch, dirty files, open TODOs — without typing it every time.

Minimal SessionStart hook

In .claude/settings.json (or settings.local.json for personal-only rules):

{ "hooks": { "SessionStart": [ { "hooks": [ { "type": "command", "command": "bash -lc 'echo \"## Session context\"; echo \"Branch: $(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo n/a)\"; echo; git status -sb 2>/dev/null | head -40'" } ] } ] } } 

When Claude Code opens, the command runs once. Its stdout is added to the session context, so the model already knows which branch you are on and what is dirty.

Keep it short

  • Cap the output (head -40) so you do not dump a huge status into every chat.
  • Prefer settings.local.json if the hook is personal and should stay out of git.
  • Fail soft: wrap git calls so a non-repo folder does not break session start.

Pair it with house rules

Your project CLAUDE.md still loads as usual. The SessionStart hook is for live facts (branch, status); put stable rules (coding style, never push main) in CLAUDE.md instead.

Want the rest of the setup?

I keep copy-ready Claude Code configs (CLAUDE.md templates, slash commands, hooks, permission rules) in Vildanden Agent Config. There's a free sample: https://justly-mia-429.rehost.page/