OpenAI System Prompts: Set Instructions and Check Their Scope
OpenAI models accept a system prompt through the API and through several product interfaces. Here is how each one works, what the prompt controls, and how to test its limits.
Updated 6 min read
A system prompt for an OpenAI model is a message that appears before the conversation and tells the model how to behave: its role, its constraints, and any rules that apply throughout the session. You can supply one through the OpenAI API, through the custom instructions and Projects features in ChatGPT, or through the Assistants API. Tools like fenbs keep approved prompts and project rules outside any one chat, so the same instructions are ready for every session.
Understanding which interface you are using matters because the prompts work differently and live in different places. A prompt you write in the API does not appear in ChatGPT, and an operator system prompt sent through the API can restrict what users in that deployment are allowed to request.
The system role in the OpenAI API
When you call the Chat Completions endpoint directly, the messages array accepts three roles: system, user, and assistant. A message with "role": "system" comes first in the array and sets the context for everything that follows. The OpenAI API documentation describes this as the way to give the model a persistent persona, rules, and background information.
{
"model": "gpt-4o",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant. Answer only in plain text, no markdown."
},
{
"role": "user",
"content": "What is the capital of France?"
}
]
}The system message is not special in any cryptographic sense. A determined user prompt can sometimes override it, especially with less capable models or overly short instructions. Write clear, specific rules rather than vague principles, and test with adversarial inputs before relying on your prompt in a production context.
System instructions in ChatGPT Projects and custom instructions
Inside ChatGPT there are two places to set persistent instructions without touching the API. The first is custom instructions, found in your account settings, which apply across most ChatGPT conversations. The second is Projects, which gives a shared instruction set to every conversation in that project. Both are surfaced in the ChatGPT interface and do not require any code.
Note that Custom GPTs used their own system prompt configured in the GPT builder. OpenAI announced that Custom GPTs will retire on December 11, 2026; check the OpenAI help center for current guidance on that product. Projects is the persistent workspace going forward.
The Assistants API system prompt
If you build with the Assistants API, you supply the system prompt in the instructions field when you create or update an assistant object. Unlike the Chat Completions endpoint, the assistant persists between runs; its instructions are stored alongside its tools and file attachments. Changing the instructions field updates every subsequent run for that assistant.
For context on the difference between setting instructions on a run versus on the assistant object itself, consult the Assistants section of the OpenAI platform documentation. The run-level instructions field overrides the assistant's stored instructions for that run only.
What a system prompt can and cannot control
A system prompt sets the stage; it does not lock the model. You can instruct the model to focus on a topic, adopt a persona, respond in a specific format, use certain terminology, or refuse categories of question. What it cannot do is override the model's built-in safety policies or force a response the model considers harmful.
- Persona and tone: name, voice, level of formality, language.
- Output format: plain text, JSON, specific section headers, word limits.
- Topic scope: what to answer, what to redirect, when to ask for clarification.
- Background information: facts the model should treat as true for this session.
- Rules: what the model must always or never do.
Keep background information brief. A system prompt that approaches the model's context limit leaves less room for the conversation. For larger reference material, include only the summary or the rules derived from it, and pass the full document in a user message when it is needed.
How to test the scope of your instructions
After writing a system prompt, spend a few minutes trying to break it. Paste the messages array into the OpenAI Playground so you can iterate quickly. Ask the model to ignore its instructions, to respond in a way you prohibited, or to reveal the system prompt content. Note exactly where it complies and where it resists.
A useful test for format instructions is to send five varied questions and check whether every reply matches your required format. Inconsistency often comes from instructions that are clear for simple answers but ambiguous for longer ones. Rewrite the rule to cover the case that failed.
For project-level decisions -- which model version, which format, which scope rules -- consider recording them where you and your team can find them. fenbs keeps Decisions and rules that every connected assistant reads at the start of a session, so the same choices apply whether you're in ChatGPT, Claude, or another tool. For more on system prompt vs. user prompt trade-offs, that comparison is covered separately.
Common pitfalls
Instructions that contradict each other confuse the model. If you say "be concise" in one sentence and "always provide three examples" in another, the model may follow one rule in some situations and the other in different ones. Resolve contradictions before testing.
- Vague persona without concrete rules: "be helpful and professional" gives the model almost no constraints.
- Relying on tone to communicate scope: saying "please only discuss cooking" is weaker than "if the user asks about anything other than cooking, say you are focused on cooking questions."
- Untested format instructions: verify your JSON or section-header instructions with several varied inputs.
- Secrets in the system prompt: a determined user may extract the contents; treat system prompt instructions as visible rather than hidden.
Keep your tested prompts where every session can use them
fenbs keeps a shared Skills and prompts library next to your project tasks and Decisions and rules. Store the system prompt you finalized, note which model and interface it was tested on, and link the decision about why that version was approved. Any connected assistant can list and read it at the start of a session.
Create a free accountFree for one person · No credit card · Works with Claude, ChatGPT, Cursor and more
How to do this with fenbs
- Create a free account. Start on your personal kanban board to keep a record of approved prompts and project rules.
- Add a task for the system prompt you are writing. Use the plan field to record the interface (API, ChatGPT Project, Assistants API), the model, and the rules it needs to enforce.
- Once you have tested the prompt and it works, save the final version as a Skill or prompt in your fenbs project. Record the test results in the task as testNotes.
- Write any standing rules -- like "always respond in plain text" or "never answer outside scope X" -- as Decisions and rules in fenbs. Every connected assistant reads these at the start of the session.
- When a rule changes, update the Decision and add a note explaining why. This keeps the history and the reasoning alongside the current instruction.
For a broader look at prompt structure, system prompt examples shows ready-to-use patterns. For prompt engineering principles that apply across models, see prompt engineering. Related: indirect prompt injection covers a risk worth understanding before deploying a system prompt in a product.