feat(memory): add scope_mode config and strictAgentIsolation for full agent memory isolation#1123
Open
gaomind wants to merge 1 commit intovolcengine:mainfrom
Open
Conversation
|
Failed to generate code suggestions for PR |
… agent memory isolation
Server side:
- Add memory.scope_mode ("default" | "isolated") to MemoryConfig with Literal type and field_validator
- Update _get_owner_space(), create_memory(), and _append_to_profile() to respect scope_mode
- When "isolated", all memory categories (including PROFILE/PREFERENCES) route to agent scope
- Read scope_mode from config in compressor and pass through extraction pipeline
Plugin side (examples/openclaw-plugin):
- Add strictAgentIsolation boolean config option
- When enabled, memory_recall tool and auto-recall only search viking://agent/memories
- Add configSchema and uiHints entries
Tests:
- tests/session/test_memory_scope_mode.py: 10 tests for owner_space routing and config validation
- examples/openclaw-plugin/__tests__/strict-agent-isolation.test.ts: 6 tests for config parsing
Docs:
- Updated English and Chinese configuration guides with scope_mode field
- Clarified relationship between scope_mode and agent_scope_mode
74a8427 to
1168ca5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
memory.scope_modeon the server side andstrictAgentIsolationon the OpenClaw plugin side, enabling full inter-agent memory isolation in multi-agent deployments.Currently, user-level memory categories (PROFILE, PREFERENCES, ENTITIES, EVENTS) are routed to shared user scope, meaning different agents on the same account can see each other's profile. This PR adds an opt-in
"isolated"mode that routes all categories to agent scope.Related: #1069, #954
What Changed
Server side
memory_config.py: Addedscope_modefield (Literal["default", "isolated"], default"default") withfield_validatormemory_extractor.py:_get_owner_space(),create_memory(),_append_to_profile()now accept and respectscope_modecompressor.py: Readsscope_modefrom config and passes it through the extraction pipelinePlugin side (
examples/openclaw-plugin)config.ts: AddedstrictAgentIsolationboolean config optionindex.ts: When enabled,memory_recalland auto-recall only searchviking://agent/memoriesopenclaw.plugin.json: Schema and UI hints for the new optionDocumentation
scope_modeandagent_scope_modeTests
tests/session/test_memory_scope_mode.py: 10 tests (owner_space routing + config validation)examples/openclaw-plugin/__tests__/strict-agent-isolation.test.ts: 6 tests (config parsing)Behavior
Default behavior is unchanged. When
scope_modeis set to"isolated", all categories route toviking://agent/{agent_space}/memories/.scope_modevsagent_scope_modeagent_scope_mode"user+agent"scope_mode"default"These are independent. Typical combinations:
scope_modeagent_scope_modedefaultuser+agentisolateduser+agentisolatedagentExample
Server (
ov.conf):{ "memory": { "scope_mode": "isolated" } }Plugin (
openclaw.json):{ "plugins": { "entries": { "openviking": { "config": { "strictAgentIsolation": true } } } } }Testing
Checklist