# When should I clear, compact, or resume a Claude Code session?

Exam: CCDV-F — Claude Certified Developer - Foundations
Knowledge domain: Claude Code
Updated: 2026-11-25T08:30:00.797425+00:00
HTML: https://learningpathx.com/faq/CCDV-F/ccdvf-claude-code-clear-compact-resume.html

## Also asked as

- How do /clear, /compact, and /resume differ in Claude Code?
- What should I check before continuing an old Claude Code conversation?

Use `/clear` for a new, unrelated objective, `/compact` to keep working on the same objective with summarized history, and `/resume` to reopen a previous conversation whose goal and repository still match. Use `/context` before you compact to see what is consuming the active window.

When compacting, call out instructions, decisions, source references, and open checks needed for the remaining task. Review what survived. A fresh conversation clears conversation context while repository instructions and configured memory can load again. When resuming, confirm working directory, branch, changed files, and earlier assumptions against current evidence. Conversation history is separate from current filesystem state and external effects.

A headless caller can choose a specific prior session with `--resume <session-id>` when session persistence is enabled. Keep IDs bound to the appropriate user and task, and independently validate the resulting diff or artifacts.

* [Claude Code session and context commands](https://code.claude.com/docs/en/commands)
* [Claude Code headless session continuation](https://code.claude.com/docs/en/headless)

Source: [Claude Code Operation, Configuration, and Extension Surfaces](https://learningpathx.com/news/claude-code-operation-configuration-and-extension-surfaces.html)
