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.md file in any ancestor directory is read into the system prompt — this is the harness's user-editable memory.
  • settings.json declares 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 /foo to 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:

  1. Walks up from the cwd collecting CLAUDE.md files, concatenating them into the system prompt.
  2. Reads the merged settings.json (project + user + global).
  3. Establishes connections to declared MCP servers (stdio or HTTP).
  4. 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 PreToolUse hooks, getting permission, executing, running PostToolUse hooks), spawns a sub-agent, or terminates.
  5. Persists the transcript so the next claude --continue can 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 in settings.json permissions. Sensitive tools (Bash, Edit, Write) default to prompt unless explicitly allowed.
  • Hooks: Defined in settings.json as { 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, and model. Invoked by the main agent via the Task tool.
  • MCP: Configured in settings.json mcpServers. 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: --continue and --resume reload 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:

PrimitiveClaude CodeCodex CLICursorrufloOpenHands
CLAUDE.md-style memory filepartial (AGENTS.md)✅ (.cursorrules)✅ (extends CLAUDE.md)
Hooks on lifecycle events✅ (7+)partial (approval modes)✅ (27 events)partial
Sub-agents as filespartial
Slash commandspartialpartial
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.