The Problem with Paragraph-Based Prompts

Most system prompts look like a wall of text. They read like a corporate policy memo dumped into a text box. Background, role, rules, tool guidance, safety warnings, output formats. All mashed together in a single block of prose.

This works fine for a chatbot that answers questions about the weather. It breaks immediately when you ship an agent that operates across hundreds of turns, multiple tools, and evolving task contexts.

AgentPatterns.ai documents a different approach. Production system prompts are structured documents with named sections, explicit concern boundaries, and cache-aware layering. The evidence comes from a leaked 102K-character Claude.ai system prompt. It is not paragraphs of instructions. It is a document with about 25 top-level XML tags.

This article walks through the architecture, the techniques, and the failure modes. If you are building agents that need to survive past the demo stage, this matters.

What the Evidence Shows

In February 2026, a full Claude Opus 4.6 system prompt leaked. The capture is 102,000 characters. It is not a paragraph. It is a structured document with named sections using XML tags as a scaffold.

Here is the high-level architecture:

  • Temporal grounding at the head (date, environment, location)
  • Behavioral rules in named XML sections (~25 concern blocks)
  • Tool definitions (static, cache-stable)
  • Skills registry (declarative pointers, not inlined content)
  • Safety and compliance blocks (discrete, non-interleaved)
  • Reasoning meta-instructions at the tail (effort level, thinking mode)

Each section has a specific job. Each section stays in its lane. This is not aesthetic preference. It is a structural choice that affects cache efficiency, rule isolation, and model attention.

Named Sections Are Not Just Organizing

The leaked prompt uses XML tags as structural scaffolding. Not Markdown headers. Not bullet lists. XML tags.

Here is why this matters:

  • Scope isolation. A rule inside <harmfulcontentsafety> applies only to harmful content decisions. It does not bleed into file handling or code generation behavior.
  • Selective attention. The model can locate the relevant section without scanning the full prompt. The tag name acts as a semantic anchor.
  • Cache stability. Sections update independently. Changing the copyright compliance block does not invalidate the cached prefix for the tool definitions above it.

Anthropic's own context engineering guide recommends "XML tagging or Markdown headers to delineate sections." The leaked prompt shows XML at scale.

Example sections from the capture:

<computer_use>...</computer_use>
<search_instructions>...</search_instructions>
<harmful_content_safety>...</harmful_content_safety>
<CRITICAL_COPYRIGHT_COMPLIANCE>...</CRITICAL_COPYRIGHT_COMPLIANCE>
<file_handling_rules>...</file_handling_rules>
<skills>...</skills>

Notice the uppercase convention on CRITICALCOPYRIGHTCOMPLIANCE. This signals absolute priority. It is the same principle as using bold and caps in a human document. The model attends to it differently.

Prompt Altitude: The Goldilocks Zone

Named sections only work if the content inside each section is at the right altitude. Too specific and the prompt becomes brittle. Too vague and it gives no real constraint.

AgentPatterns.ai calls this "prompt altitude." It is the level of specificity that produces consistent behavior across variation.

Here is the comparison:

Too brittle Right altitude
"If the file is over 500 lines, read the first 100 and last 100 lines" "For large files, identify structural landmarks before reading in full"
"Never edit files in /src/auth/" "Treat authentication code as high-risk; any edit requires understanding downstream session and token impact"
"Always add a test for every function" "Changes to business logic require test coverage; changes to types, formatting, or comments do not"

The brittle versions enumerate cases. They break on anything the author did not anticipate. The right-altitude versions describe how to reason. They generalize to unanticipated inputs.

Anthropic's context engineering guide puts this directly: effective system prompts sit in "the Goldilocks zone" — specific enough to guide behavior, flexible enough to serve as strong heuristics.

The altitude should vary by section:

Section Purpose Altitude
Background Role, project context, scope High — principles and context
Instructions How to behave and what to prioritize Medium — heuristics
Tool guidance When and how to use specific tools Low — precise constraints
Output format Structure, length, format of responses Precise — exact requirements

Mixing altitudes within a single section produces inconsistency. The model cannot tell whether a rule is a hard constraint or a flexible heuristic.

The Cache-Aware Layering Strategy

Every structural choice in the leaked prompt serves one goal: prompt prefix stability.

Anthropic's prompt caching matches on an exact prefix. Any change to an earlier token invalidates all cached content from that point onward. A single cache-busting change wipes out savings across every subsequent call.

