Claude Code Workshop (2026 Q2)
An org-driven tutorial of the CLI, slash commands, and runtime surface

Table of Contents

1. Preface: How to use this workshop

This file is both documentation and apparatus. Read it top-to-bottom the first time. After that, use it three ways:

  1. Run blocks in place. Every sh / bash block can be executed with C-c C-c inside Emacs org-mode. Most are defensive (:eval no-export) so they don't run during batch HTML export. Remove the guard locally when you want to run them.
  2. Tangle configs out. Blocks with :tangle <path> write config files when you invoke C-c C-v t. The appendix includes a starter settings.json, a hook script, an agent definition, and a SKILL.md.
  3. Walk the exercises. Each session ends with an exercise. Do them.

One invariant across the whole workshop: you do not need to understand Claude Code's internals to drive it well; you need to understand its surface — the CLI, the slash commands, the hook lifecycle, and where each one writes state.

1.1. What this workshop targets

:CUSTOM_ID: workshop-targets :REVIEW: 2026-06-21 – Added FreeBSD end-of-support note from 2.1.112 gist :VERIFIED_AT: 2026-06-21T15:00Z :VERIFIED_BY: skeptic-agent :VERDICT: correct :FINDING: 2.1.112 is last FreeBSD version; 2.1.113+ requires Linux/macOS native binaries

Claude Code 2.1.x (April 2026). Opus 4.6 default on Pro/Max, Opus 4.7 via /model or auto. Tested on FreeBSD 15 + macOS + Linux; Windows notes inline where relevant.

FreeBSD native support ended with 2.1.112. Versions 2.1.113+ ship platform-specific native binaries (Linux/macOS only). Two options on FreeBSD:

  1. Pin to the last native build: npm install -g @anthropic-ai/claude-code@2.1.112
  2. Run 2.1.185+ via the Linux compatibility layer (linux64 + FreeBSD linux_base-c7). Grind-tested 2026-06-21: all features work including X11 headless screenshots, Emacs daemon on DISPLAY:99=, CIDER nREPL, and org-mode rendering. See feature reference gist.

1.2. Conventions

  • $ prefix on shell lines = command to run.
  • #=> ... = expected output shape (not exact).
  • :beginner:, :intermediate:, :advanced: tags on sections.
  • ! prefix in running Claude sessions = shell escape; useful when the workshop asks you to run a shell command.

2. Setup   beginner

Before anything else, establish a known-good baseline.

claude --version
claude doctor

claude doctor spawns stdio MCP servers from .mcp.json as part of its health check. Run it in a directory you trust.

# Where does Claude keep its state?
ls ~/.claude/ 2>/dev/null
ls ~/.claude/projects/ 2>/dev/null | head -5

The per-project directory is derived from the absolute path: ~/.claude/projects/-home-you-ghq-github-com-you-repo. That directory holds sessions (as JSONL), memory (memory/), and auto-memory index.

2.1. Exercise

Find the most recent session in the current project:

