Hermes Agent: context window below the minimum 64,000 (the fix)
Why Hermes Agent says a model's context window is below the minimum 64,000, and how to raise it in Ollama, llama.cpp, vLLM or LM Studio, or set the real figure.
Hermes Agent refuses to start a session on any model whose context window it measures below 64,000 tokens, and apart from one LM Studio case (below) there is no switch to turn the check off. Either the model really is that small, and you pick one with at least 64K, or the server is serving less than the model can hold, which is the usual case with a local model: Ollama gives any machine with less than 24 GiB of GPU memory a 4,096-token window unless told otherwise. Start the server with a 64K window (OLLAMA_CONTEXT_LENGTH=64000, llama.cpp’s -c 64000, vLLM’s --max-model-len), or, when the server already serves enough and only reports less, tell Hermes the real figure in config.yaml with model.ollama_num_ctx (local servers) or model.context_length.
The whole message, and which half you got
The check is in agent/agent_init.py on Hermes’s main branch (as read on November 17, 2026, the file last changed in commit be3d6aff). It raises a ValueError whose first sentence is always the same, followed by one of two remedies. When the model is served from your own machine or network, with a model of 40,960 tokens as the example:
Model qwen3:8b has a context window of 40,960 tokens, which is below the minimum 64,000 required by Hermes Agent. Your local server is serving a 40,960-token window. Start it with at least 64K context (llama.cpp: -c 64000; vLLM: --max-model-len; Ollama: OLLAMA_CONTEXT_LENGTH=64000 or a Modelfile num_ctx), or set model.ollama_num_ctx in config.yaml to the window it really serves (at least 64K).Copied“Local” means, in Nous’s provider docs, an endpoint on 127.0.0.1, the LAN or a Docker service name. For anything else, a hosted API or a gateway on the internet, the second sentence is instead:
“Choose a model with at least 64K context. If your server reports a window smaller than the model’s true window, set model.context_length in config.yaml to the real value (this must be at least 64K).”
The floor itself is a constant, MINIMUM_CONTEXT_LENGTH = 64_000 in agent/model_metadata.py, whose comment says where it bites: “Sessions, model switches and cron jobs reject models below this.” So the same message can come from a chat, from a /model switch, or from a scheduled job whose model or fallback resolves to a smaller one than your everyday model. The docs give the reason: “the system prompt, tool schemas, and working conversation state need enough room for reliable multi-step workflows.”
Where Hermes gets the number
The figure in the message is what Hermes concluded about the model, not necessarily what the model can do. Nous’s docs list the order it looks in, first match wins: model.context_length in your config, then a per-model value under a custom provider, then a cache of what it found earlier, then the endpoint’s own /models list, then Anthropic’s and OpenRouter’s metadata, Nous Portal and the models.dev registry, and only then a built-in default. For Ollama it also asks the server directly. Three things follow:
- A local server reports what it serves. If Ollama is running a model with a 4,096-token window, 4,096 is the true answer, and raising the figure in Hermes alone does not give the model more room.
- A model’s advertised window is not always what is served. An Ollama model whose file advertises 40,960 tokens can be served with a larger window from a Modelfile or a server setting; this is the case
model.ollama_num_ctxexists for, added after issue #100437 in September 2026. - A discovered figure is remembered. Hermes keeps what it learns in
~/.hermes/context_length_cache.yaml, so a wrong number can outlive the cause.
Ollama
Ollama’s own page on context length gives its defaults by the GPU memory it finds: 4k below 24 GiB, 32k between 24 and 48 GiB, 256k above. A CPU-only server or a small GPU therefore serves 4,096 tokens whatever the model supports, and Ollama’s page says agents and coding tools “should be set to at least 64000 tokens.” Nous’s docs add that “You cannot set context length through the OpenAI-compatible API”, so it has to be set on the Ollama side. Run by hand:
OLLAMA_CONTEXT_LENGTH=64000 ollama serveCopiedOn a Linux server, Ollama usually runs as a systemd service, and its FAQ sets environment variables there: open the override, add the line under [Service], then reload and restart.
sudo systemctl edit ollama.service
# under [Service]:
Environment="OLLAMA_CONTEXT_LENGTH=64000"
sudo systemctl daemon-reload
sudo systemctl restart ollamaCopiedTo give one model its own window instead, a Modelfile with PARAMETER num_ctx makes a copy of it under a new name, which you then select in Hermes:
FROM qwen3:8b
PARAMETER num_ctx 64000CopiedSaved as Modelfile, it becomes a model with:
ollama create qwen3-8b-64k -f ./ModelfileCopiedollama ps shows the window a loaded model is actually running with in its CONTEXT column. If it reads 64000 or more and Hermes still reports the smaller figure, the server is serving enough and only the metadata is short; tell Hermes the real window:
model:
ollama_num_ctx: 64000CopiedNous’s docs say model.ollama_num_ctx “is honoured on every local endpoint”, not only Ollama, and the source counts it only for local servers, so it cannot admit a hosted model.
A bigger window costs memory. In Ollama’s words, “Setting a larger context length will increase the amount of memory required to run a model.” A model that fitted in GPU memory at 4K may not at 64K, and Ollama’s page advises against offloading to the CPU; the PROCESSOR column of ollama ps shows the split. Where the memory is not there, a smaller model with the full window is the way to meet the floor.
llama.cpp, vLLM and LM Studio
- llama.cpp’s llama-server. The server’s reference gives
-c, --ctx-size N, “size of the prompt context (default: 0, 0 = loaded from model)”, also settable asLLAMA_ARG_CTX_SIZE. Start it with-c 64000or more. With several parallel slots (-np), Nous’s docs warn that the window is shared between them:-c 64000 -np 4gives each slot 16k, under the floor. - vLLM.
--max-model-lenis the “Model context length (prompt and output)”, per the option’s definition. It takes65536or64k(a lowercase k is 1,000, an uppercase K 1,024), andautochooses “the maximum model length that fits in GPU memory”, which may come out below 64K on a small GPU. - LM Studio. Load the model with a larger window, using the CLI’s
--context-length, for examplelms load <model_key> --context-length 64000, or the Context Length setting in the app. Nous’s docs say Hermes “preserves the context of an already-loaded LM Studio instance”, so a model already loaded with a small window has to be loaded again with the larger one. LM Studio is also the one exception in the source: with the provider set tolmstudio, an explicit positivemodel.context_lengthis accepted even below 64K.
A hosted model or a gateway
On a hosted provider the figure usually comes from the provider’s metadata, and the remedy is the plain one: a model with a 32K window cannot run Hermes, and the fix is another model. Where a provider or a proxy reports less than the model really has, or exposes no /models list at all, set the true figure. For the main model:
model:
context_length: 131072Copiedor per model on a named provider, as in Nous’s docs:
providers:
my-gateway:
api: "https://gateway.example.com/v1"
models:
some-model:
context_length: 131072Copiedhermes config set model.context_length 131072 writes the first form from the shell. Use the number the provider documents for the model: it is a pin, checked first, and a figure larger than the model really has does not make room that is not there. Nous’s troubleshooting puts a model that seems to forget earlier parts of the conversation down to exactly that, a window too small for what Hermes is sending.
One reported case is a wrong figure Hermes learned by itself. In issue #150519 (opened November 7, 2026, still open with its fix pending on November 17), a gateway’s one-off error “max_tokens exceeds the limit of 4096”, a cap on the length of one reply, was saved as a 4,096-token context window, and every start after it was refused with this message. The reporter’s workaround was to “delete the row from ~/.hermes/context_length_cache.yaml and set model.context_length.” If the number in your message matches an output limit rather than anything the model’s documentation gives as its window, look in that file first.
If you would rather not run the model yourself
Hermes can also download and run llama.cpp itself, sizing the window to your hardware; Nous’s local-models page says “Every recommended model gets at least a 64K context window.” The other local runtimes it works with, and the hosted providers, are in what Hermes Agent is; where config.yaml lives and how hermes config set decides which file a value goes to is in installing Hermes Agent on a Linux server.