maximus-ollama-ops
Skill1 starsChanged 4 months agoMITView on GitHub
Operate Ollama as a real service: Modelfiles, context length that actually applies, server env (keep-alive, parallelism, loaded models, flash attention, KV cache type, bind address), GGUF/safetensors import, native vs OpenAI-compatible API, structured outputs, and memory sizing under concurrency. Use for 'Ollama Modelfile', 'num_ctx', 'OLLAMA_ env vars', 'import a GGUF', 'Ollama is slow/out of memory', 'serve Ollama to my team'.
In this repository49 other files it gives its agents.
- core/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- file-opsSkill
- maximus-agent-designSkill
- maximus-ai-cost-controlSkill
- maximus-ai-data-pipelineSkill
- maximus-ai-fluency-for-buildersSkill
- maximus-ai-product-specSkill
- maximus-ai-safety-governanceSkill
- maximus-ai-ux-patternsSkill
- maximus-brainSkill
- maximus-build-featureSkill
- maximus-chain-of-verificationSkill
- maximus-code-reviewSkill
- maximus-contact-intelligenceSkill
- maximus-counterparty-discoverySkill
- maximus-debug-incidentSkill
- maximus-deep-research-proSkill
- maximus-deep-researchSkill
- maximus-design-specSkill
- maximus-devops-shipSkill
- maximus-eval-and-testSkill
- maximus-fine-tuningSkill
- maximus-fintech-paymentsSkill
- maximus-investigative-researchSkill
- maximus-k3-model-selectionSkill
- maximus-k3-self-hostingSkill
- maximus-literature-reviewSkill
- maximus-llm-model-selectionSkill
- maximus-local-research-assistantSkill
- maximus-local-research-assistantSkill
- maximus-mlops-deploySkill
- maximus-openclaw-localSkill
- maximus-people-finder-recruiterSkill
- maximus-people-finderSkill
- maximus-plan-implementationSkill
- maximus-prompt-engineeringSkill
- maximus-python-scientificSkill
- maximus-rag-pipelineSkill
- maximus-replit-handoff-proSkill
- maximus-slm-evalSkill
- maximus-slm-local-finetuneSkill
- maximus-slm-local-stackSkill
- maximus-slm-tool-callingSkill
- maximus-transaction-analystSkill
- maximus-write-articleSkill
- memory-keeperSkill
- skill-templateSkill
- web-researchSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 88
Importing a GGUF and trusting the auto template: Check it.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Maximus — Ollama Ops
Ollama's install is one line, which is why so many installs are wrong. The
defaults are tuned to make a first ollama run feel instant, not to serve an
agent with a 20K-token prompt to three people at once. This skill is the gap
between those two.
Purpose
Turn an Ollama install into a configured, measured service: models defined in version-controlled Modelfiles, context and memory settings chosen from arithmetic, the right API for each client, and a verification step that reads what the server actually loaded rather than what the config says.
Scope boundary
| Need | Skill |
| Configure and run the Ollama server and its models | this skill |
| Choose model + quant for the hardware | maximus-slm-local-stack |
| Point OpenClaw / Maximus at it | maximus-openclaw-local |
| Force valid JSON or tool calls | maximus-slm-tool-calling |
| Turn a fine-tune into an Ollama model | maximus-slm-local-finetune |
Core workflow
- Read the live state first.
ollama --version,ollama ps(loaded models, their context, and CPU/GPU split),ollama show <model>(parameters, template, capabilities). Record them before changing anything. - Pick the context from need, then prove it fits. Context size is a
memory decision, not a quality knob. KV cache grows linearly with it and is
multiplied by parallel slots: required memory scales with
OLLAMA_NUM_PARALLEL × context length. - Define models in Modelfiles, not in client code.
FROMplusPARAMETER num_ctx,temperature,stop, and aSYSTEMline if the model is single-purpose. Check the Modelfiles into the project. A tag likeqwen3-64kdocuments itself; a request-time option does not. - Choose the API per client. The native
/api/chatacceptsoptions(includingnum_ctx),keep_alive,format, andthink. The OpenAI-compatible/v1/*endpoints are for tools that only speak OpenAI. They cannot set context size, so those clients must use a Modelfile tag. - Set server env deliberately (
references/ollama-ops-2026-09.mdhas defaults with sources):OLLAMA_CONTEXT_LENGTH— server-wide default context.OLLAMA_KEEP_ALIVE— how long a model stays loaded; requestkeep_aliveoverrides it.-1pins,0unloads.OLLAMA_NUM_PARALLEL(default 1),OLLAMA_MAX_LOADED_MODELS(default 3 × GPUs, or 3 on CPU),OLLAMA_MAX_QUEUE(default 512; beyond it, 503).OLLAMA_FLASH_ATTENTION=1andOLLAMA_KV_CACHE_TYPE(f16default,q8_0about half the memory,q4_0about a quarter). The cache type is global, and models with high GQA ratios (the docs cite Qwen2) lose more from it.OLLAMA_HOST— loopback by default. Keep it there unless there is a reverse proxy with auth in front.
- Import, don't hand-roll. GGUF:
FROM ./model.gguf(split files by wildcard). Ollama does not quantize GGUF on import, so quantize first withllama-quantize. Safetensors:FROM /dir. Always compareollama show --templateagainst the model card's chat template. A wrong template is the most common cause of garbage output from an imported model. - Verify.
ollama psagain. The context must match, and the PROCESSOR column should read 100% GPU if you sized for GPU. A CPU/GPU split means layers spilled and throughput will crater. Then run a real request of realistic length and time it.
Structured outputs
Pass a JSON schema in format (native) or response_format (OpenAI-compatible).
Also put the schema in the prompt, set temperature to 0, and validate with
Pydantic or Zod anyway. Constraining the format guarantees the shape, not the
facts. For tool calls on small models, go to maximus-slm-tool-calling.
Anti-patterns
- Context set in a client library that talks to
/v1. It is discarded with a 200. OLLAMA_NUM_PARALLEL=4without redoing the memory math. Four slots mean four times the KV cache.OLLAMA_HOST=0.0.0.0on a laptop on café Wi-Fi. The API has no auth.- Assuming the default context. Ollama's own docs give 4,096 in the FAQ
and 2,048 in the Modelfile table, and newer builds size it by VRAM. Read
ollama ps. - Importing a GGUF and trusting the auto template. Check it.
- Pinning every model with
keep_alive: -1on a shared GPU. The next model load then evicts or fails.
Output
Modelfiles, a server env block for the platform (systemd override, launchd,
or Windows user env), a memory table (weights + KV × parallel slots +
overhead vs. available VRAM), and the post-change ollama ps output as proof.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

