@MajorPeabody The compaction is most likely OpenClawâs own budget, not the model. Per docs/providers/ollama/advanced.md (2026.10.9), auto-discovered Ollama models get contextTokens capped at 32,768, and OpenClaw sends that to Ollama as num_ctx on each request. So gemma4 runs in 32K whatever it advertises, and the system prompt and tool schemas use a good part of that before you type anything.
Two checks:
/context detail in a chat shows the system prompt size and the size of each tool schema.
ollama ps on the Spark has a CONTEXT column. That is what Ollama actually allocated.
To get more, write the model entry yourself. This is our live entry (Ollama on a 96 GB box, port changed to the default):
models: { providers: { ollama: {
baseUrl: "http://127.0.0.1:11434",
api: "ollama",
timeoutSeconds: 600,
models: [{
id: "qwen3.8:27b-mlx",
reasoning: true,
input: ["text", "image"],
contextWindow: 131072, // what the model supports
contextTokens: 98304, // OpenClaw's input budget
maxTokens: 8192, // output cap
params: { num_ctx: 131072, keep_alive: "30m" },
compat: { supportsTools: true },
}],
}}}
params.num_ctx wins over contextTokens for what Ollama allocates (same doc). Prompt and output share that window, so we keep num_ctx at or above contextTokens + maxTokens (106,496 here).
On the RAM: keep one big model loaded at a time. On our 96 GB box, Nemotron 3.5 Super alone took about 68 GB, and with it loaded the other models loaded slowly or not at all. OLLAMA_MAX_LOADED_MODELS=1 stops that pile-up, but then every switch evicts the agentâs model and the next turn rereads the whole prompt. We measured that on a 27B model on a 64 GB Mac: a cold 33,772-token system prompt took 167 s, the warm repeat 0.5 s. That is why keep_alive is set.
If you take joeâs vLLM route: we ran vLLM on a DGX Spark for about four weeks. Our first service was the same Qwen3.6-35B-A3B, NVFP4 weights (hf download nvidia/Qwen3.6-35B-A3B-NVFP4, 23.5 GB):
docker run -d --name vllm --restart unless-stopped \
--device nvidia.com/gpu=all --ipc=host \
-p 127.0.0.1:8000:8000 \
-v $HOME/models:/models:ro \
vllm/vllm-openai@sha256:2a7cde230b59f3ce6cab33dd245ba6bee41aa87b38c9fe84f966ff24016813ce \
--model /models/Qwen3.6-35B-A3B-NVFP4 \
--served-model-name qwen3.6-35b-a3b \
--max-model-len 32768 --max-num-seqs 1 \
--gpu-memory-utilization 0.5 \
--attention-backend FLASHINFER --moe-backend marlin \
--reasoning-parser qwen3 \
--enable-auto-tool-choice --tool-call-parser qwen3_xml \
--host 0.0.0.0 --port 8000
The image is pinned by digest (arm64). Docker on that box had no nvidia runtime, so --gpus all failed; the CDI --device form worked.
The OpenClaw side has to match the server. This row ran an agent on that Spark for five days, against a later 262K model:
models: { providers: { spark: {
baseUrl: "http://127.0.0.1:8000/v1",
api: "openai-completions",
timeoutSeconds: 900,
models: [{
id: "allspark",
reasoning: true,
input: ["text", "image"],
contextWindow: 262144, // = --max-model-len
contextTokens: 196608,
maxTokens: 16384,
compat: { supportsTools: true, thinkingFormat: "qwen-chat-template" },
}],
}}}
For the 32K service above, set contextWindow: 32768 and keep contextTokens + maxTokens under it. thinkingFormat: "qwen-chat-template" comes from docs/providers/vllm.md for Qwen models.
Speed on the Spark with that 262K model (176B MoE, 6B active, FP4): a 34,441-token prompt took 14.4 s to the first token (about 2,400 tokens/s prefill), then 69 tokens/s. 102 of 121 GB RAM was in use.