VinsonWild/Wangdefa.Memory2

wangdefa-memory

本地优先的 Agent 五层记忆体组件 - DSH 插件。

AI 分析

核心用途是为 Agent 提供本地优先的五层记忆管理。适合需要持久化、多层次记忆能力的 Agent 任务。必要条件是已安装 .NET 10.0 或更高版本,并配置 DeepSeek API Key。

包名
wangdefa-memory
版本
1.1.0
许可证
Apache-2.0
最近更新
2026年8月21日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:VinsonWild/Wangdefa.Memory

🔌 DSH 插件使用

如果你使用的是 DeepSeek Harness(DSH),可以直接将 Wangdefa.Memory 作为 MCP 插件接入。

前置条件

  • 已安装 .NET 10.0 或更高版本
  • 已配置 DEEPSEEK_API_KEY 环境变量(DeepSeek API Key)
  • (可选)如需自定义安装路径,可设置 WANGDEFA_MEMORY_PATH 环境变量

安装

方式一:从 GitHub 安装(推荐)

dsh plugin add github:VinsonWild/WangdefaMemory

方式二:本地安装

git clone https://github.com/你的用户名/WangdefaMemory.git
cd WangdefaMemory
dotnet build -c Release
dsh plugin add ./WangdefaMemory.MCP

配置

在 DSH 的 cordis.patch.yml 中配置 API Key:

- insert:
    - id: mcp-wangdefaMemory
      name: '@deepseek-ai/dsh-mcp-client'
      config:
        serverName: WangdefaMemory
        transport: stdio
        command: "dotnet"
        args:
          - "exec"
          - "/WangdefaMemory.MCP/bin/Release/net10.0/WangdefaMemory.MCP.dll"
        cwd: "/WangdefaMemory.MCP"
        env:
          DEEPSEEK_API_KEY: '${DEEPSEEK_API_KEY}'

使用

在 DSH 对话中调用 MCP 工具:

1. 处理用户消息(写框架)

mcp__WangdefaMemory__process_message 帮我记录一下:我喜欢用简洁的代码风格

返回示例:

{
  "enrichedInput": "...",
  "intent": "闲聊",
  "hasMemory": false,
  "frameId": "认知_20260819_143022"
}

2. 补全记忆(填内容)

拿到 frameId 后,调用 save_memory 补全:

mcp__WangdefaMemory__save_memory 好的,已记录你的偏好 认知_20260819_143022 completed

返回示例:

{
  "success": true,
  "message": "记忆已补全并保存,cardId: 认知_20260819_143022,状态: completed"
}

3. 查询记忆

下次对话时,记忆体会自动检索相关记忆:

mcp__WangdefaMemory__process_message 写代码时要注意什么

如果命中,返回的 hasMemorytruememory 字段包含摘要和标签。

状态说明

状态含义
pending框架已建,内容待补全
completed已补全,可被检索
interrupted补全中断
failed补全失败

配置

在 DSH 的 cordis.patch.yml 中配置 API Key:

- insert:
    - id: mcp-wangdefaMemory
      name: '@deepseek-ai/dsh-mcp-client'
      config:
        serverName: WangdefaMemory
        transport: stdio
        command: "dotnet"
        args:
          - "exec"
          - "/WangdefaMemory.MCP/bin/Release/net10.0/WangdefaMemory.MCP.dll"
        cwd: "/WangdefaMemory.MCP"
        env:
          DEEPSEEK_API_KEY: '${DEEPSEEK_API_KEY}'

使用

在 DSH 对话中调用 MCP 工具:

1. 处理用户消息(写框架)

mcp__WangdefaMemory__process_message 帮我记录一下:我喜欢用简洁的代码风格

返回示例:

{
  "enrichedInput": "...",
  "intent": "闲聊",
  "hasMemory": false,
  "frameId": "认知_20260819_143022"
}

2. 补全记忆(填内容)

拿到 frameId 后,调用 save_memory 补全:

mcp__WangdefaMemory__save_memory 好的,已记录你的偏好 认知_20260819_143022 completed

返回示例:

{
  "success": true,
  "message": "记忆已补全并保存,cardId: 认知_20260819_143022,状态: completed"
}

3. 查询记忆

下次对话时,记忆体会自动检索相关记忆:

mcp__WangdefaMemory__process_message 写代码时要注意什么

如果命中,返回的 hasMemorytruememory 字段包含摘要和标签。