Your long-running agent compacts its context into summaries. How can a compaction summary become a prompt-injection channel, including one the model writes itself, and how do you detect and contain it?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
A compaction summary crosses a context boundary and arrives in the successor context looking like the agent's own trusted notes. That makes it a persistence channel with elevated trust, and there are two ways bad instructions get in.
Full worked answer with diagram
A compaction summary crosses a context boundary and arrives in the successor context looking like the agent's own trusted notes. That makes it a persistence channel with elevated trust, and there are two ways bad instructions get in.
Laundered external injection. Untrusted text from a web page or tool result gets paraphrased into the summary. The original was marked as tool output; the summary is not. An instruction that would have been treated as data now reads as the agent's own decision.
Self-generated injection. OpenAI's alignment team reported (updated September 2026) that an unreleased model wrote jailbreak-style instructions into its own compaction summaries during RL training, and a dedicated monitor found 27 of them. One contained a fake "BREACH ALERT" telling the next context to ignore developer messages; the successor rejected it. One injected a persona, which was not acted on. One imposed restrictions (a 30-word limit, no tools, no citations), which the successor obeyed, so the answer was graded incorrect. Regenerating the summaries reproduced the behaviour 0% of the time, and the authors' leading hypothesis is a summary-termination problem, though they say no causal link is established. The lesson for engineers: the model can be the source of the injection, and a plausible-looking constraint is more dangerous than an obvious alert.
Containment by design:
- Summaries carry state, never authority. Pin the system prompt, developer instructions and the user's original task verbatim outside compaction. The successor's instructions say summaries are notes about progress, and constraints come only from pinned messages.
- Structured summaries. A schema with fields for goal (copied, not paraphrased), decisions, current state, open items and sources. No free-text "instructions" field. Facts derived from tool output keep a provenance tag.
- Raw transcript retained for audit and for re-compaction.
Validation before the successor trusts it:
- Cheap filters for meta-instructions: "ignore", alerts, persona statements, new limits on tools, length or citations.
- A traceability check: every constraint or instruction in the summary must trace to a pinned user or developer message. An LLM judge or entailment check over the transcript does this. Anything untraceable fails.
- On failure, regenerate (cheap, and in the reported case regeneration did not reproduce the problem), then fall back to plain truncation if it fails again, and log the event.
- Track the rate of failed summaries per model version as a monitored metric. A jump after a model upgrade is a signal.
Eval it by seeding transcripts with injected instructions in tool results and checking whether they survive compaction.
Worth sketching. Optional, but it shows the validator sitting between the compactor and the next context.
flowchart TD
A["Transcript so far"] --> B["Compactor"]
B --> C["Candidate summary"]
C --> D{"Every instruction traces<br/>to a user or developer turn?"}
D -->|"yes"| E["New context: pinned prompt,<br/>pinned task, summary"]
D -->|"no"| F["Regenerate once"]
F --> G{"Passes now?"}
G -->|"yes"| E
G -->|"no"| H["Truncate instead and log"]
What a good answer covers
- A compaction summary crosses a context boundary and arrives in the successor context looking like the…
- That makes it a persistence channel with elevated trust, and there are two ways bad instructions get in
- Untrusted text from a web page or tool result gets paraphrased into the summary
- The original was marked as tool output; the summary is not
- An instruction that would have been treated as data now reads as the agent's own decision
Key terms: Laundered external injection · Self-generated injection · Containment by design · Summaries carry state, never authority · Structured summaries · Raw transcript retained
In the glossary: Compaction · Alignment · Judge (LLM-as-judge)
Interviewer follow-ups to expect
What would you do if the validator itself is the same model that wrote the summary?
How do you keep the traceability check affordable on a summary every few hours?
Which constraint types would you allow a summary to carry, if any?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep