Knaph

Depth 1 · 170 s

The hidden first message

The same model chats about anything in one app and only talks about orders in another. The difference is the system prompt, the app's own message at the start of every request.

About this video

Leila uses the same Claude model in two places: a chat app, where it will talk about anything, and a shop's help chat, where it politely refuses everything but orders and returns, and signs off with the shop's name. Same model, two personalities. Where does the difference come from?

A model keeps nothing between requests and sees only what is in the request, so the difference must be in the request: something the shop's app sends that hers doesn't. Before your first message, the app puts its own message at the very top, in every single request. That hidden first message is the system prompt. It usually says who the assistant is, its rules, how to answer, useful facts like today's date, and which tools it has.

A coding agent's system prompt is long, often thousands of tokens. It tells the model how to work on a project: read a file before changing it, keep changes small, check the result, be careful with commands that delete or send things. Much of how an agent behaves comes from here, and since it is in every request, it takes part of the context window before you type a word.

Models are trained to give the system prompt more weight than your messages, and your messages more weight than text that merely arrives, like a web page the agent has read. That order comes from training, not from a lock: cleverly written text can sometimes talk a model round, so a system prompt is not a security wall.

You can add to the start yourself: custom instructions in chat apps, and files of instructions that agents load at the start of every session. Keep them short and true every time: each line costs tokens on every request.

This video shows depth 1 of System prompt.

Learn System prompt

Transcript

  1. 0:00The same model, in two apps. In one, it writes you a poem. In a shop's help chat, it only talks about orders and returns. Where does the difference come from?
  2. 0:20The model keeps nothing between requests, and it sees only what's in the request. So if it behaves differently, the difference must be in the request. Something you never typed, and never see, comes first.
  3. 0:45That hidden first message is the system prompt. The app writes it and puts it at the start of every request, before the conversation. Who the assistant is. Its rules. How to answer. Useful facts, like today's date. And the tools it can use.
  4. 1:15A coding agent's system prompt is long, often thousands of tokens. Read a file before changing it. Keep changes small. Check the result. Be careful with commands that delete or send things. Much of how an agent behaves comes from here, and it takes room before you type a word.
  5. 1:40Models are trained to weigh the system prompt above your messages, and your messages above text that just arrives, like a web page. But that order comes from training, not a lock. Clever text can sometimes talk a model round.
  6. 2:05You can add to the start too. Chat apps have custom instructions. Agents load files of instructions at the start of every session. Text that comes first, every time, shapes everything after it.
  7. 2:25Put what's true every time in custom instructions, and keep them short. If an app won't do something, it's often the system prompt, not the model. And never treat it as a security wall.
  8. 2:43Same model. Different first message.