Writing Instructions That Still Hold After Context Compaction
Long Claude Code sessions eventually trigger context compaction — older conversation turns get summarised to make room for new work. Most of the time this is invisible, but instructions given casually early in a session ("also, never touch the migrations folder") can get lost or diluted in the summary if they weren't stated as a durable rule. The fix isn't to avoid long sessions — it's to put anything genuinely load-bearing somewhere compaction can't quietly drop it.
- Durable constraints belong in CLAUDE.md, not in a mid-conversation aside — compaction summarises conversation, it doesn't touch project memory files.
- Repeat critical constraints when they matter, not just when you first think of them — a one-line reminder before a risky operation costs little and removes ambiguity about whether the rule survived.
- Prefer explicit re-confirmation for destructive operations over trusting that an early-session caveat is still active forty turns later.
Before a long unattended run, ask: "if this session's context got compacted right now, would the rule I care about survive?" If the honest answer is "maybe," it belongs in CLAUDE.md instead of a passing comment.