Repository navigation
feat(llama-cpp): raise default context size to 64K - #123701
Conversation
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.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 14, 2026, 11:02 AM ET / 15:02 UTC. ClawSweeper reviewWhat this changesThis PR raises the managed llama.cpp plugin’s default context window from 8K to 64K and updates its setup documentation. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep open for maintainer review: the PR repairs a source-proven first-run local-model failure through the plugin’s canonical default, but the 16 GiB onboarding threshold needs capacity confirmation for the eightfold context increase. Priority: P1 Review scores
Verification
How this fits togetherThe llama.cpp plugin builds the default local model configuration during onboarding, then writes that model’s context size into a managed llama-server preset. The server uses that preset for local agent turns and local embeddings. flowchart LR
A[Local-model onboarding] --> B[Default model configuration]
B --> C[Selected context size]
C --> D[Managed server preset]
D --> E[llama-server]
E --> F[First agent turn]
Decision needed
Why: The code correctly changes the canonical default, but choosing the minimum supported memory envelope is a maintainer product and reliability tradeoff. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +3, Docs +1. Total +4 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the plugin-owned 64K default, but land only after confirming the 16 GiB offer threshold is safe for a 64K first turn or raising the threshold to match the measured envelope. Do we have a high-confidence way to reproduce the issue? Yes. Current main routes the default model’s 8K context value into the generated llama-server preset, and the PR supplies a real fresh-onboarding report of the resulting overflow. Is this the best way to solve the issue? Yes for the context-overflow defect: the canonical plugin default feeds both setup metadata and the server preset. The remaining question is whether the RAM offer floor must change with it. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 493a3e46b3f2. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
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.
What problem this solves
The managed llama.cpp default
ctx-sizewas 8192. The full OpenClaw agent system prompt alone is ~31K tokens, so the very first agent turn on a fresh local-model install overflowed the context window and forced immediate compaction. Observed live during the Mac app local-model onboarding: at 8K the turn failed with "Context overflow: prompt too large for the model"; even at 32K the session sat at 93% context with compaction firing. Only at 64K did a clean agent turn complete (47% used).Why this change was made
The 8K default predates the external-llama-server migration (#123105) and was never sized against the real agent prompt. Raising the default makes the out-of-box local-model agent actually usable.
DEFAULT_LLAMA_CPP_CONTEXT_SIZE: 8192 → 65536 inextensions/llama-cpp/src/defaults.ts.docs/plugins/llama-cpp.md) updated to match.This only changes headroom, not the offer gate: the 16 GiB RAM floor for the default download already bounds weaker machines, and Gemma 4 E4B supports far more than 64K context. Operators can still override per-model via
params.contextSize.User impact
Fresh llama.cpp onboarding now produces a model that can run a real agent turn without immediate context overflow. No migration needed — the value applies at setup/prepare time; existing installs keep whatever context their generated
models.inialready has until they re-run setup.Evidence
node scripts/run-vitest.mjs extensions/llama-cpp→ 4 files, 24 tests passed.