Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Multi-turn agents usually “forget” because earlier messages have been dropped, compressed, or become harder to retrieve inside a growing context—not because the model has lost knowledge from training. Treat the prompt as limited working memory: inspect what each request contains, then choose whether to trim old turns, compact them into a summary, clear obsolete tool output, or save durable state outside the conversation.
Why does an AI agent forget earlier instructions?
An API-driven conversation often sends previous messages along with each new request: system and developer instructions, user turns, assistant replies, tool calls and results, and sometimes retrieved memory. The model works from the context supplied for that request; it is not consulting an unlimited record of the entire conversation. Anthropic describes the information assembled for a model at inference time as “context engineering”: selecting the useful messages, tools, and external data for the next step (Anthropic’s context-engineering guidance).
As an Amazon Associate I earn from qualifying purchases.
As an agent acts, it creates more material that might matter later. All of it competes for finite context space. Anthropic calls the context window a model’s working memory and notes that accuracy and recall can degrade as the context grows, a phenomenon it calls “context rot.” That is a reason to curate context, not evidence that every model or task degrades at the same rate (Anthropic’s context-window documentation).
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Three different problems can look like forgetting
- The request is too large. It may exceed the model’s context limit and fail, or the application may have to shorten it.
- The application removed or summarized history. The needed instruction may no longer be present verbatim.
- The information is present but difficult to retrieve. A large prompt can make an earlier detail less accessible even when it has not been removed.
These causes call for different fixes. Log the actual request sent to the model before deciding that the model itself has forgotten.
#1 Best Overall
How do I keep context across agent turns?
Start by making context growth visible. Record what enters each model request, including instructions, conversation messages, tool definitions and outputs, retrieved notes, and the output budget. Then reserve space for the model’s response and the next tool cycle rather than filling the entire available window with history. Use the provider’s current token-counting and context-management documentation; there is no universally established threshold that suits every task.
- Inspect the request. Confirm whether the required instruction or decision is actually present, and identify which content is consuming the context.
- Keep recent interaction intact. Recent turns often depend on precise wording and tool exchanges; avoid deleting fragments arbitrarily.
- Choose a policy for older material. Trim complete turns for bounded tasks, compact older history for long conversations, clear bulky tool results when they are no longer needed in raw form, or persist milestone state externally.
- Protect durable facts explicitly. Store hard constraints, settled decisions, progress, and source pointers somewhere the agent can retrieve them rather than trusting a summary alone.
- Test recovery on real traces. Replay representative long interactions and check whether the agent can state active constraints, explain decisions, identify the next action, and point to supporting sources.
Which context-management approach should I use?
| Approach | Best fit | What it preserves | Main risk or cost |
|---|---|---|---|
| Complete-turn trimming | Short-lived chats or bounded tasks | Recent exchanges and their associated tool activity | Older decisions disappear, and turn lengths vary. |
| Summarization or compaction | Long conversations or tool-intensive work | A distilled account of older history | Important details can be omitted. |
| Tool-result clearing | Tool-heavy work where old raw results are no longer needed | The conversation plus whatever summaries or references are retained | Evidence may need to be fetched again; behavior and cache effects are vendor-specific. |
| Structured external notes | Milestone-based work or continuity across sessions | Durable state selected and stored explicitly | Requires storage, retrieval, and upkeep. |
When should I compact older conversation?
Compaction replaces some older history with a generated summary so a run can continue using less active context. It suits a conversation with extensive follow-up or tool work, especially when retaining every raw message is unnecessary. Anthropic’s threshold-compaction documentation describes configuring a token threshold and continuing from a summary or compaction block; exact API names, beta headers, and model support can change, so check the current documentation before implementing it.
Rank #2
Compaction is lossy by design. A detail that seems incidental when the summary is made may become critical later. Anthropic specifically cautions that overly aggressive compaction can discard subtle but important context (context-engineering guidance).
Give the summary a job-specific checklist
- Objective and hard constraints
- Relevant user preferences
- Settled decisions and why they were made
- Current progress and unresolved questions
- Next action
- Exact source references needed to verify details later
Keep recent turns verbatim when precise wording matters, and store non-negotiable requirements in explicit state as well as in the summary. Anthropic’s live compaction documentation is the place to verify current configuration details.
When is trimming safer than summarizing?
If older raw conversation is no longer useful, remove it at complete turn boundaries. In the OpenAI Agents SDK cookbook, a turn is a user message plus the assistant and tool activity that follows, ending before the next user message. Retaining the last N complete user turns is one straightforward policy; the cookbook also demonstrates summarizing older history while leaving recent turns intact (OpenAI Agents SDK session-memory cookbook).
Do not trim arbitrary message fragments. Removing a tool result while retaining an assistant reply that depends on it, for example, can leave incoherent history. A turn-count limit also is not a fixed token budget: one turn with large tool output can outweigh many ordinary exchanges. Pair turn retention with a token-aware bound or a summarization policy, and keep durable requirements separately.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.When should I clear old tool results?
Search results, file contents, and other tool outputs can occupy substantial context after the agent has already processed them. Anthropic’s context-editing feature can clear older tool results server-side before the prompt reaches the model, while the client may keep its full, unmodified history. The documentation also notes possible prompt-cache effects, so treat this as vendor-specific behavior and verify current support and configuration (Anthropic’s context-editing documentation).
Before clearing a result, preserve what later steps need: a concise finding, its provenance, and a pointer that allows retrieval or audit. If the agent may need to inspect the evidence again, clearing the raw output without a recovery path trades context space for potential rework.
Best Value
When should I store state outside the context window?
For work that spans milestones or sessions, keep durable state in a file, database, or memory service and load the relevant parts when needed. Anthropic describes writing structured notes outside the context window and retrieving them later; the MemGPT paper explores virtual context management through memory tiers for document work and multi-session chat. These are architectural patterns, not a requirement to adopt a particular product (MemGPT: Towards LLMs as Operating Systems).
A practical record can separate stable task state from transient tool output:
- Goal and constraints: the objective and requirements that must not be violated.
- Decisions: what was decided and the reason, so the agent does not reopen settled questions without cause.
- Current state: completed work, pending actions, and unresolved issues.
- Evidence: important facts with confidence or provenance and pointers to source data.
Include an explicit retrieval step at session start or a recovery checkpoint. External notes help only if the agent knows when to load them and can find the relevant evidence.
How can I tell whether the fix worked?
Evaluate continuity on representative traces from your own agent rather than assuming a particular threshold or memory format is optimal. Compare behavior before and after trimming, compaction, or tool-result clearing. Ask concrete questions at the points where context changes:
- Which constraints are still active?
- Which decisions are settled, and why?
- What is the next action?
- Which source supports a particular fact?
Check not only whether the agent can repeat a summary, but whether it resumes the correct action and can recover details from referenced sources. No universal context threshold, state schema, or performance gain is established for all agents; the useful policy depends on the task and should be validated against its failure modes.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

