5. Context and Memory
Sessions do not share memory. Information persists between sessions only where it is written to a file.
| Subject | Behavior | Command |
|---|---|---|
| Context window | All material read during a session occupies a single window. | /context reports usage. |
| Compaction | When the window is full, earlier messages are replaced by a summary and detail is lost. | /compact performs it early. Content to retain may be specified: /compact keep the open pull requests. |
| Rules | Stored in CLAUDE.md files. ~/.claude/CLAUDE.md applies to every project, and each project directory may hold its own. They are read at the start of every session. | Instruct Claude to "add this to CLAUDE.md". |
| Automatic memory | Corrections and preferences are saved for each project. | /memory opens the rule files and the saved notes. |
Verified November 23, 2026 against Claude Code 2.1.327. References