Local models, all the way down.

ctxfile pairs with models running on your own machine through Ollama. There are two directions, and knowing which is which saves confusion:

Setup (macOS)

brew install ollama && brew services start ollama

Pull a model. Two good starting points:

ollama pull gemma3:4b
ollama pull qwen3:8b

gemma3:4b is small and quick for summaries. qwen3:8b supports tool calling, which you need for agent use. Check any model's abilities with ollama show <model>; look for tools under capabilities. 16GB of RAM runs the 4B and 8B classes comfortably; 32GB handles 12B and up.

Local session summaries (free core)

In your project's .ctxfile.json:

{
  "ollama": { "summarize": true, "model": "gemma3:4b" }
}

Snapshots now include a working-session summary written by the local model. It appears in get_context and in exports under the full or custom profiles; the default repo-safe profile excludes it by design. If Ollama is not running, the connector skips quietly; nothing breaks.

Local consult (Pro)

Ask a second opinion from a local model, from inside any agent:

{
  "consult": {
    "providers": [
      { "type": "ollama", "model": "qwen3:8b" }
    ]
  }
}

The consult tool sends your question plus context to each configured provider and returns the answers side by side. An Ollama provider means the consult never leaves your machine, and costs nothing per call.

A fully local agent (OpenCode + Ollama)

Local brain, local harness, local context: OpenCode uses an Ollama model as the agent and loads ctxfile over MCP. In the project's opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "ollama": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Ollama (local)",
      "options": { "baseURL": "http://localhost:11434/v1" },
      "models": { "qwen3:8b": { "name": "Qwen 3 8B (local)" } }
    }
  },
  "model": "ollama/qwen3:8b",
  "mcp": {
    "ctxfile": {
      "type": "local",
      "command": ["ctxfile", "--root", "."],
      "enabled": true
    }
  }
}

Then:

opencode run "Use the ctxfile get_context tool, then summarize this project's plan."

The model decides to call get_context, reads your working state, and answers from it. Zero bytes leave the machine.

Traps we hit so you do not have to