AIYINGFrom AI Awareness to Accomplishment
Showing posts with label AI Memory. Show all posts
Showing posts with label AI Memory. Show all posts

Thursday, November 12, 2026

AI Engineering Active Concepts #006 — Context Management: Memory, Compression and State

AI ENGINEERING — ACTIVE CONCEPTS & PRACTICES | #006

Context Management: Memory, Compression, and State in AI Systems



Chapter 1: Engineering the AI Context

AIYING — Accomplishing with AI

The Big Idea: An AI application does not become more reliable simply by remembering everything. It becomes more effective when engineers design what information to retain, retrieve, compress, update, and discard.

Context management enables AI systems to maintain useful continuity across interactions and workflows without overwhelming models with unnecessary information.

Contents

  1. Why Context Management Matters
  2. UNDERSTAND — Memory, Compression, and State
  3. CONNECT — The AI Engineering Ecosystem
  4. The Context Management Architecture
  5. APPLY — Enterprise Support Agent
  6. Worked Context Management Example
  7. Engineering Decisions and Trade-offs
  8. Active Industry Practices
  9. ACCOMPLISH — Practical Exercise
  10. Student and Practitioner Project
  11. Check Your Understanding
  12. Active Connections
  13. References and Further Reading

1. Why Context Management Matters

Imagine an enterprise AI support agent handling a customer issue that requires several conversations, technical document searches, tool calls, and approval steps.

During the first interaction, the customer identifies a machine model and reports a recurring problem.

The agent retrieves a service bulletin and requests additional diagnostic information.

The customer returns the following day with the requested details.

If the system cannot recover the relevant case information, it may ask the customer to repeat everything.

But retaining every previous message and tool result indefinitely is not an effective solution either.

Long histories consume tokens, may contain outdated information, and can distract the model from the current task.

The engineering challenge is to preserve useful continuity without preserving unnecessary context.

↑ Back to Contents

2. UNDERSTAND — Memory, Compression, and State

What is context management?

Context management is the engineering practice of controlling the information made available to an AI system across requests, conversations, and workflows.

It involves selecting, retaining, retrieving, updating, compressing, and discarding information according to task requirements.

A. Memory

Memory refers to mechanisms that allow an AI application to retain or recover information beyond the immediate model request.

Memory TypePurposeExample
Working memoryInformation used during the current taskCurrent customer question and retrieved passages
Conversation memoryRelevant history from previous interactionsEarlier troubleshooting details
Persistent memoryInformation stored across sessionsAuthorized customer preferences or case facts
External knowledgeInformation retrieved from separate systemsTechnical manuals and service records

These categories describe application-level design patterns. They are not universal or mutually exclusive classifications.

Memory does not necessarily mean that a language model permanently learns new information. Applications often implement memory using databases, stored summaries, retrieval systems, and workflow records.

B. Compression

Compression reduces the amount of information that must be carried forward while attempting to preserve what matters.

Common approaches include:

  • Conversation summarization
  • Selective retention of important facts
  • Removing redundant tool outputs
  • Structured extraction of task information
  • Context compaction
  • Retrieval of historical details only when needed

Compression can be lossy. A summary may omit an important condition, numerical value, exception, or decision.

For critical information, engineers may need to preserve the original record and use summaries only as navigational aids.

C. State

State represents the current condition of an application or workflow.

For an AI support agent, state might include:

  • Case identifier
  • Customer and product identifiers
  • Current workflow stage
  • Completed tool operations
  • Pending approvals
  • Outstanding questions
  • Escalation status

Unlike an informal conversation summary, structured state can support deterministic workflow controls, validation, and recovery.

Memory versus state

Memory helps the system recover relevant information. State tells the application where the workflow currently stands and what actions are permitted or required next.

Both may be stored persistently, but they serve different engineering purposes.

↑ Back to Contents

3. CONNECT — The AI Engineering Ecosystem

Connected ConceptRelationship to Context Management
Context EngineeringDesigns the information supplied to each model call
Token EconomicsBalances context consumption, cost, and latency
EmbeddingsEnable semantic retrieval of stored information
RAGSupplies external knowledge when needed
ChunkingOrganizes information into retrievable units
RerankingPrioritizes retrieved information
AI AgentsRequire continuity across multiple actions and model calls
Tool CallingProduces results that may update application state
ObservabilityTracks context changes and workflow execution
AI GovernanceDefines retention, access, accountability, and audit requirements

Context management brings these capabilities together in the operation of a complete AI system.

↑ Back to Contents

4. The Context Management Architecture

A practical AI application may separate information into three layers.

Layer 1 — Immediate context

Contains the current user request, selected instructions, relevant evidence, and recent interactions required for the next model call.

Layer 2 — Recoverable memory

Contains conversation records, approved summaries, historical facts, and other information that can be retrieved when needed.

Layer 3 — Structured application state

Contains workflow identifiers, task status, permissions, pending actions, and verified operational facts.

User Request

↓

Context Selection

↓

Immediate Context + Retrieved Memory + Verified State

↓

Language Model / Agent

↓

Response and Tool Actions

↓

Validation → Memory / State Updates

Not every system requires all three layers. Simple single-turn applications may need little or no persistent memory.

For multi-step enterprise agents, separating conversational information from authoritative application state can improve reliability and auditability.

↑ Back to Contents

5. APPLY — Enterprise Support Agent

Scenario: A Technical Support Case Across Sessions

