Per-user agent isolation (Dynamic Agent Creation)
EnabledynamicAgentCreation to automatically create isolated agent instances for each DM user. Each user gets their own:
- Independent workspace directory
- Separate
USER.md/SOUL.md/MEMORY.md - Private conversation history
- Isolated skills and state
Dynamic bindings include the normalized Feishu
accountId, so default and named accounts route each sender to the correct dynamic agent.If a named account created an unscoped dynamic agent on an older release, that legacy agent still counts toward maxAgents. Confirm that it is not used by the default account before removing it, or temporarily increase maxAgents; OpenClaw cannot safely infer which account owns ambiguous legacy state.Quick setup
How it works
When a new user sends their first DM:- The channel generates a unique
agentId:feishu-{user_open_id}for the default account, or a bounded account-prefixed identity digest for a named account - Creates a new workspace at
workspaceTemplatepath - Registers the agent and creates a binding for this user
- The workspace helper ensures bootstrap files (
AGENTS.md,SOUL.md,USER.md, etc.) on first access - Routes all future messages from this user to their dedicated agent
Configuration options
Template variables:
{agentId}- the generated agent ID (e.g.,feishu-ou_xxxxxxorfeishu-support-<identity_digest>){userId}- the sender’s Feishu open_id (e.g.,ou_xxxxxx)
Session scope
session.dmScope controls how direct messages are mapped to agent sessions. This is a global setting that affects all channels.
Tradeoff: Using
"main" enables automatic bootstrap file loading (USER.md, SOUL.md, MEMORY.md), but means all DMs across all channels share the same session key pattern. For public multi-user bots where isolation matters more than bootstrap auto-loading, consider "per-channel-peer" and manage bootstrap files manually.
Use
"per-account-channel-peer" when named Feishu accounts should keep separate sessions for the same sender. Dynamic bindings preserve the account scope.Typical multi-user deployment
Verification
Check gateway logs to confirm dynamic creation is working:Notes
- Workspace isolation: Each user gets their own workspace directory and agent instance. Users cannot see each other’s conversation history or files within the normal messaging flow.
- Security boundary: This is a messaging-context isolation mechanism, not a hostile co-tenant security boundary. The agent process and host environment are shared.
- Config writes must stay enabled: Dynamic agent creation writes agents and bindings into the config; it is skipped when
channels.feishu.configWritesisfalse(default: enabled). bindingsshould be empty: Dynamic agents auto-register their own bindings- Upgrade path: Existing manual bindings continue to work alongside dynamic agents
session.dmScopeis global: This affects all channels, not just Feishu