Claude Code sometimes skips reading CLAUDE.md at session start

Resolved 💬 4 comments Opened Apr 6, 2026 by mstang Closed Jun 1, 2026

Problem

Claude Code sometimes skips reading CLAUDE.md at session start, which means custom session lifecycle protocols defined there are not followed.

Context

We use CLAUDE.md to define a mandatory session start protocol for a case management system (CaseMgr). The protocol requires the agent to:

  1. Detect the current worktree case first (worktrees-get by path/hostname)
  2. Only fall back to global preferences-getcurrent_case_id if not in a worktree

This distinction matters because current_case_id is one per user across all machines, while the worktree case is specific to the current directory on the current machine.

Failure Mode

When Claude Code skips CLAUDE.md:

  • The agent calls preferences-get directly, getting a stale current_case_id from another machine
  • It resumes work on the wrong case (in this instance, a completed case from a different worktree)
  • After context compaction, the agent has no memory of the correct case and no protocol to recover

Impact

  • Agent works on the wrong case entirely
  • Multi-machine workflows break — work machine picks up home machine's current case
  • Session recovery after compaction fails because the wrong case is loaded
  • User has to manually correct the agent every time

Expected Behavior

CLAUDE.md should always be read at session start, before any tool calls. The instructions in CLAUDE.md are user-defined mandatory protocols — skipping them defeats the purpose.

Environment

  • Claude Code CLI v2.1.81 and v2.1.91
  • Ubuntu Linux
  • MCP server with session lifecycle management

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