OpenClaw Hits 33K Context Limit: How to Fix It

✍️ OpenClawRadar📅 Published: August 18, 2026🔗 Source
Ad

A developer on r/openclaw reports a persistent 33K token context cap in OpenClaw, despite configuring a 262K context window. The issue affects every model they load locally, including Qwen3.8-27B, and appears to be outside OpenClaw's control.

What's Happening

The user set the context window correctly:

openclaw config set agents.defaults.contextWindow 262144

OpenClaw acknowledges the model supports 262144 tokens, but responses degrade after ~33K tokens, forcing frequent /compact or /new commands on Telegram. Running ollama ps reveals the model only has a 33K context loaded, regardless of the model's native capacity.

Root Cause

The problem is likely in Ollama, not OpenClaw. Ollama defaults to a context size (often 4096 or 8192) unless overridden via the OLLAMA_CONTEXT_LENGTH environment variable or the num_ctx parameter in Modelfile. OpenClaw doesn't pass the context length to Ollama, so Ollama loads with a small window.

Ad

Solutions

  • Set OLLAMA_CONTEXT_LENGTH: Before starting Ollama, set the environment variable to 262144.
    export OLLAMA_CONTEXT_LENGTH=262144
  • Update Modelfile: If you're using a custom model, add the parameter
    PARAMETER num_ctx 262144
    and recreate the model.
  • Check Docker: If Ollama runs in Docker, ensure the environment variable is passed via docker run -e OLLAMA_CONTEXT_LENGTH=262144.

Additional Notes

You can verify the loaded context with ollama ps — it should show the new size after the fix. Also, consider using Ollama's OpenAI-compatible endpoint with num_ctx in the request, which some clients support.

For more details, check the source discussion.

📖 Read the full source: r/openclaw

Ad

👀 See Also

Workaround for Control UI assets error after OpenClaw 2026.3.22 upgrade
Tips

Workaround for Control UI assets error after OpenClaw 2026.3.22 upgrade

A user posted a solution for the 'Control UI assets not found' error that occurs after upgrading to OpenClaw 2026.3.22, involving copying the control-ui folder from a beta installation to the stable release.

OpenClawRadar
OpenClaw API Budget Drain: Settings to Change Immediately
Tips

OpenClaw API Budget Drain: Settings to Change Immediately

OpenClaw's default Heartbeat feature can drain API budgets by checking tasks every 30 minutes and loading full context files, memory, and chat history each time. The source recommends changing Active Hours, using cheaper base models, manually switching to premium models only when needed, and using /new to reset sessions.

OpenClawRadar
Loading Every MCP Server on Every Prompt Quietly Destroys Token Budget
Tips

Loading Every MCP Server on Every Prompt Quietly Destroys Token Budget

A user with 5–6 MCP servers found each prompt loaded all servers, causing massive token waste. Implementing a routing layer to load only relevant servers per prompt drastically reduced token usage and improved response times.

OpenClawRadar
Vague Prompts Are the Real Problem, Not the Model — 50-Run Test Shows Prompt Quality Trumps Model Choice
Tips

Vague Prompts Are the Real Problem, Not the Model — 50-Run Test Shows Prompt Quality Trumps Model Choice

A Reddit user ran the same ten prompts through ChatGPT 4, Claude Sonnet, and Gemini 1.5 Pro five times each (150 outputs total) and found that all three models produced similarly usable or similarly generic results — the deciding factor was prompt specificity, not the model.

OpenClawRadar