Xpersona
C

claw-local-knowledge

CLAWHUB · Unverified

本地知识库技能,用于添加和检索知识。当用户需要将文档(docx/pdf/xlsx/pptx)添加到知识库时使用本技能,或在需要从知识库中检索相关知识时使用。 Skill: claw-local-knowledge Owner: overdue-lin Summary: 本地知识库技能,用于添加和检索知识。当用户需要将文档(docx/pdf/xlsx/pptx)添加到知识库时使用本技能,或在需要从知识库中检索相关知识时使用。 Tags: latest:1.0.0 Version history: v1.0.0 | 2026-04-03T15:36:34.431Z | auto Initial release of claw-local-knowledge skill. - 支持将 docx、pdf、xlsx、pptx 文档转为 markdown 并添加到本地知识库 - 可从知识库检索与任务相关的文档内容 - 明确指引添加、整合、检索知识的场景与流程 - 提供参考文档,助力标准化知识处理 Archive index: Archive v1.0.0: 7 files, 8231 bytes

62
Rank
84
Safety
1.1k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.1K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17fbf4zbr57r15beketeb4bth83m1qm:claw-local-knowledge
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-overdue-lin-claw-local-knowledge/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

12,735 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: claw-local-knowledge
description: "本地知识库技能,用于添加和检索知识。当用户需要将文档(docx/pdf/xlsx/pptx)添加到知识库时使用本技能,或在需要从知识库中检索相关知识时使用。"
---

# Local Knowledge Skill

本地知识库技能,帮助 AI Agent 管理本地文档知识库。

## 主要功能

- **添加知识**:将用户上传的 docx、pdf、xlsx、pptx 文档转换为 markdown,存入知识库
- **检索知识**:从知识库中检索与当前任务相关的文档内容

## 何时使用

- 用户要求将文档添加到知识库
- 用户上传了文件并希望整合到知识库
- Agent 需要查询知识库中的已有知识来辅助回答问题
- 用户询问与知识库中已有文档相关的内容

## References 指引

| 场景 | 读取文件 | 说明 |
|------|---------|------|
| 添加/整合知识 | `references/add_knowledge.md` | 完整的文件转换流程:检查临时文件 → 转换格式 → 清洗乱码 → 更新索引 |
| 检索知识 | `references/retrieval_knowledge.md` | 检索流程:读取索引 → 定位文件 → 读取内容 → 整合信息 |

README.md

# Claw Local Knowledge

A specialized skill enabling AI Agents to manage a local document knowledge base with semantic search and retrieval capabilities.

## Overview

This skill provides two core functionalities:

| Function | Description |
|----------|-------------|
| **Ingest Knowledge** | Convert user-uploaded documents (docx, pdf, xlsx, pptx) into markdown and store them in the knowledge base |
| **Retrieve Knowledge** | Search and retrieve relevant documents from the knowledge base to assist decision-making |

## Architecture

```
.openclaw/workspace/
├── memory/
│   ├── knowledge_base/              # Converted markdown documents
│   └── knowledge_base_index.json     # Knowledge base index (JSON array)
└── temp_file/                        # Staging area for uploaded files
```

### File Flow

1. User uploads documents → `.openclaw/workspace/temp_file/`
2. Agent converts to markdown → `.openclaw/workspace/memory/knowledge_base/`
3. Agent updates index → `.openclaw/workspace/memory/knowledge_base_index.json`

## Initial Setup

Before first use, initialize the required directory structure:

### Linux / macOS

```bash
# Create knowledge base directory
mkdir -p .openclaw/workspace/memory/knowledge_base

# Create temporary file directory
mkdir -p .openclaw/workspace/temp_file

# Create empty index file
echo '[]' > .openclaw/workspace/memory/knowledge_base_index.json
```

### Windows PowerShell

```powershell
# Create directories
New-Item -ItemType Directory -Path ".openclaw/workspace/memory/knowledge_base" -Force
New-Item -ItemType Directory -Path ".openclaw/workspace/temp_file" -Force

# Create empty index file
Set-Content -Path ".openclaw/workspace/memory/knowledge_base_index.json" -Value "[]"
```

### Configure SOUL.md

If the `SOUL.md` file exists in the OpenClaw workspace, inject the following instructions in the original `SOUL.md` style to enable proactive knowledge retrieval:

```plaintext
## Local Knowledge (claw-local-knowledge skill)
Please attempt to load the **claw-local-knowledge skill** when encountering uncertain or specialized knowledge, and retrieve relevant information according to the instructions.

**Retrieval Process:**
1. Read `memory/knowledge_base_index.json` to obtain the file list.
2. Match relevant files based on keywords.
3. Read the corresponding Markdown files from `memory/knowledge_base/`.
4. Integrate the information and reply to the user.

**Note:**
The knowledge base path is `workspace/memory/knowledge_base/`, and the index file is `workspace/memory/knowledge_base_index.json`.
```

This configuration ensures that the Agent can proactively query the local knowledge base when facing knowledge blind spots.

## Index File Format

The `knowledge_base_index.json` is a JSON array where each entry represents a document:

