{"course":{"slug":"context-engineering","title":"Context Engineering","url":"https://addaly.com/learn/context-engineering","level":"advanced","track":"build"},"lesson":{"slug":"repeating-the-instruction","title":"Saying it twice without saying two things","url":"https://addaly.com/learn/context-engineering/repeating-the-instruction","position":35,"of":87,"minutes":8,"answer":"Restate only the gating constraints (output contract, grounding, refusal) next to the question, render both copies from one source of truth so they cannot drift apart.","keyIdea":"Restate only the gating constraints (output contract, grounding, refusal) next to the question, render both copies from one source of truth so they cannot drift apart, and remember that a validator or a constrained decoder is a guarantee where a repeated instruction is only a nudge."},"body":{"format":"markdown","text":"## Repetition is a tool with a specific failure mode\n\nRestating a constraint near the question works. The cost is small and the effect on adherence at long context is often large. The danger is not the tokens; it is that you now have two statements of the same rule in two places, maintained by different people at different times.\n\nSix months later the system prompt says \"answer in at most three sentences\" and the trailing reminder says \"be thorough\". The model resolves the contradiction however it likes, and the behaviour looks random because nobody has read both strings in the same sitting.\n\n## One source of truth, two renderings\n\nThe fix is structural rather than editorial. Keep the constraints as data, and render both copies from them.\n\n```python\nCONSTRAINTS = {\n    \"format\": \"Reply as JSON matching the Answer schema. No prose outside it.\",\n    \"grounding\": \"Use only the numbered passages. Cite each claim as [n].\",\n    \"refusal\": \"If the passages do not answer the question, return \\\"insufficient\\\".\",\n}\n\nsystem = SYSTEM_TEMPLATE.format(**CONSTRAINTS)             # full version, top\nreminder = \"\\n\".join(CONSTRAINTS[k] for k in REMIND_AT_END)  # subset, bottom\n```\n\nNow the two cannot disagree, and choosing what to repeat is a one-line configuration change you can run an experiment on.\n\n## What is worth repeating\n\nNot everything. The reminder is paid on every request and it competes for the same attention it is trying to win.\n\nRepeat:\n\n- **The output contract.** The single most fragile instruction at long context, and the cheapest to verify, so also the easiest to measure.\n- **The grounding rule.** \"Only use the passages\" degrades with distance in exactly the way you would expect, and its failure is a fabricated answer.\n- **The refusal condition.** Because it fires rarely, it is the instruction the model has least recent evidence of.\n\nDo not repeat: the role, the tone, the background, the examples, the policy list. These shape a whole answer rather than gating a specific behaviour, and they survive distance better.\n\n## The order inside the reminder\n\nIf you are repeating three lines directly before generation begins, the last one has the strongest position of anything in the entire request. Put the constraint that is violated most often there.\n\nWhich one that is, you know from your own failure log rather than from a guess. If 60% of your bad outputs are format violations, the format line goes last. This is a two-minute change that is worth the two minutes.\n\n## The sandwich has a limit\n\nStating something at the top and the bottom helps. Stating it four times through the context does not help proportionally, and past a point it hurts: the repeated block is text competing with your evidence, and a model reading the same rule five times in different phrasings can treat the variations as different rules.\n\nTwo placements is the sensible ceiling. If two are not enough, the problem is usually not repetition: it is that the instruction is ambiguous, or that it contradicts something else in the prompt, or that the task needs a schema-constrained decoder rather than a request.\n\n## Prefer a mechanism to a repetition\n\nThe honest hierarchy, strongest first:\n\n1. **Make it structurally impossible.** Constrained decoding or a tool schema for output format. The model cannot emit invalid JSON if the decoder will not sample it.\n2. **Validate and retry.** Parse the output, and on failure send it back with the specific error. Cheap, deterministic, and it turns a soft instruction into a hard guarantee.\n3. **Repeat the instruction near the question.** This lesson.\n4. **Word the instruction more firmly.** Weakest, and where most teams spend their time.\n\nRepetition is worth doing because it is nearly free and it reduces how often the first two have to fire. It is not a substitute for either. A system whose format correctness depends on an instruction being remembered is a system that will produce a malformed answer during your busiest hour.\n\n## Measure adherence, not vibes\n\nThe experiment is cheap because the outcome is machine-checkable. Run your evaluation set with and without the reminder, and count schema validation failures, missing citations and refusals-that-should-have-happened.\n\nA typical result at long context is a meaningful drop in format violations and no change in answer quality, which is exactly what you want from 40 tokens. If you see no change at all, your context is probably short enough that this whole lesson does not apply to you yet, and knowing that is worth the run."},"check":{"question":"A team repeats its full 900-token system prompt after the retrieved passages. Format violations fall slightly, but answers become inconsistent in tone and occasionally contradict the policy. What went wrong?","options":[{"text":"The repeated block invalidated the prefix cache, so the model received a different prompt than before.","correct":false,"tempting":"Caching changes cost and latency, not content; the model sees the same tokens whether or not they were cached."},{"text":"Repetition past two placements always degrades adherence, so the second copy should be removed entirely.","correct":false,"tempting":"Overcorrects to a rule the evidence does not support; a targeted short reminder is a second placement and it helps."},{"text":"Repeating everything puts a large competing block between the evidence and the question, and duplicated shaping instructions can be read as distinct rules.","correct":true},{"text":"The system prompt lost its role weighting when copied into a user message.","correct":false,"tempting":"Role weighting is real but would weaken the copy rather than produce contradictions between two copies."}]},"prev":{"slug":"where-the-instruction-goes","title":"Top, bottom, or both","url":"https://addaly.com/learn/context-engineering/where-the-instruction-goes"},"next":{"slug":"delimiters-and-boundaries","title":"Marking where one thing ends","url":"https://addaly.com/learn/context-engineering/delimiters-and-boundaries"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Exam keys checked blind by a second model: 3,665 of 3,666 agreed. Academic review invited.","review":{"status":"Draft, open for academic review"},"cite":"Addaly (2026) 'Saying it twice without saying two things', in Context Engineering. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/context-engineering/repeating-the-instruction (Accessed: 13 October 2026).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"Saying it twice without saying two things","courseTitle":"Context Engineering","module":{"index":4,"slug":"position-and-order","title":"Position, order and what the model actually reads"},"answer":null,"keyIdea":"Restate only the gating constraints (output contract, grounding, refusal) next to the question, render both copies from one source of truth so they cannot drift apart, and remember that a validator or a constrained decoder is a guarantee where a repeated instruction is only a nudge.","hero":{"kind":"plate","image":null,"alt":null,"caption":null},"blocks":[{"t":"h2","id":"repetition-is-a-tool-with-a-specific-failure-mode","runs":[{"text":"Repetition is a tool with a specific failure mode"}]},{"t":"p","runs":[{"text":"Restating a constraint near the question works. The cost is small and the effect on adherence at long context is often large. The danger is not the tokens; it is that you now have two statements of the same rule in two places, maintained by different people at different times."}]},{"t":"p","runs":[{"text":"Six months later the system prompt says “answer in at most three sentences” and the trailing reminder says “be thorough”. The model resolves the contradiction however it likes, and the behaviour looks random because nobody has read both strings in the same sitting."}]},{"t":"h2","id":"one-source-of-truth-two-renderings","runs":[{"text":"One source of truth, two renderings"}]},{"t":"p","runs":[{"text":"The fix is structural rather than editorial. Keep the constraints as data, and render both copies from them."}]},{"t":"code","lang":"python","label":"Python","text":"CONSTRAINTS = {\n    \"format\": \"Reply as JSON matching the Answer schema. No prose outside it.\",\n    \"grounding\": \"Use only the numbered passages. Cite each claim as [n].\",\n    \"refusal\": \"If the passages do not answer the question, return \\\"insufficient\\\".\",\n}\n\nsystem = SYSTEM_TEMPLATE.format(**CONSTRAINTS)             # full version, top\nreminder = \"\\n\".join(CONSTRAINTS[k] for k in REMIND_AT_END)  # subset, bottom"},{"t":"p","runs":[{"text":"Now the two cannot disagree, and choosing what to repeat is a one-line configuration change you can run an experiment on."}]},{"t":"h2","id":"what-is-worth-repeating","runs":[{"text":"What is worth repeating"}]},{"t":"p","runs":[{"text":"Not everything. The reminder is paid on every request and it competes for the same attention it is trying to win."}]},{"t":"p","runs":[{"text":"Repeat:"}]},{"t":"ul","items":[[{"text":"The output contract.","b":true},{"text":" The single most fragile instruction at long context, and the cheapest to verify, so also the easiest to measure."}],[{"text":"The grounding rule.","b":true},{"text":" “Only use the passages” degrades with distance in exactly the way you would expect, and its failure is a fabricated answer."}],[{"text":"The refusal condition.","b":true},{"text":" Because it fires rarely, it is the instruction the model has least recent evidence of."}]]},{"t":"p","runs":[{"text":"Do not repeat: the role, the tone, the background, the examples, the policy list. These shape a whole answer rather than gating a specific behaviour, and they survive distance better."}]},{"t":"h2","id":"the-order-inside-the-reminder","runs":[{"text":"The order inside the reminder"}]},{"t":"p","runs":[{"text":"If you are repeating three lines directly before generation begins, the last one has the strongest position of anything in the entire request. Put the constraint that is violated most often there."}]},{"t":"p","runs":[{"text":"Which one that is, you know from your own failure log rather than from a guess. If 60% of your bad outputs are format violations, the format line goes last. This is a two-minute change that is worth the two minutes."}]},{"t":"h2","id":"the-sandwich-has-a-limit","runs":[{"text":"The sandwich has a limit"}]},{"t":"p","runs":[{"text":"Stating something at the top and the bottom helps. Stating it four times through the context does not help proportionally, and past a point it hurts: the repeated block is text competing with your evidence, and a model reading the same rule five times in different phrasings can treat the variations as different rules."}]},{"t":"p","runs":[{"text":"Two placements is the sensible ceiling. If two are not enough, the problem is usually not repetition: it is that the instruction is ambiguous, or that it contradicts something else in the prompt, or that the task needs a schema-constrained decoder rather than a request."}]},{"t":"h2","id":"prefer-a-mechanism-to-a-repetition","runs":[{"text":"Prefer a mechanism to a repetition"}]},{"t":"p","runs":[{"text":"The honest hierarchy, strongest first:"}]},{"t":"ol","start":1,"items":[[{"text":"Make it structurally impossible.","b":true},{"text":" Constrained decoding or a tool schema for output format. The model cannot emit invalid JSON if the decoder will not sample it."}],[{"text":"Validate and retry.","b":true},{"text":" Parse the output, and on failure send it back with the specific error. Cheap, deterministic, and it turns a soft instruction into a hard guarantee."}],[{"text":"Repeat the instruction near the question.","b":true},{"text":" This lesson."}],[{"text":"Word the instruction more firmly.","b":true},{"text":" Weakest, and where most teams spend their time."}]]},{"t":"p","runs":[{"text":"Repetition is worth doing because it is nearly free and it reduces how often the first two have to fire. It is not a substitute for either. A system whose format correctness depends on an instruction being remembered is a system that will produce a malformed answer during your busiest hour."}]},{"t":"h2","id":"measure-adherence-not-vibes","runs":[{"text":"Measure adherence, not vibes"}]},{"t":"p","runs":[{"text":"The experiment is cheap because the outcome is machine-checkable. Run your evaluation set with and without the reminder, and count schema validation failures, missing citations and refusals-that-should-have-happened."}]},{"t":"p","runs":[{"text":"A typical result at long context is a meaningful drop in format violations and no change in answer quality, which is exactly what you want from 40 tokens. If you see no change at all, your context is probably short enough that this whole lesson does not apply to you yet, and knowing that is worth the run."}]}],"check":{"question":[{"text":"A team repeats its full 900-token system prompt after the retrieved passages. Format violations fall slightly, but answers become inconsistent in tone and occasionally contradict the policy. What went wrong?"}],"options":[{"text":[{"text":"The repeated block invalidated the prefix cache, so the model received a different prompt than before."}],"correct":false,"tempting":[{"text":"Caching changes cost and latency, not content; the model sees the same tokens whether or not they were cached."}]},{"text":[{"text":"Repetition past two placements always degrades adherence, so the second copy should be removed entirely."}],"correct":false,"tempting":[{"text":"Overcorrects to a rule the evidence does not support; a targeted short reminder is a second placement and it helps."}]},{"text":[{"text":"Repeating everything puts a large competing block between the evidence and the question, and duplicated shaping instructions can be read as distinct rules."}],"correct":true,"tempting":null},{"text":[{"text":"The system prompt lost its role weighting when copied into a user message."}],"correct":false,"tempting":[{"text":"Role weighting is real but would weaken the copy rather than produce contradictions between two copies."}]}],"order":[3,1,0,2],"why":null},"prev":{"slug":"where-the-instruction-goes","title":"Top, bottom, or both","minutes":8},"next":{"slug":"delimiters-and-boundaries","title":"Marking where one thing ends","minutes":8}}}