Blog Post

Microsoft Foundry Blog
15 MIN READ

Remember, Retrieve, Revalidate-or Forget? Architecting Memory for Production AI Agents

shrutikakade's avatar
shrutikakade
Icon for Microsoft rankMicrosoft
Oct 26, 2026

An implementation architecture: who decides, which component executes, where the data lives, what source is authoritative, and how each operation fails-traced end to end for Remember, Retrieve, Revalidate, and Forget.

A memory‑aware agent is not a cleverer prompt or a bigger vector store. Remember, Retrieve, Revalidate, and Forget are not four model behaviors, they are four coordinated capabilities split across the agent, an application policy layer, a platform/memory service, and the owning data systems, each with its own identity checks, policy gates, failure handling, and audit trail. This article makes that split explicit and shows how to build each operation so an architect can follow every path from trigger to telemetry.

1. Why "give the agent memory" is still insufficient

The failure mode is concrete. A Release Orchestrator (user‑facing) answers an engineering lead; it holds the lead's durable preference "summarize as impact, owner, next action" as user‑scoped memory. A Project Data Agent is the only component authorized to read the program system—the system of record for dates. If the lead once said "Atlas targets December 15" and the Orchestrator persists that as a durable fact, then answers "December 15" a week after the authoritative system moved Atlas to November 18, the response is perfectly formatted and dangerously wrong. The fix is not a better model ,it is an architecture in which the preference is remembered, the date is retrieved and revalidated by the Project Data Agent against the system of record, and the stale copy is forgotten. Microsoft's own agent‑memory guidance states the same: short‑term memory is session context, long‑term memory requires a service that extracts, consolidates, and retrieves, and "memory is useful context, not automatic authority. Persistent memory is simultaneously data and a behavior‑influencing configuration layer, which is exactly why it needs governed write, read, revalidation, and deletion paths rather than a single retrieval pool.6 [1][2]

2. One implementation contract for all four operations

Every operation is specified by the same contract: decision trigger → decision owner → agent role → application/policy role → platform/service role → data/system‑of‑record role → identity & authorization → policy checks → storage/source → provenance → success → failure behavior → telemetry/audit → lifecycle consequence. Collapsed to the "who does what" view that the prior article left implicit:

Action

Agent proposes/requests

Application / policy layer decides

Platform / memory service executes

Data system / system of record

Primary failure behavior

Remember

Nominates a candidate fact; cannot persist model output directly

Classifies provenance, scope, sensitivity, purpose, retention, write authority

Extracts, consolidates/merges, stores typed record, applies TTL

n/a (memory is owned, not authoritative)

Reject/quarantine write; keep session‑only

Retrieve

Declares an information need

Resolves tenant/user/agent/team scope; sets authorization filter

Filters by authz, then searches, ranks, assembles minimal context

Returns only authorized records/knowledge

Continue without, ask, or exclude un‑provenanced items

Revalidate

Signals "current truth required"

Determines freshness policy and trigger

Checks TTL/version; calls validation service

Returns current value / version / ETag

Show cached only if policy permits, with source+timestamp

Forget

Requests or flags removal

Executes retention/DSR/incident policy; determines scope

De‑indexes, deletes, propagates to derivatives, verifies

Deletes/expires/invalidates record where permitted

Retry idempotently; tombstone; escalate on failed deletion

 

Microsoft's agent‑tracing schema already names these as first‑class operations—create_memory, search_memory, update_memory, upsert_memory, delete_memory spans allowing these operations to be observed independently. [3]

3. The unified implementation architecture

The vendor‑neutral pattern is Agent/Orchestrator → Memory Policy & Decision Layer → {Memory Manager | Retrieval/Index | Validation/Invalidation | Policy/Retention} → Stores & Authoritative Systems → Response, with Identity & Authorization enforced across every layer and Telemetry/Evaluation/Audit as a cross‑cutting plane. What matters is that the read, write, revalidation, invalidation, and deletion paths are separate, not that the box list is complete.

