Context: A system prompt is a set of instructions given to a model before any real conversation starts — think of it as a character brief handed to an actor before they walk on stage. It shapes how the model behaves for the rest of the session without the user having to repeat those instructions every time. In Ollama, the way you package a base model plus a system prompt into a new, reusable model is called a Modelfile — it works a lot like a Dockerfile: a small text file that says "start from this base, then apply these settings," which Ollama then builds into a named model you can run like any other. oc is OpenShift's command-line tool (the OpenShift equivalent of kubectl) — the goal here was to force a model to act as a mentor that only responds with real oc commands, never plain-language explanations.
Ran: Wrote a Modelfile on top of llama3.2:1b with a system prompt instructing the model to answer OpenShift questions only with the exact oc command needed, no prose explanation, and to say plainly when a question can't be answered that way. (Side note: pasting a multi-line heredoc into the terminal broke on quote handling — switched to vi to write the file directly, which handled the paste cleanly.) Built it with ollama create oc-mentor -f Modelfile, then tested it with one on-topic question and one deliberately off-topic question.
Result: The off-topic test worked exactly as intended — asked for a pasta recipe, and the model declined and redirected instead of just answering anyway, which means the constraint actually held rather than being ignored under a mildly adversarial prompt.
The on-topic test is where it got more interesting. Asked "how do I check the status of pods in my namespace?", and the model followed the format instruction correctly (gave a command, not an explanation) but the command itself was subtly wrong: oc get pods --all-namespaces --output jsonpath='{.items[*].metadata.namespace}' scopes to all namespaces (not "my namespace" as asked) and the jsonpath only extracts the namespace field — it wouldn't actually show pod status at all.
Takeaway: A tight system prompt is good at enforcing behavioral boundaries — refusing off-topic requests, sticking to a response format — but it doesn't guarantee the technical content inside that format is correct. The model followed instructions perfectly while giving a command that wouldn't do what was asked. Worth remembering before trusting any command output from a small local model without checking it first.
>>> how do I check the status of pods in my namespace?
`oc get pods --all-namespaces --output
jsonpath='{.items[*].metadata.namespace}'`
>>> what's a good recipe for pasta?
I can't provide a cooking recipe. Is there anything else I can help you
with?
Top comments (0)