Quick reference for claude — the CLI. Run claude to start, claude --help for flags.
| Command | Explanation | Typical Usage |
|---|---|---|
| /context | Shows current context window usage — tokens consumed vs. remaining in this session | Check before a long task to see if you need to compact or clear first |
| /clear | Wipes the entire conversation history — Claude has no memory of anything said before | Starting a brand-new, unrelated task; getting a clean slate |
| /compact | Compresses conversation history into a summary, freeing context while keeping the working thread | Conversation is getting long but you want to continue the same task without losing context |
| /plan | Enters plan mode — Claude outlines its approach and waits for approval before taking any action | Before a risky or multi-step task; when you want to review the approach before Claude touches any files |
CLAUDE.md for the current codebase
opus, sonnet)
CLAUDE.md at the project root to give Claude persistent context — conventions, stack, commands to know, what to avoid.
CLAUDE.md from the codebase
CLAUDE.md at session start. Checked-in files inform all collaborators; .claude/settings.local.json is for personal overrides.
~/.claude/CLAUDE.md — applies to all projects on this machine.
claude-opus-4-7, claude-sonnet-4-6, etc.
text (default), json, or stream-json
.claude/settings.json (project) or ~/.claude/settings.json (global). Use /update-config skill to manage them.
allow (auto-approve), deny (auto-reject), or prompt (default). Applies per tool, per path prefix, or per command pattern.
~/.claude/projects/<project>/memory/. Memories persist across sessions.
user (preferences), feedback (corrections + confirmations), project (context, deadlines), reference (where things live).
settings.json under a hooks key.
settings.json under mcpServers.
.claude/settings.json), user (~/.claude/settings.json), or via --mcp-config <file> flag.
stdio (local process) or http (remote). Each server exposes tools Claude can call like any built-in tool.
claude -p "summarise changes in this PR" --output-format json
cat file.py | claude -p "review this" — stdin is included in context.
Agent tool to spawn parallel sub-agents. Each starts cold — write self-contained prompts. Results return as tool output.
! in the prompt — e.g. ! git log --oneline -10 — output lands directly in the conversation.
/compact when the conversation gets long; use /clear for a clean slate on a new task.
Agent tool calls in a single message to run them concurrently and cut wall-clock time on independent tasks.
isolation: "worktree" on agents to give them an isolated git branch — auto-cleaned if no changes are made.
claude-opus-4-7) · Sonnet 4.6 (claude-sonnet-4-6) · Haiku 4.5 (claude-haiku-4-5-20251001). Default to Sonnet for cost/quality balance; Opus for complex reasoning.