In short
A system prompt is the standing instruction given to an AI model before any user message, telling it who it is, how to behave, what rules to follow and what format to use. Where a user prompt is the specific request you type, the system prompt is the persistent context that frames the entire conversation: the model role, tone, constraints and any tools or knowledge it should assume. It is set once by the developer (or by you in a settings file) and applies to every turn until it changes.
System prompt vs user prompt
The two work together but do different jobs. The system prompt is the configuration; the user prompt is the task. Models are trained to treat the system prompt as higher-priority, standing guidance, so it is where you put rules that should hold no matter what the user asks.
- System prompt: role, rules, tone, format, constraints. Set once, applies throughout.
- User prompt: the specific question or instruction for this turn.
- The model weighs the system prompt as persistent, higher-priority context.
What goes in a good system prompt
A strong system prompt states the role ("you are a senior TypeScript engineer"), the rules ("never use em dashes", "always run the tests"), the output format you expect, and any context the model should treat as given. Keep it clear and specific; vague system prompts produce vague behaviour. In agent tools, files like a project instructions file act as a system prompt that teaches the agent your conventions.
System prompts in agents
In an agent harness, the system prompt is part of what the harness assembles every turn, and it counts against the context window, so it should be focused rather than bloated. Subagents take this further: each subagent gets its own short, specialised system prompt tuned to its single task, which is one reason they behave reliably. Because the system prompt is sent on every request, it is also a prime candidate for prompt caching to cut cost.
