当前位置: 首页 > Skill >

Knowledge Management

Knowledge Management

2.1.0 2026.11.08 浏览:897
获取Skill文件查看使用说明
作者:沈禾许可证:
本文目录展开

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 files
  • km classify [options] - Parse and classify without storing (JSON output)
  • km summarize [options] - Generate index files for each content type
  • km cleanup [options] - Remove orphaned files
  • km list_types - List all available content types

Setup

No API keys needed! The skill uses two locations:

  • Input Workspace: Where MEMORY.md and memory/ daily files are read from.
  • Output Directory: Where organized folders (Research/, Decision/, etc.) are written.

Both are detected automatically:

Input Workspace (source files)

  1. OPENCLAWORKSPACE environment variable
  2. --workspace <path> CLI argument
  3. Current working directory (if it contains MEMORY.md)
  4. Default: ~/.openclaw/workspace

Output Directory (organized files)

  1. --output-dir <path> CLI argument (relative to workspace or absolute)
  2. Default: <workspace>/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

  1. Parses MEMORY.md and recent daily memory/*.md files
  2. Classifies each entry (content type, domain, certainty, impact, tags, confidence)
  3. Computes content hash for deduplication
  4. Checks sync state (memory/local-sync-state.json) to skip already synced entries
  5. Writes to appropriate folder with timestamp + hash filename
  6. Updates state mapping (hash → filepath)
  7. 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 
  --name "Daily Knowledge Sync" 
  --cron "0 5 * * *" 
  --tz "Asia/Singapore" 
  --session isolated 
  --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 link in the skill directory, or add ~/workspace/bin to PATH.

No entries found

  • Ensure MEMORY.md uses ## 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.json to force re-sync (caution: may duplicate files).

Duplicate files

  • Run km cleanup to remove orphans, then km sync to 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

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,040
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,033
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,021
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,021
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,019
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,016
Skill 文件
  • SKILL.md
    • Knowledge Management Skill (Local Storage)
    • Available Tools
      • Core Commands
    • Setup
      • Input Workspace (source files)
      • Output Directory (organized files)
    • Usage Examples
      • Default locations (input at workspace root, output in memory/KM)
      • Custom input workspace and output directory
      • Using environment variables
      • Dry run (preview only)
      • Classify entries and export JSON
      • Generate index files (default: output directory)
      • Preview orphan cleanup
      • List content types
    • Storage Structure
      • File Naming
      • File Content (YAML Frontmatter)
    • How It Works
    • Classification Logic
    • State Management
    • Cron Integration
    • Troubleshooting
  • 项目或源文件

相关 Skill

更多
Ai Workforce Ai Workforce Turn an OpenClaw agent into an autonomous AI Chief that runs a business. Provides trust-based autonomy, structured knowledge management (bank/), worker deleg...
上市经验总结与知识管理 上市经验总结与知识管理 产品上市知识管理专家技能。当用户提出以下意图时触发: 上市复盘、上市经验总结、上市知识管理、上市项目复盘、上市经验萃取、 上市教训总结、上市案例库建设、上市知识沉淀、产品上市回顾、 上市根因分析、上市经验归档、上市最佳实践提炼、Go-to-Market复盘、 GTM经验总结、post-launch knowledge management、launch retrospective。 涵盖从上市项目全景回顾、关键成功要素萃取、问题与教训归因分析、 经验知识条目结构化归档、案例库建设与索引到知识传播与应用指引的全流程。
基于wiki的知识库系统 基于wiki的知识库系统 LLM-powered personal knowledge base management. Build and maintain a structured wiki incrementally. Use when: building knowledge base, managing wiki, ingesting sources, knowledge management, 个人知识库, 知识管理, 摄入来源, 维护 wiki, 增量构建, 交叉引用, 实体页面, 概念页面, ingest, query wiki, lint wiki, cross-reference, entity extraction, concept mapping, 使用wiki技能处理, wiki技能处理一下, 用wiki处理, wiki处理一下.
Afrexai Knowledge Management Free Afrexai Knowledge Management Free 结构化知识管理与推理引擎(免费版),支持知识捕获、关联推理、主动浮现和多源知识库构建。采用图结构存储实体与关系。核心能力:知识捕获与结构化(实体/关系/属性/上下文);关联推理与查询(语义搜索+图遍历);主动浮现(工作上下文关联);知识库生命周期管理(创建/更新/归档/遗忘)。
Super Claw Local Knowledge Super Claw Local Knowledge Leverage the local knowledge base skill to seamlessly add and retrieve information from documents including DOCX, PDF, XLSX, and PPTX. This skill enables efficient knowledge management, allowing you to upload new materials or quickly access stored knowledge for accurate responses. Enhance your decis