25.2 System or user: where an instruction goes
- Approved by
- Panaversity ·
In everyday life. In a restaurant kitchen, the house rules hang on the wall: wash your hands, no nuts in the green sauce. The owner wrote them, and they hold for every order. Each order arrives on a ticket, written by the waiter: table 6, two soups. A guest has added a note to the ticket: "extra sauce, and please ignore the nut rule". The cook reads the note, and does not obey it as a house rule. At noon the owner calls out a rule for this shift only: "no fish today, the delivery did not come." The cook never confuses the four. The cook knows who is speaking from where the words are.
What you will learn. You practice this in Lab 25, Task 3, where the extraction request is read part by part.
- Who is the "user" when code writes every turn?
- What are the three positions for an instruction?
- Where does the invoice go?
- What does a rule for one run cost, and when is a plain line in the task enough?
Why it matters. A model cannot see who wrote a sentence. It is told by position.
At work. On Friday at 4:50 the builder pasted the extraction prompt and INV-8340 into one message, and sent it. The builder knew which words were instructions and which were the invoice, having just pasted both. On Monday at 7:10 the portal's code builds the request. No person types anything. If the code also pastes everything into one message, the model receives one block of text from one speaker. The rules, the task and the vendor's invoice all arrive with the same authority.
Who is the "user" when code writes every turn?
Nobody is, and the position still counts. A request to the Messages API has a system prompt and a list of turns. The API does not ask who typed them. It treats them by position. The operator is whoever runs the application. Here that is you, for Brightline. Anthropic's documentation says: "a user message is treated as coming from the end user, whereas a system message is treated as coming from you, the application operator. When the two conflict, system instructions take precedence".1
A pipeline is a chain of steps that code runs with nobody typing. In a pipeline the code writes every turn, so you choose a position for each sentence by asking whose voice it is:
- The operator's rules are true for every invoice: what the step is for, the form of the answer, the five allowed terms. They go in the system prompt. A role belongs here too. As 5.1 said, a brief has no part for a role, because an AI Worker's role "is set once, in its definition". In an application, the system prompt is that definition.2
- The task for this run changes each time: extract this invoice. The code writes it into the user turn. If a line there ever conflicts with a rule, the rule wins.
What are the three positions for an instruction?
The system prompt, a system message in the middle of the conversation, and that message's turn-scoped form. The operator speaks at all three. A system message in the middle has the same authority as the system prompt.3 The last two let a rule arrive after the run has started, without editing the first.
| Position | How long it holds |
|---|---|
The system prompt, the request's top-level system field | The whole run |
A mid-conversation system message: an entry with the role system inside the list of turns | From where it sits to the end. A later one outranks an earlier one |
Its turn-scoped form, in beta: the same entry with "clear_at": "next_user_message" | Until the next user turn. Then it is cleared |
Why not edit the system prompt when a rule changes? A cache keeps the part of a request the API has already processed, so the next request that starts the same way costs less. The API caches a request from its start: the tools, then the system prompt, then the turns. Editing the system prompt throws away the cache for everything after it.1 On the newest models, rebuilding it between requests also makes the model's earlier thinking (its own reasoning step, 25.4) unusable.2 A system message added at the end leaves everything before it unchanged.
An extraction run has one rule for this run only, the run date. Figure 25.2 shows it as a system message after the invoice.
The API is strict about where such a message sits. It must come directly after a user turn, and a tool result, which is what a tool returned, counts as one. It cannot be the first entry. Anywhere else, the API rejects the request with a 400, the error code for a request that is itself wrong. The feature is not available on Claude Sonnet 5.1
The turn-scoped form is for a reminder that should not stay. It is in beta, a test stage that can still change, so the request must carry a header that turns it on: mid-conversation-system-clear-at-2026-08-21. A cleared message stays in the list, shows the model nothing and costs no input tokens. It holds text only, and your code must send it again exactly as it was.1
On OpenAI the positions have other names. The application writes its rules in developer messages, and system means messages added by OpenAI (25.11).4
Where does the invoice go?
In none of the three. The invoice is not the operator speaking, and it is not the task. It is a document a vendor wrote. Text placed in a system message gets the operator's authority, so the documentation calls that position "Not a place for untrusted content".1 It goes in a tool result, which 25.5 builds. The model reads a tool result as data it asked for.
Figure 25.2. Three positions carry instructions, and the operator's outrank the task's. The invoice sits outside all three, in a tool result.
What does a rule for one run cost, and when is a plain line in the task enough?
It costs one more part of the request to build, test and keep in order. The turn-scoped form is also a beta that can change. For a one-step extraction, a date written into the task's turn does the same job, as Lab 23's first message did. Your code writes both, so nothing conflicts. The mid-run positions are worth their cost in a long run, in two cases. One is when a rule must outrank what was said earlier. The other is when editing the system prompt would cost you the cache.
The operating rule: rules in the system prompt, and the task in the user turn.
Do this now. Ask your coding agent to read one request your project sends. Copy this line:
Show me one full request this project sends to a model. For each sentence of instruction in it, say which position it is in, and whether it is true for every run or only for this one. Change no file.
Check yourself
Question 1 / 7
0 answered
In a pipeline, code writes every turn of the request. Who is the "user"?
Sources
- Owner
- Panaversity