Claude Code SOP
Claude Code SOP — Agent Orchestration Guide
Section titled “Claude Code SOP — Agent Orchestration Guide”Auth: Anthropic subscription (not API key)
Overview
Section titled “Overview”Claude Code is a full coding agent CLI with file editing, bash execution, subagents, skills, and multi-agent teams. It’s superior to sessions_spawn for serious builds because it iterates on errors, explores codebases, and coordinates multi-file changes.
Three Modes of Operation
Section titled “Three Modes of Operation”Mode 1: Plan → Execute (RECOMMENDED for builds)
Section titled “Mode 1: Plan → Execute (RECOMMENDED for builds)”Phase 1 — Plan (read-only analysis):
cd /path/to/projectclaude -p --permission-mode acceptEdits --model sonnet --max-budget-usd 1 \ "Analyze the codebase. Create a detailed plan in PLAN.md. Be specific: file paths, component names, exact changes. ONLY create PLAN.md, do NOT modify existing files."Phase 2 — Execute (full permissions, batched):
claude -p --dangerously-skip-permissions --model sonnet --max-budget-usd 3 \ "Read PLAN.md. Execute items 1-5. Run 'npm run build' after. Fix errors. Commit. Do NOT ask questions. Just execute."CRITICAL: Break large plans into batches of 5–7 items per run. 14+ items in one run risks hitting the 10-min timeout.
Mode 2: Stream-JSON Interactive (for monitoring + steering)
Section titled “Mode 2: Stream-JSON Interactive (for monitoring + steering)”claude -p \ --input-format stream-json \ --output-format stream-json \ --verbose \ --dangerously-skip-permissions \ --model sonnetMode 3: Agent Teams (parallel workers)
Section titled “Mode 3: Agent Teams (parallel workers)”CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 claude --teammate-mode tmux \ --dangerously-skip-permissions --model sonnet \ "Build X and Y in parallel. See PLAN.md."Mandatory Rules
Section titled “Mandatory Rules”- Project must be a git repo —
git initif needed. Claude Code requires it. - Always include “Do NOT ask questions”
- Always include build/verify step
- Always include commit step
- Batch large tasks
- Set
--max-budget-usd - Set timeout to 600s
- Monitor progress
- Update the user every 10 min
Key Flags Reference
Section titled “Key Flags Reference”| Flag | Purpose |
|---|---|
-p / --print | Non-interactive, exit after response |
--dangerously-skip-permissions | Full auto, no prompts |
--model sonnet / --model opus | Model selection |
--max-budget-usd <n> | Cost cap |
See Also
Section titled “See Also”- Spawn SOP — Full sessions_spawn reference
- Model Catalog — Which model to use
- Checkpoints — Checkpoint protocol