Zenaique

When does it pay to repeat key instructions near the bottom of the user turn instead of trusting the system prompt?

Flashcard·Medium·4.0 · 0·~30s·Asked atCapgeminiOracleSigmoid
Attempt it
TL;DR

Mirror one or two critical rules at the bottom of the user turn to exploit the recency slot and punch through the lost-in-the-middle trough, while keeping the bulk of the policy in the cached system prompt.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

Imagine a meeting where you spent 20 minutes laying out the agenda at the start, then talked through a long set of slides, then asked the team to act. The agenda is at the top, the slides are in the middle, and the action ask is at the bottom. By the time people are about to act, the slides are fresh in their minds and the agenda is fading. So when you really need them to remember one specific rule, you say it again right before the action. A prompt works the same way. The system prompt is the start of meeting agenda. The retrieved chunks are the slides. The user turn is the action ask. Repeating the critical rule right before the model generates is the equivalent of saying "and remember, this one thing matters most" right before people start working.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

Where you put an instruction in a prompt matters as much as what the instruction says. Position controls how strongly the model attends to a rule during generation, and the strongest position is the bottom of the input immediately before the model starts producing tokens. Experienced context engineers use this fact deliberately by mirroring one or two critical rules at the bottom of the user turn, even though those rules are already stated in the system prompt at the top.

This deep dive walks through the two attention effects that make this pattern work, the two situations where the pattern earns its tokens, and the discipline around using it without making the prompt worse.

Recency, primacy, and the lost-in-the-middle trough

Three position effects shape how a model attends to instructions in a long prompt.

Recency is the strongest. The next-token prediction depends most strongly on tokens immediately before the generation start. This is partly architectural (autoregressive decoding plus self-attention compounds the weight of recent positions) and partly a training-distribution property (real text correlates next tokens with what was just said). Whatever the precise mechanism, the empirical result is that instructions in the recency slot are the hardest for the model to ignore.

Primacy is the second-strongest position. The top of the prompt has high attention weight because the model has to establish the framing for everything that follows. This is why system prompts at the top of the input are reasonably effective, even though they are far from the generation start: the model establishes the persona and the rules early.

The middle is the weakest position. The lost-in-the-middle effect, documented in the 2023 Liu et al. paper and replicated many times since, shows that key information placed in the middle of a long input is recalled significantly less reliably than the same information placed at the boundaries. The U-shape persists in 2026 long-context models, though aggregate benchmarks have improved; the trough never fully flattens.

A typical RAG or agent prompt arranges itself naturally into this shape. The system prompt sits at the top (primacy slot), accumulated retrieval or tool-call history fills the middle (the weak zone), and the user turn is at the bottom (recency slot). A critical rule stated only in the system prompt has to compete with everything in between to reach the model's attention at generation time. In a 32K-token prompt with the system prompt at position 0 and the user turn at position 31000, the system-prompt instruction is in a structurally weaker position than a freshly stated instruction at the bottom of the user turn.

When mirroring earns its tokens
Discipline: selectivity, source of truth, cache awareness
Composition with other position-engineering tricks
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.

Real products, models, and research that use this idea.

  • Anthropic's prompt engineering guide for Claude 4.7 recommends restating critical rules near the end of long prompts.
  • Cursor agent mode mirrors the 'only modify files in scope' rule at the bottom of every tool-call prompt.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QHow does this pattern interact with provider-side prompt caching (Anthropic, OpenAI, etc.)?
A

The cached portion of the prompt is typically the system prompt plus the long static retrieval block, depending on provider semantics. The mirrored rules at the bottom of the user turn live outside the cache boundary, so they cost a few extra tokens per call but do not invalidate the cache. This is the cost-aware way to deploy the pattern: the bulk of the prompt remains cache-friendly while the mirrored rule does its work at the recency slot.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Treating instruction repetition as a sign that the system prompt failed. The repetition is a deliberate use of the recency slot, not a workaround for a broken system prompt.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • Define the recency slot and explain why it gets the most attention weight

  • Define the lost-in-the-middle effect and explain when it dominates

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Pick the most effective intervention when an agent's context grows by 8KB every iteration
MCQ·Medium