# System Prompt

A system prompt is an application-supplied instruction layer that sets intended model behavior, context, and constraints across an interaction.

- Type: artifact
- Domain: Engineering & architecture
- Level: Intermediate
- Last reviewed: 2026-09-26
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/system-prompt/>)

## What it means

A system prompt is a higher-priority message or instruction supplied by an application before or alongside user input. It commonly defines role, task boundaries, response style, tool rules, and product context. Priority mechanisms vary by model API, and the system prompt remains text interpreted by a model—not secret storage, executable policy, or an enforceable security boundary.

## Why it matters

System prompts centralize product behavior that can affect every interaction. They need ownership, versioning, evaluation, and security review because a seemingly editorial change can alter refusal, disclosure, tool use, or output quality.

## When to use it

Use a system prompt for stable interaction-level guidance that the model must consider across user turns. Enforce permissions, data access, financial limits, workflow state, and safety-critical rules in code and infrastructure even when the prompt describes them too.

## How it works

1. Define durable product behavior separately from request-specific user input.
2. Write concise instructions with explicit task boundaries, uncertainty behavior, and output expectations.
3. Keep secrets and authorization data out; expose only the context required for the task.
4. Test instruction conflicts, extraction attempts, indirect injections, and tool-use edge cases.
5. Version the prompt with the model and evaluate changes before gradual release.

## A practical example

A benefits assistant's system prompt says to answer only from supplied policy evidence, cite it, and escalate when coverage is unclear. The application—not the prompt—checks account access, limits retrieved records, validates citations, and prevents the model from approving claims.

## Where it breaks

Models can misunderstand, reveal, or fail to follow system instructions, especially when context is long or adversarial. Exact precedence differs across providers. Concealment offers no reliable protection, and prompt text cannot authorize an action or prevent data access that architecture already permits.

## Common mistakes

- Putting credentials, private policy, or sensitive user data in a system prompt.
- Assuming users can never recover or infer the prompt.
- Using natural-language prohibitions instead of least privilege and deterministic checks.
- Editing a global prompt without regression tests across affected journeys.

## Sources

1. [The Instruction Hierarchy](<https://model-spec.openai.com/2025-09-12.html#the-instruction-hierarchy>) — OpenAI Model Spec · Official specification
2. [System Prompt Leakage](<https://genai.owasp.org/llmrisk/llm072025-system-prompt-leakage/>) — OWASP GenAI Security Project · Security guidance

## Related topics

- [Prompt](<https://wiki.soroush.uk/topic/prompt/>)
- [Prompt Injection](<https://wiki.soroush.uk/topic/prompt-injection/>)
- [Tool Calling](<https://wiki.soroush.uk/topic/tool-calling/>)