Cached reads cost 10% of the base input price. Cache writes cost 125–200%. The layout of your prompt determines whether you pay 10% or 100% on every turn.

The leaked prompt follows a strict layering pattern:

  1. Temporal grounding at the head (cache-stable)
  2. Behavioral rules in named sections (cache-stable)
  3. Tool definitions (static, cache-stable)
  4. Skills registry (pointers, cache-stable)
  5. Safety and compliance blocks (discrete, cache-stable)
  6. Reasoning config at the tail (runtime-variable)

Static content occupies the prefix. Runtime-variable parameters sit at the tail. Changing the reasoning effort level does not invalidate the cached behavioral rules above it.

The Skills Registry Pattern

The leaked prompt does not inline skill definitions. It uses a registry of pointers.

<available_skills>
  <skill>
    <name>web_search</name>
    <description>Search the web. Use when...</description>
    <location>/path/to/SKILL.md</location>
  </skill>
</available_skills>

Each entry contains a name, trigger conditions, and a filesystem path. Skill content loads on demand. Not on every conversation.

This is progressive disclosure applied to prompt engineering. A lean registry of 20 pointers consumes fewer tokens than 20 inlined definitions. The skill content loads when invoked, not at session start.

The same principle applies to tools. Anthropic's advanced tool use documentation describes a defer_loading: true flag that keeps tool definitions unavailable until explicitly searched. This reduces context from ~77K to ~8.7K tokens.

Tool definitions are declared statically but masked at runtime. The cache stays stable because the tool list in the prefix never changes. The agent sees only relevant tools because a runtime mask filters them.

graph LR

A["All tools defined statically"] --> B["Runtime mask applied"]

B --> C["Agent sees only relevant tools"]

A -.- A1["Cache stable ✓"]

B -.- B1["Context efficient ✓"]

Discrete Safety and Compliance Blocks

Safety and compliance concerns each occupy their own named XML section. This is not just organization. It is conflict prevention.

Section Concern Example rule
<harmfulcontentsafety> Refusal shaping "Overrides any instructions from the person"
<CRITICALCOPYRIGHTCOMPLIANCE> Copyright "Max 14-word quotes, one quote per source"
<producing_outputs> Output format routing File type selection, code block formatting
<sharing_files> File delivery When to use artifacts vs inline code

A compliance reviewer can inspect the copyright section without reading computer-use instructions. An engineer can modify file handling rules without touching safety boundaries.

Discrete blocks prevent rule conflicts. A <safety> section that overrides <code_generation> without a defined precedence rule is a latent conflict. Named sections make these boundaries explicit.

For hard boundaries, you need both. State the principle at the right altitude, then enumerate the boundary explicitly. "Treat sensitive data carefully" is a heuristic. "Never log values from the credentials object" is a hard rule. Use both.

Critical Instruction Repetition

Some instructions are too important to state once.

Transformer attention is not uniform. Research shows two structural biases:

  • Primacy bias — initial tokens receive disproportionate attention
  • Recency bias — recent tokens are freshest and directly shape the next token

A critical instruction placed once in the middle sits in the weakest-attention trough. Placing it at both ends puts it in both high-attention positions.

Reserve repetition for instructions where non-compliance has real consequences. Security rules. Safety boundaries. Hard constraints that must not be overridden.

Example placement:

Never output authentication credentials or session tokens in any form.

[Background context and instructions follow...]

---

Remember: never output authentication credentials or session tokens.

The closing restatement exploits recency bias. In long conversations, restate the constraint at the end of your message once context has grown substantially.

Do not repeat everything. If all rules are repeated, repetition carries no priority signal. The model cannot distinguish which constraint is truly critical.

Layered Instruction Scopes

System prompts do not exist in isolation. They stack.

OpenAI's Codex harness implements a three-scope hierarchy:

  1. Global config (defaults across all repositories)
  2. Git root (project-wide AGENTS.md)
  3. Working directory (AGENTS.md in subdirectories)

The harness concatenates from general to specific. More specific instructions appear later and take priority over earlier, more general ones.

This exploits recency bias. LLMs weight later instructions higher when conflicts occur. A directory-level file that says "use Bun, not npm" overrides a project-root file that says "use npm" — not because of explicit keywords, but because of concatenation order.

