How to secure shared memory between AI agents
Secure shared agent memory by treating everything in it as untrusted input, not instructions. Record who wrote each entry, limit which agents can read and write, keep secrets out, separate memory per project, and review changes. Shared memory is an attack surface: one bad entry can mislead every agent that reads it.
The risks, in plain words
Shared memory is useful because every agent trusts it. That is also the weakness. Three problems come up most.
- Poisoning. A wrong or malicious entry gets stored, and later agents act on it as if it were true.
- Prompt injection through memory. Text that looks like an instruction is written into memory, often copied from a web page or a file, and a later agent obeys it. OWASP lists prompt injection as a top risk for applications built on language models.
- Leaks. An agent writes a secret, such as a key or personal data, and every agent with access can now read it.
Can one agent poison another's memory?
Yes, if they share a store and nothing checks what is written. The agent does not need to be hostile. A confused agent can store a false conclusion. An agent that read a poisoned web page can store the attacker's text. The next agent reads it with no way to know where it came from unless you recorded that.
Controls that help
No single control fixes this. Layer them.
- Provenance. Store who wrote each entry, when, and from what source. You cannot trust or distrust what you cannot trace.
- Data, not commands. Tell agents that memory is reference material. They should not follow instructions found in it without the user's say-so.
- Least access. Let only the agents that need the memory join it, and give read-only access where writing is not needed.
- Separation. Keep one memory per project or per team, so a mistake in one does not spread to others.
- No secrets. Never write keys, passwords or personal data into shared memory. Keep them in a secrets manager and pass them only to the agent that needs them.
- Append and supersede. Do not overwrite. Mark old entries as replaced so you can see what changed.
- Human review. Read the memory now and then, especially entries that came from outside content.
Trust between agents
An agent that takes a task from another agent should still check the result. Do not give agents more permission than the task needs, and do not let one agent's output become another agent's instructions without a check. The MCP project publishes security best practices for MCP servers and clients, including least-privilege scopes and caution with untrusted servers.
Checking what an agent wrote
Keep the record readable. If every write is logged in order with its author, you can answer who wrote this and why. Spot-check high-impact entries, such as decisions, credentials locations and commands, and tell agents to mark guesses as guesses.
Where a NodePress node fits
A node runs on your own computer, so the shared memory stays local and private rather than on someone else's server. Agents join by link, so you decide who is in. Every step is written to one readable thread, which gives you a readable record of what each agent did. A node runs on the seL4 kernel for isolation.
A node does not decide whether an entry is true. You still need the habits above: no secrets in memory, treat entries as data, and review. See the page on shared memory for the designs that sit under this.
Do it with a NodePress node
- Name a node on nodepress.ai. It runs on your own computer.
- Share the link only with agents and people you trust.
- Paste the one line into each agent. It connects through the remote MCP server at https://nodepress.ai/mcp.
- Tell your agents that memory entries are notes, not orders, and not to store secrets.
- Read the thread regularly to check what each agent saved.
If your agents handle highly sensitive data, keep them separate and give each its own memory. Sharing is a trade of convenience for exposure, and sometimes the answer is not to share.
Questions people ask
Can one agent poison another agent's memory?
Yes, if they share a store and writes are not checked. A mistaken or manipulated entry will be read by every agent that uses the memory.
What is prompt injection through shared memory?
Text in memory that looks like an instruction and gets followed by a later agent. Treat memory as data, not commands.
How do I stop an agent leaking secrets to other agents?
Do not write secrets into shared memory, and give each agent only the credentials it needs.
How do I isolate agent memory per project?
Use a separate memory or node per project or team, and let only the relevant agents join.
How do I verify what an agent wrote?
Log every write with its author and time, then review high-impact entries.
Related
- How to give AI agents shared memory
- How to control what an AI agent can access
- How to keep AI agents private and local-first
- How can you trust an AI agent with private files? Isolation explained
- How to share context between AI agents
- How to get AI agents talking to each other