360 Secure SkillHub
360 安全技能中心

knowledge-vault

核心功能是将文档、笔记等转为向量嵌入存储,支持语义检索(RAG),让AI Agent拥有无限长期记忆,无需担忧上下文窗口限制。典型场景包括存储用户偏好、搭建私有知识库等。输入为文档内容或查询语句,输出相关知识,支持自托管TiDB或自动临时库,需配置TiDB及GEMINI密钥。

lilyjazz
lilyjazz
热度 35.69
最近更新 2026-05-11 17:26:37
分类:知识依赖:代码执行 / 读写文件 / 第三方 API应用场景:笔记整理 / 研究

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add knowledge-vault
Metadata
name
knowledge-vault
description
Long-term RAG memory storage for your agent, powered by TiDB Vector.
metadata
{"openclaw":{"emoji":"📚","requires":{"bins":["python3","curl"],"env":["TIDB_HOST","TIDB_PORT","TIDB_USER","TIDB_PASSWORD","GEMINI_API_KEY"]}}}

Knowledge Vault (Powered by TiDB Zero)

Overview

Knowledge Vault is a Long-Term Memory module for AI Agents, powered by TiDB Vector Search (RAG).

Traditional agent memory (context window) is ephemeral and limited. Knowledge Vault allows agents to:

  1. Store: Ingest documents, notes, and facts as vector embeddings.
  2. Retrieve: Semantically search for relevant information based on user queries ("RAG").
  3. Remember: Access unlimited historical context without overflowing the LLM prompt.

Why use this?

  • Infinite Recall: Store millions of documents without confusing the agent.
  • Contextual Relevance: Find exact paragraphs related to a question, not just keywords.
  • Privacy: Keep your knowledge base private in your own TiDB Cloud instance.

Prerequisites

  • TiDB Cloud (Serverless): With Vector Search enabled.
  • Embedding Model: Requires GEMINI_API_KEY (or compatible).

🔐 Security & Provisioning

This skill operates in two modes:

  1. Bring Your Own Database (Recommended): Set TIDB_HOST, TIDB_USER, TIDB_PASSWORD environment variables. The skill will use your existing database.
  2. Auto-Provisioning (Fallback): If no credentials are found, the skill calls the TiDB Zero API to create a temporary, ephemeral database for you. It caches the connection string locally (~/.openclaw_knowledge_vault_dsn) to persist memory across runs.

Installation

1. Add to TOOLS.md

- **knowledge-vault**: Store and retrieve knowledge using vector search.
  - **Location:** `{baseDir}/skills/knowledge_vault/SKILL.md`
  - **Command:** `python {baseDir}/skills/knowledge_vault/run.py --action search --query "<QUESTION>"`

2. Add to AGENTS.md (Protocol)

Copy PROTOCOL.md.

Usage

  • Add Knowledge:
    python {baseDir}/run.py --action add --content "The user prefers spicy food but is allergic to peanuts."
    
  • Search (RAG):
    python {baseDir}/run.py --action search --query "What are the user's dietary restrictions?"