```json
{
  "name": "document_name.md",
  "description": "Brief summary of the document's content"
}
```

## Supported Input Formats

| Format | Type | Extension |
|--------|------|-----------|
| Word Do

_meta.json

{
  "ownerId": "kn78rw1z1f0adg2hsvq7tsfp7s83m129",
  "slug": "claw-local-knowledge",
  "version": "1.0.0",
  "publishedAt": 1775230594431
}

references/add_knowledge.md

# 添加知识到知识库指南

本文档指导 AI Agent 如何将上传的文件添加到本地知识库。

## 工作流程

### 1. 检查临时上传文件

检查 `.openclaw/workspace/temp_file/` 文件夹,查找以下格式的上传文件:
- `.docx` (Word 文档)
- `.pdf` (PDF 文档)
- `.xlsx` (Excel 电子表格)
- `.pptx` (PowerPoint 演示文稿)

### 2. 文件格式转换

使用适当的工具将每个文件转换为 Markdown 格式:

| 文件格式 | 推荐工具 | 备选方案 |
|---------|---------|---------|
| docx | `officecli docx` skill | python-docx |
| pdf | pdfplumber, PyPDF2 | - |
| xlsx | `officecli xlsx` skill | openpyxl |
| pptx | `officecli pptx` skill | python-pptx |

**格式转换优先级**:
1. 优先使用 `officecli` 相关 skill(已注册的命令)
2. 无法使用 skill 时,使用对应的 Python 库

### 3. 保存转换后的文件

将转换得到的 Markdown 文件保存到:
```
.openclaw/workspace/memory/knowledge_base/
```

### 4. 文本清洗(重要)

**必须过滤乱码/乱字符**:
- 检测并移除 Mojibake(编码错误的字符)
- 检查常见的编码问题标志:
  - 大量 `�` 字符
  - 异常的 `\x` 转义序列
  - 非预期的 Unicode 替代字符
- **禁止写入**包含乱码的内容到 Markdown 文件

### 5. 生成文件元信息

为每个转换后的文件生成:
- **文件名**:使用语义化的中文名称,`.md` 后缀
- **摘要**:简洁描述文件的主要内容(中文,1-3 句话)

### 6. 更新知识库索引

在 `.openclaw/workspace/memory/knowledge_base_index.json` 中追加条目:

```json
{
  "name": "markdown文件名称.md",
  "description": "该文件主要讲述的内容(摘要)"
}
```

**注意事项**:
- 如果 `knowledge_base_index.json` 不存在,创建为空数组 `[]`
- 追加而非覆盖现有内容
- 保持 JSON 格式正确

### 7. 删除原始文件

转换并保存成功后,从 `.openclaw/workspace/temp_file/` 中删除原始文件:

```bash
# 删除原始文件(以 docx 为例)
rm .openclaw/workspace/temp_file/文件.docx
```

**注意**:仅在转换成功且已更新索引后才删除原始文件。

## 示例

假设 `temp_file/` 中有一个 `文件.docx`:

```bash
# 1. 转换 docx 为 markdown
# 使用 officecli docx skill 或 python-docx 读取并转换

# 2. 保存到知识库
# .openclaw/workspace/memory/knowledge_base/文件.md

# 3. 更新索引
# .openclaw/workspace/memory/knowledge_base_index.json
```

生成的索引条目:
```json
{
  "name": "文件.md",
  "description": "文件记录的主要内容摘要。"
}
```

## 质量检查清单

- [ ] 所有上传文件均已转换并保存
- [ ] Markdown 内容无乱码/乱字符
- [ ] 文件名语义化且使用中文
- [ ] 摘要简洁、准确描述内容
- [ ] 索引文件格式正确(有效 JSON)
- [ ] 新条目已正确追加到索引数组
- [ ] 原始文件已从 temp_file 中删除

references/retrieval_knowledge.md

# 知识库检索指南

本文件指导 AI 代理如何从本地知识库中检索相关知识。

## 检索流程

### 第一步:读取索引文件

当代理需要额外知识来辅助用户时,首先读取以下文件:

```
.openclaw/workspace/memory/knowledge_base_index.json
```

该索引文件包含所有知识文件的列表,每个条目包含文件名和描述。

### 第二步:搜索相关文件

根据当前话题或问题,搜索索引文件中的描述,找出与该话题相关的文件。

### 第三步:读取具体知识文件

根据搜索结果,从以下文件夹中读取对应的 markdown 文件:

```
.openclaw/workspace/memory/knowledge_base/
```

### 第四步:整合信息

将读取到的内容整合到回复中,以增强代理的响应质量。

## 示例流程

1. 读取 `knowledge_base_index.json`
2. 搜索包含关键词"LLM推理优化"的文件
3. 找到匹配的文件(如 `inference_optimization.md`)
4. 读取该文件内容
5. 使用获取的知识来回答用户问题

## 注意事项

- 索引文件是 JSON 格式,解析时注意结构
- 知识文件均存储在 `knowledge_base` 文件夹下
- 优先检索与当前问题最相关的文件

Sponsored

Ads related to claw-local-knowledge and adjacent AI workflows.