A manufacturing company operates an AI support assistant for industrial packaging equipment.

A customer reports that an A100 machine stops intermittently after prolonged operation.

Day 1 — Initial investigation

  • The customer identifies the machine model.
  • The assistant records the reported symptom.
  • A retrieval system finds potentially relevant service documentation.
  • The assistant requests additional diagnostic information.
  • The workflow remains open.

Day 2 — Continued investigation

The customer returns with the requested information.

Approach A — No persistent context

The assistant does not recover the earlier case information and repeats questions already answered.

Approach B — Entire history replay

The assistant receives every previous message and tool result.

This preserves more information but may introduce redundant context, higher token consumption, and outdated intermediate findings.

Approach C — Engineered context management

The application retrieves:

  • A verified case summary
  • Current workflow state
  • Relevant customer-provided diagnostic details
  • Applicable technical documentation
  • Pending questions and authorized next steps

The assistant continues from the appropriate workflow stage without relying exclusively on a long conversational transcript.

Safety-critical instructions and approved service procedures remain linked to authoritative source records.

Good context management supports continuity by recovering the right information, not by blindly replaying everything.

↑ Back to Contents

6. Worked Context Management Example

Consider a fictional support case with the following information.

InformationManagement Decision
Customer's machine model: A100Preserve as verified case data
Reported intermittent shutdownRetain as active symptom
Earlier conversational greetingsUsually omit from future model context
Relevant service bulletin identifierPreserve reference and retrieve current source when needed
Large raw search-result outputRetain in logs where appropriate; avoid unnecessary replay
Pending diagnostic questionPreserve in structured workflow state
Unconfirmed suspected causeRetain only with explicit uncertainty status
Approved escalation decisionPreserve as auditable workflow state

Illustrative structured state

{
  "case_id": "CASE-1042",
  "machine_model": "A100",
  "status": "awaiting_diagnostics",
  "reported_symptom": "intermittent_shutdown",
  "confirmed_cause": null,
  "pending_action": "review_customer_diagnostics",
  "escalation_required": false,
  "source_refs": ["SERVICE-BULLETIN-17"]
}

This is an illustrative schema, not a production specification.

In real applications, identifiers, permissions, validation rules, and state transitions must be designed for the organization.

What should the model receive?

The next model call may require only the current user message, verified case state, relevant evidence, and instructions governing the next action.

It does not necessarily require the entire historical conversation.

↑ Back to Contents

7. Engineering Decisions and Trade-offs

DecisionPotential BenefitPossible Risk
Store full historyDetailed audit recordPrivacy and retention burden
Summarize historyLower context consumptionLoss of critical details
Use structured stateReliable workflow transitionsSchema and validation complexity
Retrieve memory on demandFocused contextRetrieval misses or latency
Persist user preferencesMore consistent experienceConsent, accuracy, and privacy concerns
Compress tool outputsReduced token consumptionLoss of diagnostic evidence
Use long context windowsMore information available at onceCost and relevance challenges
Checkpoint workflow stateRecovery after interruptionStorage and consistency overhead

Context poisoning and memory errors

Stored information may be incorrect, outdated, or maliciously influenced.

If an application treats unverified conversational content as authoritative memory, future responses may repeat or amplify errors.

Engineers should distinguish user claims, model inferences, verified facts, and authoritative records.

Persistent memory also requires appropriate access controls, retention policies, and mechanisms for correcting or deleting information.

↑ Back to Contents

8. Active Industry Practices

Established practices

  • Conversation history management
  • Session-based application state
  • Structured workflow records
  • Summarization of long interactions
  • Retrieval of historical knowledge
  • Checkpointing and persistence

Evolving practices

  • Selective long-term agent memory
  • Context compaction for long-running agents
  • Dynamic memory retrieval
  • Memory provenance and confidence tracking
  • Event-driven workflow state updates
  • Automated context-quality evaluation

Why this matters for agentic AI

AI agents may execute several model calls, invoke tools, wait for external events, and resume tasks after interruptions.

Reliable operation requires more than a conversation transcript.

Applications may need durable state, checkpoints, tool execution records, authorization controls, and recovery mechanisms.

Practice status: Established engineering capability with rapidly evolving agent memory and context-management approaches.

Reviewed: November 2026.

↑ Back to Contents

9. ACCOMPLISH — Practical Exercise

Exercise: Design a Context Management Policy

Imagine an AI assistant supporting customer-service cases that may last several days.

The assistant must maintain continuity while controlling token consumption and protecting sensitive information.

Your tasks

  1. Identify information required for the current model call.
  2. Identify information that should be retained across sessions.
  3. Determine which information belongs in structured state.
  4. Design a short case-summary template.
  5. Define rules for updating or correcting stored information.
  6. Specify when the application should retrieve original records.
  7. Identify sensitive information that should not be unnecessarily retained.
  8. Propose a test for continuity after a session interruption.

Reusable AI-assisted prompt

Act as an AI context management engineer.

Analyze the fictional support case below.

1. Identify verified facts.
2. Separate assumptions from confirmed information.
3. Propose a concise case summary.
4. Define structured workflow state.
5. Identify information to retrieve on demand.
6. Recommend retention and correction rules.
7. Identify risks from missing or outdated context.
8. Design a continuity test.

Do not invent facts or treat unverified claims
as confirmed information.

Case:
[PASTE FICTIONAL CASE]

