Skip to content

Commit f65a6f8

Browse files
authored
feat(llama-cpp): raise default context size to 64K (#123701)
The managed llama-server default ctx-size was 8192, but the full OpenClaw agent system prompt alone is ~31K tokens, so the first agent turn overflowed the context window and forced immediate compaction (observed live on the Mac app local-model onboarding). Raise the default to 65536 so a fresh local-model install can run a real agent turn out of the box. The default-download 16 GiB RAM floor already bounds weaker machines, and Gemma 4 supports far more than 64K, so this only changes headroom, not the offer gate. Docs updated to match.
1 parent fc5265d commit f65a6f8

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎docs/plugins/llama-cpp.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ The default chat model remains:
3838
`hf:unsloth/gemma-4-E4B-it-GGUF/gemma-4-E4B-it-Q4_K_M.gguf`
3939

4040
Gemma 4 E4B IT Q4_K_M is about 5.0 GB. OpenClaw offers that download only on
41-
machines with at least 16 GiB of RAM. The default context cap remains 8,192
42-
tokens. The bundled EmbeddingGemma model is about 0.3 GB.
41+
machines with at least 16 GiB of RAM. The default context cap is 65,536 tokens,
42+
which the full agent system prompt requires. The bundled EmbeddingGemma model is
43+
about 0.3 GB.
4344

4445
Discovery is read-only. It reports a prepared choice only when the managed
4546
binary, server preset, and selected model already exist; it never installs or
@@ -76,11 +77,11 @@ Example model entry:
7677
reasoning: false,
7778
input: ["text"],
7879
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
79-
contextWindow: 8192,
80+
contextWindow: 65536,
8081
maxTokens: 2048,
8182
params: {
8283
modelPath: "~/Models/my-model.Q4_K_M.gguf",
83-
contextSize: 8192,
84+
contextSize: 65536,
8485
},
8586
compat: { supportsTools: true },
8687
}

‎extensions/llama-cpp/src/defaults.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ export const DEFAULT_LLAMA_CPP_MODEL_CACHE_FILE =
2727
export const DEFAULT_LLAMA_CPP_MODEL_SIZE_BYTES = 4_977_171_584;
2828
export const DEFAULT_LLAMA_CPP_MODEL_SHA256 =
2929
"85a896a047553e842f25297ee5b031d64ff30147d9c4af17b1e4b394cd1fab87";
30-
export const DEFAULT_LLAMA_CPP_CONTEXT_SIZE = 8192;
30+
// The full OpenClaw agent system prompt alone is ~31K tokens, so 8K overflows on
31+
// the first turn. 64K leaves real headroom for history and tool output; Gemma 4
32+
// supports far more, and the 16 GiB offer floor already bounds weaker machines.
33+
export const DEFAULT_LLAMA_CPP_CONTEXT_SIZE = 65536;
3134

3235
export const DEFAULT_LLAMA_CPP_EMBEDDING_MODEL =
3336
"hf:ggml-org/embeddinggemma-300m-qat-q8_0-GGUF/embeddinggemma-300m-qat-Q8_0.gguf";

0 commit comments

Comments
 (0)