[BUG] Session-start memory instructions not followed after context summarization
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Issue: Session-start memory instructions not followed after context summarization
Setup:
- CLAUDE.md contains a ## Session Start section with an explicit instruction: "At the beginning of every session, read all files in .claude/memory/ before doing anything else."
- Project-level memory lives in .claude/memory/ (3 files: conventions.md, workflow.md, decisions.md)
- User-level memory lives at ~/.claude/projects/<project>/memory/ (4 feedback files, indexed in MEMORY.md)
- MEMORY.md is loaded automatically into context as a system-reminder
What failed this session:
The session resumed from a context-window summary. Despite CLAUDE.md being shown in the system context and explicitly saying to read .claude/memory/ first, I jumped directly into the pending task (API.md update) without reading any of the three project memory files (conventions.md, workflow.md, decisions.md). The user's four feedback rules (e.g. never invoke mvn directly — use ./test.sh/./run.sh; plan before code; tests required; SCREAMING_SNAKE_CASE error codes) were only available to me because they appeared in the system-reminder auto-load of MEMORY.md, not because I actively read them as instructed.
Root cause hypothesis:
When a session is restored from a summary, the "session start" framing is lost — the model picks up mid-task rather than treating the restored turn as a new session start that triggers the CLAUDE.md instructions.
User impact:
Multiple sessions have failed to correctly follow the read-memory-first instruction, requiring the user to repeatedly re-establish conventions they've already documented.
What Should Happen?
What should happen:
When a session resumes from a context-window summary, the model should treat the resumption as a new session start and execute any explicit startup instructions found in CLAUDE.md (or equivalent project instruction files) before doing anything else — including before continuing the pending task described in the summary.
Concretely: if CLAUDE.md contains a ## Session Start section that says "read all files in .claude/memory/ before doing anything else," that instruction should fire on resumption exactly as it would on a cold start. The presence of a pending task in the summary should not suppress it; the memory read should happen first, then the task should continue.
A reasonable implementation might be: after injecting the conversation summary as the first turn, the system inserts a synthetic user turn that replays any CLAUDE.md session-start instructions before handing control back to the model. Alternatively, the model could be prompted to detect and execute session-start instructions before acting on summary content.
The current behavior — where session-start instructions are visible in context but silently skipped because the model anchors on the "resume the pending task" framing from the summary — means users cannot rely on CLAUDE.md startup hooks to enforce conventions across long-running or multi-session work. That undermines the primary use case of CLAUDE.md for teams that use it to maintain consistent behavior across sessions.
Error Messages/Logs
Steps to Reproduce
Steps to reproduce:
- Create a CLAUDE.md in the project root with a ## Session Start section containing an explicit read instruction, e.g.:
Session Start
At the beginning of every session, read all files in .claude/memory/
before doing anything else.
- Populate .claude/memory/ with one or more .md files containing conventions or rules that should govern the session (e.g. "never invoke mvn directly, use ./test.sh").
- Start a Claude Code session in that project and do enough work that the context window fills and the conversation is automatically summarized.
- Continue working in the same session past the summarization point, or open a new session that loads the summary.
- Observe that Claude does not read the files in .claude/memory/ before proceeding. It resumes the pending task from the summary directly, treating the ## Session Start instruction as already-satisfied even though no file reads occurred in the current context window.
Expected: Claude reads .claude/memory/ files before acting on the summary's pending task.
Actual: Claude skips the read and proceeds with the task. The conventions in those files are not actively loaded — they are only available if they happened to appear in an auto-injected system-reminder (e.g. via MEMORY.md), which is a separate mechanism the user had to set up independently.
Claude Model
Sonnet (default)
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.196 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