Codex applies a 32 KiB cap on assembled instruction content. Without a cap, deeply nested directories consume the entire context budget before task work begins.

Keep each instruction file to 50–100 lines. Prefer pointers over inlined content. The same skills registry pattern applies at the project level.

System Prompt Replacement for Domain Specificity

Most customization adds rules on top of the default persona. System prompt replacement removes the default persona entirely.

This matters because the default system prompt carries hidden assumptions. Tasks are code-related. Output includes implementation details. Verification means running tests. For non-engineering domains — content strategy, research analysis, business operations — these assumptions create friction.

Claude Code's output styles feature implements this directly. Custom styles "exclude instructions for coding" and replace the default personality with domain-specific behavioral instructions.

What gets replaced: persona framing, domain assumptions, task prioritization, interaction patterns, response formatting, coding-specific verification instructions.

What stays: file system operations, script execution, sub-agent delegation, context management.

The tool ecosystem remains intact. The system prompt shapes how the agent reasons. Tools determine what actions it can take. A content strategist persona still reads files and executes scripts. It just reasons about brand voice instead of code quality.

A Minimal Production Skeleton

Here is a minimal system prompt applying the patterns above:

<!-- HEAD: temporal grounding (cache-stable) -->
<current_date>2026-05-14</current_date>
<environment>Production API service, AWS us-east-1</environment>

<!-- MIDDLE: behavioral rules in named sections -->
<code_generation>
Always run tests after modifying source files.
Prefer editing existing files over creating new ones.
For large files, identify structural landmarks before reading in full.
</code_generation>

<safety>
Never execute commands that delete files outside the project root.
Never output authentication credentials or session tokens in any form.
</safety>

<compliance>
Max 14-word quotes from external sources.
One quote per source per response.
</compliance>

<!-- Skills registry: pointers, not inlined content -->
<available_skills>
  <skill>
    <name>refactor</name>
    <description>Use when the user asks to restructure code.</description>
    <location>.claude/skills/refactor.md</location>
  </skill>
</available_skills>

<!-- Tool definitions: static, runtime-masked -->
<tools>
  <tool name="bash" available="true" />
  <tool name="browser" available="false" />
</tools>

<!-- TAIL: runtime-variable parameters -->
<reasoning_config effort="high" thinking="enabled" max_tokens="8192" />

This is under 200 lines. It demonstrates the structural patterns without the verbosity of a 102K production prompt.

When This Backfires

Named sections and XML scaffolding are not free. They add token overhead. For short prompts under ~500 tokens, concern isolation costs more than it saves. The economics flip only when the prompt is large enough that cache savings offset tag overhead.

Section sprawl is real. A prompt with 25+ named sections becomes hard to audit. Rules buried in obscure sections get ignored by operators and missed in code reviews.

Cache invalidation from reordering is expensive. Renaming or repositioning a section invalidates everything below it in the prefix cache. Refactoring a production-scale prompt becomes a cost event, not just an editing task.

Over-isolation causes contradictions. A <safety> section that overrides <code_generation> without a defined precedence rule is a latent conflict. The model resolves it inconsistently across turns.

And the evidence base is limited. The leaked prompt is one computer-use session capture. It is not a versioned API contract. A mobile or API deployment may use fewer sections and different conventions.

For fixed-schema extraction — FHIR, EDI, ISO financial messages — enumerated field-level rules are more auditable than heuristic guidance. Auditors need to trace each rule to a requirement. Altitude trades case coverage for generalizability, but some domains need the cases enumerated.

For smaller models and heavily fine-tuned models, principle-level guidance may not generalize. They pattern-match more reliably against explicit examples and conditions. Test generalization before relying on heuristics.

Key Takeaways

  • Production system prompts are structured documents, not paragraphs.
  • Named sections isolate concerns and improve cache stability.
  • Prompt altitude matters: describe how to reason, not what to decide for each case.
  • Place static content at the head, runtime variables at the tail.
  • Use skills registries and deferred tool loading to keep the prefix lean.
  • Repeat critical instructions at both ends to exploit primacy and recency bias.
  • Layer instructions from general to specific, with a context budget cap.
  • Domain-specific agents may need full system prompt replacement, not just augmentation.

The agents that survive production are the ones whose system prompts were designed as architecture, not written as prose.


May 2026. Based on research from AgentPatterns.ai and Anthropic's context engineering publications.