◉CLAUDE LABJP
●2.1.296 — Subagents can set their own autoCompactWindow, and an env var pins the model used by workflow agents●AGENTS — Managed Agents gain dynamic workflows in beta: an agent can build a run for work with many pieces (Oct 9)●SONNET 4.5 — Retires on the Claude API on 11/30, 48 days left. Migrate to Sonnet 5.5●Q&A — A write-up shows how to stop a streaming call midway so a closed tab stops being billed●WORKTREE — Running claude --worktree on one repo in parallel: what to settle first, as one write-up lays it out●NEW — Stop making it reread the whole notes file: look up one section by number●2.1.296 — Subagents can set their own autoCompactWindow, and an env var pins the model used by workflow agents●AGENTS — Managed Agents gain dynamic workflows in beta: an agent can build a run for work with many pieces (Oct 9)●SONNET 4.5 — Retires on the Claude API on 11/30, 48 days left. Migrate to Sonnet 5.5●Q&A — A write-up shows how to stop a streaming call midway so a closed tab stops being billed●WORKTREE — Running claude --worktree on one repo in parallel: what to settle first, as one write-up lays it out●NEW — Stop making it reread the whole notes file: look up one section by number
Articles/Claude.ai
◉ Claude.ai/2026-07-06Advanced

When Instructions Fade in Long Conversations: Measuring Adherence and Pulling It Back

System-prompt instructions quietly lose their grip as a conversation grows. This piece turns that drift into a number you can track, then fixes it with prompt structure and mid-conversation re-anchoring, backed by runnable code and measured results.

Claude50system prompt3long conversationprompt design6instruction following

✦ Premium Article

One evening I was batch-generating drafts for four sites at once.

The first several came back with exactly the heading structure I had asked for. But somewhere around the twentieth, a "summary" section I had never requested began quietly slipping in. No errors. The model was writing with full confidence, and writing something slightly different each time.

I only noticed the next morning, looking at the diffs. It was unsettling. Nothing had broken. The instructions had simply faded.

The longer a conversation runs, the more quietly a system prompt loses its grip. This piece is about catching that fade as a number rather than a hunch, and then pulling behavior back with prompt structure and a mid-conversation fix, all traced through runnable code and measured results.

Why instructions fade as conversations grow

Several independent forces stack up behind fading instructions.

One is position. The system prompt is pinned to the front of the conversation, but as turns accumulate, the model leans harder on recent context. The rules up front become relatively "far away."

Another is dilution. Once twenty turns of exchange are in the history, the ten lines of constraints you placed at the start are a tiny fraction of the whole. The absolute amount of rule text hasn't changed, but its weight has dropped.

Then there is competition. When you slip a new request or an exception into the middle of a conversation, it acts as an implicit override and quietly collides with the original rules.

None of this is the simple story of "the model forgot." It's the priority of adherence sliding along with the center of gravity of the context. That's exactly why we start by measuring.

Turning adherence into a number

As long as you're saying "it feels like it's drifting," you can't verify whether any fix actually worked. So we define the rules as a set of checks that can be judged mechanically, and produce an adherence score for each turn of the conversation.

For a concrete target, imagine we want the model to obey three rules: "always start headings with H2," "never use bullet points," and "don't append a sources section." The judging is done with deterministic checks such as regular expressions, never relying on the model's own self-report.

import os
import re
from anthropic import Anthropic
 
client = Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
 
SYSTEM_PROMPT = """You are an assistant that drafts technical articles.
Always obey these rules.
1. Headings must start with ##.
2. Do not use bullet points (lines beginning with - or *).
3. Do not append a "Sources" or "References" section at the end."""
 
# Judge each rule with a deterministic function (True = obeyed)
def rule_heading(text: str) -> bool:
    return bool(re.search(r"^##\s", text, re.MULTILINE))
 
def rule_no_bullets(text: str) -> bool:
    return not re.search(r"^\s*[-*]\s", text, re.MULTILINE)
 
def rule_no_sources(text: str) -> bool:
    return not re.search(r"(Sources|References)", text)
 
CHECKS = {
    "heading": rule_heading,
    "no_bullets": rule_no_bullets,
    "no_sources": rule_no_sources,
}
 
def adherence(text: str) -> float:
    passed = sum(1 for fn in CHECKS.values() if fn(text))
    return passed / len(CHECKS)

Next, we send nearly the same "probe" request on every turn and record the adherence score each time. The history keeps growing, so the context gets longer as the turns advance. Keeping the probe text almost identical isolates the change as coming from prompt length rather than from what we asked.

PROBE = "Write about 60 words of body text under this heading. Any topic is fine."
 
def run_session(turns: int, reanchor_every: int = 0):
    history = []
    curve = []
    digest = "Strict: (1) headings start with ## (2) no bullets (3) no trailing Sources section"
    for t in range(1, turns + 1):
        # Re-inject the rule digest at a fixed interval (0 disables it)
        if reanchor_every and t % reanchor_every == 0:
            history.append({"role": "user", "content": digest})
            history.append({"role": "assistant", "content": "Understood. I will strictly comply."})
        history.append({"role": "user", "content": PROBE})
        resp = client.messages.create(
            model="claude-sonnet-5",
            max_tokens=400,
            system=SYSTEM_PROMPT,
            messages=history,
        )
        out = resp.content[0].text
        history.append({"role": "assistant", "content": out})
        curve.append((t, adherence(out)))
    return curve

The point of this harness is that judgment never depends on human eyes or on the model grading itself. An adherence of 1.0 means every rule was obeyed; 0.66 means one has slipped, at a glance. Run run_session(50) in the bare state first, and watch the shape of the decay.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦A small harness that scores instruction adherence turn by turn (Anthropic SDK, runnable as written)
✦Locating the turn band where rules break, then restoring adherence by restructuring the system prompt (before/after)
✦A re-anchoring implementation that re-injects a rule digest mid-conversation, with measured cadence tuning
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $15 for lifetime access
View Membership →

Related Articles

◉ Claude.ai2026-10-09
I Kept Rewriting My First Request to Claude Until I Handed It One Page About My Work
If Claude's answers keep missing the mark, the cause may not be your wording. It may be that you never explained your work. Here is how a non-engineer can write a one-page work description today and fold it into the first request.
◉ Claude.ai2026-10-03
My Usage Limit Ran Out Before Noon, and the Reason Was Conversation Length, Not Message Count
When the usage-limit banner shows up on Pro or Max sooner than you expected, here is the order I check: the two bars in Settings > Usage, the length of the conversation and its attachments, then the model and effort level. The morning I got cut off before lunch, and the lines I drew afterwards.
◉ Claude.ai2026-08-18
What to Settle Before Watermarked Claude Text Ships Inside Your App
Claude models released on or after August 2, 2026 embed watermarks in generated text and attach C2PA-signed provenance metadata to files. Here is how I redrew the line for shipped copy, plus a measured look at where image metadata disappears and a submission gate that keeps provenance reproducible.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links