知识管理:使用 Openclaw 技能组织 AI 记忆
作者:互联网
2026-03-30
什么是 知识管理技能?
知识管理技能提供了一个强大的框架,用于管理 AI 代理生成的长期记忆和见解。通过解析 MEMORY.md 和每日日志等源文件,它会自动将信息归类为研究、教训和决策等不同类型。
该工具将扁平的文本文件转换为高度组织化的目录结构,确保关键的项目知识始终可访问且可操作。对于使用 Openclaw 技能的开发人员来说,这是一个必不可少的组件,他们需要维护一个干净、幂等且可进行版本控制的文档系统,而无需人工干预。
下载入口:https://github.com/openclaw/skills/tree/main/skills/claireaicodes/knowledge-management
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install knowledge-management
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 knowledge-management。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
知识管理技能 应用场景
- 自动化从原始每日日志到永久、分类的本地知识库的转换。
- 为特定内容类型(如项目决策或技术教程)生成结构化索引。
- 将本地 AI 记忆与版本控制的文档系统同步,以便团队协作。
- 清理孤立或冗余的记忆文件,以维持简洁准确的知识库。
- 该技能会扫描配置的工作区以查找源文件,包括主要的 MEMORY.md 和每日记忆日志。
- 每个条目都会被解析并传递给分类引擎,由其确定内容类型、领域、确定性和影响。
- 为每个条目生成唯一的 8 字符内容哈希,以方便去重并防止文件名冲突。
- 经过验证的条目将作为单独的 Markdown 文件写入输出目录中特定类型的文件夹(如 /Research 或 /Lesson)。
- 内部同步状态将被更新以跟踪已处理的条目,从而在未来的运行中实现快速、幂等的同步。
知识管理技能 配置指南
配置您的工作区环境变量或使用默认路径开始使用 Openclaw 技能工具:
export OPENCLAWORKSPACE=~/.openclaw/workspace
可选:预先创建目录结构以准备环境:
mkdir -p ~/.openclaw/workspace/memory/KM/{Research,Decision,Insight,Lesson,Pattern,Project,Reference,Tutorial}
运行您的第一次同步以处理过去一周的条目:
km sync --days_back 7
知识管理技能 数据架构与分类体系
该技能根据内容分类将数据组织成层级文件夹结构。每个生成的文件都包含一个 YAML 前置数据块,以便与其他 Openclaw 技能保持元数据兼容性。
| 文件夹 | 描述 |
|---|---|
| Research/ | 调查数据和技术发现 |
| Decision/ | 关键项目架构或逻辑选择 |
| Lesson/ | 回顾性见解和习得行为 |
| Pattern/ | 循环出现的解决方案或代码结构 |
| Tutorial/ | 逐步指南和流程文档 |
命名规范: YYYYMMDDTHHMM_标题_哈希.md
name: knowledge-management
description: Organize and classify OpenClaw knowledge entries into local folders by content type (Research, Decision, Insight, Lesson, Pattern, Project, Reference, Tutorial).
homepage: https://github.com/ClaireAICodes/openclaw-skill-knowledge-management
metadata: { "openclaw": { "emoji": "??", "requires": { "bins": ["km"] } } }
Knowledge Management Skill (Local Storage)
Organize your OpenClaw memory files into a structured local knowledge base. Automatically parses MEMORY.md and daily memory files, classifies entries by content type, and stores each as a timestamped markdown file in the appropriate folder.
Available Tools
Core Commands
km sync [options]- Sync memory entries to local fileskm classify [options]- Parse and classify without storing (JSON output)km summarize [options]- Generate index files for each content typekm cleanup [options]- Remove orphaned fileskm list_types- List all available content types
Setup
No API keys needed! The skill uses two locations:
- Input Workspace: Where
MEMORY.mdandmemory/daily files are read from. - Output Directory: Where organized folders (
Research/,Decision/, etc.) are written.
Both are detected automatically:
Input Workspace (source files)
OPENCLAWORKSPACEenvironment variable--workspaceCLI argument- Current working directory (if it contains
MEMORY.md) - Default:
~/.openclaw/workspace
Output Directory (organized files)
--output-dirCLI argument (relative to workspace or absolute)- Default:
/memory/KM
The skill will create the output directory and all content-type folders automatically.
If you want to pre-create:
mkdir -p ~/.openclaw/workspace/memory/KM/{Research,Decision,Insight,Lesson,Pattern,Project,Reference,Tutorial}
Usage Examples
Default locations (input at workspace root, output in memory/KM)
# From any directory (workspace auto-detected)
km sync --days_back 7 --cleanup
Custom input workspace and output directory
km sync --workspace /custom/input/workspace --output-dir /custom/output/KM --days_back 7
Using environment variables
export OPENCLAWORKSPACE=/custom/input/workspace
km sync --output-dir /custom/output/KM --days_back 7
Dry run (preview only)
km sync --dry_run --days_back 1
Classify entries and export JSON
km classify --days_back 3 > entries.json
Generate index files (default: output directory)
km summarize
# or specify different location
km summarize --output_dir ~/some/other/folder
Preview orphan cleanup
km cleanup --dry_run
List content types
km list_types
Storage Structure
Assuming default configuration:
- Input workspace:
~/.openclaw/workspace - Output directory:
~/.openclaw/workspace/memory/KM
~/.openclaw/workspace/
├── MEMORY.md (source file - you edit this)
├── memory/ (daily memory files)
│ ├── 2025-02-11.md
│ ├── 2025-02-12.md
│ └── ...
└── memory/KM/ (organized output by the skill)
├── local-sync-state.json
├── local-sync-log.md
├── Research/
│ ├── 20260215T1448_Title_Here_HASH.md
│ └── ...
├── Decision/
├── Insight/
├── Lesson/
├── Pattern/
├── Project/
├── Reference/
├── Tutorial/
├── Research_Index.md
├── Decision_Index.md
└── ... (other index files)
File Naming
Format: YYYYMMDDTHHMM_Title_With_Underscores_8CHARHASH.md
The 8-character content hash suffix prevents filename collisions when titles are identical but content differs.
File Content (YAML Frontmatter)
---
title: "Protocol Name"
content_type: "Research"
domain: "OpenClaw"
certainty: "Verified"
impact: "Medium"
confidence_score: 8
tags: ["AI", "Automation"]
source: "MEMORY.md"
source_file: "MEMORY.md"
date: "2026-02-11"
content_hash: "e4b30e75d0f5a662"
---
Entry body content starts here...
How It Works
- Parses
MEMORY.mdand recent dailymemory/*.mdfiles - Classifies each entry (content type, domain, certainty, impact, tags, confidence)
- Computes content hash for deduplication
- Checks sync state (
memory/local-sync-state.json) to skip already synced entries - Writes to appropriate folder with timestamp + hash filename
- Updates state mapping (hash → filepath)
- Optional cleanup removes files not in state
Classification Logic
- Content Type: Keyword matching (Research, Lesson, Decision, Pattern, Tutorial, Reference, Insight)
- Domain: Contextual inference (AI Models, OpenClaw, Cost, Trading, etc.)
- Certainty: Based on language (Verified, Likely, Speculative, Opinion)
- Impact: Importance indicators (High, Medium, Low, Negligible)
- Tags: Auto-extracted from predefined keyword map
- Confidence Score: 1–10 heuristic (source credibility, length, data mentions)
Customize by editing the EntryClassifier class in index-local.js.
State Management
memory/local-sync-state.json maps content hashes to file paths:
{
"e4b30e75d0f5a662": "/path/to/Research/202602151440_Title_e4b30e75.md"
}
This enables idempotent syncs and fast duplicate detection.
Do not edit manually unless recovering from corruption.
Cron Integration
Automate daily syncs:
openclaw cron add r
--name "Daily Knowledge Sync" r
--cron "0 5 * * *" r
--tz "Asia/Singapore" r
--session isolated r
--message "km sync --days_back 7"
Note: By default, the skill reads MEMORY.md from ~/.openclaw/workspace and writes organized files to ~/.openclaw/workspace/memory/KM. Use --workspace or --output-dir to customize these locations.
Troubleshooting
"km: command not found"
- Run
npm linkin the skill directory, or add~/workspace/binto PATH.
No entries found
- Ensure
MEMORY.mduses##section headers and###entry titles within recognized sections.
Files not created
- Check write permissions; run with
--verbose.
Old entries not syncing
- They may already be in state. Clear
memory/KM/local-sync-state.jsonto force re-sync (caution: may duplicate files).
Duplicate files
- Run
km cleanupto remove orphans, thenkm syncto create missing files.
Version: 2.0.0 Changed: 2026-02-15 — Switched from Notion to local storage, added hash suffixes for uniqueness. Author: Claire (OpenClaw Agent) License: MIT
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
信号管道:自动化营销情报工具 - Openclaw Skills
技能收益追踪器:监控 Openclaw 技能并实现变现
AI 合规准备就绪度:评估与治理工具 - Openclaw Skills
FOSMVVM ServerRequest 测试生成器:自动化 API 测试 - Openclaw Skills
酒店搜索器:AI 赋能的住宿与位置情报 - Openclaw Skills
Dub 链接 API:程序化链接管理 - Openclaw Skills
IntercomSwap:P2P BTC 与 USDT 跨链兑换 - Openclaw Skills
spotplay:macOS 原生 Spotify 播放控制 - Openclaw Skills
DeepSeek OCR:AI驱动的图像文本识别 - Openclaw Skills
Web Navigator:自动化网页研究与浏览 - Openclaw Skills
AI精选
