Skip to main content
Use this guide when your system stores conversation summaries, user preferences, notes, plans, or reusable state. Memory is useful because it survives across requests. That is also what makes it dangerous when attacker-controlled content gets promoted into it.

Assumptions

  • Your application has a memory or state layer that can persist across model calls.
  • You can control which events are allowed to write into that layer.
  • Anthale can evaluate both the write path and the replay path around stored content.

Secure the memory layer

1

Decide what is allowed into memory

Separate durable facts, short-lived task state, user preferences, and generated summaries. Not every useful string belongs in long-term storage.
2

Tag memory by source and trust level

Record whether the content came from a user, a retrieved document, a tool result, another agent, or a model summary. Provenance matters when you replay the memory later.
3

Evaluate before write and before replay

Run Anthale before content is persisted and again before saved content is merged back into model context. A clean write path does not guarantee a safe replay path forever.
4

Keep summaries from becoming policy

Store summaries as context, not as hidden instruction. A model-generated note should not silently upgrade itself into a higher-authority rule for future tasks.
5

Expire or review privileged memory

Put retention limits and review paths around memory that can affect access, workflow routing, or high-impact tool use.
6

Test for persistence attacks

Check whether one malicious note, summary, or retrieved chunk can keep influencing later sessions after the original trigger is gone.
Persistent prompt injection is harder to spot than one-shot injection because the source often disappears from the current request while the bad instruction survives in stored state.

What this looks like in code

This keeps Anthale on both sides of the memory lifecycle: before the application saves the content and again before the workflow replays it into model context.

Common failure patterns

  • A summary job copies user or tool text into memory without trust tagging.
  • Long-term memory is replayed as if it were system instruction.
  • Sensitive data is retained longer than the workflow requires.
  • Teams protect the first request but not the later replay of stored state.

Next steps

Continue with Log Security Events or Data Leakage Prevention.
Last modified on March 19, 2026