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 file 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 files, 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-style memory file | ✅ | partial (AGENTS) | ✅ (.cursorrules) | ✅ (extends CLAUDE) | ✅ |
| 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? — The category Claude Code instantiates.
- Claude Agent SDK Overview — The SDK that powers it (and lets you build your own).
- hooks-and-lifecycle-events — Claude Code's hook surface in detail.
- sub-agents-as-primitives — How Claude Code defines sub-agents.
- slash-commands, settings-and-configuration-files, mcp-as-the-universal-tool-bus — 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.