AI Help
How do I keep Claude Code following CLAUDE.md after /compact?
Store durable rules in the applicable CLAUDE.md file and inspect which instruction files the current session loads after compaction.
Steps to follow
- Confirm the working directory and location of the project's CLAUDE.md. Keep recurring commands and constraints concise and remove conflicting duplicates.
- After /compact, inspect loaded memory or instruction files using the controls supported by your installed version. Ask Claude to restate the relevant rule.
- Test a small task and inspect its commands and diff. If a rule is missed, reduce ambiguity and report a reproducible case with the version.
Example in practice
Illustrative example. A rule requires npm run typecheck before completion. After compaction, verify the command's actual output in the session.
Related AI help
- Why is my MCP server connected but its tools aren’t showing up?
- How do I handle AI API 429 rate limits without losing requests?