When one OpenClaw agent serves a small team over private DMs and a shared channel, how do you decide what it writes to memory and who can read it?
answer
- one workspace, one memory
- injection filter is not access control
- every direct chat sees MEMORY.md
- enforce with tool policy and agents
- provenance gates promotion
basics
~20 sTreat the agent's memory as one shared notebook: MEMORY.md reaches every direct-message session but not group or channel sessions, and memory_search reaches all notes wherever tool policy allows it. Keep private facts out or give them their own agent.
solid answer
~50 sStart from what OpenClaw actually separates. `MEMORY.md` is dropped from the bootstrap of group, channel, cron and sub-agent sessions, but it is injected into every direct-message session of that agent, including per-sender DM sessions, because they are all private chats over one workspace. Daily notes are not filtered by chat type at all: any session whose tool policy allows `memory_search` and `memory_get` can search the whole workspace's notes. So the decision is a policy, not a setting: write only team-level facts and decisions to `MEMORY.md`, deny `group:memory`, and file tools, where a shared channel should not reach history, and give genuinely personal memory its own agent and workspace. AGENTS.md can state the policy, but tool policy and agent separation enforce it. One Gateway is one trust boundary, so this suits mutually trusting teammates, not strangers.
go deeper
Recall that an agent's memory files belong to its workspace and are shared by every conversation that agent has.
Explain the exact filter: MEMORY.md is withheld from group, channel, cron and sub-agent sessions but injected into direct-message sessions, while memory_search is governed by tool policy.
Show the enforcement layers: deny group:memory where a channel should not search, sandbox file access, separate agents for separate memory, and memory forget for deletion requests.
Own the policy: which classes of fact the team assistant may keep, which audiences need their own agent or Gateway, and why prompt wording alone cannot carry a privacy promise.
## The decision An OpenClaw agent shared by a few teammates will accumulate memory about all of them. Someone has to decide what kinds of facts it should write down, where, and which conversations can read them back. There is no single right answer, but there are facts about the product that every good answer starts from. ## What OpenClaw separates, and what it does not - **Memory is per agent workspace.** `MEMORY.md` and `memory/*.md` live in the agent's workspace. Every session of that agent writes to and searches the same files. - **`MEMORY.md` injection is filtered by session type.** OpenClaw drops the root `MEMORY.md` from the bootstrap of **group, channel, cron and sub-agent** sessions. A **direct-message** session still gets it, whether it is the shared main session or a per-sender DM session created by DM isolation. - **The memory tools are not filtered by chat type.** `memory_search` searches `MEMORY.md`, `USER.md` and everything under `memory/`; `memory_get` reads those files. Where a session's tool policy allows `group:memory`, a channel conversation can surface notes written in someone's private DM. Filesystem tools on an unsandboxed session can read the files directly too. - **Cross-conversation recall** (`memory.search.rememberAcrossConversations`) is on for personal installs and off once DM isolation is configured. It covers recognized private conversations; groups and channels are excluded as sources and destinations. The withheld-from-groups rule is a context filter that keeps the curated file out of shared prompts. It is not a permission system on memory. ## What the product already protects Dreaming, the background sweep that promotes material into `MEMORY.md`, uses provenance recorded in the index. Content from non-owner participants in group chats is classed as `untrusted`, and untrusted candidates never enter the promotion path. Cron, heartbeat and sub-agent sessions produce no durable candidates. So a stranger's message in a channel does not quietly become a curated fact, although the agent can still write anything to a daily note if asked. ## The options | Approach | Gives you | Costs you | |---|---|---| | One agent, shared notebook | simple; everyone benefits from shared decisions | every DM sees `MEMORY.md`; search reaches all notes | | One agent, `group:memory` denied in the shared channel | the channel cannot search private history | the channel loses recall of its own past decisions | | Separate agents and workspaces per audience | memory that never mixes | more configuration, duplicated team facts | | Sandboxed channel with no workspace access | limits file tools | no pre-compaction flush there either | ## A defensible default 1. **Decide the classes of fact.** Team decisions, project facts and conventions go in `MEMORY.md`. Personal details (health, family, salary, credentials) are not written at all, or live with a personal agent. 2. **Write the policy where the agent reads it.** AGENTS.md can tell the agent what not to record and to keep `MEMORY.md` maintenance to the owner's sessions. That shapes behaviour; it does not stop a tool call. 3. **Enforce with configuration.** Deny `memory_search` and `memory_get` in the tool policy that applies to the shared channel if it should not search history, and route personal DMs to a separate agent when their memory must stay apart. 4. **Plan for deletion.** `openclaw memory forget --agent <id> --participant <actor-id> --dry-run` previews removal of memory artifacts traced to the sessions that person took part in. It works from recorded lineage, selects whole sessions including other people's contributions, and is not a text search for every mention of a name. 5. **Respect the trust model.** One Gateway supports one trust boundary: a single operator or a mutually trusting team. Anyone who can edit `~/.openclaw` is an operator. If the people are not mutually trusting, they need separate Gateways, not cleverer memory rules. ## Signs the policy needs revisiting - The shared channel answers a question with a detail that was only ever said in a private DM: memory tools are allowed there and search crossed the line. - `MEMORY.md` keeps growing with personal facts about individual teammates: the write policy is missing or ignored, and every DM session now pays for and sees those lines. - Someone leaves the team and asks to be forgotten, and nobody knows which notes came from their sessions: run a dry-run forget first and plan the agent split before the next request. ## How to judge an answer A strong answer names the real boundary (the agent workspace), states the injection filter precisely, notices that search crosses it, picks enforcement layers over prompt wording, and says when the right move is a second agent or a second Gateway.
- Does turning on per-sender DM isolation keep one teammate's MEMORY.md facts out of another teammate's DM?No. DM isolation gives each sender a separate session and turns cross-conversation recall off by default, but every direct-message session of that agent still gets the same workspace `MEMORY.md` injected, and `memory_search` still reaches the same notes. Facts that must not cross need a separate agent with its own workspace, or should not be stored.
- Can a message from a non-owner in a shared channel end up promoted into MEMORY.md by dreaming?Not through dreaming. The index records provenance, content from non-owner group participants is classed `untrusted`, and untrusted candidates never enter the consolidation prompt or the promotion path. The agent could still be asked to write such content to a daily note in a normal turn, which is why the write policy and tool policy matter too.
- MEMORY.md is never loaded outside the owner's main session, so DMs cannot see it.
- Because MEMORY.md is withheld from groups, a group session cannot reach any stored memory.
- A rule in AGENTS.md is enough to stop a shared channel from searching private notes.
- Per-sender DM isolation gives each person a private MEMORY.md.
- One Gateway can safely keep separate memories for mutually untrusted users.