One-Line Summary: Claude Code is Anthropic's official terminal harness — a CLI that wraps Claude with a programmable loop, hooks, sub-agents, slash commands, skills, MCP servers, and permission scoping, used in this course as the reference harness for examples and exercises.
Prerequisites: What is an AI harness, agent loop
What Is Claude Code?
Claude Code is the binary you invoke as claude in your terminal. From a model-only perspective it sends messages to Claude and prints responses; from a harness perspective it owns a richly configured local agent that can read files, run commands, edit code, talk to MCP servers, spawn sub-agents, fire hooks on lifecycle events, and respect a permission policy expressed in settings.json. It is the cleanest publicly available example of every primitive this course discusses, which is why the course uses it as a running example.
The product surface that matters for this course:
- A session lives in a working directory, holds a conversation history, and persists in transcripts the harness can resume.
- A
CLAUDE.mdfile in any ancestor directory is read into the system prompt — this is the harness's user-editable memory. settings.jsondeclares hooks, allowed tools, MCP servers, and permission rules.- Sub-agents are markdown files in
.claude/agents/that define a system prompt + tool scope + termination criteria; the main agent can dispatch tasks to them. - Slash commands are markdown files in
.claude/commands/that the user types as/footo inject a parameterized prompt. - Skills are bundled prompts + tools the model can opt into mid-conversation.
How It Works
When you type claude, the harness:
- Walks up from the cwd collecting
CLAUDE.mdfiles, concatenating them into the system prompt. - Reads the merged
settings.json(project + user + global). - Establishes connections to declared MCP servers (stdio or HTTP).
- Starts the agent loop. On each turn it sends the current message + context to Claude, parses the response, and either prints it, calls a tool (after running
PreToolUsehooks, getting permission, executing, runningPostToolUsehooks), spawns a sub-agent, or terminates. - Persists the transcript so the next
claude --continuecan resume.
The loop is deliberately the same shape an SDK user would write — Claude Code is partly a reference implementation of the Claude Agent SDK.
Why It Matters
Two reasons it is the reference for this course. First, every concept in the course either maps directly to a Claude Code primitive or is a generalization of one — concepts come into focus faster when they have a concrete instance you can run locally. Second, Claude Code is the harness most likely to be familiar to learners who have read Anthropic's docs or shipped a coding agent in 2025–2026.
Key Technical Details
- Permission model: Tool calls go through a permission decision (
auto,prompt,deny) configured insettings.jsonpermissions. Sensitive tools (Bash,Edit,Write) default topromptunless explicitly allowed. - Hooks: Defined in
settings.jsonas{ PreToolUse: [{ matcher: "Bash", command: "./hook.sh" }], ... }. Claude Code passes JSON on stdin; the hook prints JSON on stdout to allow/deny/rewrite. - Sub-agents: Defined in markdown with frontmatter declaring
tools,description, andmodel. Invoked by the main agent via theTasktool. - MCP: Configured in
settings.jsonmcpServers. Stdio servers are launched as subprocesses; HTTP/SSE servers must be reachable at startup. - Output styles: The harness can render output as plain markdown, JSON (
--output-format json), or stream events (--output-format stream-json) for programmatic consumption. - Transcript replay:
--continueand--resumereload prior conversations including tool results.
How Harnesses & Frameworks Implement This
This concept is about one harness, so the comparison row is implicit. The relevant axis is which other harnesses expose comparable primitives:
| Primitive | Claude Code | Codex CLI | Cursor | ruflo | OpenHands |
|---|---|---|---|---|---|
CLAUDE.md-style memory file | ✅ | partial (AGENTS.md) | ✅ (.cursorrules) | ✅ (extends CLAUDE.md) | ✅ |
| Hooks on lifecycle events | ✅ (7+) | partial (approval modes) | ✗ | ✅ (27 events) | partial |
| Sub-agents as files | ✅ | ✗ | ✗ | ✅ | partial |
| Slash commands | ✅ | partial | ✅ | ✅ | partial |
| MCP support | ✅ | ✅ | ✅ | ✅ (314 tools) | ✅ |
Connections to Other Concepts
what-is-an-ai-harness.md— The category Claude Code instantiates.claude-agent-sdk-overview.md— The SDK that powers it (and lets you build your own).hooks-and-lifecycle-events.md— Claude Code's hook surface in detail.sub-agents-as-primitives.md— How Claude Code defines sub-agents.slash-commands.md,settings-and-configuration-files.md,mcp-as-the-universal-tool-bus.md— Each Claude Code primitive expanded.
Further Reading
- Anthropic, Claude Code documentation — The current canonical reference.
- Anthropic, "Claude Code Hooks" — Specifically worth a read once you know what hooks are.