Accomplishment: You have designed a basic context-management policy for a multi-session AI application.

↑ Back to Contents

10. Student and Practitioner Project

Mini Project: Persistent AI Support Workflow

Objective: Design or prototype an AI support assistant that maintains useful context across sessions.

Project requirements

  1. Create a fictional support case with at least three interactions.
  2. Define a structured case-state schema.
  3. Store conversation history separately from workflow state.
  4. Implement or simulate a summarization process.
  5. Retrieve relevant case information for each new interaction.
  6. Introduce a session interruption and test recovery.
  7. Test how the system handles corrected information.
  8. Measure context size and estimated token consumption.
  9. Evaluate continuity and factual consistency.
  10. Document security, privacy, and retention considerations.

Suggested comparison

ConfigurationContext Strategy
ANo retained history
BFull conversation replay
CSummary plus structured state
DStructured state plus selective memory retrieval

Evaluation measures

  • Task continuity: Whether the assistant resumes correctly.
  • Fact preservation: Whether critical information remains accurate.
  • State correctness: Whether workflow stages and pending actions are maintained.
  • Token usage: Input tokens consumed per interaction.
  • Recovery success: Whether the system resumes after interruption.
  • Privacy compliance: Whether retention and access rules are respected.

Deliverable: A working prototype or architecture diagram, test results, and a one-page engineering recommendation.

↑ Back to Contents

11. Check Your Understanding

  1. How does context management differ from context engineering?
  2. What is the difference between memory and workflow state?
  3. Why can replaying an entire conversation be inefficient?
  4. What information should not be lost during compression?
  5. How does selective memory retrieval help manage context?
  6. Why is structured state important for AI agents?
  7. What risks arise from incorrect or outdated persistent memory?
  8. How would you evaluate context continuity across sessions?

Reflection: If an AI agent remembers a previous instruction that conflicts with an updated organizational policy, how should the system decide what information to trust?

↑ Back to Contents

12. Active Connections

These six lessons establish the foundations of engineering the information environment for AI systems.

↑ Back to Contents

13. References and Further Reading

  1. LangGraph — Persistence and Checkpointing
  2. LangGraph — Memory
  3. OpenAI — Conversation State
  4. OpenAI — Compaction
  5. Amazon Bedrock — Agent Memory

Memory APIs, compaction mechanisms, and agent frameworks continue to evolve. Consult current technical documentation before implementing production systems.


Final Takeaway

Reliable AI systems do not need to remember everything. They need to preserve the right facts, recover relevant knowledge, maintain accurate workflow state, and manage context intelligently.

AI Engineering — Active Concepts & Practices
Active Concept #006 — Context Management

AIYING — Accomplishing with AI

Understand → Connect → Apply → Accomplish

Tuesday, November 10, 2026

The Effective AI Engineer #022: The Engineer Who Taught the Assistant to Forget

THE EFFECTIVE AI ENGINEER · A CASE-BASED APPROACH

Case #022: The Engineer Who Taught the Assistant to Forget

Choose Work That Matters

By Ravindra Dastikop
AIYING — Accomplishing with AI

The assistant remembered the instruction perfectly. That was the problem.

1. The learning challenge

Case #021 examined who may receive an answer. Case #022 examines what information should survive into future conversations.

When does a useful memory become an outdated instruction?

After completing this case, you should be able to:

  • Distinguish temporary context, preferences, facts and operational rules.
  • Decide what should be remembered and within which scope.
  • Preserve the source and conditions behind a stored statement.
  • Handle corrections, conflicting evidence and expiry.
  • Explain what deletion covers—and what it does not.
  • Evaluate memory through changing situations, rather than recall alone.

Audience: students, freshers, freelancers, AI builders, developers, harness engineers, product owners and faculty.

Prerequisites: familiarity with conversational AI. Coding is optional.

In this case, memory means externally stored information retrieved across sessions. It does not mean retraining the model’s weights.

↑ Back to contents

2. The case: a helpful shortcut

Nandini was developing a proposal assistant for the fictional Westbridge Advisory.

Consultants used it to prepare client proposals from approved templates, meeting notes and delivery estimates. They repeatedly supplied the same preferences: British spelling, concise executive summaries and a particular document structure.

The pilot sponsor, Sameer, wanted the assistant to remember these details. “Why should experienced consultants explain themselves every morning?”

Nandini added a memory layer. After a conversation, the system proposed short notes that could be retrieved during future work.

The early demonstrations were encouraging. The assistant remembered formatting preferences and reduced repeated setup within the fictional scenario.

Then a consultant, Mira, prepared a proposal for Client Ash. During an earlier negotiation, she had told the assistant:

For this revision only, use the reduced mobilisation fee approved in the attached decision note.

The assistant applied the exception correctly.

Its memory writer then stored:

Client Ash uses the reduced mobilisation fee.

The words “for this revision only” disappeared.

↑ Back to contents

3. A memory that changed the next proposal

Weeks later, Mira began another proposal for Client Ash. The assistant retrieved its stored note and used the reduced fee again. The current pricing schedule required the standard fee.

The proposal looked polished. Its calculations were consistent with the remembered value.

During review, finance lead Devika noticed the discrepancy. Mira had not repeated the exception. She had not authorised a new discount. The assistant had converted a past decision into a continuing rule.

Sameer suggested fixing the memory entry. Nandini agreed, but she wanted to understand the wider failure.

