feat: Single-DB Multi-Agent Isolation with Shared Memory Support#96
feat: Single-DB Multi-Agent Isolation with Shared Memory Support#96witplay wants to merge 2 commits into
Conversation
- Add 'agent_id' column to SQLite store for logical isolation.
- Logic: instruction/persona types -> 'shared' (global), episodic -> '{profile}' (private).
- Update Hermes Plugin to prefix session keys with 'agent:{profile}:'.
- Update Gateway Recall to include 'prependContext' (L1 memories) in response.
- Implement agent identity filtering in FTS and Vector search.
- Includes automatic migration logic for legacy data.
|
Thank you very much for your contribution! |
Description | 描述
This PR implements Single-DB Multi-Agent Isolation with a Shared Memory area, solving the data mixing issue in multi-profile setups (Issue #31347).
💡 Core Design
Instead of using multiple databases (heavy), we use a single SQLite database with an
agent_idcolumn:instructionandpersonatypes are marked asshared. All profiles (default, xiaoxiao, zhi, etc.) share user profile and global rules.episodictypes are strictly isolated byagent:{profile}.defaultprofile).📂 Modified Files
hermes-plugin/...: Prefix session keys withagent:{profile}:.src/core/store/sqlite.ts: Addagent_idcolumn, implement shared/private logic, filter FTS/Vector search.src/core/hooks/auto-recall.ts: ParsesessionKeyto passagentId.src/gateway/server.ts: IncludeprependContext(L1 memories) in recall response.🛡️ Benefits
Related Issue | 关联 Issue
Related to #31347
Change Type | 修改类型
Self-test Checklist | 自测清单
Additional Notes | 其他说明
This approach is lightweight compared to the proposed multi-DB solution and works perfectly with SQLite's local architecture.