docs: add bilingual README with WaterFlow usage instructions

This commit is contained in:
root
2026-04-15 15:51:54 +08:00
parent d05bb5507f
commit aa18c1c8b1

View File

@ -1,55 +1,64 @@
# TrulyMEM - WaterFlow Adapter # TrulyMEM - WaterFlow 适配版 / WaterFlow Adapter
让 AI 拥有真正的长期记忆能力 - WaterFlow 框架适配版 让 AI 拥有真正的长期记忆能力 - WaterFlow 框架适配版
*Give AI true long-term memory capability - WaterFlow framework adapter version*
--- ---
## 简介 ## 简介 / Introduction
本项目是将 TrulyMEM 的图记忆能力迁移到 WaterFlow 框架的 TypeScript 实现。 本项目是将 TrulyMEM 的图记忆能力迁移到 WaterFlow 框架的 TypeScript 实现。
This project ports TrulyMEM's graph memory capability to TypeScript for the WaterFlow framework.
作为 WaterFlow 的内置模块,提供图记忆功能: 作为 WaterFlow 的内置模块,提供图记忆功能:
- **recall**: 检索记忆
- **commit**: 写入记忆 As a built-in module for WaterFlow, it provides graph memory functionality:
- **purge**: 删除记忆
- **introspect**: 查看状态 - **recall**: 检索记忆 / Retrieve memories
- **persona_update/clear**: 人设管理 - **commit**: 写入记忆 / Commit memories
- **task_create/set_state/delete**: 任务管理 - **purge**: 删除记忆 / Delete memories
- **introspect**: 查看状态 / Inspect status
- **persona_update/clear**: 人设管理 / Persona management
- **task_create/set_state/delete**: 任务管理 / Task management
--- ---
## 目录结构 ## 目录结构 / Directory Structure
``` ```
ts/ ts/
├── src/runtime/core/ ├── src/runtime/core/
│ ├── graph_memory/ # 图记忆核心模块 │ ├── graph_memory/ # 图记忆核心模块 / Graph memory core module
│ │ ├── types.ts # 类型定义 │ │ ├── types.ts # 类型定义 / Type definitions
│ │ ├── graph_database.ts # 图数据库 │ │ ├── graph_database.ts # 图数据库 / Graph database
│ │ ├── memory_service.ts # 记忆服务 │ │ ├── memory_service.ts # 记忆服务 / Memory service
│ │ └── index.ts # 模块导出 │ │ └── index.ts # 模块导出 / Module exports
│ └── tools/ │ └── tools/
│ └── builtin/ │ └── builtin/
│ └── graph_memory_tool.ts # Tool 实现 │ └── graph_memory_tool.ts # Tool 实现 / Tool implementation
│ │
├── bundled-skills/ # Skill 定义 ├── bundled-skills/ # Skill 定义 / Skill definitions
│ └── graph_memory/ │ └── graph_memory/
│ ├── SKILL.md # 记忆操作 │ ├── SKILL.md # 记忆操作 / Memory operations
│ ├── persona/SKILL.md # 人设管理 │ ├── persona/SKILL.md # 人设管理 / Persona management
│ └── task/SKILL.md # 任务管理 │ └── task/SKILL.md # 任务管理 / Task management
│ │
├── package.json # 项目配置 ├── package.json # 项目配置 / Project config
└── tsconfig.json # TypeScript 配置 └── tsconfig.json # TypeScript 配置 / TypeScript config
``` ```
--- ---
## 在 WaterFlow 中使用 ## 在 WaterFlow 中使用 / Usage in WaterFlow
### 方式一:作为独立模块引用 ### 方式一:作为独立模块引用 / Method 1: Import as standalone module
将 `ts/` 目录复制到你的 WaterFlow 项目中: 将 `ts/` 目录复制到你的 WaterFlow 项目中:
Copy the `ts/` directory to your WaterFlow project:
```typescript ```typescript
import { GraphMemoryTool, createGraphMemoryTool } from './runtime/core/tools/builtin/graph_memory_tool'; import { GraphMemoryTool, createGraphMemoryTool } from './runtime/core/tools/builtin/graph_memory_tool';
@ -64,14 +73,16 @@ const result = await tool.handler({
}, context); }, context);
``` ```
### 方式二:使用 Skill ### 方式二:使用 Skill / Method 2: Use Skill
GraphMemory 已配置为 bundled skill,可直接调用: GraphMemory 已配置为 bundled skill,可直接调用:
GraphMemory is configured as a bundled skill and can be called directly:
``` ```
使用 skill:graph_memory 进行记忆操作 使用 skill:graph_memory 进行记忆操作 / Use skill:graph_memory for memory operations
使用 skill:graph_memory_persona 进行人设管理 使用 skill:graph_memory_persona 进行人设管理 / Use skill:graph_memory_persona for persona management
使用 skill:graph_memory_task 进行任务管理 使用 skill:graph_memory_task 进行任务管理 / Use skill:graph_memory_task for task management
``` ```
--- ---
@ -86,23 +97,23 @@ const tool = new GraphMemoryTool(sessionId?: string);
#### Actions #### Actions
| Action | 说明 | 参数 | | Action | 说明 / Description | 参数 / Parameters |
|--------|------|------| |--------|------|------|
| `recall` | 检索记忆 | `queryIntent`, `seedEntities`, `sessionFilter` | | `recall` | 检索记忆 / Retrieve memories | `queryIntent`, `seedEntities`, `sessionFilter` |
| `commit` | 写入记忆 | `triplets`, `sessionId`, `turnId` | | `commit` | 写入记忆 / Commit memories | `triplets`, `sessionId`, `turnId` |
| `purge` | 删除记忆 | `criteria`, `mode` | | `purge` | 删除记忆 / Delete memories | `criteria`, `mode` |
| `introspect` | 查看状态 | - | | `introspect` | 查看状态 / Inspect status | - |
| `persona_update` | 更新人设 | `attributes`, `mode` | | `persona_update` | 更新人设 / Update persona | `attributes`, `mode` |
| `persona_clear` | 清除人设 | `confirm` | | `persona_clear` | 清除人设 / Clear persona | `confirm` |
| `task_create` | 创建任务 | `task_id`, `description`, `info_nodes` | | `task_create` | 创建任务 / Create task | `task_id`, `description`, `info_nodes` |
| `task_set_state` | 设置状态 | `task_id`, `state` | | `task_set_state` | 设置状态 / Set state | `task_id`, `state` |
| `task_delete` | 删除任务 | `task_id` | | `task_delete` | 删除任务 / Delete task | `task_id` |
--- ---
## 示例 ## 示例 / Examples
### 写入记忆 ### 写入记忆 / Commit Memory
```json ```json
{ {
@ -116,7 +127,7 @@ const tool = new GraphMemoryTool(sessionId?: string);
} }
``` ```
### 检索记忆 ### 检索记忆 / Recall Memory
```json ```json
{ {
@ -127,7 +138,7 @@ const tool = new GraphMemoryTool(sessionId?: string);
} }
``` ```
### 创建任务 ### 创建任务 / Create Task
```json ```json
{ {
@ -142,6 +153,6 @@ const tool = new GraphMemoryTool(sessionId?: string);
--- ---
## 许可证 ## 许可证 / License
[GNU General Public License v3.0 (GPLv3)](LICENSE) [GNU General Public License v3.0 (GPLv3)](LICENSE)