Claude / Operating Manual · Reference

← All Operating Manual pages

Context management

Steer what stays in the window and what persists across sessions. /compact directs compaction, /clear resets, /memory edits the memory files.

GA · updated 2026-06-14

The commands for managing the live context window and the files that persist between sessions. For how the layers fit together and what belongs where, see Memory & Context.

How you use it day-to-day

  • /compact [instructions] summarizes the conversation when the window fills, and you can steer what survives: /compact focus on the auth refactor and the files still to migrate keeps your working set instead of a generic summary. The highest-value long-session move.
  • /clear wipes the conversation context for a clean start, while leaving your CLAUDE.md and memory files in place. Reach for it between unrelated tasks rather than letting an old thread bleed into a new one.
  • /memory opens and edits your CLAUDE.md memory files and controls auto-memory from inside the session, so you never hand-edit the files.
  • # mid-session writes a one-line rule straight into CLAUDE.md instead of forgetting it after the turn.

Gotchas

  • Auto-memory loads in full every session. The MEMORY.md index is read every time, so keep it lean and one fact per entry. Past a couple hundred lines it crowds out real work.
  • The automatic compaction summary is generic. On a long session, run a directed /compact before the window forces one on you, or you lose the details you cared about.
  • A subagent resets the clock. Quality degrades as the window fills; delegating a noisy task to a subagent keeps your main context clean (it gets a fresh window).
  • Nothing persists unless it is in a file. Between sessions, only CLAUDE.md and memory files survive. If you want it next time, write it down (or press #).