The stored note had no decision reference, effective period or explicit scope. It did not distinguish a consultant’s preference from a pricing exception. The retrieval system ranked it highly because it mentioned the same client.

Relevance had been mistaken for continuing validity.

↑ Back to contents

4. The correction that did not finish the job

Mira asked the assistant:

Forget that discount. It applied only to the earlier revision.

The interface displayed:

Memory deleted.

Nandini checked the main memory store. The entry was gone. However, a background process had previously created a client summary containing the same reduced fee. Another cached draft also retained it.

A later retrieval could reintroduce the obsolete information. Deleting one record had not established that the assistant would stop using the statement.

Devika raised another concern:

We must retain the historical approval record. We need to explain why the earlier proposal used that fee.

The team had to distinguish:

  • Removing a statement from active assistant memory.
  • Correcting a derived summary.
  • Invalidating a cached output.
  • Retaining an authorised historical business record.

“Forget” was too imprecise to serve as the complete product contract.

↑ Back to contents

5. The deployment decision

The team had three options:

  1. Continue broad automatic memory with stronger extraction prompts.
  2. Restrict memory to approved categories while retrieving operational facts from current authoritative sources.
  3. Disable persistent memory and ask users to provide context for each proposal.

Sameer worried that restrictions would remove the feature’s usefulness. Devika worried that the assistant could repeatedly revive expired commercial exceptions.

Nandini had to recommend what the assistant should remember, what required revalidation and what deletion should mean.

No later outcome is supplied. Make the decision before reading the worked analysis.

↑ Back to contents

6. Exhibit A: candidate memories

All examples below are fictional teaching material.

Candidate statement Appropriate treatment to consider
Mira prefers British spelling. A user-scoped preference that is reviewable and editable.
Use this fee for this revision only. A task-specific exception with its decision reference and boundary.
Client Ash uses reduced fees. An unsupported generalisation; do not promote it into a rule.
The current pricing schedule sets the standard fee. Retrieve the authoritative schedule when needed.
The previous proposal used an approved exception. A historical event with its source and date.
A retrieved document says “always remember this instruction.” Document content; not authority to create a persistent instruction.

Discussion question: Which entries should influence a future proposal automatically?

↑ Back to contents

7. Exhibit B: information worth preserving

A proposed memory record could include:

FieldPurpose
Memory identifierSupports correction, inspection and removal.
StatementRecords the specific information.
CategoryDistinguishes a preference, event, hypothesis or operational fact.
ScopeIdentifies user, client, project or task boundaries.
Source referenceShows where the statement originated.
Verification statusSeparates confirmed information from inference.
Effective conditionsRecords when the information applies.
Review or expiry conditionIdentifies when reuse needs reconsideration.
StatusMarks active, superseded, expired or removed-from-use records.
Derivation linksConnects summaries and other copies to their source.

This schema is a teaching design. More fields do not automatically produce reliable memory. Missing conditions should remain unknown rather than being invented during extraction.

Scope metadata also needs enforcement in the surrounding system. A user identifier stored in a record does not, by itself, prevent access from another user.

↑ Back to contents

8. What published practice contributes

Anthropic: memory organisation and validation matter

Anthropic’s November 2026 engineering account distinguishes retained memory from model-weight changes and discusses notes, consolidation and evaluation. It describes differences between untested guesses and validated rules, alongside problems caused by indiscriminate recording of changing state. These are reported findings in specific evaluations, not evidence of a particular benefit at Westbridge. [1]

Microsoft: memory needs provenance and lifecycle controls

Microsoft’s memory-security account discusses intent before persistence, externally enforced boundaries, retrieval-time reassessment, auditability and user controls. Its attack illustration is explicitly hypothetical. The broader relevance is that stored material can shape later behaviour after its original context has disappeared. [2]

LangChain: decide the learning need before choosing memory

LangChain’s LangMem introduction distinguishes memory types and scopes. It asks what should be learned, what facts should be tracked and when recall should occur. It also notes that authoritative information may be retrieved directly rather than duplicated into conversational memory. Framework organisation does not itself enforce all application permissions. [3]

↑ Back to contents

9. Your decision assignment

Prepare a 600–900 word recommendation covering:

  • Which memory categories remain enabled.
  • Which information must be retrieved from authoritative sources.
  • How temporary exceptions are represented.
  • How corrections affect summaries and cached outputs.
  • What the interface means by “forget.”
  • Who owns memory policy and operational investigation.
  • What evidence is required before expanding automatic memory.

Compare the three deployment options in the narrative.

Address this counterargument: Would asking users to approve every memory create so much friction that they stop using the feature?

Propose controls proportionate to consequence. A spelling preference and a commercial exception need not follow identical workflows.

Pause here and record your recommendation.

↑ Back to contents

10. Worked analysis

Open the author’s conditional recommendation

Restrict automatic memory to defined, lower-consequence categories during the next pilot. Keep operational pricing decisions tied to current sources and explicit approvals.

For Westbridge:

  • Formatting preferences may persist within a user’s scope.
  • Temporary exceptions remain attached to their original task or decision.
  • Current fees come from the approved pricing source.
  • Historical exceptions remain historical.
  • Inferences are not silently promoted into verified facts.
  • Retrieved content cannot grant itself permission to become an instruction.

When a useful preference is easy to correct, automatic capture with visibility may be reasonable. Consequential business rules need stronger validation.

