Feedback

Chat Icon

Local AI Engineering with Ollama

Run, understand, customize, fine-tune, and build agentic apps on your own hardware

Building, Running, and Sharing Custom Models for Ollama (Modelfile)
58%

Step 2: Give It One Job with SYSTEM

The goal of this step is to make the model always write commit messages, without you explaining the task every time.

The SYSTEM instruction sets a fixed system message. It loads with every request, so the model starts each chat already knowing its role. You write the rules once, in the file, and they stick.

Add a SYSTEM block to your Modelfile:

cat < $HOME/commitwriter/Modelfile
# commitwriter - turns a code change into a commit message
FROM granite4.1:3b

SYSTEM """
You write git commit messages in Conventional Commits format.
Read the user's description or code diff. Reply with one commit message and nothing else.

Use this shape:
type(scope): short summary

An optional body that explains what changed and why.

Rules:
- type is one of: feat, fix, docs, refactor, test, chore.
- scope is optional and lowercase.
- the summary is under 60 characters, in the imperative mood, with no period at the end.
- do

Local AI Engineering with Ollama

Run, understand, customize, fine-tune, and build agentic apps on your own hardware

Enroll now to unlock all content and receive all future updates for free.