feat: 记忆层重构 — 跨 session 搜索 + mem0/ReMe 适配器 + 权限模型#17
Merged
Conversation
重构 Agent 记忆层架构,新增跨 session 查询能力,支持可插拔的记忆后端。 核心变更: - 新增 MemoryScope / MemoryAccessLevel 权限模型,支持 session/user/channel/global 四级权限 - BaseMemory 新增 cross_session_search() 接口,所有后端(Buffer/SQLite/Hybrid)均已实现 - MemoryMessage 新增 user_id / channel / memory_type 字段 - MemoryRecord 模型新增对应持久化列 + 索引 - 数据库迁移:run_migrations() 自动补充新列,migrate_memory.py 回填历史数据 - 新增 mem0 适配器(Mem0Memory):支持语义检索、跨 session 搜索 - 新增 ReMe 适配器(ReMeMemory):支持 Server 模式和本地 buffer 模式 - MemoryFactory 扩展支持 "mem0" / "reme" 后端 - 新增 /api/v1/memory/search API(POST 跨 session + GET 单 session) - config.py 新增 mem0/reme 配置项 测试:470 tests passed(含 88 memory + 10 API 集成 + 5 迁移测试) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Keep both memory endpoints and notifications endpoints from both branches. Keep both memory_records and sub_agent_tasks migration columns. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
cross_session_search()接口,所有后端(Buffer / SQLite / Hybrid)均已实现user_id/channel/memory_type字段,支持记忆归属和分类ix_memory_user_time/ix_memory_channel_time)run_migrations()自动补充新列;migrate_memory.py脚本从session_id格式推导channel,从sessions表回填user_idMem0Memory):映射 BaseMemory 接口到 mem0 AsyncMemory API,支持语义检索 + 跨 session 搜索(pip install mem0ai)ReMeMemory):支持 Server 模式(HTTP API)和本地 buffer 模式,适配 ReMe 的个人记忆系统"mem0"/"reme"后端选项,通过配置切换POST /api/v1/memory/search(跨 session 搜索)+GET /api/v1/memory/sessions/{id}/search(单 session 搜索)memory_mem0_config/memory_mem0_infer/memory_reme_server_url/memory_reme_agent_name等架构设计
Test plan
🤖 Generated with Claude Code