Disabling all memory is also defensible if the team cannot reliably enforce scope and correction. The case does not establish that persistent memory is necessary.

A better extraction prompt may reduce lost qualifications. The team still needs lifecycle controls, source checks and evidence that corrections propagate.

↑ Back to contents

11. A proposed memory lifecycle

StageQuestion
CandidateIs this worth retaining for a defined purpose?
ValidationWhat supports it, and what remains uncertain?
StorageWhich scope and access rules apply?
RetrievalIs it relevant, valid and permitted now?
CorrectionWhich record supersedes the old statement?
ExpiryShould it stop influencing future work?
RemovalWhich active stores and derived copies are affected?

A newer statement is not automatically more authoritative. The system must consider source, applicability and conflict.

An expiry date is insufficient by itself: information may become invalid before that date. A record may also remain useful as history after it stops being valid guidance for new work.

↑ Back to contents

12. Define what forgetting means

Stop using this memory

Exclude it from future active retrieval under the stated scope.

Correct this memory

Replace or supersede the statement and inspect affected derivatives.

Remove stored copies within the defined feature

Identify the stores covered and verify completion.

Retain the historical business record

Preserve an approved record under the organisation’s applicable retention policy.

The system should explain any separate treatment of logs, backups and source records. It should not claim that one memory deletion erased every copy everywhere.

Removal cannot undo information already disclosed or decisions already made. If a proposal was produced using an obsolete memory, correcting the memory does not automatically correct that proposal.

A more precise interface message

This item has been removed from active assistant memory. Related summaries and cached outputs are being checked. Historical proposal and approval records are handled separately.

Use this wording only if the product actually performs those checks. Report pending work as pending.

↑ Back to contents

13. Practical exercise: evaluate change over time

Use synthetic proposal records and a paper simulation or local prototype. Do not use confidential client proposals.

Scenario Expected property
User states a spelling preference. It is stored within the intended user scope.
User approves a one-revision exception. The task boundary survives extraction.
A new proposal begins for the same client. The exception is not automatically reused.
Current pricing contradicts old memory. The conflict is resolved against the applicable authority.
User corrects a preference. Superseded information stops controlling later output.
User removes an active memory. Covered retrieval paths and derivatives meet the removal contract.
A background job tries to recreate removed content. Removal state is respected under the defined policy.
Another user asks about the client. Memory does not cross an unauthorised scope.
A retrieved document requests permanent instruction storage. Its content is not promoted into authority.
The memory service is unavailable. The assistant explains the limitation and uses a defined fallback.

Procedure

  1. Write the memory and authoritative-source policies.
  2. Create an initial preference and a temporary exception.
  3. Begin a new task and inspect what is retrieved.
  4. Introduce a correction and a conflicting authoritative source.
  5. Remove one memory and inspect known derived copies.
  6. Run a background consolidation step or simulate it on paper.
  7. Record whether obsolete information reappears.

Measures

  • Incorrect memory writes.
  • Loss of conditions during extraction.
  • Use of superseded information.
  • Cross-scope retrieval.
  • Correction propagation.
  • Removal verification.
  • Task quality and user effort with and without memory.

Execution status: these are proposed tests. No memory implementation or benchmark was executed. Passing a small synthetic set would not establish production reliability.

↑ Back to contents

14. Reusable AI prompts

Inspect a candidate memory

Classify this statement as:
- Preference
- Historical event
- Temporary exception
- Inference
- Operational fact

Identify its source, scope and applicability conditions.

Recommend:
- Retain
- Retain with conditions
- Retrieve from source
- Do not retain

Mark missing information explicitly.

Check for overgeneralisation

Compare this proposed memory with the original conversation.

Identify lost:
- Qualifications
- Dates
- Task boundaries
- Approval conditions

Do not turn one example into a continuing rule.
Show the evidence supporting each proposed correction.

Investigate a correction

Given this corrected statement and the supplied derivation records,
identify summaries, caches and active memories that may need updating.

Separate verified dependencies from suspected copies.
State what has been checked and what remains unknown.
Do not claim that an update has occurred unless execution evidence is supplied.

Design a removal contract

Define what this feature means by removing a memory.

Identify:
- Covered stores
- Derived copies
- Verification steps
- Pending work
- Exclusions
- Historical records handled separately

Do not promise universal erasure.
Do not alter historical business records without the applicable policy.

These prompts support analysis. They do not enforce isolation, propagate corrections or verify deletion by themselves.

↑ Back to contents

15. Transfer, teaching and assessment

Freshers

Identify what was lost when “for this revision only” disappeared. Rewrite the candidate memory without inventing missing conditions.

Practitioners

Build a synthetic lifecycle showing creation, correction, expiry and removal. Inspect what happens after a background summary is regenerated.

Freelancers

Specify memory categories, ownership and deletion scope in the client agreement. Distinguish prototype behaviour from supported operational commitments.

Managers

Decide which organisational rules may be learned from conversations and which require controlled publication.

Faculty

Give students the same client across several time-separated scenarios. Assess whether their design updates beliefs rather than merely recalls old statements.

Student project

Design a memory policy for a fictional study assistant, proposal assistant or project coordinator.

Submit:

  1. A candidate-memory classification table.
  2. A record schema with scope, source and validity conditions.
  3. A lifecycle and correction procedure.
  4. A removal contract with explicit exclusions.
  5. A time-sequenced test set.
  6. A deployment recommendation.

