# Claude Code harness: what's inside it

> Anthropic calls Claude Code the agentic harness around Claude: the loop, five tool groups, four permission modes, compaction, CLAUDE.md, 33 hook events.

Source: https://shuriken.sh/guides/claude-code-harness

The Claude Code harness is everything Anthropic wraps around the Claude model: the agentic loop, the built-in tools, permission modes and checkpoints, context management and compaction, CLAUDE.md and auto memory, hooks, subagents, MCP and saved sessions. The Claude Agent SDK is the same harness as a library.

[Guides](https://shuriken.sh/guides) By Shuriken Updated 1 December 2026 7 min read

**Contents**

The Claude Code harness is everything Anthropic wraps around the Claude model so it can work in your repo: the agentic loop, the built-in tools, permission modes and checkpoints, context management and compaction, CLAUDE.md and auto memory, hooks, subagents, MCP and saved sessions. Anthropic's docs use the word, and the Agent SDK is the same harness as a library.

This page takes it apart piece by piece, from [Anthropic's own description](https://code.claude.com/docs/en/how-claude-code-works), read on 25 October 2026. For the general idea, and the difference between this inner layer and apps that run Claude Code for you, see [what an agent harness is](https://shuriken.sh/guides/what-is-an-agent-harness).

## What Anthropic means by "the Claude Code harness" #

The sentence that settles it is in "How Claude Code works": "The agentic loop is powered by two components: models that reason and tools that act. Claude Code is the layer around the model that provides the tools and manages the context the model sees. This surrounding layer is what the term agentic harness refers to."

So the model is Claude (Sonnet, Opus, switched with /model or claude --model <name>), and Claude Code is the rest. The same page says the loop, tools and capabilities "are the same everywhere you use Claude Code": the terminal, the desktop app, the IDE extensions, claude.ai/code, Remote Control, Slack and CI pipelines. Only the screen around it changes.

## The loop: gather context, take action, verify #

Anthropic describes three phases that "blend together": gather context, take action, verify results. The example in its docs is "fix the failing tests": run the suite, read the error output, search for the source files, read them, edit, run the tests again. Each tool result goes back into the loop and decides the next step, "chaining dozens of actions together".

You're in the loop as well. Esc stops Claude at once and cancels the running tool call. Typing a correction and pressing Enter without stopping queues it, and Claude reads it as soon as the current tool calls finish, inside the same turn.

## The tools #

Without tools the model can only answer in text. The built-in ones fall into five groups in Anthropic's table:

| Group | What Claude can do |
| --- | --- |
| File operations | Read, edit, create, rename and reorganise files |
| Search | Find files by pattern, search content with regex |
| Execution | Run shell commands, start servers, run tests, use git |
| Web | Search the web, fetch docs, look up error messages |
| Code intelligence | Type errors after edits, definitions, references (needs code intelligence plugins) |

There are more for spawning subagents and asking you questions; the full list is in Anthropic's tools reference. On native Windows, the shell tool is Git Bash when Git for Windows is installed and PowerShell when it isn't.

## Permissions and checkpoints #

Claude Code puts two guards around its tools. The first is the permission mode, and Shift+Tab cycles through four:

- Auto: a classifier reviews most actions in the background and blocks the risky ones. Since Claude Code v2.1.283 it's the starting mode for interactive terminal and VS Code sessions.
- Manual: asks before file edits and shell commands.
- Accept edits: edits files and runs commands like mkdir and mv without asking, asks for the rest.
- Plan: explores and proposes a plan without touching your source files.

A rule like "allow": ["Bash(npm test *)"] in .claude/settings.json under permissions lets one trusted command through without asking. The second guard is checkpoints: Claude Code snapshots a file before editing it, and pressing Esc twice opens the rewind menu. Only files are snapshotted. psql, curl -X POST or git push can't be rewound, so those are what the permission mode has to catch.

## Context, compaction and memory #

The context window holds the conversation, file contents, command output, CLAUDE.md, auto memory, loaded skills and system instructions. When it fills, Claude Code "clears older tool outputs first, then summarizes the conversation if needed", and early instructions can get lost in the summary. Anthropic's advice is to put lasting rules in CLAUDE.md, and to steer a summary with /compact focus on the API changes or a "Compact Instructions" section in CLAUDE.md. (When to compact and when to start fresh is in [compact vs clear](https://shuriken.sh/guides/claude-code-compact-vs-clear).)

Memory comes in two kinds. CLAUDE.md is what you write; Claude Code loads it every session and reads an AGENTS.md in its place if that's what your repo has. Auto memory is what Claude saves on its own, and "the first 200 lines or 25KB of MEMORY.md, whichever comes first" load at the start of each session. Advice on what belongs in the file is in [CLAUDE.md best practices](https://shuriken.sh/guides/claude-md-best-practices).

Some of what's in context you never typed: the output style you picked, a note that a file Claude read earlier has changed on disk, and the Co-Authored-By lines Claude Code adds to commits. When Claude follows a rule nobody wrote, Anthropic's docs send you to that list first. The commit lines come from the attribution setting.

MCP tool definitions are deferred by default: only tool names and server instructions take up context until Claude uses a tool.

Shuriken runs Claude Code, Codex, Gemini CLI and 64 more agents side by side, with your own sign-ins.

[Download](https://shuriken.sh/download)

## Hooks, skills, subagents and MCP #

These four are how you extend the harness without forking it.

- Hooks are "user-defined shell commands, HTTP endpoints, MCP tool calls, LLM prompts, or subagents that execute automatically at specific points in Claude Code's lifecycle." The hooks reference lists 33 events, from SessionStart and PreToolUse to PreCompact, WorktreeCreate and SessionEnd. A command hook can stop an action: "Exit with code 2 to block the action." Working examples are in our [Claude Code hooks guide](https://shuriken.sh/guides/claude-code-hooks-examples).
- Skills live in .claude/skills/<name>/SKILL.md. At the start Claude sees only each skill's description, and it reads the rest of the file when it uses that skill.
- Subagents are defined in .claude/agents/<name>.md. Each runs in its own context window and hands back a summary, so its tool calls never fill yours. A fork subagent starts from a copy of your conversation instead of a blank one.
- MCP servers are added with claude mcp add and bring in outside services: GitHub, Linear, a database, a browser.

## Sessions #

A session is a file. Claude Code writes "each message, tool use, and result" as plaintext JSONL under ~/.claude/projects/, in a folder named after the directory you started in. claude --continue picks up the newest one there and claude --resume lets you choose; both append to the same file under the same ID. --fork-session and /branch copy the history to a new ID instead. Because a session belongs to its folder, Anthropic's answer for parallel sessions is a git worktree each. A fresh session starts with an empty context window plus CLAUDE.md and auto memory, nothing else.

## The same harness as a library: the Claude Agent SDK #

Anthropic's [Agent SDK overview](https://code.claude.com/docs/en/agent-sdk/overview) says it "gives you the same tools, agent loop, and context management that power Claude Code, programmable in Python and TypeScript", and that it is "a library that runs the Claude Code binary". Hooks, subagents, MCP, permissions, sessions, skills and plugins all come with it.

One line on that page matters if you build a product on it: "Unless previously approved, Anthropic does not allow third party developers to offer claude.ai login or rate limits for their products, including agents built on the Claude Agent SDK." Anthropic's legal page says the same for third-party apps in general, and it says that this "does not prevent an end user from signing in to the unmodified Claude Code binary with their own Claude subscription."

## Not to be confused with: the Claude Code Harness plugin #

Search for "claude code harness" and you'll also find [Chachamaru127/claude-code-harness](https://github.com/Chachamaru127/claude-code-harness), a community project with about 3.2k stars on 25 October 2026. Its description: "Claude Code Dedicated Development Harness - Achieving High-Quality Development Through an Autonomous Plan→Work→Review Cycle". It's MIT licensed, needs Claude Code v2.1 or later, and installs as a plugin from inside Claude Code:

text
/plugin marketplace add Chachamaru127/claude-code-harness
/plugin install harness@claude-code-harness-marketplace
/harness-setup

It adds commands like /harness-plan, /harness-work, /harness-review and /harness-release. It works through the extension points above; it's a workflow on top of Claude Code, not a replacement for its loop. Anthropic didn't make it.

## Where an outer harness fits #

Everything above is the inner harness: one Claude Code session, one context window, one account. Apps that run several Claude Code sessions for you sit one layer out, and they don't change any of it, because they start the same claude program. Shuriken is one of them. A Claude Code chat in Shuriken is the real Claude Code, driven through Anthropic's Agent SDK, in your project folder or, if you pick it, on its own branch in its own git worktree. What Shuriken adds is around the session: which of your accounts it runs on, moving the chat to another of your accounts when one reaches its limit (only accounts you own and are entitled to use; providers' terms may not allow sharing a subscription sign-in), one list of MCP servers for every project, and which of your computers it runs on. How the outer options compare is in [the best harness for Claude Code](https://shuriken.sh/compare/best-claude-code-harness).

If you want to see that layer around your own Claude Code, [download Shuriken](https://shuriken.sh/download).

Share

[X](https://x.com/intent/post?url=https%3A%2F%2Fshuriken.sh%2Fguides%2Fclaude-code-harness&text=Claude%20Code%20harness%3A%20what's%20inside%20it)[LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fshuriken.sh%2Fguides%2Fclaude-code-harness)[Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fshuriken.sh%2Fguides%2Fclaude-code-harness&t=Claude%20Code%20harness%3A%20what's%20inside%20it)[Reddit](https://www.reddit.com/submit?url=https%3A%2F%2Fshuriken.sh%2Fguides%2Fclaude-code-harness&title=Claude%20Code%20harness%3A%20what's%20inside%20it)[E-mail](mailto:?subject=Claude%20Code%20harness%3A%20what's%20inside%20it&body=https%3A%2F%2Fshuriken.sh%2Fguides%2Fclaude-code-harness)

## Sources

- [Claude Code docs: How Claude Code works](https://code.claude.com/docs/en/how-claude-code-works) (accessed 25 October 2026)
- [Claude Code docs: Hooks reference](https://code.claude.com/docs/en/hooks) (accessed 25 October 2026)
- [Claude Code docs: Agent SDK overview](https://code.claude.com/docs/en/agent-sdk/overview) (accessed 25 October 2026)
- [Claude Code docs: Legal and compliance](https://code.claude.com/docs/en/legal-and-compliance) (accessed 25 October 2026)
- [claude-code-harness on GitHub (Chachamaru127)](https://github.com/Chachamaru127/claude-code-harness) (accessed 25 October 2026)

## Frequently asked questions

**Is Claude Code a harness or an agent?**

Both words fit. Anthropic's docs say the agentic loop is powered by models that reason and tools that act, and that Claude Code is the layer around the model which provides the tools and manages context: "what the term agentic harness refers to".

**Is the Claude Agent SDK the same harness as Claude Code?**

Yes. Anthropic's overview says the Agent SDK gives you "the same tools, agent loop, and context management that power Claude Code", in Python and TypeScript, and that it runs the Claude Code binary. Products built on it should sign in with an API key, not a claude.ai login.

**Where does Claude Code keep its sessions?**

Each message, tool use and result goes into a plaintext JSONL file under ~/.claude/projects/. That file is what lets you resume a session with claude --continue or --resume, or fork it into a new session ID with --fork-session or /branch.

**What is the Claude Code Harness plugin?**

A community project, Chachamaru127/claude-code-harness on GitHub, MIT licensed. It adds slash commands such as /harness-plan, /harness-work and /harness-review on top of Claude Code. It isn't made by Anthropic and doesn't replace Claude Code's own harness.

Every coding agent

67 coding agents, one harness.

Run Claude Code, Codex, Gemini CLI and the rest on your own computers, with the sign-ins you already have.

[Download](https://shuriken.sh/download)

[Other platforms](https://shuriken.sh/download#main)

## Keep reading

- [Harness engineering: what it means, and how we do it: Guide 6 Dec 2026 4 min read Harness engineering is building the rules, checks and tools around a coding agent so it gets work right. Our repo's real harness, with dates and counts.](https://shuriken.sh/guides/harness-engineering)
- [Codex CLI resume session: codex resume, --last and fork: Guide 24 Nov 2026 4 min read Resume a Codex CLI session with codex resume, --last or a session ID. Where Codex keeps sessions, what comes back, and why one is missing from the list.](https://shuriken.sh/guides/codex-resume-session)
- [How to choose an app for your coding agents: Guide 27 Oct 2026 4 min read Picking an app to run Claude Code, Codex and other agents? Eight questions that separate them: where agents run, your plans, worktrees, limits and privacy.](https://shuriken.sh/guides/choose-a-coding-agent-app)
- [Can you use your Claude plan in OpenCode or other tools?: Guide 27 Oct 2026 6 min read Not in OpenCode. Anthropic keeps Pro and Max sign-ins for Claude Code and its own apps, and OpenCode dropped its Claude plugins in 1.3.0. Use an API key.](https://shuriken.sh/guides/claude-subscription-in-other-tools)

## Free tools

- [Claude limit reset tracker](https://shuriken.sh/tools/limit-resets/claude)
- [Codex limit reset tracker](https://shuriken.sh/tools/limit-resets/codex)
