◉CLAUDE LABJP
●CC 2.1.332 — 2.1.332 (11/25) is still current. Skills from MCP servers appear as server:skill (beta)●OPUS 4.5 — Opus 4.5 is now scheduled to retire from the Claude API on 2027/1/22. Move to claude-opus-5-5●SONNET 4.5 — Sonnet 4.5 retires from the Claude API tomorrow, 11/30. Last day to check for hard-coded IDs●DISK — Users on Windows report Cowork's session disk filling up with no way to clean it●NEW — New: Asking Cowork for a meeting draft? Hand over old minutes after the outline is set●JETBRAINS — Our guide to using Claude with JetBrains IDEs is still among the most-read pages●CC 2.1.332 — 2.1.332 (11/25) is still current. Skills from MCP servers appear as server:skill (beta)●OPUS 4.5 — Opus 4.5 is now scheduled to retire from the Claude API on 2027/1/22. Move to claude-opus-5-5●SONNET 4.5 — Sonnet 4.5 retires from the Claude API tomorrow, 11/30. Last day to check for hard-coded IDs●DISK — Users on Windows report Cowork's session disk filling up with no way to clean it●NEW — New: Asking Cowork for a meeting draft? Hand over old minutes after the outline is set●JETBRAINS — Our guide to using Claude with JetBrains IDEs is still among the most-read pages
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.

Claude55system 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 $10 for lifetime access
View Membership →

Related Articles

◉ Claude.ai2026-11-26
I Kept Saying Yes to "Should I Also Fix This?" — Where to Draw the Line on Out-of-Scope Findings
When a one-change task with Claude keeps growing through "should I also fix…?", one question decides what gets fixed now and what gets recorded for later. Includes the few lines I put in my instructions and a small script that keeps findings from disappearing.
◉ Claude.ai2026-11-17
My Scheduled Job Woke Claude Up Just to Ask Anything New — Multiply Runs per Day by Tokens per Run First
When a recurring job you asked Claude to build drains your weekly allowance early, the culprit is often the runs that only check for changes. A runnable estimator, a non-AI pre-check, and a failure brake that stops the job before it keeps spending.
◉ Claude.ai2026-10-19
Claude Said the File Was Created, but the Folder Was Empty — A Read-Back Check After Every Write
When a file-creation call reports success but nothing exists on disk, here is the order I use to narrow down the cause, plus a small script that reads back every write.