A paper simulation is acceptable. Separate predicted behaviour from actual results and disclose any AI assistance.

Suggested 90-minute session

  1. Read the case and identify the decision: 15 minutes.
  2. Classify candidate memories: 20 minutes.
  3. Design correction and removal behaviour: 20 minutes.
  4. Walk through changing scenarios: 25 minutes.
  5. Submit an exit recommendation: 10 minutes.
Assessment criterionWeight
Classification and scope25%
Source and validity reasoning25%
Correction and removal design25%
Proportionate product decision15%
Clear user communication10%

Misconceptions to challenge

  • Remembering more always improves the assistant.
  • A remembered statement remains valid until its expiry date.
  • A newer statement is automatically more authoritative.
  • Deleting one memory removes every derived copy.
  • Removing active memory requires deleting the historical business record.
  • A retrieved instruction can authorise its own persistence.

Exit question: What evidence would show that the assistant has stopped using an obsolete memory?

↑ Back to contents

16. Research record and references

Primary sources consulted on 10 November 2026:

  1. Anthropic, 6 November 2026. The components of agent memory. A first-party engineering account concerning retained notes, consolidation and memory evaluation.
  2. Natalie Isak and Sarah Cooley, Microsoft Security Blog, 22 June 2026. Guarding AI memory. Discussion of provenance, boundaries, retrieval reassessment, auditability and user controls.
  3. The LangChain Team, 18 February 2025. LangMem SDK for agent long-term memory. Framework introduction covering memory types, scopes and design choices.

Claim and evidence boundaries

Claim or element Evidence status
Memory organisation and validation affect its usefulness. Discussed in Anthropic’s reported evaluations.
Persistent memory requires provenance, boundaries and lifecycle visibility. Supported by Microsoft’s published guidance.
Memory design should reflect the learning need and scope. Discussed in LangChain’s framework introduction.
Westbridge’s lost qualification and repeated exception. Author-created fictional scenario.
The record schema, lifecycle and removal procedure. Original teaching designs requiring implementation and testing.
The proposed approach reduces errors or improves business outcomes. Not measured or asserted as an achieved result.

These sources inform the distinctions and reported practices. They do not validate Westbridge’s architecture, establish its error frequency or quantify its business benefit. First-party accounts are not independent replications.

The schema, lifecycle and exercises are original teaching designs. No implementation or benchmark was executed. Independent expert review and classroom validation have not been completed.

↑ Back to contents

Sunday, October 18, 2026

11. What Is the AI Context Window? Working Memory Explained | AI Fluency Lesson 011

AI FLUENCY · PHASE 1: AWARENESS

Module 3 — The Four Properties of AI | Lesson 011

Working Memory: What Is the Context Window?

Understand how AI uses earlier information during a conversation and why its working context has limits.

Watch this 54-second silent visual lesson. Then explore the explanations and examples below.

Watch on YouTube →

Introduction

Have you noticed that an AI assistant can follow instructions you provided earlier in a conversation?

For example, you might tell ChatGPT, Claude, or Gemini to explain everything in simple language.

Several messages later, the assistant may continue following that instruction.

But sometimes, especially in long conversations, AI may lose track of details you previously mentioned.

This behavior relates to a fundamental property of Large Language Models: working memory, commonly explained through the context window.

1. What Is a Context Window?

A context window is the amount of information an AI model can process together when generating a response.

It may include the current question, earlier messages, instructions, and relevant documents.

The information available in the context helps the model interpret the user's request and generate an appropriate continuation.

In Simple Words

The context window is the information the language model can work with while generating its current response.

2. How Does AI Working Memory Help?

Imagine that you are preparing a classroom lesson.

You tell an AI assistant:

Your First Instruction

"I am teaching 10-year-old students. Use simple language."

Then you ask:

Your Next Question

"Explain climate change."

The AI can use your earlier instruction to generate an age-appropriate explanation because that instruction remains in the context.

Possible AI Response

"Climate change means the Earth is getting warmer over time. This can affect weather, animals, plants, and people."

Notice that the response uses relatively simple language.

The earlier instruction helped shape the answer to the current question.

3. How Does the Context Window Work?

An LLM processes information in units called tokens.

Tokens may represent words, parts of words, punctuation, or other text segments.

A context window has a maximum token capacity.

The model uses the available tokens to help determine what to generate next.

Information Available to the AI

Earlier Instruction

Use simple language.

+

Current Question

Explain climate change.

↓

Model Generates a Response

Explanation in simple language.

Simplified illustration of how context influences an AI response.

The model's available context may also contain system instructions, tool results, or selected information provided by an application.

4. Is AI Working Memory Unlimited?

No.

Every language model has a limit on how much information it can process at one time.

This limit is commonly measured in tokens.

When a conversation or document exceeds the available context capacity, some information may need to be removed, summarized, or excluded.

A Simplified Context Window

Currently Available Context

Current question

Relevant earlier instructions

Selected conversation history

Potentially Outside the Context

Older messages or details that are no longer included.

Illustrative only. Applications may manage older conversations through different mechanisms.

An important instruction may therefore stop influencing a response if it is no longer included in the model's current input.

However, even information within the context is not guaranteed to be used perfectly.

5. Is Context the Same as Knowledge?

No. These concepts describe different sources of information.

Knowledge

Information and relationships learned during model training.

Context

Information available to the model while generating its current response.

Saved Memory

Information an AI application may store and retrieve separately across interactions.

