What is a system prompt?
A system prompt is the set of instructions an application sends to a language model ahead of the conversation, defining its role, rules, tool guidance and output format for every turn that follows.
Chat APIs separate the instructions an application sets from the messages a user sends. The system prompt is the first part: it tells the model who it is working for, what it may and may not do, how to use its tools and what a good answer looks like. Anthropic's prompting guidance notes that setting a role in the system prompt focuses the model's behaviour and tone, and that even a single sentence makes a difference.
In an agent, the system prompt is also the most expensive text in the run, because it is sent on every turn. What goes into it, and what is left out, is a large part of context engineering.
Writing one at the right altitude
Anthropic's "Effective context engineering for AI agents" (September 2025) describes a target between two failure modes: hard-coded if-else logic that breaks on the first unexpected case, and guidance so vague the model has nothing concrete to follow. The useful middle states the goal, the constraints and the reasoning behind them, with a few examples.
Newer models follow instructions more literally. Anthropic's guidance notes that Claude Opus 4.5 and Opus 4.6 respond more strongly to the system prompt than earlier models, and suggests replacing shouted rules such as "CRITICAL: You MUST" with plain instructions, because forceful wording written for older models can now cause overtriggering.
Common mistakes
The Frankenprompt
Anthropic's October 2026 article on folding subagents into one loop warns against a system prompt bloated with every team's conflicting rules. Procedures used only sometimes belong in skills loaded on demand.
Documents pasted in
Large reference material in the system prompt costs tokens on every call. Retrieval or a tool that fetches it when needed is cheaper and keeps the window clear.
Treating it as security
A system prompt cannot stop prompt injection or protect secrets. Credentials and permissions belong in code, sandboxes and scoped tools.
Editing without tests
A one-line change can shift behaviour across thousands of cases. System prompt edits need a regression eval like any code change.
Caching and change control
Because the system prompt is identical across calls, it is the natural prefix for prompt caching, which cuts the cost of resending it. Changing it invalidates the cache, which is one more reason to version it and change it deliberately rather than tweak it in production.
How Motiontic's engineers apply it
Motiontic's engineers keep client system prompts short and versioned in the repository, move procedures into skills or tools, keep secrets and permissions out of the prompt entirely, and run the regression suite on every edit.
What belongs in a system prompt
| Content | Where it belongs | Why |
|---|---|---|
| Role, goal and tone | System prompt | Applies to every turn |
| Hard rules and escalation triggers | System prompt, enforced again in code | The prompt guides; code guarantees |
| A few worked examples | System prompt | Examples steer format reliably |
| Long reference documents | Retrieval or a fetch tool | Avoids paying for them on every call |
| Occasional procedures | Skills loaded on demand | Keeps the prompt small |
| Secrets and permissions | Code, vaults and sandboxes | A prompt is not a security boundary |
Common questions
What is a system prompt in AI?
The instructions an application gives a language model before the conversation, setting its role, rules, tool guidance and output format. The user usually never sees it.
What is the difference between a system prompt and a user prompt?
The system prompt is written by the application and applies to the whole conversation. A user prompt is a single message from the person using it.
Can a system prompt be kept secret?
Not reliably. Models can be coaxed into revealing it, so nothing sensitive such as keys, internal URLs or private rules that would cause harm if read should be placed in one.
How long should a system prompt be?
As short as it can be while still stating the goal, constraints and examples. Material needed only sometimes should load on demand through retrieval, tools or skills.
Related
Context engineering
Curating everything in the model's view, not just the wording of the prompt.
Prompt injection
Untrusted text that hijacks a model's instructions, and how agents are built to survive it.
Prompt caching
Paying less for the part of the prompt that does not change between calls.
Few-shot prompting
Teaching a model the task by showing a few examples, not by retraining it.
AI agent development
Agents that do real work for users, with the evals, traces and guardrails to keep them in production.
Right altitude (system prompts)
Specific enough to steer, general enough not to break: the target for a system prompt.
Running agents that have to hold up?
Describe the agent, the systems it touches and what it must never get wrong. The first call is with a lab engineer, who will say plainly whether it is ready for production, and whether Motiontic is the right team.