New Tool Radar

Local AI

How to Give Ollama a System Prompt for One Chat Only

Set a system prompt for a single Ollama chat with /set system, so it shapes only that session and never becomes a saved model.

Schematic diagram with three steps: start ollama run llama3.2, set a one-chat system prompt with /set system, then check it with /show system before asking a question.

Sometimes you want the model to answer in a particular way just once: briefly, as a named character, or in a fixed format. Building a custom model with a Modelfile is the permanent way to do that — the Ollama README shows a SYSTEM line in a Modelfile that sets the system message for every conversation with that model — but it is more work than a one-off chat needs. Inside a running ollama run chat, the command /set system sets the system prompt for that session only, and nothing is saved when you leave.

Set the system prompt inside the chat

Start a chat with a model you already have, for example ollama run llama3.2. Inside ollama run, lines starting with a slash configure the session instead of going to the model, and /? lists them. Type the system prompt as one line after /set system:

/set system You are a lighthouse keeper's logbook. Answer in one short sentence.

The system prompt in this example is fictional, written for the practice chat below. Check that it took effect with /show system, which displays the system message for the session. Then ask your question as a normal message. The next question you type goes to the model with that system prompt in place.

Try it: one chat, one voice, then back to normal

Ask the fictional question below, then leave the chat and start a fresh one to see the difference.

Step What you type What you should see
Start the chat ollama run llama3.2 The >>> prompt, ready for a message
Set the voice for this chat only /set system You are a lighthouse keeper's logbook. Answer in one short sentence. No reply from the model; the line configures the session
Check it /show system The system prompt you just set
Ask the question What does the keeper check first each morning? An answer in one short sentence, in the logbook voice
Leave /bye The chat ends; a new ollama run llama3.2 starts with no system prompt

Expected result. We checked the Ollama commands cheat sheet, which lists /set system as the session system prompt, and the Ollama README, which shows the Modelfile SYSTEM line for a permanent prompt. We did not run ollama run or set a system prompt on this machine, and the logbook prompt and question above are fictional.

Limits

A system prompt set with /set system lasts only for that chat session: leaving with /bye or closing the terminal ends it, and the next chat starts without it. If you want the same voice every time, save the session with /save or build a custom model with a Modelfile instead. The prompt also only steers the model; it cannot make the model know facts it does not have, and a model may still ignore the instruction. The slash commands in this guide come from a third-party cheat sheet that was checked against Ollama 0.40.14, not from Ollama’s own documentation, which documents /set parameter in its FAQ but does not list the full set of slash commands. We did not test any of this ourselves.

Sources

See all