Advanced
Open
Pro
Compaction Failure Modes on a Four-Hour Session
A developer runs a single Claude Code session for roughly four hours straight, working through a large multi-file migration. The session auto-compacts twice during that time. Afterward they notice two problems:
- A path-specific coding-style rule (
paths: "src/legacy/**"in its frontmatter) that Claude was clearly following two hours ago is no longer being followed, even though Claude is still editing files undersrc/legacy/. - A skill they invoked early in the session, which contains a long, detailed 8,000-token runbook, seems to have had its later, more detailed sections forgotten — Claude is following the skill's general shape but missing specifics that were near the end of the file.
- Explain the mechanical cause of each symptom, referencing exactly what compaction does and doesn't preserve.
- For each symptom, propose a concrete mitigation the developer could apply before the next long session to prevent it from recurring.
- Is there a way to avoid ever hitting automatic compaction on a session like this in the first place, and would you actually recommend it here? Justify your answer.
Share this question