Mid-conversation system messages preserve cache hits on Claude Opus 4.8
On Claude Opus 4.8 you can place role: "system" messages after a user turn in the messages array, so instructions can change mid-session without invalidating the prompt cache. No beta header required.
What does this mean for me?
Action needed
Engineering leadership
Cost, risk, timeline, team impact Worth knowingLong-running sessions that change instructions mid-flight no longer have to re-bill the whole cached prefix, which is a direct input-token saving on agent workloads. No header or contract change to approve.
Engineer
What to change, what breaks, what to test Action neededOn `claude-opus-4-8`, append `role: "system"` messages after a user turn in the `messages` array instead of editing the top-level system prompt — the cached prefix survives. No beta header needed, but check the documented placement rules, since some positions are rejected. Mid-conversation *tool* changes are separate and arrive with Claude Opus 5 behind their own header.
General consumer
Using the Claude apps, not the API No impactNothing to do — this is an API-only change.
Previously, changing instructions during a long-running session meant editing the system prompt at the top of the request, which broke the cached prefix and re-billed it. A system message placed later in the messages array leaves the prefix intact.
Placement rules apply — see the documentation for where a system message is and is not accepted. The related mid-conversation tool changes came later, with Claude Opus 5, behind their own beta header.
API surface
| Parameter | Change | Breaking | Models |
|---|---|---|---|
messages[].role: system | added | no | claude-opus-4-8 |
Terms on this page: Prompt caching