ls -lt ~/.claude/projects/$(pwd | tr '/' '-')/*.jsonl | head -1

3. Release notes timeline (what's actually shipped)

Read this before Session 1. Each point anchors later sessions.

3.1. 2.1.114 – 2026-04-18

  • Fix: crash in permission dialog when an agent-teams teammate requested tool permission.

3.2. 2.1.113 – 2026-04-17

  • Native binary spawning (platform-specific, no bundled JS shim).
  • sandbox.network.deniedDomains setting (egress denylist).
  • Fullscreen mode: scrolling + readline improvements.
  • Windows: Ctrl+Backspace deletes previous word.
  • Long wrapped URLs stay clickable.
  • /loop gets Esc cancellation and status messages.
  • /extra-usage + @ file autocomplete work from Remote Control clients.
  • /ultrareview faster, parallelized.
  • macOS path protections + exec-wrapper matching for Bash rules.

3.3. 2.1.112 – 2026-04-16

  • Fix: transient claude-opus-4-7 temporarily unavailable in auto mode.
  • Last FreeBSD-compatible release. FreeBSD support was dropped in 2.1.113 in favor of platform-specific native binaries.

3.4. 2.1.111 – 2026-04-16

  • Opus 4.7 xhigh effort level.
  • Auto mode available for Max subscribers with Opus 4.7.
  • Interactive /effort slider.
  • "Auto (match terminal)" theme.
  • /less-permission-prompts skill (scan transcript, propose allowlist).
  • /ultrareview (cloud code review; 3 free runs on Pro/Max).
  • PowerShell tool rolling out on Windows (CLAUDE_CODE_USE_POWERSHELL_TOOL).
  • Auto-allow read-only bash with globs and cd <dir> && patterns.

3.5. 2.1.110 – 2026-04-15

  • /tui fullscreen (flicker-free alt-screen rendering).
  • /focus (prompt + tool summary + response only).
  • Remote Control push notifications.
  • autoScrollEnabled config.
  • Context-as-comments in external editor.
  • /plugin token-count sort; /doctor status icons.

3.6. 2.1.109 – 2026-04-15

  • Extended-thinking indicator now rotates a progress hint.

3.7. 2.1.108 – 2026-04-14

  • ENABLE_PROMPT_CACHING_1H env var (1-hour cache TTL).
  • Session recap.
  • Built-in skills discoverable via the Skill tool.
  • /undo alias for /rewind.
  • Rate-limit vs usage-limit errors distinguished.
  • Reduced memory footprint for file operations.

3.8. 2.1.105 – 2026-04-13

  • path parameter to EnterWorktree tool.
  • PreCompact hook.
  • Background monitor support for plugins.
  • 5-minute stalled-API-stream timeout.

3.9. Earlier (selected)

  • 2.1.101: /team-onboarding, Monitor tool for streaming background events, Bash subprocess sandboxing with PID namespace, OS CA trust, /ultraplan auto cloud env.
  • 2.1.98: Vertex AI wizard, CLAUDE_CODE_PERFORCE_MODE, Monitor tool.
  • 2.1.94: Bedrock Mantle support, default effort high, compact Slack message headers.
  • 2.1.84: PowerShell tool preview, ANTHROPIC_DEFAULT_*_MODEL_SUPPORTS env vars, TaskCreated hook.
  • 2.1.76: MCP elicitation (interactive dialogs), /effort landed, session display names via -n, worktree.sparsePaths.
  • 2.1.75: 1M context window for Opus 4.6, /color, session name on prompt bar, memory file timestamps.

4. Session 1 – First contact   beginner

Three ways to start Claude:

# 1) Interactive session -- the default
claude

# 2) One-shot, no TTY
claude -p "list the files in this directory and group by extension"

# 3) Continue the most recent session in this directory
claude -c

The first difference that matters: -p skips the workspace-trust dialog. Only use -p in a directory you trust. It is the correct mode for scripts, CI, and pipes.

4.1. Exercise

Run Claude non-interactively and pipe the answer through jq:

claude -p "respond with a JSON object {status: 'ok', now: <iso-timestamp>}" \
  --output-format json | jq .

5. Session 2 – Driving a single shot   intermediate

-p has the richest flag surface. Key combinations:

# Structured output with schema validation
claude -p "extract the TLDs from https://wal.sh" \
  --json-schema '{"type":"object","properties":{"tlds":{"type":"array","items":{"type":"string"}}},"required":["tlds"]}' \
  --output-format json

# Streaming JSON -- one message per line
claude -p "count to five slowly" --output-format stream-json --include-partial-messages

# Hard budget cap -- stops before burning through $
claude -p "refactor all Python files in src/" --max-budget-usd 2.00

# Input from stdin in stream-json format -- for long-running pipelines
cat requests.jsonl | claude -p --input-format stream-json --output-format stream-json

--no-session-persistence is the right call when -p is part of a pipeline and you don't want thousands of session files accumulating.

--fallback-model only works with -p and only triggers on overload of the primary model:

claude -p "do the thing" --model opus --fallback-model sonnet

5.1. Exercise

Write a shell script that takes a URL, fetches the page, and asks Claude (in -p mode, no persistence, with a --max-budget-usd 0.25 cap) for a three-bullet summary as JSON. Validate the JSON shape with --json-schema.

6. Session 3 – Slash commands, grouped   beginner

In an interactive session, type / and a picker appears. The full list is in Appendix B. Here are the groups you'll touch most often in the first week, with the reason each one exists.

6.1. Session control

  • /clear – start with empty context. Aliases: /new, /reset.
  • /resume [id-or-name] – pick a prior session.
  • /continue (CLI flag -c) – resume the most recent session in pwd.
  • /branch [name] – fork the conversation at the current point.
  • /rewind / /undo – rewind both conversation and code to a prior state.
  • /recap – one-line summary of the current session.
  • /rename [name] – label the session (shows in /resume).

6.2. Context and memory

  • /context – visualize context usage (how much of the window is filled by system prompt, tools, messages, memory).
  • /compact [focus] – summarize conversation to free up context. The optional focus string tells Claude what to keep.
  • /memory – open CLAUDE.md files and project memory in your editor.
  • /cost – token usage for this session.

6.3. Model and effort

  • /model [alias-or-id] – switch models mid-session. Aliases: sonnet, opus, haiku. IDs: claude-opus-4-6, claude-haiku-4-5-20251001.
  • /effort [low|medium|high|xhigh|max|auto] – more effort = more tokens = slower but deeper reasoning.
  • /fast [on|off] – Fast mode. Same Opus 4.6 model, faster output path; slightly less deliberation.

6.4. Permissions and safety

  • /permissions – view/edit allow/ask/deny rules.
  • /sandbox – toggle sandbox mode.
  • /add-dir <path> – grant file access to another directory.

6.5. Development

  • /review [PR] – review a pull request locally.
  • /security-review – scan pending changes for vulnerabilities.
  • /diff – interactive diff viewer for uncommitted work.

6.6. Discovery

  • /help – everything available to you in your environment.
  • /skills – list skills.
  • /agents – manage agent configurations.
  • /mcp – MCP server connections.
  • /plugin – Claude Code plugins.
  • /hooks – view hook configurations.
  • /doctor – diagnostics.
  • /status, /usage, /cost – accounting.
  • /release-notes – interactive changelog picker.
  • /powerup – animated tours of features you haven't tried.

6.7. Exercise

Start a session, run /context, note the percentages. Then run /compact "keep only what's relevant to the current refactor" and run /context again. Compare.

7. Session 4 – Memory and context   intermediate

Claude Code reads several files as context automatically:

  • ~/.claude/CLAUDE.md — user-global preferences.
  • <project>/CLAUDE.md — project instructions.
  • ~/.claude/projects/<slug>/memory/*.md — per-project auto-memory (facts, feedback, references; indexed via MEMORY.md).
  • Plus whatever tools pull in (file reads, grep, URL fetches).

Key CLI knobs:

# Make another directory readable without prompting (multi-dir projects)
claude --add-dir ../shared-libs ../docs

# Override CLAUDE.md auto-discovery entirely
claude --bare --system-prompt "You are a minimal assistant." \
  --add-dir . --mcp-config ./mcp.json

# Append to the default system prompt without replacing it
claude --append-system-prompt "Always cite file:line when referencing code."

--bare is the escape hatch when you want a reproducible Claude run for CI or an experiment: no hooks, no LSP, no plugin sync, no auto-memory, no keychain, no CLAUDE.md auto-discovery. You provide context explicitly via the flags.

7.1. Auto-memory: what gets written without you asking

Claude Code writes memory in these categories (from the harness instructions): user, feedback, project, reference. The index is MEMORY.md. Read it; it is the cheapest audit of what Claude "knows" about you.

cat ~/.claude/projects/$(pwd | tr '/' '-')/memory/MEMORY.md 2>/dev/null

7.2. Exercise

Write a one-paragraph CLAUDE.md for this project that tells Claude one thing to always do and one thing to never do. Start a fresh session and verify that Claude honors both.

8. Session 5 – Permissions and safety   intermediate

Permissions live at three levels: session, project (.claude/settings.json), user (~/.claude/settings.json).

# Scope tools explicitly for a single invocation
claude -p "tidy this repo" \
  --allowedTools 'Bash(git:*) Edit Read' \
  --disallowedTools 'Bash(rm:*) Bash(curl:*)'

# Permission modes
claude --permission-mode plan          # think, don't act
claude --permission-mode acceptEdits   # auto-accept edits
claude --permission-mode bypassPermissions  # ⚠ only in sandbox
claude --permission-mode dontAsk       # never prompt
claude --permission-mode auto          # ask the classifier

--dangerously-skip-permissions / --allow-dangerously-skip-permissions turn off the permission model. Only defensible inside a VM, jail, container, or other blast-radius-bounded environment with no credentials. Otherwise: don't.

8.1. Example: safe non-interactive CI run

claude --bare -p "$(cat request.txt)" \
  --allowedTools 'Read Grep Glob' \
  --permission-mode dontAsk \
  --max-budget-usd 0.50 \
  --no-session-persistence \
  --output-format json

Read-only tools, no session file, capped spend, JSON out, no auto-discovered context. That's a tight supply chain.

8.2. Exercise

Write a project-level .claude/settings.json that denies Bash(rm:*) and Bash(sudo:*) and asks before any Bash(git push:*).

9. Session 6 – Models and effort   beginner

# Pin model for this session only
claude --model opus

# Pin effort (also available as /effort in session)
claude --effort max

# Fallback when primary is overloaded (only with -p)
claude -p "..." --model opus --fallback-model sonnet

Effort is a cost/quality knob. low is fastest and cheapest; xhigh and max chew tokens. auto lets the classifier pick — reasonable default on Max with Opus 4.7.

10. Session 7 – Hooks   intermediate

Hooks are shell commands triggered by lifecycle events. They run in the harness, so they're deterministic. Events:

  • SessionStart / SessionEnd
  • UserPromptSubmit / AssistantResponseComplete
  • PreToolUse / PostToolUse (can veto)
  • PreCompact (new in 2.1.105 — run before context summary)
  • TaskCreated
  • conditional if hooks (2026-03 research preview)

Example: append a Co-Authored-By trailer automatically via PostToolUse on any git commit.

Tangle a hook script:

# guard-dangerous-bash.sh -- PreToolUse hook for the Bash tool
# Veto rm -rf /, git push --force, etc.
set -euo pipefail

# Claude passes the tool invocation as JSON on stdin
invocation=$(cat)
cmd=$(printf '%s' "$invocation" | jq -r '.input.command // ""')

case "$cmd" in
  *"rm -rf /"*|*"rm -rf ~"*|*"rm -rf /*"*)
    echo '{"decision":"deny","reason":"rm -rf at a dangerous root"}'
    exit 0
    ;;
  *"git push --force"*|*"git push -f"*)
    echo '{"decision":"deny","reason":"force-push blocked; rebase and ask"}'
    exit 0
    ;;
esac

# Default: allow
echo '{"decision":"allow"}'

Register it in ~/.claude/settings.json (tangled in Appendix D).

10.1. Exercise

Add a SessionStart hook that runs bd ready (or any project-specific onboarding command) and prints the top three items into the session as context.

11. Session 8 – Skills   intermediate

:CUSTOM_ID: session-8-skills :REVIEW: 2026-06-21 – Added /schedule skill to built-ins list :VERIFIED_AT: 2026-06-21T15:00Z :VERIFIED_BY: skeptic-agent :VERDICT: correct :FINDING: /schedule added in 2.1.111+ for managing cron-scheduled remote agents

A skill is a named prompt + tool scope, discoverable at /. Built-ins (2026 Q2):

  • /simplify [focus] – review changed files for quality.
  • /debug [description] – enable debug logging, walk through a bug.
  • /loop [interval] [prompt] – run prompt repeatedly.
  • /schedule [description] – create cron-scheduled remote agents for recurring tasks.
  • /claude-api – load the current Claude API reference for your project language (Python, TS, Go). Triggers automatically if the code imports anthropic.
  • /batch <instruction> – orchestrate 5-30 parallel agents.
  • /fewer-permission-prompts – scan your transcript, propose a minimal allowlist addition.
  • /less-permission-prompts – same, as of 2.1.111.

Custom skills live in .claude/skills/<name>/SKILL.md. Shape:

---
: 
: 
  detailed git notes, push to remote.
: 
---

# repo-sync

Given the current working tree:

1. Summarize what changed with `git status` + `git diff`.
2. Propose a conventional-commit branch name.
3. Ask for confirmation *before* creating the branch.
4. Commit. Add a git note with the detailed rationale.
5. Push with upstream tracking.

Always use conventional commits. Never force-push to main.

opencode.ai's Skills spec walks up from pwd looking in .claude/skills/, .opencode/, .agents/ — so a skill placed in .claude/skills/ is cross-harness portable.

11.1. Exercise

Tangle the skill above. Start a session. Type /repo-sync and observe.

12. Session 9 – Agents and subagents   advanced

Custom agents are named prompt + tools scoped for delegation.

# Pin a custom agent at startup
claude --agent reviewer

# Define agents inline (rare, but valid)
claude --agents '{
  "reviewer": {
    "description": "Reviews code for bugs, logic errors, OWASP issues.",
    "prompt": "You are a rigorous code reviewer."
  },
  "scribe": {
    "description": "Writes clear commit messages.",
    "prompt": "You are a conventional-commits pedant."
  }
}'

Project-level agents live in .claude/agents/<name>.json. Tangle:

{
  "description": "Rigorous code reviewer. Reads diffs, flags high-signal issues, suppresses low-confidence nits.",
  "prompt": "You are a senior engineer doing a pull-request review. Output: (1) blocking issues, (2) non-blocking suggestions, (3) out-of-scope observations. Cite file:line. Never suggest rewrites unless asked.",
  "tools": ["Read", "Grep", "Glob", "Bash(git:*)"]
}

Subagents are delegated Claude runs launched from inside an active session via the Agent tool. Supported types visible to the harness include general-purpose, Explore, Plan, and any you register.

12.1. Built-in agents (2.1.112+)

:CUSTOM_ID: built-in-agents :REVIEW: 2026-06-21 – Documented from 2.1.112 gist :VERIFIED_AT: 2026-06-21T15:00Z :VERIFIED_BY: skeptic-agent :VERDICT: correct :FINDING: Five built-in agents available by default for delegation and direct use

Agent Model Purpose
Explore haiku Fast codebase exploration and discovery
Plan inherit Design and plan implementation approaches
general-purpose inherit Multi-step autonomous task execution
claude-code-guide haiku Answer questions about Claude Code itself
statusline-setup sonnet Configure terminal status line

Pin a built-in agent at startup with --agent <name>, or delegate to one via the Agent tool from inside a session.

12.2. Exercise

Tangle the reviewer agent. Run:

claude --agent reviewer -p "review the last commit"

13. Session 10 – MCP   advanced

MCP (Model Context Protocol) servers expose tools and resources over a transport the harness speaks.

# Use a project-local MCP config
claude --mcp-config ./.mcp.json

# Use multiple configs (space-separated)
claude --mcp-config ./team.json ./personal.json

# Strict: ignore all other MCP sources
claude --mcp-config ./only.json --strict-mcp-config

# Set up a long-lived auth token for an MCP server
claude setup-token

Minimal .mcp.json:

{
  "mcpServers": {
    "fs": {
      "command": "uvx",
      "args": ["mcp-server-filesystem", "."],
      "env": {}
    },
    "gh": {
      "command": "gh-mcp-server",
      "args": [],
      "env": {}
    }
  }
}

Once connected, MCP prompts appear at /mcp__<server>__<prompt>. Inspect:

claude /mcp       # inside a session
# or
claude mcp        # subcommand form for management

13.1. Claude Code as an MCP server (new in 2.1.112)

Claude Code itself can now run as an MCP server, exposing its tools and capabilities to other MCP clients:

# Start Claude Code as an MCP server on stdio
claude mcp serve

# This makes Claude Code's tools available to other clients that speak MCP
# Useful for multi-agent systems and orchestration

This inverts the traditional architecture: instead of Claude Code consuming MCP servers, Claude Code becomes a service endpoint for other agents.

See also the broader 2026 Q2 notes on Cloudflare's MCP enterprise architecture and terminal AI agents 2025.

14. Session 11 – Plugins   advanced

Plugins add commands, skills, hooks, and MCP servers in one bundle.

claude plugin list
claude plugin install <name>
claude --plugin-dir ./local-plugins  # ephemeral, session-only

A plugin directory looks roughly like:

my-plugin/
├── manifest.json
├── skills/
│   └── my-skill/SKILL.md
├── hooks/
│   └── pre-tool.sh
├── agents/
│   └── specialist.json
└── mcp.json

When loaded, all contained surfaces register.

15. Session 12 – Worktrees and tmux   advanced

Git worktrees + Claude = per-feature, per-branch sandboxes that don't stomp on each other.

# Create a worktree and start Claude in it
claude -w feat-x

# Create a worktree AND open it in a tmux session
claude -w feat-y --tmux

# With a named session for /resume
claude -w feat-z -n "feature z planning"

On this project we keep worktrees inside the repo under worktrees/ (gitignored). Set BEADS_NO_DAEMON=1 in each worktree so bd doesn't fight itself.

Inside a Claude session, the harness has EnterWorktree and ExitWorktree tools. From 2.1.105 on, EnterWorktree accepts a path parameter, so subagents can operate on a named directory.

15.1. Exercise

Create a throwaway worktree, run Claude inside it with a trivial task, run /diff, then git worktree remove the worktree. Confirm no leaks into main.

16. Session 13 – Remote, web, IDE   intermediate

  • /remote-control – make this terminal session remotely controllable from claude.ai.
  • /remote-env – configure the default cloud environment for web sessions.
  • /teleport – pull a Claude-on-the-web session into the terminal.
  • /autofix-pr [prompt] – spawn a remote session that watches a PR and pushes fixes.
  • /ide / --ide – connect to an IDE (VS Code, JetBrains) on startup.
  • /chrome / --chrome – Claude-in-Chrome integration.
  • /desktop, /ios, /android, /mobile – link a session to the desktop or mobile app.

Useful combination: use /autofix-pr from your laptop, then /remote-control to drive it from your phone.

17. Session 14 – Sessions and history   intermediate

The session file is the source of truth; everything else (terminal UI, Remote Control, etc.) is a view.

# Resume a specific session by ID (fork instead of mutate)
claude -r <uuid> --fork-session

# Resume by PR (opens interactive picker scoped to PR-linked sessions)
claude --from-pr 123

# Resume with a search term
claude -r "caching-layer"

# Start a session with a known UUID (for scripting)
claude --session-id $(uuidgen)

--no-session-persistence turns off session files entirely (only with -p). Pair with --bare for fully reproducible one-shots.

18. Session 15 – Advanced modes   advanced

  • /fast [on|off] – Fast mode. Same Opus 4.6 model; faster output path. Trade: slightly less deliberation, much lower latency.
  • /sandbox – toggle sandbox mode on the current session.
  • /tui fullscreen vs /tui default – alt-screen vs inline rendering.
  • /focus – minimal UI (prompt + tool summary + response).
  • auto mode (via /effort auto or /model auto on Max) – permission classifier picks effort/model per turn.

--bare is the extreme of "do less automatically"; /focus and /tui fullscreen are the extremes of "show less automatically."

19. Session 16 – Debugging and doctors   intermediate

# Turn on debug logging, filter to specific categories
claude -d "api,hooks"

# Send debug output to a file (implicitly enables debug)
claude --debug-file /tmp/claude-debug.log

# Category negation
claude -d "!1p,!file"   # everything except first-party and file noise

# One-shot health check
claude doctor

# Inside a session
#  /doctor      -- diagnose harness
#  /heapdump    -- JS heap snapshot + memory breakdown
#  /stats       -- daily usage, session history, streaks
#  /insights    -- session analysis report

When a session misbehaves, the triage order is usually:

  1. /context — is the window saturated?
  2. /doctor — is the harness healthy?
  3. -d in a fresh session — reproduce with logs.
  4. /heapdump — if memory is spiralling.

20. Session 17 – Telemetry and gossip   advanced

On a LAN with an OTel collector, the harness emits metrics and logs via OTLP when these env vars are set:

# Sample telemetry env -- source this before starting claude
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
export OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector.local:4317
export OTEL_RESOURCE_ATTRIBUTES="host.name=$(hostname -s),team=solo"

The per-session resource attributes let you filter dashboards meaningfully (by repo, host, branch, conjecture).

21. Appendix A – CLI flags (complete reference, 2.1.114)

From claude --help.

21.1. Flags

Flag Purpose
--add-dir <dirs...> Additional readable directories
--agent <name> Pin agent for this session
--agents <json> Define custom agents inline
--allow-dangerously-skip-permissions Enable skip-permissions flag (still needs to be used)
--allowedTools <tools...> Allow list (space/comma)
--append-system-prompt <prompt> Append to default system prompt
--bare Skip hooks/LSP/plugins/auto-memory/CLAUDE.md
--betas <betas...> Beta headers (API-key users only)
--brief Enable SendUserMessage tool
--chrome / --no-chrome Chrome integration toggle
-c, --continue Continue most recent session in cwd
--dangerously-skip-permissions Bypass all permission checks
-d, --debug [filter] Debug mode (e.g. api,hooks or !1p,!file)
--debug-file <path> Write debug log to path
--disable-slash-commands Disable all skills
--disallowedTools <tools...> Deny list
--effort <level> low / medium / high / max (xhigh on 2.1.111+)
--exclude-dynamic-system-prompt-sections Skip dynamic sections for better cache reuse
--fallback-model <model> Fallback on overload (-p only)
--file <specs...> File resources at startup: file_id:path
--fork-session New session id when resuming
--from-pr [value] Resume a session linked to a PR
-h, --help Help
--ide Auto-connect to IDE at startup
--include-hook-events Emit hook lifecycle events (stream-json only)
--include-partial-messages Emit partial chunks (-p + stream-json)
--input-format <fmt> text or stream-json (with -p)
--json-schema <schema> Structured-output schema
--max-budget-usd <amount> Hard spend cap (-p only)
--mcp-config <configs...> MCP config files/strings
--model <name> sonnet / opus / haiku / full id
-n, --name <name> Session display name
--no-session-persistence No session file (-p only)
--output-format <fmt> text / json / stream-json (-p only)
--permission-mode <mode> acceptEdits / bypassPermissions / default / dontAsk / plan / auto
--plugin-dir <path> Load plugins from path (repeatable)
-p, --print Non-interactive
--replay-user-messages Re-emit user msgs on stdout (stream-json)
-r, --resume [value] Resume by id or picker
--session-id <uuid> Use specific UUID
--setting-sources <list> user,project,local (comma)
--settings <file-or-json> Extra settings
--strict-mcp-config Ignore other MCP sources
--system-prompt <prompt> Replace default system prompt
--tmux Tmux session for worktree (--tmux=classic variant)
--tools <tools...> Built-in tool subset or default or ""
--verbose Override verbose config
-v, --version Version
-w, --worktree [name] Create worktree for session

21.2. Subcommands

:CUSTOM_ID: subcommands-reference :REVIEW: 2026-06-21 – Updated from 2.1.112 gist; added mcp serve capability :VERIFIED_AT: 2026-06-21T15:00Z :VERIFIED_BY: skeptic-agent :VERDICT: correct :FINDING: claude mcp serve enables Claude Code to run as an MCP server for other clients

Command Purpose
agents List configured agents
auth Manage authentication
auto-mode Inspect auto-mode classifier configuration
doctor Health check (spawns stdio MCP servers; trust required)
install [target] Install native build (stable/latest/version)
=mcp [add\ list\ remove\ serve]= Manage MCP servers; serve makes Claude Code an MCP server
plugin / plugins Manage plugins
setup-token Create a long-lived auth token (Claude subscription)
update / upgrade Check and install updates

22. Appendix B – Slash commands (complete reference, 2.1.114)

22.1. Session control

Command Purpose
/clear (/new) Reset conversation
/exit Exit
/resume [session] Pick a prior session
/branch [name] Fork at this point
/rewind / /undo Rewind conversation + code
/rename [name] Label this session
/recap One-line session summary

22.2. Model and configuration

Command Purpose
/model [name] Switch model
/effort [level] Low / medium / high / xhigh / max / auto
/config Settings UI
/theme Color theme
/color [c] Prompt-bar color

22.3. Permissions and safety

Command Purpose
/permissions Allow/ask/deny rules
/sandbox Toggle sandbox mode
/add-dir <path> Grant access to another dir

22.4. Context and memory

Command Purpose
/context Context-usage visualization
/compact [focus] Summarize + free context
/memory Edit CLAUDE.md memory files
/cost Token usage stats

22.5. Development and review

Command Purpose
/review [PR] Review a PR locally
/security-review Scan pending changes
/diff Interactive diff viewer
/ultrareview Cloud-based deep review (2.1.111+)

22.6. Workflow

Command Purpose
/btw <question> Side question; not in history
/plan [description] Enter plan mode
/ultraplan Auto cloud-env plan (2.1.101+)
/schedule [description] Recurring remote agents

22.7. Tools and integrations

Command Purpose
/mcp MCP connections
/plugin Plugins
/hooks Hook configurations
/ide IDE integrations
/install-slack-app Slack app install
/install-github-app GitHub Actions app
/chrome Claude in Chrome

22.8. Display and UI

Command Purpose
/help Full help
=/tui [default fullscreen]= Renderer
/focus Minimal focus view
/copy [N] Copy Nth-latest response
/export [filename] Export conversation as text

22.9. Account and status

Command Purpose
/login / /logout Auth
/status Version, model, account
/usage Plan limits
/upgrade Upgrade
/mobile QR for mobile
/passes Share a free week

22.10. Desktop, mobile, remote, web

Command Purpose
/desktop Continue in Desktop app
/ios, /android QR codes
/remote-control Drive from claude.ai
/remote-env Default cloud env
/teleport Pull web session to terminal
/autofix-pr [prompt] Remote PR auto-fix
/web-setup Connect GitHub to web

22.11. Advanced and utility

Command Purpose
=/fast [on off]= Fast mode
/skills List skills
/agents Manage agents
/doctor Diagnose install
/heapdump JS heap snapshot
/insights Session analysis report
/stats Usage stats
/release-notes Interactive changelog
/powerup Animated feature tours
/feedback [report] Submit feedback
/extra-usage Configure overflow usage
/privacy-settings Privacy
/keybindings Keybindings config
/statusline Status line config
/terminal-setup Terminal keybindings
/voice Push-to-talk voice dictation

22.12. Cloud setup

Command Purpose
/setup-vertex Google Vertex AI wizard
/setup-bedrock Amazon Bedrock wizard

22.13. Bundled skills (invocable as slash-commands)

Skill Purpose
/batch <instruction> Parallel 5-30-agent orchestration
/simplify [focus] Quality review of changed files
/debug [description] Debug logging + bug walkthrough
/loop [interval] [prompt] Run prompt repeatedly
/claude-api Load Claude API reference for project
/fewer-permission-prompts Propose allowlist from transcript
/less-permission-prompts Same, 2.1.111+

23. Appendix C – Tangled starter configs

23.1. ~/.claude/settings.json (skeleton)

{
  "permissions": {
    "deny": [
      "Bash(rm -rf /)",
      "Bash(rm -rf ~)",
      "Bash(git push --force)",
      "Bash(git push -f)",
      "Bash(sudo:*)"
    ],
    "ask": [
      "Bash(git push:*)",
      "Bash(curl:*)",
      "Bash(wget:*)"
    ]
  },
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "command": "~/.claude/hooks/guard-dangerous-bash.sh"
      }
    ]
  },
  "sandbox": {
    "network": {
      "deniedDomains": [
        "pastebin.com",
        "transfer.sh",
        "0x0.st"
      ]
    }
  },
  "autoScrollEnabled": true
}

23.2. Project-local .claude/settings.json (skeleton)

{
  "permissions": {
    "allow": [
      "Read",
      "Grep",
      "Glob",
      "Bash(git status:*)",
      "Bash(git diff:*)",
      "Bash(git log:*)",
      "Bash(gmake:*)"
    ],
    "ask": [
      "Bash(git push:*)",
      "Edit",
      "Write"
    ]
  },
  "hooks": {
    "SessionStart": [
      {"command": "bd ready 2>/dev/null | head -5 || true"}
    ]
  }
}

23.3. A minimal invocation recipe file

# claude-review.sh -- non-interactive code review of HEAD
set -euo pipefail

claude --bare -p "Review the diff in HEAD. List blocking issues with file:line, then non-blocking suggestions. Be terse." \
  --agent reviewer \
  --allowedTools 'Read Grep Glob Bash(git:*)' \
  --permission-mode dontAsk \
  --max-budget-usd 0.25 \
  --no-session-persistence \
  --output-format text

24. Open questions

  • How stable is the flag surface? --bare landed recently; historical flags like --mcp-debug are already deprecated. Anything scripted against 2.1.x should pin the CLI version or use doctor as a capability probe.
  • Is there a canonical way to introspect which slash commands are available right now? /help shows a filtered list. --disable-slash-commands is the inverse. No JSON introspection endpoint as of 2.1.114.
  • Hook veto semantics. PreToolUse hooks can return {"decision":"deny"}. Order of multiple hooks, short-circuit semantics, and whether deny messages surface to the model consistently remain under-documented.

25. Related