Join our Newsletter — 33% off our NHI Course
Agentic AI & Autonomous Identity

Memory Write

← Back to Glossary
By NHI Mgmt Group Updated November 26, 2026 Domain: Agentic AI & Autonomous Identity

A Memory Write is an action in which an AI agent stores information in persistent memory for use in later sessions. Attackers abuse it through prompt injection to plant false or malicious instructions that persist and influence future behaviour. Log writes with their source, restrict what agents may store, scope memory per user, and allow review and expiry.

What Memory Write Means in an Agentic System

Persistent memory turns a one-off interaction into future state. A memory write is useful when an agent needs continuity across sessions, but it also becomes a durable trust boundary because whatever is stored may shape later decisions, tool use, or responses long after the original context is gone.

That persistence is why memory write is not just “saving notes.” It is a control point over what an agent believes about users, tasks, policies, and prior outcomes. If the write path is weak, short-lived prompts can become long-lived behavioural influence.

Why Memory Write Becomes a Security Boundary

The danger is not the act of storing data itself, but the ability to persist untrusted instructions, misleading summaries, or biased task state. In agentic systems, attacker-supplied content can be written once and then reused in later sessions, where it may be treated as background knowledge rather than hostile input.

That makes provenance and scope critical. Memory should distinguish user-owned facts from system-authored facts, and durable instructions should be harder to create than transient observations. If all writes are treated equally, memory poisoning becomes a slow-moving compromise rather than a single obvious exploit.

How Memory Writes Are Commonly Abused

Prompt injection often aims at the write path rather than the immediate response. An attacker may try to persuade the agent to remember a false preference, a hidden instruction, a malicious endpoint, or an unsafe exception so the manipulation survives into later turns.

Delayed abuse is especially effective because the harmful content may not look dangerous at write time. A later session can trigger the stored payload when the agent revisits the memory, making the compromise harder to trace back to the original injection event.

Controlling Persistence, Scope, and Review

Good memory design narrows what can be written, where it is stored, and how long it lives. The safest pattern is to keep memory scoped to the smallest meaningful context, attach source metadata to each write, and separate user-specific memory from shared or system-level memory unless there is a clear governance reason to combine them.

Expiry and review matter because durable memory accumulates risk over time. An organisation should treat memory writes as auditable state changes, not informal convenience features, and should make it possible to inspect, correct, or delete stale or suspicious entries before they influence later behaviour.

Risk and Threat Considerations

Persistent memory creates a replay path for prompt injection, because one successful write can influence many later sessions. The practical risk is not only bad answers, but durable behavioural drift, unsafe tool use, and contamination of decisions that appear to come from the agent itself.

Failure mechanism: An attacker gets untrusted content into memory, then waits for the agent to reuse that content as if it were trusted context, policy, or user preference.

Impact: Future sessions can inherit false instructions, unauthorized actions, or corrupted task state, which may persist until the memory is discovered and removed.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Agentic AI Top 10 and MITRE ATLAS address the attack and risk surface, while NIST CSF 2.0 sets the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Agentic AI Top 10ASI06 — Memory & Context PoisoningCovers durable prompt poisoning through stored context and memory.
Recommendation — Apply ASI06 controls to prevent untrusted content from being persisted as agent memory.
MITRE ATLASAML.T0094 — Delay Execution of LLM InstructionsDescribes deferred prompt injection that survives until a later turn or trigger.
Recommendation — Hunt for delayed prompt-injection patterns and block deferred instruction triggers in stored context.
NIST CSF 2.0PR.DS-10 — Information is destroyed according to policyMemory expiry and removal map to lifecycle control over retained information.
Recommendation — Set retention and expiry rules for agent memory and remove stale entries on schedule.

Practitioner Guidance

Why practitioners should care: Memory writes deserve the same discipline as other state changes because they can outlive the session that created them. Log each write with its source and purpose, and make memory policy explicit so the agent cannot silently promote untrusted text into durable behaviour.

Common misunderstanding: Teams often assume that only the current turn matters. In practice, the security question is whether the agent can be induced to preserve an instruction that will still be influential when the original attacker is no longer present.

Practitioner takeaway: Design memory as a controlled, reviewable store of facts, not a passive dump of conversation history.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 26, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org