artifactEngineering & architecture

System Prompt

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

Download Markdown (.md)

01What 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.[1][2]

02Why 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.

03When 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.

04How 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.

05A practical example

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.

06Where 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.

07Sources

  1. The Instruction HierarchyOpenAI Model Spec · Official specificationThe Instruction Hierarchy
  2. System Prompt LeakageOWASP GenAI Security Project · Security guidanceSystem Prompt Leakage
View saved topics

Start typing to search titles, definitions, categories, and frameworks.