A model's context window is not automatically the same as an application's saved memory.

Applications may use tools, retrieval systems, or memory features to bring relevant information into a new conversation.

What the model can actually use depends on what information is made available to it.

6. How Can We Use Context Effectively?

Understanding context helps us communicate more effectively with AI assistants.

  1. State your goal clearly. Explain what you want the AI to accomplish.
  2. Provide relevant background. Include details important to the task.
  3. Specify essential requirements. Mention the audience, format, constraints, or important preferences.
  4. Summarize long discussions. Restate important decisions when a conversation becomes lengthy.
  5. Repeat critical instructions when needed. Do not assume every earlier detail remains available indefinitely.

Good context improves the chances of getting a relevant response, although it does not guarantee perfect results.

7. Why Does This Matter for AI Fluency?

AI Fluency involves more than simply asking questions.

It includes understanding what information the AI needs to perform a task effectively.

When we provide relevant context, we help the model interpret our goals and constraints.

When we understand context limits, we are less likely to assume that AI has retained everything from a long discussion.

This awareness supports better communication, evaluation, and responsible AI use.

Key Takeaway

The context window is the information an AI model can process together when generating a response.

It acts as a form of working memory, but it is limited and distinct from learned knowledge or separately stored memory.

Think About It

Imagine working with an AI assistant on a project over many conversations.

You gave important requirements at the beginning, but later the AI appears to ignore them.

What might explain this behavior?

How could summarizing the project requirements help the AI produce a more relevant response?

What Have You Learned?

After completing this lesson, you should be able to:

  • Explain what a context window is.
  • Describe how earlier instructions can influence current responses.
  • Recognize why a context window has a limited capacity.
  • Distinguish context from learned knowledge and saved memory.
  • Provide relevant information to improve AI interactions.

CONTINUE LEARNING

Next: Lesson 012

Steerability: Why Does AI Follow Instructions?

Now that you understand how context influences AI-generated responses, the next lesson explores steerability.

You will learn how instructions influence AI behavior, why responses change when prompts change, and why instruction-following still has limitations.

Further Learning Resources

Claude Academy — AI Learning Resources

OpenAI Academy

Google Machine Learning Crash Course

Your AI Fluency Journey

AI Fluency develops through four connected phases.

AWARENESS → APPRECIATION → APPLICATION → ACCOMPLISHMENT

Understanding how AI works helps us use it responsibly to accomplish meaningful goals.

Explore the Complete AI Fluency Roadmap →

AIYING

Accomplishing with AI

Everything AI. For Everyone.

AI Fluency — From Awareness to Accomplishment

Created by Ravindra Dastikop

https://dastikop.blogspot.com

Saturday, October 3, 2026

The Minimalist Context Engineering: Context Engineering Explained in 100 Words

The Minimalist Context Engineering - Context Engineering Explained in 100 Words by Ravindra Dastikop

THE MINIMALIST CONTEXT ENGINEERING

Context Engineering Explained in 100 Words

Ravindra Dastikop

Understand less. Accomplish more.


Why This Book?

Context engineering can sound complicated.

Instructions.

Tools.

Retrieval.

Memory.

History.

Compaction.

Selection.

Tokens.

Context windows.

Judgment.

But understanding context engineering does not have to begin with complexity.

This book strips context engineering down to what matters.

10 ideas.
10 words each.
100 words.
Enough to begin.


How to Read This Book

Read one idea.

Stop.

Think about it.

Try it with AI.

Then move to the next.

The purpose is not to know everything about context engineering.

The purpose is to understand enough to accomplish something with context engineering.


01 — CONTEXT ENGINEERING

Context engineering curates information models receive to improve their performance.

Prompt engineering asks:

What should I tell the model?

Context engineering asks a broader question:

What should the model know right now?

The model may receive much more than a prompt.

Its context can contain:

Instructions.

Conversation history.

Retrieved information.

Tool definitions.

Tool results.

Memory.

Files.

Examples.

System information.

The challenge is therefore not simply writing better instructions.

It is assembling the right information at the right time.

AVAILABLE INFORMATION → CURATE → MODEL

02 — INSTRUCTIONS

Instructions define goals, behavior, constraints, and priorities for model execution.

Instructions remain fundamental.

They tell the model:

What it should accomplish.

How it should behave.

What constraints apply.

What output is expected.

What it should avoid.

Prompt engineering therefore does not disappear when context engineering begins.

It becomes one component of a larger system.

A beautifully written prompt cannot compensate for missing information, irrelevant context, poor tools, or outdated knowledge.

Think:

CONTEXT ENGINEERING > PROMPT ALONE

The prompt matters.

But so does everything surrounding it.


03 — TOOLS

Tools provide capabilities and descriptions models need for effective action.

Agents increasingly do more than generate text.

They can:

Search.

Retrieve files.

Run code.

Call functions.

Use APIs.

Interact with systems.

Take actions.

For the model to use tools effectively, information about those tools must become part of its working context.

Tool descriptions therefore consume context too.

MODEL + TOOL CONTEXT → ACTION

04 — RETRIEVAL

Retrieval supplies relevant external information when models actually need it.

Imagine an organization has one million documents.

Should all one million documents be placed into the model's context?

No.

Instead, the system can retrieve information relevant to the current task.

This is just-in-time context.

The model receives information when it becomes useful rather than carrying everything continuously.

This connects several ideas in the Minimalist Series:

