# 25.2 System or user: where an instruction goes (/building-ai-workers/prompts-and-structured-output/system-or-user)

---
type: Document
title: "25.2 System or user: where an instruction goes"
description: "The three positions for an instruction when code writes every turn, which one wins on a conflict, and where the invoice goes."
status: stable
order: 325.02
ksor:
  owner: team:panaversity
  audience:
    - public
  approval:
    by: process:panaversity
    at: 2026-11-30T00:02:23Z
chapter: '25'
part: III
expert_status: co-build
concepts: [ "25.2" ]
last_verified: '2026-11-29'
sources:
  - id: anthropic-prompting-best-practices
    title: Prompting best practices (verified 2026-11-29)
    resource: https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices
  - id: anthropic-mid-conversation-system-messages
    title: Mid-conversation system messages (verified 2026-11-29)
    resource: https://platform.claude.com/docs/en/build-with-claude/mid-conversation-system-messages
  - id: anthropic-working-with-messages
    title: Using the Messages API (verified 2026-11-29)
    resource: https://platform.claude.com/docs/en/build-with-claude/working-with-messages
  - id: openai-model-spec
    title: OpenAI Model Spec, 2026-10-29, The chain of command (verified 2026-11-29)
    resource: https://model-spec.openai.com/2026-10-29.html
generated:
  at: 2026-11-30T00:02:23Z
  by: esl-rewrite/1.2.0+ksor.1
trust_tier: unverified
build_id: sha256:cc6fd9ac5f72207d4365ecbda63d87d1b64f99e05519b358a45b9f5d9bfd6f8f
dirty: true
ksor_version: 0.0.60
---

**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".[^anthropic-mid-conversation-system-messages]

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](../../managing-ai-workers/the-four-part-brief/four-parts.md) 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.[^anthropic-prompting-best-practices]
- **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.[^anthropic-working-with-messages] 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 |

<!-- EDITOR: the table keeps how each position is written and how long it holds, and Figure 25.2, which the spec fixes, carries who speaks at each. The other option: cut the table and let the figure carry all of it. -->

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.[^anthropic-mid-conversation-system-messages] On the newest models, rebuilding it between requests also makes the model's earlier thinking (its own reasoning step, 25.4) unusable.[^anthropic-prompting-best-practices] 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.

<!-- OPEN: the spec says the mid-run form is shown with "one rule that applies to one run only" and does not name the rule. This draft uses the run date, after Lab 23 Task 18's first message ("The run date is Monday, April 5, 2027."). Confirm it, or name the rule in specs/labs. -->

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.[^anthropic-mid-conversation-system-messages]

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.[^anthropic-mid-conversation-system-messages]

On OpenAI the positions have other names. The application writes its rules in `developer` messages, and `system` means messages added by OpenAI (25.11).[^openai-model-spec]

### 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".[^anthropic-mid-conversation-system-messages] It goes in a tool result, which 25.5 builds. The model reads a tool result as data it asked for.

<!-- FIGURE 25.2: "Where an instruction goes." One request drawn as a tall box, read top to bottom, with a column on its left headed "who speaks". Row 1, at the top of the box, in gold: "the system prompt". Left label: "the operator (you, for Brightline)". Note inside: "rules for every invoice. Holds for the whole run." Row 2: "user turn". Left label: "the task, written by the portal's code". Note: "extract INV-8340". Row 3: "assistant turn: asks for the invoice". Row 4, drawn as a separate sheet that sits OUTSIDE the three instruction rows, with a dashed border and its own left label "a vendor wrote this": "tool result: the invoice, as data". Row 5, in gold: "mid-conversation system message". Left label: "the operator". Note: "a rule for this run only: the run date is Monday, April 19, 2027. Holds from here on. Must follow a user turn or a tool result." Beside row 5, a smaller gold box with a dashed outline: "turn-scoped form (beta): cleared at the next user turn". Row 6: "assistant turn: the answer". Three arrows, all pointing from the left column into the box: from "the operator" to row 1, from "the operator" to row 5 and its small box, and from "the task" to row 2. One arrow of a different color points from "a vendor wrote this" to row 4 only, and it touches none of rows 1, 2 or 5. On the right edge, one bracket over rows 1, 2 and 5 labeled "instructions: on a conflict, system wins", and one bracket over row 4 labeled "data, in none of them". Below: "The model is told who is speaking by position." -->

*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.

[^anthropic-mid-conversation-system-messages]: Mid-conversation system messages, Anthropic.
[^anthropic-prompting-best-practices]: Prompting best practices, Anthropic.
[^anthropic-working-with-messages]: Using the Messages API, Anthropic.
[^openai-model-spec]: OpenAI Model Spec, The chain of command, OpenAI.
