
TencentDB Agent Memory模块化设计核心组件与扩展接口详解【免费下载链接】TencentDB-Agent-MemoryTencentDB Agent Memory is a team-level memory hub for AI Agents — turning conversations, docs, and code into four reusable memory assets (Chat Memory, Skill, LLM-Wiki, Code-Graph) that are governed, shared, and equipped across agents and frameworks.项目地址: https://gitcode.com/GitHub_Trending/te/TencentDB-Agent-MemoryTencentDB Agent Memory是一款团队级AI Agent记忆中枢能够将对话、文档和代码转化为四种可复用的记忆资产Chat Memory、Skill、LLM-Wiki、Code-Graph实现跨Agent和框架的治理、共享与装备。本文将深入剖析其模块化设计理念详解核心组件架构与扩展接口实现帮助开发者快速掌握定制与集成方法。一、记忆金字塔分层模块化核心架构TencentDB Agent Memory采用四层金字塔架构每层对应独立功能模块通过标准化接口实现数据流转与协作。这种分层设计确保记忆从原始数据到智能资产的渐进式转化同时保持各模块的松耦合特性。图1TencentDB Agent Memory四层记忆金字塔架构L0-L31.1 L0原始日志层Raw Log功能全量保存原始对话与事件流确保信息不丢失实现模块src/core/conversation/l0-recorder.ts核心接口L0ConversationRecord定义了原始对话的存储结构包含消息序列、时间戳和元数据1.2 L1原子记忆层Atomic Memory功能自动提取事实、偏好、约束和状态从噪声中稳定抽关键信息实现模块src/core/record/l1-extractor.ts关键特性通过L1ExtractionResult接口标准化提取结果支持多维度事实存储1.3 L2场景块层Scene Block功能按项目/主题/工作流场景聚类带上文召回减少单场误用实现模块src/core/scene/scene-extractor.ts数据结构SceneBlock包含场景元数据、关联原子记忆ID和上下文边界信息1.4 L3用户画像层Persona功能构建稳定的用户偏好与服务方式画像让Agent按用户习惯协作实现模块src/core/persona/persona-generator.ts生成逻辑基于L2场景块聚合分析通过PersonaPromptResult接口输出标准化画像二、核心功能模块解析2.1 存储模块多引擎适配设计TencentDB Agent Memory采用存储抽象层设计通过IMemoryStore接口统一不同存储引擎的访问方式目前已实现SQLite和TencentDB两种存储方案SQLite存储引擎src/core/store/sqlite.ts实现VectorStore类支持本地轻量级向量检索提供VectorSearchResult接口标准化搜索输出TencentDB存储引擎src/core/store/tcvdb.ts实现TcvdbMemoryStore类支持分布式向量存储提供TcvdbClientConfig配置接口支持连接池管理2.2 适配器模块跨框架集成能力项目提供两种适配器实现使记忆系统能无缝集成到不同AI框架OpenClaw适配器src/adapters/openclaw/host-adapter.ts实现OpenClawHostAdapter类适配OpenClaw框架通过OpenClawHostAdapterOptions配置钩子策略独立适配器src/adapters/standalone/host-adapter.ts实现StandaloneHostAdapter类支持独立部署场景提供StandaloneLLMConfig接口配置本地模型三、插件扩展机制详解3.1 插件元数据规范TencentDB Agent Memory采用YAML格式定义插件元数据典型配置如hermes-plugin/memory/memory_tencentdb/plugin.yaml所示name: memory_tencentdb display_name: memory-tencentdb version: 1.0.0 description: memory-tencentdb four-layer memory — L0 conversation recording, L1 episodic extraction, L2 scene blocks, L3 persona synthesis via local Node.js Gateway. hooks: - on_memory_write - on_session_end aliases: - tdai - memory-tencentdb3.2 钩子扩展点系统预设两类核心钩子允许插件介入记忆处理流程on_memory_write内存写入前触发可用于数据清洗与增强on_session_end会话结束时触发适合执行批量分析与聚合3.3 自定义存储扩展通过实现IMemoryStore接口开发者可添加新的存储引擎。接口定义位于src/core/store/types.ts核心方法包括init(): 初始化存储连接searchL1(): 搜索L1原子记忆searchL0(): 搜索L0原始记录saveL1(): 保存L1提取结果saveL0(): 保存原始对话记录四、快速开始模块化部署与配置4.1 安装部署通过项目提供的自动化脚本快速部署git clone https://gitcode.com/GitHub_Trending/te/TencentDB-Agent-Memory cd TencentDB-Agent-Memory ./scripts/install_hermes_memory_tencentdb.sh4.2 核心配置主配置文件src/config.ts定义了各模块的配置接口包括CaptureConfig: 对话捕获配置ExtractionConfig: 信息提取配置PersonaConfig: 用户画像生成配置TcvdbConfig: TencentDB存储配置4.3 存储引擎切换通过修改配置中的memory.provider参数切换存储引擎使用SQLite:memory.provider: sqlite使用TencentDB:memory.provider: tdai(或memory-tencentdb)五、总结与扩展建议TencentDB Agent Memory通过分层架构与插件化设计实现了AI Agent记忆系统的高度可定制性。开发者可重点关注以下扩展方向自定义提取器实现L1层的领域特定信息提取逻辑新存储引擎通过IMemoryStore接口集成其他向量数据库框架适配器开发新的HostAdapter适配更多AI框架分析插件基于记忆数据构建自定义分析报表项目的模块化设计确保各扩展点之间低耦合新功能的添加不会影响现有系统稳定性。通过这种灵活架构TencentDB Agent Memory能够适应不同规模团队的记忆管理需求成为AI Agent协作的重要基础设施。【免费下载链接】TencentDB-Agent-MemoryTencentDB Agent Memory is a team-level memory hub for AI Agents — turning conversations, docs, and code into four reusable memory assets (Chat Memory, Skill, LLM-Wiki, Code-Graph) that are governed, shared, and equipped across agents and frameworks.项目地址: https://gitcode.com/GitHub_Trending/te/TencentDB-Agent-Memory创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考