CLAUDE LABJP
ENTERPRISE — Claude Enterprise adds richer admin analytics, model-level entitlements, and spend alertsDEVICES — Trusted Devices arrives for Team and Enterprise, verifying devices before remote Claude Code sessionsCODE — Claude Code adds org default models, readable session names, and clickable file attachmentsMODEL — Claude Sonnet 5 is the default across all plans at $2/$10 per million tokens through August 31FABLE 5 — Claude Fable 5 returns worldwide from July 1 after export controls lift, with a new cybersecurity classifierLIMITS — Claude Code weekly usage limits are up 50% through July 13; Claude Science applications close July 15ENTERPRISE — Claude Enterprise adds richer admin analytics, model-level entitlements, and spend alertsDEVICES — Trusted Devices arrives for Team and Enterprise, verifying devices before remote Claude Code sessionsCODE — Claude Code adds org default models, readable session names, and clickable file attachmentsMODEL — Claude Sonnet 5 is the default across all plans at $2/$10 per million tokens through August 31FABLE 5 — Claude Fable 5 returns worldwide from July 1 after export controls lift, with a new cybersecurity classifierLIMITS — Claude Code weekly usage limits are up 50% through July 13; Claude Science applications close July 15
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.

Claude43system 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-03-15
AI Partner — Intermediate Guide: Better Prompts, Memory Workarounds, and Multiple Personas
Ready to go deeper? Learn how to write tighter system prompts, work around Claude's memory limits, prevent character breaks, and run multiple AI personas for different parts of your life.
Claude.ai2026-07-04
Claude in Chrome Went GA and I Stopped Babysitting the Tab — Where Background Notifications and Handoff Actually Help
Claude in Chrome's general availability adds background notifications, draft handoff, and better failover. As someone who hands browser work to it daily in solo development, here's what to notify on, what to leave running, and the settings I actually changed.
Claude.ai2026-06-29
Three Ways to Start with Claude — Browser, Desktop, and Mobile, and How to Use Each
A clear walkthrough for getting started with Claude on the browser, desktop app, and iPhone/Android — plus how to combine all three so your day flows smoothly. Written from the perspective of a solo app developer who lives across all three.
📚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
See all →