Skip to content

feat(ollama): allow configurable context size via ZEROCLAW_OLLAMA_NUM_CTX#3518

Open
faustoheikkinen wants to merge 8 commits intozeroclaw-labs:masterfrom
faustoheikkinen:fausto-dev
Open

feat(ollama): allow configurable context size via ZEROCLAW_OLLAMA_NUM_CTX#3518
faustoheikkinen wants to merge 8 commits intozeroclaw-labs:masterfrom
faustoheikkinen:fausto-dev

Conversation

@faustoheikkinen
Copy link
Contributor

Feature

Add support for configuring the Ollama context window via environment variable.

Environment variable:

ZEROCLAW_OLLAMA_NUM_CTX

If set, the value is forwarded to the Ollama /api/chat request as options.num_ctx.

Motivation

Ollama defaults to a 4096 context window when num_ctx is not provided.
This prevents full utilization of larger models on systems with sufficient VRAM.

This change allows deployments to configure larger contexts (e.g. 32k) without modifying source code.

Example

docker-compose:

environment:
ZEROCLAW_OLLAMA_NUM_CTX=32768

Result

Requests sent to Ollama include:

options:
num_ctx: 32768

faustoheikkinen and others added 6 commits March 13, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants