Skip to content
AI agent memory

AI agent memory and prompt injection: treat records as data

A record may contain someone else’s text or an outdated instruction. Memory does not grant new permissions.

Agent memory can contain quotations, document notes, historical tasks or imported conversation data. Not every record is an instruction to execute. Prompt injection is an attempt to cause a model to treat reference content as a command. With durable memory, the risk can reappear in a later session when that record is retrieved.

Separate context from authorization

Stored content should be assessed as reference data. The user’s current request and the application’s rules define the authorized task. A note saying “send a report” may describe a historical plan, not present permission. Likewise, a stored recipient address does not authorize sending information to it. Verify the source and current goal.

A harmless boundary test

  1. Grant read-only access if the test does not require writes.
  2. Retrieve the test note. Check whether the assistant recognizes it as a reference rather than a command.
  3. Ask it to identify provenance and limitations; do not permit unauthorized operations.
  4. Review imported material before storing it. In Review mode, inspect proposals before approval.

Combine multiple controls

Use scoped tools, project roles, separate client workspaces and record versions. Do not treat memory as a vault for credentials. When an agent needs an external system, grant access through the appropriate integration for the current task. Text saved in a project cannot extend those permissions.

LocalMemory exposes selected records through MCP and the API, with tool descriptions that treat memory as reference data. No single filter guarantees that a model is resistant to every prompt-injection attempt. Evaluate the complete workflow, from the origin of a record to the actions the agent is permitted to take.

Sources and further reading

Source material used to prepare this article. Feature availability in external services may change.

Solid Code Apps

The team building LocalMemory. We write about practical work with project memory and AI tools.

FROM READING TO DOING

Your next conversation can start further ahead.

Create a project, save your first decision and recall it in a connected AI tool.

Create a free account