Figure 1: The unified implementation architecture—one agent and policy layer routing five distinct paths (write/Remember, read/Retrieve, revalidation, invalidation, and deletion/Forget) across memory stores, retrieval indexes, authoritative systems, and a deletion lifecycle, all under identity enforcement and audit.

The architecture deliberately separates memory from knowledge and current business truth. A memory may be relevant but stale; a retrieval result may be relevant but unauthorized; deleting a primary record may still leave embeddings, summaries, or caches. Each path therefore needs its own implementation contract and verifiable evidence. The rest of this article walks each path, then applies it across scopes, agents, scenarios, failures, and governance.

4. Implementing REMEMBER (the write path)

The non‑negotiable: the agent never writes arbitrary model output straight into durable memory. It nominates a candidate; the application write gate decides. The decision owner is the application product owner (schema and write policy); the executing components are the policy layer (eligibility), the memory manager (extraction/consolidation), and the durable store (persistence).

What each candidate source is allowed to do (the write gate's core table): an authenticated user statement is policy‑eligible; an application observation is typed and bounded; a trusted enterprise system is authoritative in its domain but cached carefully; a retrieved document is knowledge, not personal fact; external web/tool content is untrusted and quarantined; model inference is session‑only by default.20 Explicit do‑not‑remember list, enforced in code, not prompt: credentials and temporary access tokens, unverified output from failed tool calls, unsupported assumptions, and authoritative facts that should be re‑queried.7 An API‑neutral write gate:

1     function remember(candidate, caller):

2         record = classify(candidate)                 # origin + provenance + sensitivity

3         if not write_policy.permits(record, caller): return DROP          # eligibility

4         if record.origin in {credential, failed_tool, low_conf_inference}: return DROP

5         if record.trust == untrusted: return QUARANTINE                   # review, don't persist

6         if record.sensitive and not consent(caller, record.purpose): return MINIMIZE_OR_DROP

7         record.scope = resolve_scope(caller)         # tenant/app/agent/user-or-team/session

8         fact = memory_manager.extract(record)

9         fact = memory_manager.consolidate(fact)      # dedupe + conflict-resolve

10         store.upsert(fact, validity, ttl, delete_lineage)   # typed, provenanced

11         audit.emit("create_memory", fact.id, caller)

Extraction and consolidation are the service's job: the system "extracts meaningful information… consolidates it into durable knowledge" and merges duplicates/conflicts—though note that profile‑style memory consolidates while episodic/summary memory typically does not, so applications must add their own cleanup for summaries. Structured records (typed fields for governance) and unstructured summaries (for continuity) coexist; a governed record carries memory_id, tenant_id, owner_id, application_scope, agent_scope, type, content, origin, provenance, confidence, sensitivity, valid_from, valid_to, expires_at, supersedes, source_version, status, retention_class, delete_lineage, and an optional embedding. Software‑engineering agents apply the same write discipline to execution state: The rule is that "durable execution state belongs in versioned external storage", bound to repository/branch/environment, not to conversational memory.[1][2]

 

5. Implementing RETRIEVE (the read path)

The decision owner is the application (retrieval scope + ranking policy); the agent only declares a need. The one rule that converts retrieval from a relevance problem into a security control: authorize before you rank. Constrain the candidate set by identity first, then search—because semantic similarity is relevance, not authorization, and a shared vector store queried without tenant/user filtering is a boundary failure even when results are highly relevant.20

 

 

function retrieve(need, caller, consequence): 
    scope = resolve_scope(caller) 
    allowed = authz.candidate_filter(scope)  # before ranking 
    hits = index.search(need, within=allowed, mode=hybrid) 
    ranked = rank(hits, by=[relevance, recency, confidence, scope]) 
    candidates = [h for h in ranked if h.provenanced and not h.superseded 
                  and policy.allows_use(h, consequence)] 
    for h in candidates: 
        if freshness.requires_revalidation(h, consequence): 
            h = validator.check_against_authority(h) 
    return assemble_minimal(valid_items(candidates), with_citations=True) 

Retrieval spans semantic/vector, keyword/full‑text, relational, graph, and hybrid techniques; the  an embedding indexes can support discovery but does not establish ownership, truth, or retention. Retrieval‑failure handling is explicit safe behavior: no valid memory → continue or ask; missing provenance → exclude from consequential use; expired → revalidate; authority unavailable → state the value cannot be verified and show cached data only if policy allows, with source and timestamp. Keep memory ≠ RAG , physically separate: user‑specific memory and source‑managed enterprise knowledge are different stores with different scopes, even when they share search technology.

6. Implementing REVALIDATE (the validation path)

Who performs revalidation, and when? Neither the agent nor the memory store performs revalidation. The agent signals that current truth is required, and the application’s freshness policy determines whether validation should be triggered. A validation/invalidation service then checks the system of record and updates, supersedes, or invalidates the memory as appropriate. The model should not determine authoritative truth independently, and a memory record should not validate itself. For volatile facts used in consequential decisions, define and apply a risk-based freshness policy before use.

Five validation triggers, chosen by staleness cost and change frequency:

  1. Read‑time validation: check on every use for high‑risk facts (prices before a quote, permissions before an action).
  2. TTL/freshness‑triggered: a record past its freshness window becomes Stale and must be re‑checked; TTL is not validity -

    TTL is not proof of validity. TTL controls storage or retrieval lifetime; it can reduce the stale-data window, but it cannot establish that a value remains correct during that window. Validity must be assessed through source versions, change events, read-time checks, or another explicit freshness policy.

  3. Source‑version/ETag check: compare a stored source version/ETag to the system of record; production designs use version‑aware or conditional writes, idempotent commands, and stale‑write detection.
  4. Event‑driven invalidation (CDC/event bus): the source emits a change event; a role‑change or price‑change event invalidates dependent memories proactively.
  5. Risk‑ or periodic‑triggered: elevate to read‑time validation for sensitive actions; batch‑revalidate on a schedule otherwise.

The read‑time revalidation flow and the event‑driven invalidation flow are distinct and both required:

 

Edge cases the service must handle explicitly: source unavailable → do not present cached data as current (fallback branch above); source contradicts memory → supersede, never return both blindly; multiple sources disagree → prefer the designated system of record, then trusted provenance, then newer valid evidence. The GH‑600 pattern makes this operational for execution state: "resume only when the checkpoint matches current authoritative state," "detect and correct stale context before execution," and "revalidate affected decisions when any dependency changes."7 The record moves through a small state machine the revalidation and deletion paths share:

 

7. Implementing FORGET (the deletion path)

Forgetting is a correctness, privacy, and security feature, and it is not DELETE WHERE id=x. A memory lifecycle service orchestrates it; the decision owners are privacy/compliance and records governance (retention and DSR), with security for incidents. Triggers: explicit user deletion, retention/TTL expiry, supersession, source invalidation, security incident, poisoning, purpose limitation, offboarding, and policy change.

Four outcomes are not interchangeable—conflating them causes outages or compliance failures: loss of retrieval eligibility (record kept, excluded from retrieval, often for audit), invalidation/quarantine (blocked from consequential use), expiration (TTL purge from the operational store), and hard deletion (removal across source and derivatives). The critical implementation fact: deleting a conversation does not inherently delete summaries, embeddings, profiles, caches, traces, or derived memories—partial deletion is a compliance risk, so derivatives need lineage identifiers and a coordinated workflow.17

 

Implementation requirements: disable retrieval before physical deletion completes; propagate across embeddings, vector/search indexes, summaries, profiles, caches, replicas, shared memory, derived artifacts, and traces; make deletion idempotent with retry; use tombstones where downstream systems need to know a record was removed; and record every deletion in a tamper‑evident audit trail.Do not mislabel removal‑from‑use as deletion—privacy guidance is explicit that calling data "deleted" when it is merely hidden is prohibited.1 Some systems stay authoritative for legal/audit retention: an expired operational fact may legitimately persist under a separate retention policy, and under data‑subject‑rights rules inferences are themselves personal data, though deleting source data need not force recomputation of derived data.2 User‑facing controls (disable memory, view what is stored, delete) are part of the implementation, not an afterthought.

 

8. Implementing across scopes

Each scope is a trust boundary with a concrete executing component, owner, source of truth, validation mechanism, retention mechanism, and failure mode. Memory is promoted outward only as it earns durability; authority flows inward from governance.

 

 

Scope

What R‑R‑R‑F means here / executing component

Owner · source of truth

Validation · retention

Principal failure mode

Session

Context window/scratchpad holds temp facts; runtime discards at end

Model runtime · in‑session state

None durable · discard

Temp facts leak into durable store

Agent

Agent memory store; policy‑gated writes; per‑agent revalidation

Agent + user · agent store

Provenance + TTL; revalidate drift

Inference persisted as fact; over‑personalization

Application

App DB + index + business APIs; app enforces write/read policy

App team · application stores

App rules · business retention

Treating the vector store as authority

Platform / multi‑agent

Private vs. governed shared memory; delegation service

Platform team · platform services

Membership + moderation

Cross‑agent poisoning; isolation breaks

Enterprise

Enterprise search + systems of record behind authz filter

IT / data & security · owning systems

ACL sync; query‑time authz

Copying authoritative facts into memory

Governance

Classification, retention, DSR, audit executed by lifecycle service

Executive / risk · policies & audit

Lifecycle ownership · DSR workflows

Failed deletion; no audit trail

 

The distinctions this makes executable: agent‑private memory, user‑scoped memory (isolated by a stable user key), application/workflow state (carts, cases, checkpoints), governed shared memory, and retrieved enterprise knowledge are different stores with different owners—even when they share search technology.

 

9. Single‑agent and multi‑agent execution paths

Single agent: one agent proposes writes to its own store, the application policy layer approves, and the same agent retrieves under its own scope. Multi‑agent is where "which agent remembered what" does the most damage, so the implementation rule is strict: no cross‑agent memory stores by default—give each agent its own private, isolated store, authenticate every memory exchange between agents, and share only what is necessary through a governed store with membership, provenance, and moderation.18 Delegation must carry identity and least privilege at every hop; a poisoned shared memory can influence many downstream agents, so shared writes require review and rollback.

Figure 2: Multi‑agent memory boundaries—each agent keeps isolated private memory, writes to a governed shared store only through a policy‑and‑identity gate, and reaches enterprise knowledge and systems of record through an authorization filter, keeping private, shared, and retrieved information unmistakably distinct.

In the opening scenario this is explicit: the Release Orchestrator answers the user and reads/writes only its user‑scoped private memory (the formatting preference); it must delegate the date to the Project Data Agent, which alone is authorized to read the system of record and performs the revalidation. Naming the answering agent, the memory owner, and the authoritative source for every fact is the discipline that removes ambiguity.

10. Production scenarios (implementation, not policy)

Each row names the answering agent, which agent reads/writes memory, the information type, the authoritative source, and the concrete revalidation/forget/telemetry mechanisms. Scenario 7 is deliberately one where remembering is the wrong implementation choice.

#

Answering agent · who touches memory

Information → decision

Storage / source · type

Revalidation mechanism

Forget mechanism · telemetry

Failure mode

1

Personal‑productivity Assistant (own memory R/W)

"Summarize in 3 bullets" → Remember

User‑scoped private memory15

None needed

User delete + TTL · create_memory span

Inferring deeper traits → over‑personalization

2

Support Agent answers customer; reads memory + CRM

Ticket status → Retrieve + Revalidate

System of record = CRM; memory holds only name/channel

Read‑time vs. CRM

Session expiry; profile per retention · audit

Caching ticket state as durable → stale answer

3

Enterprise‑Knowledge Agent retrieves KB

"Latest travel policy?" → Retrieve

Knowledge base/RAG, ACL‑synced · retrieved knowledge

On each query + citation

Re‑index on publish; no personal copy

Copying policy into memory → superseded guidance

4

Software‑Engineering Agent acts in repo

Approved plan + target version → Remember(working) + Revalidate checkpoint

External versioned checkpoint bound to repo/branch/env7

Resume only if checkpoint matches authoritative state7

Reset on dependency change; drop failed‑tool output

Resuming on stale checkpoint → wrong change

5

HR/Employee‑Service Agent reads HRIS/IAM

Manager/role/entitlements → Retrieve + Revalidate

System of record = HRIS/IAM · business state

Event‑driven on role change

Minimize; delete on offboarding (DSR)2

Remembering old manager → wrong approvals, leakage

6

Sales/Account Agent reads CRM + pricing

Price/discount/inventory → Retrieve + Revalidate

CRM + pricing + inventory systems

Before every quote (read‑time)

Quotes expire; no durable price copy

Quoting remembered price → margin error

7

Multi‑agent Travel Workflow (Orchestrator → Booking Agent)

Live seat availability → Retrieve only; do NOT Remember

Inventory/GDS via authz filter · volatile shared state

Every request

Never persisted; cache TTL seconds

Remembering "20 seats free" → double‑booking

11. Failure modes and remediation (wired to components)

Persistent memory is a behavior-influencing control surface. Because an LLM extracts and consolidates memories, malicious or inaccurate stored content can influence its future decisions and actions. A common attack path involves cross-prompt injection from external content—particularly email—triggering a memory write. Human oversight alone cannot adequately secure these writes. Effective protection requires architectural separation between trusted and untrusted write paths, including restricting memory-write tool calls after untrusted data enters the context and treating the memory store as a high-value asset.4 Systems should enforce deterministic trust boundaries around memory, separate data from control instructions, and never trust retrieved context solely because it exists in memory.5

Failure

Primary detection (component)

Primary control (component)

Stale memory

Freshness check, source diff

TTL + revalidation + source lookup

Incorrect / hallucinated‑then‑persisted

Evaluation; provenance=inferred

Session‑only inference; confirmation gate

Conflicting memories

Conflict rules at read

explicit>inferred, narrow>global, newer>older

Unauthorized / cross‑user leaked

Authn on write; scope audit

Owner‑bound writes; partition + authz filter18

Poisoned memory

Anomaly monitoring; red‑team

Typed writes, quarantine, moderation, content‑safety jailbreak detection

Failed / obsolete deletion‑retrieval

Deletion verification; stale‑usage metric

Delete lineage + propagation; exclude expired at read

Remediation is a closed loop tied to telemetry, provenance, evaluation, access controls, and lifecycle operations:

 

Evaluate memory like a production subsystem: incorrect‑write rate, retrieval precision, stale‑memory usage, cross‑scope leakage, conflict‑resolution correctness, deletion verification, poisoning resistance, authoritative‑source fallback and rerun after any change to prompts, tools, retrieval, memory policy, storage, authorization, or models; monitoring dashboards and recurring/continuous evaluations with red‑team scans operationalize this. Public agent‑hijacking benchmarks justify repeated testing but are not prevalence estimates.

12. Governance and implementation ownership (RACI)

Memory governance is not solely the agent team's responsibility, and the model/agent is never the governance authority. (R = Responsible, A = Accountable.)

Decision 

A (Accountable) 

R (Responsible) 

C (Consulted) 

Memory schema and candidate extraction 

Agent product owner 

Agent engineering 

Data owner, privacy, platform 

Write eligibility and scope policy 

Agent product owner 

Agent engineering / policy service team 

Security, privacy, data owner 

Source-of-truth designation 

Enterprise architecture or domain data owner 

Data steward 

Application team, security 

Retrieval authorization 

Security/IAM 

Application and platform engineering 

Data owner, privacy 

Ranking and context assembly 

Agent product owner 

Agent engineering 

Data/knowledge owner, evaluation team 

Revalidation triggers and invalidation events 

Domain data owner 

Application/platform engineering 

Enterprise architecture, SRE 

Retention and purpose limitation 

Privacy/compliance and records governance 

Lifecycle/platform team 

Product owner, data owner 

Deletion orchestration and verification 

Privacy/compliance or records governance 

Platform engineering and operations 

Security, application owners 

Incident response 

Security 

Security, SRE, agent/platform engineering 

Privacy, data owner, product owner 

Observability and evaluation 

Agent product owner 

Agent engineering and SRE 

Security, privacy, platform 

 

13.Architecture and design checklist

Architecture and design checklist

  • ☐ Memory, knowledge/RAG, application state, and authoritative business state are explicitly separated. 
  • ☐ Every durable memory has an owner, scope, origin, provenance, purpose, validity fields, retention rule, and deletion lineage. 
  • ☐ The agent cannot directly persist arbitrary model output; the write gate rejects secrets, failed-tool output, and untrusted instructions. 
  • ☐ Authorization constrains retrieval candidates before semantic or hybrid ranking. 
  • ☐ Each volatile fact has a documented read-time, TTL, version, event-driven, risk, or periodic validation rule. 
  • ☐ TTL, validity, and retention are modeled separately. 
  • ☐ Source-unavailable behavior is defined for each consequence class. 
  • ☐ Conflicts use designated authority, conditional writes, versions, and deterministic supersession. 
  • ☐ Private agent memory is isolated; shared memory has membership, write authority, moderation, provenance, and rollback. 
  • ☐ Forgetting distinguishes ineligibility, invalidation, quarantine, expiration, and hard deletion. 
  • ☐ Deletion propagates to embeddings, indexes, summaries, profiles, caches, shared memory, replicas, and traces where policy requires. 
  • ☐ Memory create/read/update/delete/deny/revalidate events are traceable without over-collecting sensitive content. 
  • ☐ Evaluations cover incorrect writes, stale usage, cross-scope leakage, source fallback, poisoning, and deletion verification. 
  • ☐ Governance ownership extends beyond the AI team to data, IAM, privacy, records, security, and operations. 

14. Conclusion

Production memory is not a single agent feature. Remember, Retrieve, Revalidate, and Forget are coordinated system capabilities with different triggers, authorities, components, stores, and failure modes. 

The agent may propose a memory or declare an information need, but the application must govern eligibility, scope, purpose, and risk. Platform services can extract, consolidate, search, validate, invalidate, and delete, but they execute policy rather than create it. Enterprise systems remain authoritative for the business facts they own. Governance functions define retention, privacy, security, incident, and deletion obligations, while operations verify that those obligations were completed. 

The resulting architecture is deliberately selective: 

  • Remember stable, valuable, appropriately scoped continuity with provenance and a deletion path. 
  • Retrieve governed knowledge and prior memory only after authorization constrains the candidate set. 
  • Revalidate changing or consequential facts against their designated authority using explicit freshness triggers. 
  • Forget by disabling retrieval, propagating lifecycle actions across derivatives, verifying completion, and preserving only lawful audit evidence. 

A trustworthy agent is therefore not the agent that remembers the most. It is the system that can explain why each item was remembered, who may retrieve it, when it must be revalidated, how conflicts are resolved, and how every required copy will be forgotten. 

Closing principle  Remember for continuity. Retrieve for governed knowledge. Revalidate for current truth. Forget for correctness, privacy, and security. 

 

16. References

[1] Microsoft Learn, What is Memory in Foundry Agent Service 

[2] Microsoft Learn, Create and use memory in Foundry Agent Service 

[3] Microsoft Learn, Agent tracing overview 

[4] Microsoft Learn, Monitor agents with the Agent Monitoring Dashboard 

[5] Microsoft Learn, Microsoft cloud security benchmark v2 - Artificial Intelligence Security 

[6] OWASP GenAI Security Project, Agentic AI - Threats and Mitigations 

[7] OWASP GenAI Security Project, Memory Is a Feature. It Is Also an Attack Surface 

[8] NIST, Artificial Intelligence Risk Management Framework: Generative Artificial Intelligence Profile (NIST AI 600-1) 

 
Updated Oct 21, 2026
Version 1.0