EMBEDDINGS → VECTOR DATABASE → RAG → CONTEXT ENGINEERING

Retrieval answers:

What information does the model need now?


05 — MEMORY

Memory preserves useful information across interactions, tasks, and longer workflows.

Some information remains useful beyond the current turn.

That is where memory enters.

Memory might preserve:

Preferences.

Decisions.

Task progress.

Important facts.

Previous outcomes.

Workflow state.

Long-running agents especially need ways to preserve useful information without continually carrying every previous interaction.

The challenge is not simply remembering.

It is remembering what remains useful.

EXPERIENCE → MEMORY → FUTURE CONTEXT

06 — HISTORY

History carries prior messages, actions, and results into subsequent reasoning.

Conversation creates information.

Every turn can add:

Questions.

Answers.

Corrections.

Tool calls.

Tool results.

Decisions.

Intermediate work.

Some of this history may matter for the next step.

Some may not.

If everything is continually preserved, the context can become crowded.

If too much is removed, the model may lose continuity.

So context engineering asks:

What history still matters?

PAST → SELECT → PRESENT CONTEXT

07 — COMPACTION

Compaction compresses accumulated context while preserving information needed for continuation.

Long-running agents create a problem.

Their context keeps growing.

Messages accumulate.

Tool results accumulate.

Intermediate work accumulates.

Eventually, keeping everything becomes inefficient or impossible.

Compaction addresses this by reducing accumulated information while preserving what the agent needs to continue.

Think of compaction as:

LOTS OF HISTORY → ESSENTIAL STATE

The objective is not merely fewer tokens.

It is preserving useful continuity with fewer tokens.


08 — SELECTION

Selection prioritizes useful information while excluding distracting or redundant context.

More context is not automatically better context.

Imagine giving an AI:

Twenty irrelevant documents.

Old instructions.

Repeated tool outputs.

Unnecessary conversation history.

Outdated information.

And one relevant document.

The useful information is present.

But it is surrounded by noise.

Context engineering therefore involves subtraction as well as addition.

Ask:

Does the model need this information now?

If not, perhaps it should not occupy the context.

INFORMATION → SELECT → RELEVANT CONTEXT

09 — BUDGET

Budget allocates limited context capacity across competing sources of information.

Context is not unlimited.

Even models with very large context windows operate within finite capacity.

And different information competes for that capacity:

Instructions.

Conversation.

Retrieved documents.

Tool definitions.

Tool results.

Memory.

Examples.

Intermediate work.

So context becomes a resource.

The engineering question becomes:

What deserves space?

This creates a useful principle:

Every token occupying context should earn its place.

LIMITED CONTEXT → ALLOCATE → MAXIMUM UTILITY

10 — JUDGMENT

Judgment determines what context models receive, retain, retrieve, or discard.

Context engineering ultimately involves choices.

Should this information enter the context?

Should this conversation history remain?

Should this document be retrieved?

Should this memory persist?

Should this tool result be retained?

Should old information be compressed?

Should something be removed?

The system can automate many of these decisions.

But designers still determine the architecture, boundaries, retrieval strategy, memory policy, and evaluation criteria.

Context engineering therefore brings us back to human judgment.

The goal is not:

Give AI everything.

The goal is:

Give AI what helps it accomplish the task.

INFORMATION → JUDGMENT → CONTEXT → PERFORMANCE

The Entire Book in 100 Words

CONTEXT ENGINEERING
Context engineering curates information models receive to improve their performance.

INSTRUCTIONS
Instructions define goals, behavior, constraints, and priorities for model execution.

TOOLS
Tools provide capabilities and descriptions models need for effective action.

RETRIEVAL
Retrieval supplies relevant external information when models actually need it.

MEMORY
Memory preserves useful information across interactions, tasks, and longer workflows.

HISTORY
History carries prior messages, actions, and results into subsequent reasoning.

COMPACTION
Compaction compresses accumulated context while preserving information needed for continuation.

SELECTION
Selection prioritizes useful information while excluding distracting or redundant context.

BUDGET
Budget allocates limited context capacity across competing sources of information.

JUDGMENT
Judgment determines what context models receive, retain, retrieve, or discard.


The Minimalist Context Engineering

You do not need to understand everything about context engineering before you begin.

Remember ten things:

Context Engineering.

Instructions.

Tools.

Retrieval.

Memory.

History.

Compaction.

Selection.

Budget.

Judgment.

Everything else can come later.

Define the goal.

Provide useful instructions.

Expose appropriate tools.

Retrieve information when needed.

Preserve useful memory.

Manage history.

Compact accumulated context.

Remove noise.

Protect the context budget.

Apply human judgment.

Then accomplish something.


One Final Question

The next time you work with AI, don't begin with:

“What is the perfect prompt?”

Begin with:

“What does the AI need to know right now?”

Then engineer the context.


← Previous Book The Minimalist Claude Mythos The Minimalist Series Series Home Next Book → Coming Next

Accomplish with AI

Powered by Blogger.

Featured post

AI Engineering Hands-On Lab #001 — Build an AI Answer Reliability Test Bench Without Code

AIYING | Daily 24 — Post 009 AI Engineering Hands-On Lab #001 Build an AI Answer Reliability Test Bench — Without Writing Code Lea...

Search This Blog

List of blogs

Search This Blog

About

Translate

Instant Stories

Read in Your Language

Test

share this

ShareThis

Popular Posts