Context is the information a large language model (LLM) receives for a particular interaction. Memory can also mean records the application stores for later use, such as a conversation transcript or a progress file. Long-running work depends on keeping those records useful and supplying the relevant parts when the model needs them. Prompt caching addresses a separate concern: reusing the processing of repeated input. See Anthropic's explanations of context engineering and prompt caching.

After a pause, an assistant needs to establish what was requested, what happened and what remains unresolved. A handover helps preserve those distinctions, especially when the conversation or working files have changed.

Context, parameters, records and caching

Mechanism What it contributes
Model parameters Learned numerical values supporting the model's general capabilities.
Active context Information supplied for the current model interaction, including relevant instructions, messages and observations.
Durable records Information stored outside the immediate context, such as repository files, transcripts and progress notes.
Prompt caching Reuse of previously processed prompt prefixes when the provider's caching conditions are satisfied.

An example supplied in a prompt can change a model's response without changing its trained parameters. The original GPT-3 research demonstrated adaptation to tasks through textual instructions and examples without updating those parameters during evaluation. Supplying a repository detail in a conversation therefore does not establish that the model has permanently learned it. See Language Models are Few-Shot Learners.

A saved progress note has a different limitation: it can remain on disk while absent from the model's active context. The application needs a way to retrieve and load the information for it to inform the next response.

Selecting relevant context

The context window is the model's finite capacity for the information supplied to an interaction, measured in tokens, the units into which model input is encoded. Context engineering includes selecting instructions, tool information and retrieved material, then managing them as the conversation grows. Anthropic describes loading information when needed and retaining references to larger external records in Effective context engineering for AI agents.

Consider a hypothetical task in a source-code repository, the project's files and their version history: update a name-formatting function to handle empty input according to the requester's specification, update its tests and add a release note. The function, the code that calls it and relevant test assertions may help establish the required change. An unrelated deployment transcript may offer little help with that decision.

Relevance can change during investigation. An assertion, a test's check that a condition holds, may resolve a narrow ambiguity; inspecting the calling code may reveal a wider dependency. Historical material also needs its original scope. A note about an earlier release does not establish the requirements for the current change.

Capacity alone does not explain how effectively a model uses its input. In Lost in the Middle, Liu and colleagues found that performance often changed when relevant information moved within the supplied context. The finding concerns the models and retrieval tasks they evaluated. See Lost in the Middle.

What prompt caching and session persistence preserve

Prompt caching reuses processing for a matching prompt prefix, the opening portion of a request. This can reduce repeated processing time and cost under the provider's caching rules. The application still needs to supply the task and manage its state; a cache entry does not establish the repository's current contents. See Prompt caching.

Durable task records are retrieved into the active request context. That context goes to input processing, with optional matching-prefix cache reuse. Processed context and trained model parameters support response generation. No connection updates parameters from saved notes or restores repository state from the cache.
Figure 3.1. Durable records inform a response only after relevant content is retrieved into the request. Prompt caching can reuse eligible prefix processing, while trained parameters support generation. These mechanisms do not establish the repository's current state or automatically update one another.

Session persistence preserves the recorded conversation. Anthropic's Agent SDK (software development kit) documentation describes sessions containing prompts, responses, tool calls and results, with ways to return to a previous session. It distinguishes that history from filesystem state: resuming a conversation does not automatically restore the files as they existed earlier. See Work with sessions.

For example, a saved transcript might describe an edit that another contributor later changed. It remains a record of the earlier activity. Inspecting the current repository establishes which code exists now.

Compaction and handovers after an interruption

Compaction summarises accumulated conversation material to make room for continued work. A summary can preserve the direction of a task while omitting details. In Anthropic's long-running coding experiments, compaction alone did not resolve incomplete work, undocumented progress or premature completion claims. See Effective harnesses for long-running agents.

Suppose the hypothetical name-formatting change pauses after an edit, with the test outcome unconfirmed and the release note unfinished. A handover could identify the requested behaviour, affected files, completed edits and any available test output. A branch or commit reference can help locate that work. The handover would also need to distinguish a test that completed from one merely planned or started.

Continuation involves reconciling that record with the environment. If someone has since changed the function, earlier conclusions may need reassessment. Recording the model version and the harness version, identifying the software that coordinates model interactions and tools, also helps a later reader establish which system produced the execution record. Version information supports comparison without explaining every difference in behaviour.

A saved transcript and handover and the current repository state both feed reconciliation. Reconciliation separates supported progress from changed, missing or unconfirmed work. Both feed continuation context for a resumed model and tool loop, which can record later progress in the handover. No arrow restores files from the saved conversation.
Figure 3.2. A saved conversation describes earlier activity; the repository shows what exists now. Reconciliation preserves supported progress while carrying unfinished or unconfirmed work into the next interaction. Resuming a conversation does not automatically restore earlier files.

Keeping tool output and delegated work usable

Tool responses consume part of the information the application manages. Relevant excerpts and references to complete records can keep an exchange focused while preserving access to further evidence.

A subagent is a separate worker assigned part of a task. Claude Code supports subagents with their own contexts, returning summaries to the coordinating agent. Separate contexts consume their own input and output tokens, and their results need to be integrated. Delegation therefore carries processing and coordination costs alongside the benefit of moving detailed work out of the main context. See Extend Claude Code.

For the hypothetical change, delegated test inspection could help if the findings identify which tests were examined and which questions remain unresolved. The coordinating assistant would still need enough information to relate those findings to the function change and release note.

Vikram Mohan

A London based technology consultant who has a background in cybersecurity, risk, assurance and controls, covering their design, testing and reporting.

Vikram audited the controls of one of Europe's largest banks from within its Economic Crime and Cybersecurity Audit team, including third party risk reviews of its largest cloud and outsourcing partners, and reported to its audit committee. He has more than ten years of consulting, transformation and cybersecurity experience at Capgemini Invent, Deloitte, Accenture and Tata Consultancy Services, across the public sector, financial services and several other industries.

  • Frameworks: NIST Cybersecurity Framework, COSO Internal Control, GDPR and DPIA, UK operational resilience (PRA SS1/21, FCA PS21/3), DORA
  • BCS Chartered IT Professional (CITP); CISSP in progress
  • MBA, SP Jain School of Global Management; MSc Distributed Systems and Networks, University of Kent