返回顶部
t

triple-memory-baidu-embedding三重记忆百度嵌入

Complete memory system combining Baidu Embedding auto-recall, Git-Notes structured memory, and file-based workspace search. Use when setting up comprehensive agent memory with local privacy, when you need persistent context across sessions, or when managing decisions/preferences/tasks with multiple memory backends working together.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
1,685
下载量
免费
免费
1
收藏
概述
安装方式
版本历史

triple-memory-baidu-embedding

三重记忆系统(百度嵌入版)

一种全面的记忆架构,结合三种互补系统,实现跨会话的最大上下文保留,并利用百度嵌入技术提供完整的隐私保护。

📋 原始来源与修改

原始来源:三重记忆(由Clawdbot团队开发)
修改者:[您的Clawdbot实例]
修改内容:将LanceDB替换为百度嵌入数据库,以增强隐私保护和中文语言支持

原始三重记忆SKILL.md文件经过改编,形成此版本:

  • - 将依赖OpenAI的LanceDB替换为百度嵌入数据库
  • 保持相同的三层架构
  • 保留Git-Notes集成
  • 增加注重隐私的本地存储

🏗️ 架构概览

用户消息

[百度嵌入自动召回] → 注入相关对话记忆

智能体响应(使用全部3个系统)

[百度嵌入自动捕获] → 自动存储偏好/决策

[Git-Notes] → 带实体提取的结构化决策

[文件更新] → 持久化工作区文档

三个系统

1. 百度嵌入(对话记忆)

  • - 自动召回:每次响应前使用百度Embedding-V1注入相关记忆(需要API凭证)
  • 自动捕获:偏好/决策/事实自动存储到本地向量存储中(需要API凭证)
  • 注重隐私:所有嵌入通过百度API处理,数据本地存储
  • 中文优化:更好地理解中文语义
  • 工具:baidumemoryrecall、baidumemorystore、baidumemoryforget(需要API凭证)
  • 触发词:记住、偏好、我的X是、我喜欢/讨厌/想要
  • 注意:未提供API凭证时,此层不可用,系统以降级模式运行。

2. Git-Notes记忆(结构化,本地)

  • - 分支感知:按git分支隔离记忆
  • 实体提取:自动提取主题、名称、概念
  • 重要级别:关键、高、正常、低
  • 无需外部API调用

