The model is the fulcrum.
The harness is the lever.
Claude Code supplies the agent loop. The harness is the ring of context, tools, orchestration, and verification configured around it. With the same Claude, that configuration shapes how effectively it works. The 700K-line legacy-system case illustrates its practical role.
Same model,
configuration shapes performance
Onboarding Claude like a new developer can get stalled work moving again, within the selected model's capabilities. For that model, the harness is the adjustable lever, the model the fixed fulcrum. Selecting a different model changes the fulcrum; configuring the harness adjusts the lever.
A harness needs periodic pruning. As models improve, scaffolding that once helped can become unnecessary overhead. Each layer therefore involves a decision about what to retain and when to retire it.
This piece is only about configuring Claude Code
Claude Code provides the main agent loop that Anthropic has already built. Configuring this framework does not require implementing that loop from scratch. The scope has three distinct parts: ① the capabilities of the selected model (Layer 0), ② the framework configuration covered here, and ③ building an agent from scratch, which is out of scope. Model selection belongs to configuration; the selected model's underlying capabilities are given.
Model selection, context management, the build order for knowledge and tools, orchestration with subagents and Workflows, pulling verification into its own role. These use Claude Code's existing framework and may include hook or Workflow scripts.
Plus ①model capability: the capability of the selected model — the bedrock (Layer 0).
prompt-caching design rules, implementing an MCP server, an agent-facing CLI, the single-loop vs. multi-agent trade-off, turning your product into a verifiable interface. Their implementation belongs to agent development or changes to external systems, outside this article's scope.
Where such material appears it's noted briefly and tagged "out of scope," not expanded.
Five floors, configured as needed
Layer 0: model capability and cost
The selected model provides the foundation rather than something built through configuration. Its capabilities shape how much supporting structure the harness needs.
The context window holds the system prompt, full conversation, all tool output, and files read. Its capacity is 1M tokens: as of October 2026, Fable 5.x, Opus 4.7 and later, Sonnet 5 and later, and Haiku 5.5 have 1M natively; older models have a 200K standard window. Capacity alone is not a reason to fill it.
A context progress bar in the status line makes remaining capacity visible at a glance. It provides an ongoing view without repeatedly running /context:
/compact or spin up a subagent — no more /context breaking your flow.Start from the model's default effort, then tune it against the work and the eval. In Claude Code, most effort-capable models default to high; the exceptions are Opus 5.5, Sonnet 5.5, and Haiku 5.5 at medium, and Opus 4.7 at xhigh. Anthropic's reasoning: in its testing, Opus 5.5 at medium matches or exceeds Opus 5 at high on coding and knowledge-work evaluations, and at a given level Opus 5.5 tends to think more per turn, so when moving from Opus 5, start at medium rather than carrying over the old level.
The levels are low, medium, high, xhigh, and max (Opus 4.6 and Sonnet 4.6 have no xhigh).
Use low and medium liberally as the primary controls for token cost and response time where quality holds, and step up to high or xhigh for demanding coding and agentic work. Reserve max for work that justifies unconstrained token spend; it still shows diminishing returns and can overthink.
Re-run the full effort sweep on the project's own evals for every new model rather than carrying settings forward. (Claude Code's default was xhigh on 4.7, back to high on 4.8, and down to medium on 5.5, which is exactly point D below.)
Confirm which settings you are actually on. Run /model and /effort once in a fresh session, since both remember the previous selection and that choice should be deliberate. When a session will be grunt work, MAX_THINKING_TOKENS=0 turns thinking off for that one session, the step below /effort low; on Opus 5.5, Sonnet 5.5, Haiku 5.5, and all Fable models thinking can't be turned off and the variable has no effect. The cache cost of switching model, and effort on older models, mid-conversation is in 0.4.
Beyond the five levels, /effort also offers auto, where Claude chooses per request; the slider also carries an Ultracode toggle, which is a setting rather than a level (see 3.7).
max burns through usage limits faster, so the guidance is to activate it per session, for hard debugging or architecture decisions. (In Anthropic's power-user tips collection, a Claude Code team member's personal take is to use Opus with thinking for everything: less steering and better tool use make it almost always faster overall than a smaller model. That is one engineer's experience with model selection; it does not conflict with the start-from-the-default, tune-on-your-evals guidance above, which is about effort on a given model.)
As of October 2026, Claude Code's default model on Pro, Max, Team, Enterprise, and the Anthropic API is Opus 5.5 (released 22 September 2026, requires v2.1.280 or later; Anthropic says it performs at the level of Fable 5.1 on most work and costs 40% less than Opus 5). The docs list Fable 5.1 and Fable 5 as the most capable models in Claude Code, but neither is the default on any plan, and their usage may bill to usage credits.
Sonnet 5.5 (28 September) and Haiku 5.5 (7 October) shipped in the same cycle. Opus 5, released 24 July, was previously the Max default. These model names and defaults will change; the selection and evaluation principles remain applicable when they do.
| What changed | Specifics | What to do |
|---|---|---|
| Default effort changed | Claude Code defaulted to xhigh on 4.7; 4.8 moved it back to high; 5.5 dropped it to medium | Re-run the effort sweep on your evals at each generation instead of carrying the old value |
| Long-context retrieval regressed (the 4.7 gen) | Multi-needle MRCR: 256k 91.9%→59.2%, 1M 78.3%→32.2%; heavy web research fell too, BrowseComp ≈ −4.4pp | RAG / long-doc / web-research: A/B before upgrading, don't trust the version number |
Over May and June 2026, we audited 11 reports using the same fact-check process: an independent subagent compared each claim with its source in a clean context, findings were corrected, and a fresh subagent reviewed the revisions until zero issues were found. Within this set of reports, the switch to Opus 4.8 coincided with fewer hallucinations and less verification rework:
The result was reduced rework, not "no verification after 4.8." Generation and evaluation remain separate responsibilities. The executor can run objective tests, while an independent agent reviews the work for acceptance rather than leaving the executor to declare its own work accepted (see Layer 4).
Token charges pay for inference: the GPU time needed to run the model over those tokens. Three factors determine that work: which model runs, whether a token is input or output, and whether it was cached. Section 0.2 covers model selection; the model's price applies across the categories below.
| One token | Relative to input | Why |
|---|---|---|
| Input · prefill | baseline | The model reads everything you sent: system prompt, CLAUDE.md, your message, plus every file and command output already in the conversation |
| Output · decode | roughly 5x | Written one token at a time, so a 200-token response is 200 sequential runs of the model; per token, decode keeps the GPU busy far longer |
| Cache read | 0.1x | The server loads the already-computed state instead of recomputing it |
| Cache write | up to 2x | The state has to be retained afterwards — but the write happens once, and every later turn reads at 0.1x |
In the following example, the prompt "fix the failing test in utils.test.ts." leads to five requests, each carrying the complete conversation so far:
Cache reuse requires a byte-for-byte match from the start of the request. The order is stable: tool definitions, the system prompt, then the conversation with CLAUDE.md at its front. Appending a tool result at the end preserves the preceding content. A change earlier in the request can invalidate the cache for everything after it, as can a change to the cache key, the set of values used to determine whether the prefix counts as identical:
/model: every model has its own cache, so the next turn prefills the entire conversation at full price. This includes opusplan, which switches models on every entry to and exit from plan mode./effort: part of the key on most models, which is why a mid-conversation switch asks you to confirm. The exceptions are Opus 5.5, Sonnet 5.5, Haiku 5.5, and Fable 5.1: with an API key or a Claude subscription, changing effort keeps the cache and applies without asking (not on Bedrock, Google Cloud, a Claude apps gateway, or HIPAA configurations)./compact: the conversation is replaced with a shorter one, so nothing in it matches anymore; the system prompt in front of it survives.ENABLE_PROMPT_CACHING_1H=1 sets both to an hour; finer controls since v2.1.242 are promptCacheTtl and subagentPromptCacheTtl. Come back later than that and the next turn prefills everything again, which resuming an old session almost always does, since the cache is usually gone and the system prompt is rebuilt at launch anyway.Anthropic treats a cache hit rate below its threshold as a production incident (SEV). Its account describes cache misses as requiring full-price recomputation, doubling cost and halving the plan's rate limit. Cache hit rate therefore directly affects the usable quota on a Pro/Max plan.
Model and effort changes remain available. When a change invalidates the cache, its cost depends on timing: the start of a session or immediately after /clear is a cheaper point to switch than the middle of a long conversation. The two rules below address that cost:
For agents built from scratch, caching has 5 design rules: no mid-stream tool changes, defer_loading, no model switching, updates through messages rather than the system prompt, and compaction disguised as a parent continuation. These concern agent implementation and are out of scope here.
Context: input, retention, and cleanup
Conversation content is sent again on subsequent turns. A file Claude reads or the output of a command it runs is included in each later request while it remains in the conversation. Here, a turn means a complete round trip from user or tool input to the model's response. Cached re-sends are inexpensive, but they are not free, and the content still occupies space the model must work with. A session's cost has three dimensions:
Run /context in a fresh session to inspect what is loaded at startup. Keep CLAUDE.md focused on specific instructions, move workflow-specific material into skills that load only when used, and turn off any MCP server the session does not need with /mcp. Most content added later comes from tool results. How much Claude reads depends in part on how much it must discover before doing the work:
| Three ways to ask for the same fix | What it costs |
|---|---|
| "The tests are failing" | A grep or two to find which test, several files opened to see which is relevant, all of it staying in context long after it stops being useful |
"Fix the failing test in utils.test.ts" | Skips the search; costs one Read call |
"Fix the failing test in @utils.test.ts" | Drops the Read call too: @ attaches the file to your message before anything is sent, so it is in the very first request |
The file occupies the same amount of context whether it is attached or read through a tool. Mention it once per conversation: @-mentioning it again on a later turn generally attaches a second copy.
Command output accumulates in the same way. Output from tests, a build, or a git log is appended to the conversation like a file Claude has read and remains for subsequent turns. How much of that output stays inline depends on the following threshold:
Written out to a file
Claude Code writes the output to a file and leaves only a preview of about 2,000 characters and the path in the conversation. To change how much stays inline, use the bashOutputMaxChars setting (v2.1.261+, up to 128,000); BASH_MAX_OUTPUT_LENGTH now sets the read-back window. Failed commands keep about 10,000 characters, as a head-and-tail excerpt.
The lasting weight
A test runner that prints 400 passing tests one line at a time comes in under the limit, and those 400 lines are now part of every remaining turn.
Claude often reduces command output with flags and tail. For tighter control, the docs provide a small hook that rewrites noisy commands before execution so only relevant lines return. Put the two or three commands used throughout the day into CLAUDE.md, including their quiet flags, in the form they should run. For a single test file, for example, use npx vitest run --reporter=dot. This can save a turn and a few hundred lines of output in each subsequent session.
Keeping context across turns also has a cost. One long session costs more than the same work spread over a few short ones because later turns carry the earlier history. Use /clear when starting a new task and /compact when the earlier part of the same task is complete.
Use /rename before /clear if the session will be needed again. When using /compact, specify what to retain, or add a Compact instructions section to CLAUDE.md for recurring requirements. On a 1M model, /autocompact 200k restores the earlier auto-compact threshold. This requires Claude Code v2.1.221 or later; since v2.1.288, the value is saved per model.
Background turns carry context too. Each /loop execution is a full turn in the session where it was set up, carrying the entire conversation. If more than an hour has passed since the last turn, it also incurs a cache miss. Start a fresh session in another terminal for the loop. A /loop runs locally only, for up to 3 days at a time; work that must continue with the laptop closed can use /schedule, which runs in the cloud (see the official definition of a loop).
Claude Code provides the loop; context management controls what enters the conversation, what remains, and when it is cleared. Context is an important resource within the harness. After each step, there are 5 choices, 4 of them concerned with managing context quality:
Compaction replaces the conversation with a summary that the model uses to continue in a fresh window. It is lossy: some details are left out. The timing matters because automatic compaction fires near the context limit, when accumulated context may already have reduced the model's reliability:
Consider a session in which 5 files have been read, approach A has failed, and the next step is to try B.
Failure and fix both linger
"That doesn't work, try B" — the failed approach plus your correction stay in context, adding noise and clouding judgment.
Back to the fork, switch cleanly
Roll back to "5 files read, A not tried," then say "don't use A — foo doesn't expose that interface, go to B." Keep the reads, drop the failed try.
The companion option "Summarize from here" condenses what Claude learned into a handoff note ("I tried A, it didn't work, because…"). A later session can use that record to avoid repeating the failed approach.
Rewinding also avoids the cost of rewriting the conversation. It removes turns from the end, leaving the preceding content cached; trimming those turns adds no cache-rebuild cost. By contrast, /compact generates a summary and replaces the conversation, so it always has a cost. If the last few turns are no longer useful, rewind to just before them rather than using /compact.
Forking preserves the current session while opening another direction. Rewind moves the current session back; /branch (or claude --resume <session-id> --fork-session from the CLI) copies it into a new branch and leaves the original untouched. It allows an uncertain approach to be tried without losing the current state.
/compact replaces the conversation with a summary; /clear clears it so the next task can start fresh. The practical distinction is who decides what to keep:
| Dimension | /compact | /clear |
|---|---|---|
| Effort | Low — Claude summarizes | High — you distill |
| Precision | Claude decides what to keep | You decide what to carry |
| Context rot | Partly mitigated | Prior conversation cleared |
| Best for | Clearing clutter mid-task | Starting a fresh task |
| Scenario | Use | Why |
|---|---|---|
| Same task, context still relevant | Continue | It's all still working for you |
| Claude went down the wrong path | Rewind | Keep reads, drop failed try |
| Session clogged with stale debug | /compact + steer | Low effort, you set direction |
| Starting a fresh task | /clear | Old conversation cleared; carry selected notes |
| Next step: lots of conclusion-only output | Subagent | Noise stays in the child |
| Stepping away from the keyboard | /compact | Cheap while the old conversation is still cached |
| Claude is mid-task and you have a quick question | /btw | Single turn, no tool calls, full conversation context, doesn't interrupt |
| Try another direction but keep the current state | /branch | Original session untouched; the branch inherits context up to here |
New task = new session. For related work, continue when the existing context remains highly relevant and avoids re-reading; otherwise, use /clear. For delegation, the useful question is "do I need the tool output itself, or just the conclusion?" A subagent can handle conclusion-only work in a separate context, as described in Layer 3.
That separation has a cost. Without the main conversation, a subagent may need to re-read material the main session already holds while paying for its own turns. For a small job, the overhead may outweigh the benefit, and the main session receives only what the subagent chooses to report. For a noisy job delegated repeatedly, give it a definition with model: haiku; otherwise, it runs on the main session's model.
Knowledge & tools: put each part in its place
Codebase setup shapes how effectively Claude can use its capabilities. The harness deserves attention alongside the model itself. Claude finds code through agentic search, exploring the live codebase with tools, rather than through retrieval-augmented generation (RAG) backed by an embedding index:
| Dimension | RAG tools | Claude Code · agentic search |
|---|---|---|
| Index upkeep | Needs an embedding pipeline | None |
| Freshness | Lags (hours/days/weeks) | Real time on the live codebase |
| Failure mode | Returns deleted/renamed funcs, no signal | No such problem |
| Scaling | Can't keep up with thousands of commits | Each instance runs independently |
Agentic search needs enough starting context to know "where to begin," and navigation quality depends on setup quality. Investing in codebase setup helps teams get better results.
| Layer | Most common misuse |
|---|---|
| L1 CLAUDE.md | Stuffed with reusable expertise (belongs in a skill) |
| L2 Hooks | Done via prompt instead of auto-running |
| L3 Skills | All crammed into CLAUDE.md |
| L4 Plugins | Good config left in one person's hands |
| L5 LSP | Assumed automatic (needs a plugin + language server) |
| L6 MCP | Built before the basics |
| L7 Subagents | Exploring and editing in one session |
Section 2.2 groups the available configuration capabilities. Choosing where an instruction belongs is a separate question. Anthropic groups instruction carriers into seven kinds, distinguished by four factors: when an instruction loads, whether it survives compaction (the compression of session history), how much context it uses, and how much authority it carries.
Rules are a carrier for constraints: markdown files under .claude/rules/ can use a paths: field to load only when Claude touches a matching file. Without path scoping, a rule behaves like text in root CLAUDE.md: it is always loaded and always consumes tokens. The distinction therefore rests on paths. A convention for a single directory belongs in a nested CLAUDE.md; a cross-cutting constraint that applies across directories, such as "every handler validates input first", fits a path-scoped rule better.
--- paths: - "src/api/**" - "**/*.handler.ts" --- All API handlers must validate input with Zod before processing.
src/api/** → stays out of context in a docs-only session, loading only when Claude touches a matching file. That scoping is the whole of what makes Rules different from a root CLAUDE.md.| Carrier | When it loads | Survives compaction? | Context cost | Best for |
|---|---|---|---|---|
| CLAUDE.md · root | Session start, always resident | Yes, re-read (memoized) | High, every line costs | Build commands, codebase-specific gotchas, team norms |
| CLAUDE.md · subdir | When a file under it is read | Gone until that dir is touched again | Low | A directory's local conventions |
| Rules | When a file matching paths is touched | Re-injected | Medium (resident if unscoped) | Cross-cutting local constraints |
| Skills | Name resident, body loads on invocation | Re-injected up to a shared budget, oldest dropped first | Low | Procedural workflows |
| Subagents | Name resident, body only when called | Only the final summary returns | Near-zero in main context | Isolated side tasks, result only |
| Hooks | Fire on lifecycle events | Bypass compaction entirely | Low, config lives outside context | Actions that must happen deterministically |
| Output styles | Session start, into system prompt | Never compacted | High, overwrites default system prompt | Role-level changes (use with care) |
| Append-system-prompt | CLI flag, that invocation only | Never compacted | Medium, cached after first request | Tone, length, format preferences |
The green column, "survives compaction?", describes whether an instruction remains available later in a long session. If compaction drops its carrier, the instruction may be absent afterward. A subdirectory CLAUDE.md, for example, remains absent until that directory is touched again.
The launch directory determines which CLAUDE.md files load at session start. User-level instructions in ~/.claude/ load at start, along with every CLAUDE.md / CLAUDE.local.md on the ancestor chain leading to the launch directory; files in directories below it load on demand. Launching in a subdirectory preloads the whole chain's conventions, bringing in local context while also increasing the starting context load.
Output styles and Append-system-prompt are best left unchanged in most cases. Output styles overwrite the default system prompt, removing "you are a software-engineering assistant" along with its safety and verification habits unless keep-coding-instructions: true is set. For style adjustments, check the built-in Proactive / Concise / Explanatory / Learning options first. Concise, a later addition, leads with the result and omits preamble and recaps. Append-system-prompt applies to one invocation and adds to the role, but instructions are followed less faithfully as more are piled on.
The "symptom → relocate" lookup starts with the content of an instruction rather than its carrier. Certain kinds of text in CLAUDE.md are signals that another location would fit better:
| If you're writing this in CLAUDE.md… | It belongs in | Why |
|---|---|---|
| "Every time X, always do Y" (run prettier after every edit, post to Slack on completion) | a hook in settings.json | The model choosing to run a formatter is not the same as the formatter running automatically. If it must happen reliably, hand it to the harness instead of trusting the model to remember. |
| A 30-line procedure (deploy runbook, release or review checklist) | a skill in .claude/skills/ | CLAUDE.md is for facts that are always true (build commands, codebase-specific gotchas, team conventions). A procedure's body loads only when invoked; leaving it resident just burns tokens. |
| A personal preference (e.g. "always use semantic commit messages") | a user-level file (~/.claude/ or CLAUDE.local.md) | Every file-based method has a user-level counterpart loaded across all repos. Keep personal taste at the user level; reserve project files for preferences that are team-wide but specific to this codebase. |
Two further cases concern enforcement and scope. A "never do X" rule needs hooks plus permissions, with managed settings for org-wide enforcement. A constraint that applies only to src/api/** behaves like text in CLAUDE.md unless it has a paths: field.
Auto-memory and team conventions
Auto-memory supersedes the old # hotkey workflow by saving relevant work and user preferences automatically. Memories are written to ~/.claude/projects/<project>/memory/, with one directory per git repo root, separate from the hand-maintained ~/.claude/CLAUDE.md and ./CLAUDE.md. They are configured through /memory and consolidated through /dream, whose name refers to how REM sleep turns short-term memory into long-term storage.
Anthropic's power-user tips collection also retains the team's older habit: after a correction, tell Claude “Update your CLAUDE.md so you don't make that mistake again,” or tag @claude in a PR comment to add a review learning to CLAUDE.md. The integration is installed with /install-github-app; the team calls the practice Compounding Engineering. These approaches coexist. Specific conventions that repeatedly require correction across the team belong in the checked-in CLAUDE.md; personal preferences and scattered context go to auto-memory. The subtraction list targets broad defensive prohibitions, not individual corrections.
permissions.deny to version control for the whole team.A skill is a folder, not just a SKILL.md file. SKILL.md is the entry point; scripts, references, templates and even the skill's own hooks can sit alongside it. These supporting resources let a skill provide more than prompt text alone.
SKILL.md gives the method, scripts/ the hands, references/ load on demand to save context.Each skill's name and description sit in the system prompt, where they serve as triggers. Claude scans those entries, decides which skill to use, and issues an ordinary Bash call to cat the relevant SKILL.md into context. Referenced files such as references/api.md are read with a further cat only when needed. Claude pulls the skill body and its references on demand with general tools; the harness does not pre-inject that content.
Anthropic groups common skill uses into nine kinds, ranging from documentation lookup to operations:
Anthropic draws nine best practices from its hundreds of internal skills:
Getting a skill right
- No filler: focus on what pushes Claude off its defaults (e.g. "avoid Inter and purple gradients")
- Build a Gotchas section: the most valuable content — log failure points, keep updating
- Progressive disclosure via the file system: split detail into
references/api.md - Avoid over-constraining Skills, except in highly important areas; Description is the trigger, not a summary
Keeping it durable
- Store scripts for Claude to compose, not rebuilt boilerplate
- Hooks on demand:
/carefulinterceptsrm -rf,DROP TABLE - Persist in
CLAUDE_PLUGIN_DATA(skill dirs are wiped on upgrade) - User config in
config.json; if unset, ask via AskUserQuestion
Small teams can share skills by checking them into .claude/skills; a plugin marketplace with vetting supports wider distribution. A PreToolUse hook that logs invocations shows which skills are popular. Good skills can start as a few lines and improve as edge cases emerge.
Express specifications with concrete references
Rich references give Claude concrete material to work against. Anthropic identifies four forms: an HTML artifact created with Artifacts, a detailed test suite, a function in another codebase to port, and a rubric evaluated through dynamic workflows and verifier agents. The rubric lets Claude check judgment in a field against a standard, such as what good API design looks like. Anthropic favors executable or code-adjacent references over prose: "For example, a HTML mockup of a design will generally produce better results than a description of the design or a screenshot."
Hooks can attach to more than thirty events as of October 2026. Newer events include PostToolUseFailure, PermissionDenied, PreModelSwitch / PostModelSwitch, InstructionsLoaded, ConfigChange, and FileChanged. Since v2.1.295, a hook can set onFailure: "block" to block when the hook itself fails.
Anthropic's power-user tips collection singles out six patterns the team uses. PermissionRequest is particularly useful: it lets the approve-or-deny step itself be automated.
| Event | Use case |
|---|---|
| SessionStart | Dynamically load context each time you start Claude |
| PreToolUse | Log every bash command the model runs |
| PostToolUse | Auto-format code after Write/Edit to prevent CI failures |
| PermissionRequest | Route permission prompts to Slack, WhatsApp, or Opus for review |
| Stop | Run deterministic checks on long tasks, or nudge Claude to keep going |
| PostCompact | Re-inject critical instructions after context compression |
"PostToolUse": [ { "matcher": "Write|Edit", "hooks": [{ "type": "command", "command": "bun run format || true" }] } ]
settings.json. The || true keeps a formatter failure from blocking the edit.Anything written into CLAUDE.md, Rules, or Skills is an instruction, and an instruction is a request, not a guarantee. In a long session, an ambiguous moment, or a file carrying a prompt injection, the model can simply miss it. So for things that must never happen, dropping a database, editing prod, touching off-limits paths, a line that says "don't do this" isn't enough; only hooks and permissions enforce deterministically.
Hooks fire throughout the agentic loop, from SessionStart to SessionEnd. Each tool call follows the PreToolUse → tool executes → PostToolUse cycle. Hook configuration lives outside the main context and bypasses compaction entirely. PreToolUse provides a deterministic blocking gate: a hook that exits with code 2 denies the call. The dashed cluster on the right contains off-spine, asynchronous events that fire independently of the main flow.
The Model Context Protocol (MCP) brings external data and systems into the session. On the consumer side, two client capabilities reduce context cost. Server design is outside this scope:
MCP and Skills are complementary: MCP supplies tools and data, while Skills supply the operating knowledge for using them. The five MCP-server design patterns fall outside this consumer-side scope.
Back in late 2024, Claude 3.5 Sonnet scored 49% on SWE-bench Verified with just two general tools, Bash and Text Editor — the SOTA then. Claude Code's foundation is still those two; Skills and Memory are combinations of them.
Published alongside Claude Opus 5 on 24 July 2026, Thariq Shihipar's official Anthropic post, "The new rules of context engineering for Claude 5 generation models," provides evidence from Claude Code for reducing unnecessary constraints. For Opus 5 and Fable 5, Anthropic removed over 80% of the system prompt "with no measurable loss on our coding evaluations." Its diagnosis was explicit: "Overall, we found that we were overconstraining Claude Code, both through our system prompt and in our CLAUDE.md files and skills."
The transcripts show a cost beyond context capacity. A single request could inherit "leave documentation as appropriate" from one layer and "DO NOT add comments" from another. Even when Claude recovered the intended answer, it spent attention reconciling the overlapping constraints before acting. That reconciliation cost is distinct from the token cost of carrying the instructions at all.
| Then | Now | What changed |
|---|---|---|
| Give Claude rules | Let Claude use judgement | Match surrounding code; keep Skills flexible by default, with tight constraints only in highly important areas. |
| Give Claude examples | Design interfaces | Expressive parameters and typed states teach usage without narrowing exploration. |
| Put it all upfront | Use progressive disclosure | Full definitions of built-in tools can also load on demand. |
| Repeat yourself | Simple tool descriptions | Keep usage guidance in tool descriptions rather than repeating it. |
| Memory in CLAUDE.md | Auto-memory | Relevant work and user preferences are now saved automatically. |
| Simple specs | Rich references | Artifacts, tests, existing code and rubrics provide executable evidence of intent. |
Progressive disclosure also applies to Claude Code's built-in tools. Anthropic says some tools use deferred loading: the agent must retrieve their full definitions through ToolSearch before use. The Task tools are its named example of what this makes affordable. The same mechanism used to withhold external MCP tool definitions in Section 2.7 also governs Claude Code's own tools. Anthropic also removed repeated instructions from the system prompt, judging tool descriptions sufficient to carry usage guidance without duplication.
Anthropic packaged this audit as claude doctor, exposed in Claude Code through /doctor, now a bundled skill with the alias /checkup. It provides an automated way to rightsize Skills and CLAUDE.md files by weighing unused skills, MCP servers and plugins against their context cost, checking CLAUDE.md for duplication and size, and identifying slow hooks. /doctor prompt-audit arrived in v2.1.283. The audit turns the six reversals into routine maintenance: build it, then cut it.
Orchestration: who should hold the plan
Orchestration determines where the plan lives: in Claude's conversation, carried forward turn by turn, or outside it. The principle is to keep small tasks together and avoid making the model hold an entire large plan in context alone.
What it is
- Three traits: fresh start (no history), parallel, permission isolation (research read-only / impl editable)
- Nestable: a subagent can spawn subagents, by default up to three layers below the main conversation (adjustable with
CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH), the structural basis for dynamic orchestration fanning one task across hundreds of agents - General-purpose: full tools, complex multi-step
- Plan Agent: read-only, research + strategy
- Explore Agent: read-only, fast search
When to dispatch
- Research-heavy (dozens of files)
- Multiple independent tasks (parallel)
- A fresh perspective (no inherited bias)
- Pre-commit verification (independent check)
- Pipeline workflow (clear stages/handoffs)
Conversation first, automation later: start with natural-language requests, identify recurring patterns, and turn those patterns into reusable conventions and automation.
.claude/agents/, description = a triggerHow it should be done
- Research then implement (start from a summary, not 20 raw files)
- Parallel batch edits (one pattern, independent files)
- Independent code review (a fresh view is more objective)
- Pipeline (design/implement/test, handoff via files)
Don't do this
- Sequentially dependent: one session in order is cleaner
- Same-file edits: parallel edits collide
- Tiny tasks: delegation has overhead, just do it
- Too many expert agents: lowers auto-delegation reliability
- Needing inter-agent coordination: they can't talk — use Agent Teams
A custom agent can serve as either a dispatched worker or the main conversation. claude --agent <name> starts a session with that agent's definition; adding "agent" to settings.json makes it the default. This effectively replaces the system prompt with a custom one. Each definition can specify its own color, tool set, allowed and disallowed tools, permission mode, and model. Anthropic's example restricts a read-only agent to the Read tool:
# .claude/agents/ReadOnly.md --- name: ReadOnly description: Read-only agent restricted to the Read tool only color: blue tools: Read --- You are a read-only agent that cannot edit files or run bash.
Orchestration within a session is distinct from running several sessions at once. Anthropic's power-user tips collection, updated 2026-10-16 and gathered from individual engineers on the Claude Code team, calls parallel sessions the biggest productivity unlock: 3–5 Claude sessions in parallel, each in its own git worktree. Each session works in a separate working copy rather than editing the same files in a shared directory.
| Entry point | How |
|---|---|
| CLI | claude --worktree (or claude --worktree my_worktree); add --tmux to launch in its own tmux session |
| Desktop | Code tab, check the worktree checkbox |
| Non-git VCS | Mercurial / Perforce / SVN: define WorktreeCreate and WorktreeRemove hooks in settings.json |
| Subagents | Add isolation: worktree to the agent's frontmatter |
# .claude/agents/worktree-worker.md --- name: worktree-worker model: haiku isolation: worktree ---
/batch migrate src/ from JavaScript to TypeScript interviews you about the migration first, then fans the work out.Several open sessions create a coordination problem: keeping track of which work is happening where. The team names its worktrees, uses shell aliases (za, zb, zc) to move between them, and color-codes terminal tabs. /color changes the prompt input color. Terminal notifications signal when a Claude session needs attention. Many engineers also keep a dedicated analysis worktree for reading logs and running queries.
Parallelism still assumes independent subtasks. A worktree prevents sessions from editing the same working copy; it does not remove sequential dependencies within the task (see the 3.2 anti-patterns). The collection therefore puts verification first: each agent needs a way to test whether its changes work for parallel execution to pay off.
Parallel and long-running work benefit from fewer unnecessary permission interruptions. Allowlists, automatic approval, and sandboxing provide different controls. Reducing prompts still requires explicit permission boundaries.
The collection recommends pre-approving commands as an alternative to skipping permissions entirely. This reduces prompts while retaining an auditable allowlist. Full wildcard syntax is supported, including "Bash(bun run *)" and "Edit(/docs/**)". A small set of safe commands is pre-approved by default; entries added through /permissions extend that baseline. The permission system combines prompt-injection detection, static analysis, sandboxing, and human oversight.
/sandbox offers three modes: sandbox BashTool with auto-allow, sandbox BashTool with regular permissions, or no sandbox. Sandboxing, remote control, and scheduled cloud jobs are off by default and may be disabled by organization policy. A "not available" response usually means the administrator has not enabled the feature.
A Stop hook for deterministic checks
Preferred for auditable workflows. Alternatives: prompt Claude to verify with a background agent when done, or route permission requests to Opus via a PermissionRequest hook so it scans for attacks and auto-approves the safe ones (see 2.6).
The community ralph-wiggum plugin
Not reviewed or sanctioned by Anthropic; check with your administrator before installing third-party plugins in a managed environment. Same for --dangerously-skip-permissions: sandboxed environments only.
As in 2.6, hard constraints are enforced through permissions and hooks, rather than instructions alone.
Orchestration: from delegation to scripts
The central distinction among Subagents, Skills, and Workflows is who holds the plan, represented by the PLAN token below. With a Subagent or Skill, Claude manages the plan turn by turn, and intermediate results enter its context. With a Workflow, the script manages the plan and intermediate results; the main Claude conversation receives only the final answer.
| Subagents | Skills | Workflows | |
|---|---|---|---|
| Who decides next | Claude, per turn | Claude, per prompt | The script |
| Intermediates live | Claude's context | Claude's context | Script variables |
| Reproducible | Worker definition | Instructions | The orchestration |
| Scale | A few per turn | Same as subagent | Tens to hundreds/run |
| On interruption | Restart the turn | Restart the turn | Resumable in-session |
Workflows and Skills serve different, complementary purposes. A Skill changes "what the model knows," while a Workflow changes "how things are deterministically orchestrated." An agent dispatched by a workflow can load a skill before starting its task.
The default harness keeps planning and execution in the same context. Long-running, massively parallel, or adversarial work can expose three failure modes in that arrangement, each of which provides a reason to move the plan into a script:
Laziness
A 50-item review claims "done" at item 35.
Self-preference
It shields work it just produced when judging it.
Goal drift
Fidelity leaks over turns; compaction drops "don't X."
Workflows reduce these three failure modes through their structure. For laziness, the script holds the full checklist and keeps the loop running until it is complete. For self-preference, verification goes to another independent agent. For goal drift, the goal remains in the script rather than depending on its survival through conversation compaction.
/workflows, press s to save it as a command.Convergence provides the exit condition rather than a fixed round count. A workflow can be requested in a prompt with the keyword ultracode or wording such as "use a workflow", enabled through the Ultracode setting with /effort ultracode, or invoked through a saved command. There is also a built-in /deep-research command. A single parallel() or pipeline() call accepts at most 4,096 items.
As of October 2026, Workflows are available on all paid plans, through the Anthropic API, and on Bedrock, Google Cloud, and Microsoft Foundry. Pro users enable them in /config; organizations can disable them with "disableWorkflows": true in managed settings. Token use far exceeds that of a normal session. Start with a small task; before a large run, check /model and route lighter stages to a smaller model.
Classify-and-act
A classifier decides the category, routes to different agents. A triage desk for the pipeline.
Fan-out-and-synthesize
Split into steps, one agent each; synthesis is a barrier — the only one that waits.
Adversarial verification
Each worker gets a dedicated agent to verify adversarially against a rubric. Reduces self-preference.
Generate-and-filter
Diverge into many ideas, then filter and dedupe to the best few.
Tournament
N agents, different strategies on one task; compare pairwise until a winner emerges.
Loop until done
When the workload is unknown, no fixed round count — loop to a stop condition.
Comparative judgment is more effective than absolute scoring, especially for ranking.
A Workflow ported Bun from Zig to Rust: ~750K lines, 11 days, 99.8% test pass rate, via four chained workflows (① map Rust lifetimes ② translate per file, hundreds of agents in parallel, two reviewers each ③ drive build/tests to green ④ optimize overnight, a PR per change for human review). But the preconditions are extreme; not "any migration in 11 days":
- strangler-fig incremental replacement, not a rewrite — Zig and Rust linked into one binary, switched class by class
- every switch passed tests + shadow-diff + a ≤2% performance gate — verification-driven, not "done means trusted"
- very high existing test coverage (99.8% presupposes a strong suite), single-author, not yet in production (99.8% isn't 100%)
Correct reading: on a high-value module with strong tests and gates, a deterministic script + build/test fix loop compresses quarter-scale work to days. Pilot on such a module; don't copy the timeline.
Workflows also apply to non-technical work. Of the nine use cases named in the official guidance, over half do not involve writing code:
An agent reading untrusted public content must not take high-privilege actions; those go to a separate set of agents. Reading and acting are kept apart — a structural defense against prompt injection.
When not to use it: Workflows use far more tokens than a normal session, and many tasks do not need the additional compute. The initial question is "does this really need more compute"; most traditional coding tasks don't need a five-person review panel.
A detailed prompt matters most. Small tasks can use a quick workflow; workflows can also be paired with /loop and /goal. The instruction use 10k tokens sets a token cap. Press s to save a workflow into ~/.claude/workflows or a skill, treating the saved version as a starting point for further refinement.
Non-interactive runs need explicit configuration. By default, claude -p, along with the TypeScript and Python SDKs, searches for local CLAUDE.md files, settings, and MCP configurations. For use in scripts, continuous integration (CI), or SDK-based applications, the usual recommendation is to supply configuration through --system-prompt, --mcp-config, and --settings, then add --bare for roughly 10× faster startup:
claude -p "summarize this codebase" \ --output-format=stream-json \ --verbose \ --bare
--bare. For now, opt in with the flag.Explicit configuration supports reproducibility: a scripted Claude run should receive its configuration inputs on the command line rather than silently inherit a machine's personal configuration. For multi-repo work, --add-dir, or /add-dir within a session, grants access and permissions to additional folders. The team's settings.json can include "additionalDirectories" to make those folders available by default.
Cloud sessions and Claude Desktop also support a setup script that runs before each new cloud session to install dependencies, configure settings, and set environment variables. The script is skipped when a session resumes.
Verification: self-testing and independent review
Anthropic's power-user tips collection identifies this as its single most impactful practice: give Claude a way to verify its own output. Access to checks lets Claude iterate on the feedback rather than stop after generation. Those checks depend on the domain: bash commands, test suites, simulators, or browser testing. The investment is in verification suited to the work.
For frontend work, the collection describes two options. The Claude Code Chrome extension works in Chrome or Edge, and the team uses it whenever it works on web code. The Desktop app can start and test web servers in a built-in browser. The collection compares building a website without browser access to asking someone to build it without being able to see the result: it probably will not look good.
After changes, appending /simplify to the prompt runs parallel agents that review reuse, quality, efficiency, and CLAUDE.md compliance. The setup is covered in verification loops with skills.
| Prompt | What it forces |
|---|---|
| “Grill me on these changes and don’t make a PR until I pass your test.” | Claude validates your understanding before shipping |
| “Prove to me this works.” | Claude diffs behavior between main and your feature branch |
| “Knowing everything you know now, scrap this and implement the elegant solution.” | A clean redo after a mediocre first attempt |
As code becomes cheaper to generate, verification becomes a larger part of the work. Generation and evaluation have distinct responsibilities. An agent can run objective tests on its own output, but asking it to judge that output also exposes self-preference, much as a developer reviewing their own code may overlook its weaknesses. In this approach, tuning an independent Evaluator to be strict is easier than teaching the Generator to self-criticize. Independent review complements the Generator's self-testing.
Use an independent review subagent, or the Workflow adversarial-verification pattern, so reviewer ≠ executor and they share no context. This uses Claude Code's existing delegation and orchestration rather than rebuilding the agent loop.
Turn the artifact into an agent-readable interface (data-verify-* contracts, window.__verify, .verify.ts). The thesis is "an economic inversion": agents drive verification's marginal cost toward zero, so contract testing finally scales on the front end. You'd only do this when reshaping your own product.
Onboarding a 700K-line legacy codebase
The Skyline project introduced at the opening brings all four layers together. Its core method is to onboard Claude like a new hire: provide enough background to complete a bounded project, then preserve what was learned as better context for the next round. The process follows a five-step loop, with each round building on the previous one:
pwiz-ai, not the code repo — else it's isolated by branch and Claude becomes a "different person" per branch. It is maintained and versioned as a real engineering artifact.Four takeaways from the Skyline case: isolate the scope, starting with a bounded task and expanding rather than attempting the whole legacy codebase at once; make the debugging skill a firm requirement, because blindly changing one line in 700K can trigger cascading failures; maintain context independently of code branches; and use MCP integration to take failure triage off people's hands. The approach still requires someone to maintain the context layer and advance the work incrementally. This is a maintained working environment, not an install-and-go solution.
Cut as you build: the harness's half-life
A harness has a half-life: its components encode assumptions about model capability, and those assumptions can expire. How much scaffolding can be removed depends on the capability of the selected model.
In the historical Sonnet 4.5 example, the model ended tasks early near the context limit, a behavior described as "context anxiety". A context-reset workaround addressed it. When Opus 4.5 shipped and the behavior disappeared, the workaround was no longer needed. Similarly, a hook that intercepted writes to require Perforce p4 edit became redundant once that behavior was supported natively. The maintenance focus shifts from "how to make Claude stronger" to "what can I stop doing."
Other responsibilities remain. In the app-building comparison, the Planner and Evaluator still served separate purposes: without a Planner, the Generator under-scoped the work; without an Evaluator, edge-case bugs slipped through. The distinction is between removable scaffolding and continuing responsibilities for context discipline and independent verification.
Audit the harness every 3 to 6 months, starting with /doctor to rightsize Skills and CLAUDE.md. Anthropic removed over 80% of Claude Code's system prompt with no measurable loss on its coding evals, illustrating the scale of reduction worth testing.