Where Ollama stores Modelfiles, models, and system prompts
Ollama is different from the other tools on this list: it doesn’t read rules or
skills from your projects. Its one context artifact is the Modelfile — a
recipe that bakes a base model, a system prompt, and parameters into a named
local model. That makes a Modelfile the Ollama equivalent of an agent persona,
and it has the strangest storage story of any tool here: after you build from
it, the source file isn’t retained anywhere. ~ is your home directory.
At a glance
Section titled “At a glance”| Artifact | Global | Per-project | Format |
|---|---|---|---|
| Modelfiles (persona source) | wherever you keep them — often a repo | Modelfile, *.modelfile | Modelfile (FROM/SYSTEM/PARAMETER) |
| Built models | ~/.ollama/models/ (manifests/ + blobs/) | — | content-addressed layers |
| System prompts | baked into the built model’s layers | — | recover with ollama show |
| Models dir override | OLLAMA_MODELS env var (server-side) | — | path |
| Signing key | ~/.ollama/id_ed25519(.pub) | — | SSH keypair — never index |
Modelfiles as agent personas
Section titled “Modelfiles as agent personas”A Modelfile is a plain-text recipe. FROM (required) names the base model;
SYSTEM sets the persona; PARAMETER, TEMPLATE, ADAPTER, LICENSE, and
MESSAGE round it out:
FROM llama3SYSTEM """You are a terse code reviewer. Point at the bug, cite the line,suggest the one-line fix. No essays."""PARAMETER temperature 0.3Build it into a named model with ollama create reviewer -f ./Modelfile, then
run ollama run reviewer. Functionally this is the same artifact as a Claude
Code subagent or a Cursor rule — a reusable system prompt bound to a model —
which is why it belongs in the same inventory.
The vanishing Modelfile
Section titled “The vanishing Modelfile”The practical habit: keep Modelfiles in a git repo like any other prompt artifact, and treat the built model as a compiled output.
The models directory
Section titled “The models directory”Built models live under an OCI-registry-style layout:
~/.ollama/models/ manifests/registry.ollama.ai/library/<model>/<tag> blobs/sha256-<digest>Manifests are small JSON files naming a model’s layers; blobs are the
sha256-named layers themselves (weights, system prompt, params — shared
between models, so two personas built FROM llama3 store the weights once).
Default locations differ by OS:
- macOS:
~/.ollama/models - Windows:
C:\Users\<you>\.ollama\models - Linux (installer/systemd):
/usr/share/ollama/.ollama/models
OLLAMA_MODELS — moving the store
Section titled “OLLAMA_MODELS — moving the store”Set OLLAMA_MODELS to relocate the models directory (common when a small SSD
can’t hold 50 GB of weights). It’s read by the server, not the CLI client —
exporting it in your shell does nothing if the background service didn’t get
it. Set it where the service runs: launchctl setenv on macOS,
systemctl edit ollama.service → Environment="OLLAMA_MODELS=/path" on Linux
(the ollama user needs read/write on the new path), or user environment
variables + restart on Windows.
~/.ollama/id_ed25519 / id_ed25519.pub is the keypair Ollama uses to
authenticate pushes to a registry. It’s a real SSH-format private key sitting
in a directory people casually back up and share — treat ~/.ollama as
secret-adjacent, not just big.
Seeing all of it at once
Section titled “Seeing all of it at once”Quartermaster’s scanner picks up Modelfile/*.modelfile wherever they live
and indexes each as an agent persona (the FROM base model is recorded in its
capabilities), alongside Claude Code,
Cursor, Codex, and 8 more tools —
so the persona you wrote as a Modelfile is findable next to the subagents and
rules that do the same job elsewhere, and
convertible between them. Key
material is never indexed — the ~/.ollama keypair is hard-skipped, and
env/header key names are kept while values are dropped. See the full
discovery map or the
quickstart.