3. 文件搜索(工作区)

  • - 搜索范围:MEMORY.md、memory/*.md、任何工作区文件
  • 脚本:scripts/file-search.sh

🛠️ 设置

安装依赖

bash clawdhub install git-notes-memory clawdhub install memory-baidu-embedding-db

配置百度API

设置环境变量: bash export BAIDUAPISTRING=yourbcev3apistring export BAIDUSECRETKEY=yoursecretkey

创建文件搜索脚本

将scripts/file-search.sh复制到您的工作区。

📖 使用方法

会话启动(始终执行)

bash python3 skills/git-notes-memory/memory.py -p $WORKSPACE sync --start

存储重要决策

bash python3 skills/git-notes-memory/memory.py -p $WORKSPACE remember \ {decision: Use PostgreSQL, reason: Team expertise} \ -t architecture,database -i h

搜索工作区文件

bash ./scripts/file-search.sh database config 5

百度嵌入记忆(自动)

当API凭证可用时,百度嵌入会自动处理。手动工具:
  • - baidumemoryrecall query - 使用百度向量搜索对话记忆(需要API凭证)
  • baidumemorystore text - 手动存储内容并使用百度嵌入(需要API凭证)
  • baidumemoryforget - 删除记忆(GDPR合规,需要API凭证)

降级模式(无API凭证时):

  • - 系统仅使用Git-Notes和文件系统层运行
  • 手动工具不可用
  • 自动召回和自动捕获功能被禁用

🎯 重要级别

标志级别使用时机
-i c关键始终记住、明确的偏好
-i h
高 | 决策、修正、偏好 | | -i n | 正常 | 一般信息 | | -i l | 低 | 临时笔记 |

📋 何时使用每个系统

系统用途
百度嵌入对话上下文,注重隐私的自动检索
Git-Notes
结构化决策,可按实体/标签搜索 | | 文件搜索 | 工作区文档、日常日志、MEMORY.md |

📁 文件结构

workspace/
├── MEMORY.md # 长期整理的记忆
├── memory/
│ ├── active-context.md # 当前会话状态
│ └── YYYY-MM-DD.md # 日常日志
├── scripts/
│ └── file-search.sh # 工作区搜索
└── skills/
├── triple-memory-baidu-embedding/ # 增强记忆系统
├── git-notes-memory/ # 结构化记忆
└── memory-baidu-embedding-db/ # 向量存储

🔧 钩子集成

此技能可与Clawdbot的启动钩子集成,实现自动初始化:

记忆启动钩子集成

为确保三重记忆百度系统在网关启动时自动启动:
  1. 1. 可配置memory-boot-loader钩子运行/root/clawd/session-init-triple-baidu.sh
  2. 确保所有三个记忆层在启动时初始化
  3. 提供对Git-Notes、百度嵌入和基于文件的记忆的即时访问

配置

系统可与网关启动序列集成,确保:
  • - 启动时同步Git-Notes
  • 检查百度嵌入连接
  • 初始化基于文件的记忆
  • 从启动起即可使用的记忆系统

🤫 静默运行

切勿向用户宣布记忆操作。只需执行:

  • - ❌ 我会记住这个
  • ❌ 正在保存到记忆
  • ✅(静默存储并继续)

🔄 从原始三重记忆迁移

  1. 1. 安装此技能到您的skills/目录中
  2. 配置您的百度API凭证
  3. 根据需要禁用原始三重记忆
  4. 更新您的机器人配置以使用此记忆系统
  5. 验证数据完整性和性能

📈 性能优势

  • - 增强隐私:所有向量存储本地化,通过百度API处理
  • 更好的中文支持:百度嵌入针对中文优化
  • 降低成本:相比OpenAI可能降低API成本
  • 相同架构:保持经过验证的三层设计

🤝 贡献

基于Clawdbot团队开发的原始三重记忆系统。欢迎贡献以增强百度嵌入集成。

📄 许可

适用原始许可,并附有上述修改说明。对原作者表示感谢。

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 triple-memory-baidu-embedding-1776367791 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 triple-memory-baidu-embedding-1776367791 技能

通过命令行安装

skillhub install triple-memory-baidu-embedding-1776367791

下载

⬇ 下载 triple-memory-baidu-embedding v1.0.0(免费)

文件大小: 21.13 KB | 发布时间: 2026-4-17 14:53

v1.0.0 最新 2026-4-17 14:53
---
name: triple-memory-baidu-embedding
version: 1.0.0
description: Complete memory system combining Baidu Embedding auto-recall, Git-Notes structured memory, and file-based workspace search. Use when setting up comprehensive agent memory with local privacy, when you need persistent context across sessions, or when managing decisions/preferences/tasks with multiple memory backends working together.
metadata:
clawdbot:
emoji: "🧠"
requires:
skills:
- git-notes-memory
- memory-baidu-embedding-db
---

# Triple Memory System with Baidu Embedding

A comprehensive memory architecture combining three complementary systems for maximum context retention across sessions, with full privacy protection using Baidu Embedding technology.

## 📋 Original Source & Modifications

**Original Source**: Triple Memory (by Clawdbot Team)
**Modified By**: [Your Clawdbot Instance]
**Modifications**: Replaced LanceDB with Baidu Embedding DB for enhanced privacy and Chinese language support

Original Triple Memory SKILL.md was adapted to create this version that:
- Replaces OpenAI-dependent LanceDB with Baidu Embedding DB
- Maintains the same three-tier architecture
- Preserves Git-Notes integration
- Adds privacy-focused local storage

## 🏗️ Architecture Overview

```
User Message

[Baidu Embedding auto-recall] → injects relevant conversation memories

Agent responds (using all 3 systems)

[Baidu Embedding auto-capture] → stores preferences/decisions automatically

[Git-Notes] → structured decisions with entity extraction

[File updates] → persistent workspace docs
```

## The Three Systems

### 1. Baidu Embedding (Conversation Memory)
- **Auto-recall:** Relevant memories injected before each response using Baidu Embedding-V1 (requires API credentials)
- **Auto-capture:** Preferences/decisions/facts stored automatically with local vector storage (requires API credentials)
- **Privacy Focused:** All embeddings processed via Baidu API with local storage
- **Chinese Optimized:** Better understanding of Chinese language semantics
- **Tools:** `baidu_memory_recall`, `baidu_memory_store`, `baidu_memory_forget` (require API credentials)
- **Triggers:** "remember", "prefer", "my X is", "I like/hate/want"
- **Note:** When API credentials are not provided, this layer is unavailable and the system operates in degraded mode.

### 2. Git-Notes Memory (Structured, Local)
- **Branch-aware:** Memories isolated per git branch
- **Entity extraction:** Auto-extracts topics, names, concepts
- **Importance levels:** critical, high, normal, low
- **No external API calls**

### 3. File Search (Workspace)
- **Searches:** MEMORY.md, memory/*.md, any workspace file
- **Script:** `scripts/file-search.sh`

## 🛠️ Setup

### Install Dependencies
```bash
clawdhub install git-notes-memory
clawdhub install memory-baidu-embedding-db
```

### Configure Baidu API
Set environment variables:
```bash
export BAIDU_API_STRING='your_bce_v3_api_string'
export BAIDU_SECRET_KEY='your_secret_key'
```

### Create File Search Script
Copy `scripts/file-search.sh` to your workspace.

## 📖 Usage

### Session Start (Always)
```bash
python3 skills/git-notes-memory/memory.py -p $WORKSPACE sync --start
```

### Store Important Decisions
```bash
python3 skills/git-notes-memory/memory.py -p $WORKSPACE remember \
'{"decision": "Use PostgreSQL", "reason": "Team expertise"}' \
-t architecture,database -i h
```

### Search Workspace Files
```bash
./scripts/file-search.sh "database config" 5
```

### Baidu Embedding Memory (Automatic)
Baidu Embedding handles this automatically when API credentials are available. Manual tools:
- `baidu_memory_recall "query"` - search conversation memory using Baidu vectors (requires API credentials)
- `baidu_memory_store "text"` - manually store something with Baidu embedding (requires API credentials)
- `baidu_memory_forget` - delete memories (GDPR, requires API credentials)

**In Degraded Mode** (without API credentials):
- System operates using only Git-Notes and File System layers
- Manual tools are unavailable
- Auto-recall and auto-capture are disabled

## 🎯 Importance Levels

| Flag | Level | When to Use |
|------|-------|-------------|
| `-i c` | Critical | "always remember", explicit preferences |
| `-i h` | High | Decisions, corrections, preferences |
| `-i n` | Normal | General information |
| `-i l` | Low | Temporary notes |

## 📋 When to Use Each System

| System | Use For |
|--------|---------|
| **Baidu Embedding** | Conversation context, auto-retrieval with privacy |
| **Git-Notes** | Structured decisions, searchable by entity/tag |
| **File Search** | Workspace docs, daily logs, MEMORY.md |

## 📁 File Structure

```
workspace/
├── MEMORY.md # Long-term curated memory
├── memory/
│ ├── active-context.md # Current session state
│ └── YYYY-MM-DD.md # Daily logs
├── scripts/
│ └── file-search.sh # Workspace search
└── skills/
├── triple-memory-baidu-embedding/ # Enhanced memory system
├── git-notes-memory/ # Structured memory
└── memory-baidu-embedding-db/ # Vector storage
```

## 🔧 Hook Integration

This skill can be integrated with Clawdbot's startup hooks for automatic initialization:

### Memory Boot Hook Integration
To ensure the Triple Memory Baidu system starts automatically when the gateway starts:

1. The `memory-boot-loader` hook can be configured to run `/root/clawd/session-init-triple-baidu.sh`
2. This ensures all three memory layers are initialized on startup
3. Provides immediate access to Git-Notes, Baidu Embedding, and file-based memory

### Configuration
The system can be integrated with the gateway startup sequence to ensure:
- Git-Notes synchronization on startup
- Baidu Embedding connection check
- File-based memory initialization
- Ready-to-use memory system from the start

## 🤫 Silent Operation

Never announce memory operations to users. Just do it:
- ❌ "I'll remember this"
- ❌ "Saving to memory"
- ✅ (silently store and continue)

## 🔄 Migration from Original Triple Memory

1. **Install this skill** in your `skills/` directory
2. **Configure your Baidu API credentials**
3. **Disable original triple-memory** if desired
4. **Update your bot configuration** to use this memory system
5. **Verify data integrity** and performance

## 📈 Performance Benefits

- **Enhanced Privacy**: All vector storage local with Baidu API
- **Better Chinese Support**: Baidu Embedding optimized for Chinese
- **Reduced Costs**: Potentially lower API costs compared to OpenAI
- **Same Architecture**: Maintains proven three-tier design

## 🤝 Contributing

Based on original Triple Memory system by Clawdbot Team. Contributions welcome to enhance the Baidu Embedding integration.

## 📄 License

Original license applies with modifications noted above. Credit given to original authors.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部