OpenClaw operations guide
OpenClaw context overflow: recover a long task without losing its handoff
When OpenClaw reports context overflow, save the goal, completed work and next step in a private handoff file. Trim oversized input to the relevant log lines or file sections, or use /compact on a supported release if older messages fill the window. If the request still fails, start a fresh session with the handoff and only the next task.
Last updated · Published
By CWYN · Reviewed November 17, 2026 · Commands and behavior vary by installed version; check its help and official documentation · Procedures labeled CWYN recommendations are operational advice, not OpenClaw guarantees · Short answer as of Nov 22, 2026 (OpenClaw compaction)
A long task can stop because the next request no longer fits the model. Repeating the same request may repeat the failure. This guide focuses on a full conversation window; use the memory loss guide when durable facts are missing from otherwise working sessions.
1. Confirm the failure and the active model
Save the error class, time, session identifier, installed version, actual model, and whether the failure followed a large tool result. A spinner alone does not prove overflow. Historical issue #63661 describes an overflow hidden behind a spinner on 2026.4.9; it is closed and does not establish a current defect.
The official compaction reference explains that compaction summarizes older conversation, while pruning trims tool results. A configured context budget cannot enlarge the provider's actual model window. Documentation may describe behavior newer than your installed release.
2. Preserve a small restart packet
CWYN recommends writing the following packet to a private, operator-controlled task file before resetting anything. If the agent cannot answer, reconstruct it from saved artifacts and your own notes. Mark uncertain state explicitly.
- Goal and observable acceptance criteria.
- Completed steps with file paths or receipt identifiers.
- Pending work and the last confirmed external outcome.
- Constraints, approvals still needed, and actions that must not repeat.
- The smallest set of facts required for the next step.
Keep secrets and raw customer transcripts out of the packet. A session summary is not evidence that an external action succeeded: check the receipt before retrying a send, purchase, or deployment.
3. Reduce the next request
- Stop repeated automatic attempts at the failing task while you inspect it.
- Replace full log dumps with a bounded excerpt around the error. Save full logs separately for investigation.
- Request only relevant file sections and split large document analysis into explicit stages with saved results.
- If your release supports it, use
/compactwith focus instructions naming the goal, pending work, and identifiers to preserve. Verify the result rather than assuming every detail survived.
If the current input alone is too large, summarizing earlier conversation cannot make it fit. Reduce that input first. Do not raise context settings blindly or switch to a more expensive model without confirming its capacity and cost.
4. Resume with an acceptance check
If recovery still fails, retain the old session and start a fresh one using your release's documented new-session action. Supply the restart packet and only the next bounded task. Ask the agent to restate the constraints and identify the next step before allowing external actions. Compare its answer with the packet.
Pass evidence is a completed next step, correct identifiers and constraints, and no repeated external action. Record the version, model, recovery method, and result. If the fresh session also fails with small input, investigate provider errors separately.
5. Make handoffs repeatable
Keep the handoff packet with the next session. Record the goal, the last verified result, and the first unresolved step so another operator can resume it.
Get your free CWYN Score to choose your next setup improvement.