Overview
These guides compare AI coding CLIs along concept lines, not tool lines. Pick a concept, see how it works in each tool side by side. Tab selections sync across pages - pick “Claude Code” once and every chapter opens to that tab.
If you’re new to how AI coding agents actually work - the loop, the context window, why sessions are independent - start with How agents work. It’s the shared substrate every chapter below assumes.
The translation table below now runs six tools wide. This section started with three terminal CLIs - Claude Code, Codex, and OpenCode - and Cursor, Copilot, and Pi were folded in later, since the same concepts apply there (with real gaps, called out honestly where a tool has no equivalent). Each chapter has a comparison table; interactive examples and tool-specific depth vary where a product has no equivalent or the facts need separate verification.
The six tools anchoring the translation table:
- Claude Code - Anthropic
- Codex CLI - OpenAI
- OpenCode - Anomaly, formerly SST (open source)
- Cursor - Cursor, IDE + CLI
- Copilot - GitHub, primarily via VS Code
- Pi - Earendil / minimal harness
Find the right primitive
Section titled “Find the right primitive”Sixteen chapters is a lot of doors. If you already know the problem you’re trying to solve, start from the problem:
Choose a learning path
Section titled “Choose a learning path”- New to agents: How agents work → Context window management → Rules
- Safer edits: Permissions & sandboxing → Plan mode → Hooks
- Repeatable workflows: Rules → Skills → Slash commands → Configuration
- Scale and automation: MCP servers → Subagents → Headless & CI → Plugins & marketplaces
- Tune and evaluate: Model selection → Context window management → Trust, security & evaluation → Keyboard shortcuts
Across all five paths, keep one distinction in view: instructions influence model behavior; approvals and hooks gate runtime actions; sandboxes and repository/server-side controls are stronger enforcement boundaries. A tool’s “plan mode” or “auto” label is not itself a security guarantee.
The translation table
Section titled “The translation table”Every row links to the chapter for that concept. Cells show the tool’s term for the same idea - or - if it has no equivalent.
| Concept | Claude Code | Codex | OpenCode | Cursor | Copilot | Pi |
|---|---|---|---|---|---|---|
| Context window management | /context, /compact, /clear | /status, /compact, /new | Auto-compaction on overflow, --continue | /summarize, New Chat | /compact, chat context control | Auto-compaction + /tree session tree |
| Rules | CLAUDE.md, .claude/rules/ | AGENTS.md | AGENTS.md | .cursor/rules/*.mdc or AGENTS.md | .github/copilot-instructions.md or AGENTS.md | AGENTS.md / CLAUDE.md + ~/.pi/agent/ |
| Model selection | /model (Anthropic only) | /model, --model (OpenAI) | Per-agent, multi-provider | Per-chat picker, multi-provider | Per-chat picker, plan-gated roster | /model, 15+ providers via models.json |
| Slash commands | Bundled + skill-invocable | Built-in + ~/.codex/prompts/ (deprecated → skills) | commands/ | .cursor/commands/ | .github/prompts/*.prompt.md | Built-ins + /skill:name + prompt templates |
| Skills | Skills (SKILL.md) | Skills (SKILL.md) | .opencode/skills/ | .cursor/skills/ | .github/skills/ | SKILL.md in .pi/skills/ + .agents/skills/ |
| MCP servers | .mcp.json, /mcp | config.toml, can also be an MCP server | Configurable | .cursor/mcp.json | .vscode/mcp.json | - (no native MCP, by design) |
| Hooks | Lifecycle hooks in settings.json | Lifecycle scripts | Plugin hooks (JS/TS) | hooks.json, agent/shell/MCP/file/prompt events | Per-surface hook files | TypeScript extensions (ExtensionAPI) |
| Subagents | Subagents, Agent teams (exp.) | Subagents | general / explore / scout + custom | Auto-delegation, /name, or mention | Custom agents, spawned via runSubagent | - (extension/package, or a second pi process) |
| Permissions & sandboxing | Allow/ask/deny + managed policy | Sandbox tiers + approval policy | Per-tool, per-agent | Auto-run mode + allow/denylist | Per-call approval + auto-approve | No prompts (YOLO default); container/extension gates |
| Plan mode | Shift-Tab cycle (3 base modes, more conditionally) | Permission/sandbox posture (untrusted + read-only) | plan primary agent | First-class IDE mode | Mode dropdown (Plan agent) | - (file a plan, or extension/package) |
| Configuration | settings.json (layered) | config.toml + named profiles | opencode.json | VS Code settings.json + .cursor/ | VS Code settings.json + .github/ | ~/.pi/agent/settings.json + .pi/settings.json (deep-merge) |
| Keyboard shortcuts | keybindings.json | TUI keymap | tui.json | VS Code keybindings | VS Code keybindings | keybindings.json |
| Headless / CI | claude -p | codex exec | opencode run | cursor-agent -p | copilot --prompt | pi -p, --mode json, RPC, SDK |
| Plugins & marketplaces | Plugins + marketplaces | Plugins (skills + apps + MCP + hooks) | JS/TS plugins | - (VS Code extensions + MCP Marketplace) | Plugins + MCP | Pi packages (pi install npm:… / git:…) |
| Trust, security & evaluation | Threat model + regression loop | Sandbox/approval + traceable runs | Tool policy + external containment | Classifier caveats + sandbox | Surface-specific policy + hosted controls | Extension/container boundaries + custom tests |
How to read these guides
Section titled “How to read these guides”Most concept chapters use the same four landmarks, so you can navigate by shape. The introductory How agents work chapter is intentionally a single shared model rather than a six-tool comparison.
- A scenario up top - the concrete problem the primitive exists to solve, before any definition.
- How it works in each tool - a tabbed block with one tab per tool: real paths, real syntax, the gotchas that bite.
- Comparison - a table summarising where the tools actually diverge.
- Upstream references - a link to each tool’s canonical doc, because these ship fast and this page doesn’t.
Everything between the scenario and the tabs is chosen per concept, not per template. Structural ideas get a diagram; ones that only make sense in sequence get a worked example; ones where the tools diverge on capability get a decision table. If a chapter skips a device, that’s a judgement about the concept, not an omission.
Most chapters also carry an interactive widget near the top - something to poke at rather than read. They’re built to make one decision concrete, not to decorate the page.
A note on name collisions
Section titled “A note on name collisions”The same word can mean different things across these tools. The chapters call these out individually, but a few are worth flagging up front:
- “Agents” - OpenCode has primary agents (
build,plan); Claude Code has Agent teams (independent peer sessions, experimental); Copilot has custom agents (.agent.md, both a chat persona and a delegable subagent). Most tools also have in-session subagents - Pi doesn’t, by design. Separately, Cursor Cloud Agents and the Copilot Coding Agent are async remote sandboxes that return a PR, closer to a hand-off than an in-session subagent. Always qualify which kind. - “Plan mode” - a Claude Code Shift-Tab mode cycle, an OpenCode primary agent, a Codex sandbox + approval combo, and a first-class IDE mode with its own picker entry in Cursor and Copilot. Pi has none (you file a plan or reach for an extension). Same posture, many implementations.
- “Hooks” - first-class lifecycle handlers in Claude Code, Codex, and Cursor; in OpenCode they’re registered from inside JS/TS plugins; Pi has no declarative hooks (you write TypeScript extensions instead). Copilot’s
copilot-setup-steps.ymlis not a runtime hook - it’s a one-time sandbox-prep GitHub Actions workflow. AGENTS.mdis a widely adopted open convention, not a promise of identical behavior. Codex, OpenCode, Cursor, Copilot, and Pi all read it natively, but discovery, inheritance, precedence, and enforcement remain tool-specific. Claude Code readsCLAUDE.md; you can import@AGENTS.mdwhere that fits your setup.