As you spend more time with Claude Code, the word “harness” can sound like another name for prompt craft. In practice it usually means the whole runtime around the model: the product agent loop, tools, context handling, and the outer settings you add with CLAUDE.md, hooks, MCP, and subagents.
📑Table of Contents
What to understand first
Map the problem first
This article starts from a community three-layer map—model, inner harness, outer harness—and lines it up with Anthropic Engineering guidance on long-running agent failure modes. The goal is not to stack more config. It is to name which layer you are touching, then add only the smallest verification and handoff pieces that multi-session work still lacks.
Check the primary sources
Primary sources: Effective harnesses for long-running agents, Harness design for long-running apps, Scaling Managed Agents, and the demo repository cwc-long-running-agents.
Practical check
For vocabulary, a Speaker Deck community talk is useful; for failure modes and verification design, prefer Anthropic Engineering.
Model, inner harness, and outer harness
A harness is not “better prompts” by another name. In Claude Code discussions it covers the system that keeps a model useful in a real loop—from tool delivery to context management. A practical three-layer map looks like this:
Name the layer before changing it
- Model — the inference engine (Opus, Sonnet, and so on)
- Inner harness — Claude Code’s agent loop, tools, sandbox, and context management (the product itself)
- Outer harness — CLAUDE.md, skills, hooks, slash commands, MCP, subagents (what users and teams can design)
If the same model feels different in Cursor, Devin, or Claude Code, the gap is often the inner harness. Anthropic’s Managed Agents write-up even cites Claude Code as an example of an excellent harness.
Compare the layers side by side
| Layer | Examples | Who changes it | Change speed | Typical risk |
|---|---|---|---|---|
| Model | Opus / Sonnet | Provider choice | Release-driven | Mistaking ability gaps for “missing settings” |
| Inner harness | Loop, tools, sandbox, compaction | Product updates | Fast | Custom outer work gets absorbed and goes stale |
| Outer harness | CLAUDE.md, hooks, MCP, subagents | Users / teams | Immediate | Too much surface area to debug |
Read the table as a decision aid
Read the comparison table
Compare the three layers
Sources: Speaker Deck community talk, Scaling Managed Agents (article content as of 2026).
Reader action: name the layer you are changing or debugging in one sentence—model, inner, or outer. When that label is fuzzy, teams often add hooks after a model update, or try to paper over product-loop limits with more outer config.
Practical check
For concrete outer-layer examples, see our guides on Claude Hooks and Skills.
Long-running failure modes from Anthropic
Across long jobs and multiple context windows, compaction alone is not always enough. Effective harnesses highlights two recurring failures:
Two failure modes
- Trying to do too much in one shot — the run dies mid-context and the next session must guess at a half-finished state
- Declaring the project done too early — work stops while the system is only partially complete
Handoff between sessions
The structural fix mirrors a human shift handoff:
- Initializer agent — first session sets up the environment (
init.sh, progress log, initial git, feature list treated as failing until done) - Coding agent — later sessions ship incremental features and leave a clean end state with structured updates
What counts as clean
“Clean” means merge-ready for main: no large bugs, orderly docs, and a state where the next developer (or next agent session) can start a new feature immediately. Progress logs plus git history let a fresh context recover state quickly.
Reader action: for your own long runs, answer Yes/No for progress log, git, and a feature list (or equivalent unfinished work list). Missing all three before multi-session work is a high-risk setup.
Why separate generator and evaluator
When the builder also grades the work, mediocre output can look “confidently done.” Harness design for long-running apps argues for separating generator and evaluator, and for tuning the evaluator to be skeptical.
A related failure mode is context anxiety: as the window fills, some models wind down early. Keep these levers distinct:
- compaction — summarize while staying in the same conversation
- context reset — clear fully and pass a structured handoff to the next agent
Separate the two quality roles
Official write-ups note cases where Sonnet 4.5 needed reset-style mitigation, while Opus 4.5 no longer did. The “must-have” harness layer can become dead weight after a model upgrade.
Apply the split to page checks
Frontend experiments share scoring rubrics (for example design quality, originality, craft, functionality) between generator and evaluator, and verify live pages with tools such as Playwright. Longer app work extends toward planner + generator + evaluator.
Practical check
Reader action: check whether “done” is decided by the same actor that builds the change. If not separated, optimistic self-pass is more likely.
Harnesses go stale as models improve
A harness encodes assumptions about what the model still cannot do. When the model improves, yesterday’s mandatory gate becomes ballast. Managed Agents design assumes this and separates session (durable logs), harness (loop), and sandbox (execution) so each can be replaced.
Practical implications:
Keep boundaries replaceable
- Brain vs hands — keep credentials unreachable from the sandbox; separate decisioning from execution
- Cattle, not pets — prefer re-provisionable boundaries over nursing a single all-in-one container
- Inventory after upgrades — after model or Claude Code updates, list hooks, resets, and MCP servers that no longer pay for themselves
More config is not more strength. Add only after you observe a missing capability, and remove when the assumption dies.
Reader action: after your latest model update, name one outer setting you could delete. If you cannot name one, your outer harness may still be thin—or you have not measured what still helps.
Minimal quality-loop materials before custom work
Before building a thick custom stack, test product features and official demo primitives. cwc-long-running-agents is not a turnkey product; it is demo material. Still, three quality-loop primitives are easy to map:
Three quality-loop primitives
- Default-FAIL contract — each criterion starts false; no pass before evidence is read
- Fresh-context evaluator — a separate agent without Write/Edit scores the result
- Agent-maintained handoff — progress notes plus git for the next session
On the product side, Claude Code /goal is a practical entry point for generator/evaluator-style loops. Custom hooks should wait until you need project-specific gates or audit rules. For hook mechanics, see the Hooks guide.
Use the demo as a yardstick
Caveat: the demo repo is not positioned as a maintained production template. Use it as a yardstick for missing primitives, not as a drop-in system of record.
Practical check
Reader action: try /goal or a minimal handoff (progress + git) first; promote only the missing criteria into hooks.
Minimal harness checklist you can run today
Five checks to start with
- Name the layer you are touching: model, inner, or outer
- For multi-session work, check progress log, git, feature list, and init-equivalent setup
- Confirm “done” is not judged only by the builder (
/goalor a separate evaluator) - Add outer harness only for observed gaps; keep it small and portable
- After model/product updates, inventory and delete dead-weight resets/hooks
Match each check to a situation
| Situation | Try first | If still insufficient |
|---|---|---|
| Short interactive coding | Bare inner harness + minimal CLAUDE.md | One skill or slash command |
| Multi-session implementation | Progress + git + feature list | Initializer-style first-session setup |
| Soft self-declared quality | /goal or independent evaluator |
Default-FAIL hooks |
| Config bloat | Delete via inventory | Move procedure into portable Markdown |
Pick one row
Sources: Anthropic Engineering articles above and cwc-long-running-agents (as of 2026).
Pick one row and complete one item today. You do not need to adopt the whole stack at once.
Practical check
Related reading for outer-layer hygiene: Claude Code efficiency tips. For execution boundaries and in-app browser sandbox behavior, see Desktop in-app browser.
FAQ
Practical check
Summary — separate layers, add the minimum
- Do not conflate model, inner harness, and outer harness
- For long jobs, prioritize incremental progress and clean handoffs
- Separate “done” judgment from the builder
- Add outer settings only after observing a gap; remove them after model upgrades
Harness design is not a contest to collect config files. It is choosing the smallest execution machinery that reduces known failure modes, then keeping it light as models improve. Start today by naming your layer and answering Yes/No on progress log, git, and feature list.
Author
krona23
Over 20 years in the IT industry, serving as Division Head and CTO at multiple companies running large-scale web services in Japan. Experienced across Windows, iOS, Android, and web development. Currently focused on AI-native transformation. At DevGENT, sharing practical guides on AI code editors, automation tools, and LLMs in three languages.
🔥 Most Popular
- Claude Desktop Won't Install? Windows & Mac Fixes That Worked (2026)
- Zed Language Support & IME Issues: CJK Input, i18n Status — Complete Guide (2026)
- Install OpenClaw: Node 24 or 26 (November 2026)
- Claude Code CLI vs Web vs Desktop: A Daily User's Guide (2026)
- MCP vs CLI: I Migrated From MCP and CLI Is 10-32x Cheaper (2026 Benchmarks)












Leave a Reply