← Back to Skills Marketplace
thomasliu

Kb Mini

by Thomas Lau · GitHub ↗ · v1.3.0 · MIT-0
cross-platform ⚠ suspicious
148
Downloads
0
Stars
0
Active Installs
4
Versions
Install in OpenClaw
/install kb-mini
Description
Store, search, and automatically manage a personal or shared knowledge base integrated with OpenClaw through before/after hooks.
README (SKILL.md)

Knowledge Base Skill

Version: v1.2.0 Repository: https://github.com/ThomasLiu/knowledge-base-skill


触发条件

当用户提到以下关键词时触发:

  • "加入知识库" / "存到 KB" / "存入知识库"
  • "knowledge base" / "知识库" / "KB"
  • "记得这个" / "保存上下文" / "记忆"
  • "检索知识库" / "查一下 KB"

功能

1. Collect - 存储

kb store --title "标题" --content "内容" --source "manual"

2. Retrieve - 检索

kb search --query "关键词"
kb retrieve --topic-key "entry-key"

3. Recall - 对话前自动检索

before_agent_start hook 中自动调用,检索与当前对话相关的知识。

4. Capture - 对话后自动存储

after_turn hook 中自动调用,判断并存储重要内容。


使用方式

存储信息

用户: 把这个配置加入知识库
Agent: 使用 kb store 命令存储

检索信息

用户: 查一下知识库里关于 OpenClaw 的内容
Agent: 使用 kb search 查询并返回结果

脚本列表

脚本 功能
scripts/storage.sh 核心存储 API
scripts/retriever.sh 检索 + recall/capture
scripts/hooks.sh OpenClaw Hooks 集成
scripts/lifecycle.sh 生命周期管理

依赖

  • bash
  • sqlite3
  • python3

配置

默认模式(安装即用)

Skill 安装后默认使用自身目录存储,无需任何配置:

~/.openclaw/workspace/skills/kb-mini/data/knowledge.db

共享 KB 模式(多 Agent 共用)

多个 Agent 共用同一个知识库:

# 在调用 skill 前设置
export KNOWLEDGE_SHARED_NAME="coding-kb"
# 实际路径: ~/.openclaw/shared/knowledge-bases/coding-kb/knowledge.db

显式路径模式

指定任意路径作为 KB:

export KNOWLEDGE_DB="/path/to/your/knowledge.db"

环境变量优先级

优先级 变量 说明
1 KNOWLEDGE_DB 显式指定路径
2 KNOWLEDGE_SHARED_NAME 共享 KB 名称
3 Skill 内部目录 默认,安装即用

目录结构

kb-mini/
├── data/
│   └── knowledge.db      # 默认 KB 路径
├── scripts/
│   ├── storage.sh        # 存储 API
│   ├── retriever.sh      # 检索 API
│   ├── hooks.sh          # Hooks 集成
│   └── lifecycle.sh      # 生命周期
└── SKILL.md
Usage Guidance
What to check before installing: - Understand where the DB will live: the SKILL.md and scripts disagree on default paths. Inspect (and optionally set) KNOWLEDGE_DB and KNOWLEDGE_KB_MODE to ensure data is private and stored where you expect (set mode=private and a controlled DB path if unsure). - This skill auto-recalls before conversations and auto-captures after turns. If you do not want every conversation persisted, disable the hooks or raise the capture threshold (or avoid installing the generated hook scripts). - Review the scripts for unsafe interpolation: topic_key and other values are interpolated into sqlite3 commands without parameterization. Consider hardening (use parameterized sqlite3 access from Python or properly escape inputs) to avoid local SQL injection or DB corruption from crafted messages. - Shared KB mode allows multiple agents to read/write the same DB — enable only when you explicitly want cross-agent sharing and after you trust all participating agents. - Test in a sandbox: run the scripts on a throwaway agent and inspect the created DB and files. Verify sqlite3 on your system supports FTS5 (it is required). - If you plan to use this skill, consider adding explicit required config/env declarations and limit hook registration to manually enabled hooks so captures are explicit rather than automatic. Why 'suspicious' and not 'malicious': the code implements the advertised KB functionality and uses no unexpected network endpoints, but the undeclared config/env usage, automatic persistence across agents, and unsafe string interpolation are notable coherence and safety issues that should be fixed or accepted knowingly before use.
Capability Analysis
Type: OpenClaw Skill Name: kb-mini Version: 1.3.0 The skill provides a local knowledge base using SQLite, but it contains multiple critical SQL injection vulnerabilities across `storage.sh`, `retriever.sh`, and `lifecycle.sh` because user-controlled inputs (titles, content, and search queries) are directly interpolated into shell-executed SQL strings. Furthermore, `retriever.sh` includes logic to automatically 'capture' and store sensitive information such as API keys, tokens, and passwords into the local database. While these appear to be unintentional security flaws or risky features rather than intentional malware, the lack of input sanitization and the targeting of secrets make the bundle unsafe for production use.
Capability Assessment
Purpose & Capability
Name/description match the delivered artifacts: scripts implement storage, retrieval, hooks, and lifecycle for a local SQLite FTS5 knowledge base. Declared runtime deps in SKILL.md (bash, sqlite3, python3) are consistent with the shipped code. However there are small inconsistencies between documentation and code: SKILL.md describes a default path under ~/.openclaw/workspace/skills/kb-mini/data/knowledge.db, while scripts default to $HOME/.openclaw/agents/current/knowledge.db and other locations; that mismatch should be resolved so users know where data will actually be stored.
Instruction Scope
The SKILL.md and hooks/lifecycle scripts direct the agent to automatically recall before a conversation and capture after each turn. That means conversation content and derived decisions can be written to disk without an explicit user action. The scripts embed user/agent text into SQL statements and topic keys without proper escaping or parameterization (e.g., topic_key interpolated directly into sqlite3 queries), creating risk of local SQL injection or accidental DB corruption from crafted content. The skill also provides 'shared KB' behavior where multiple agents can read/write the same DB — this expands the data-access scope and can leak cross-agent data if enabled.
Install Mechanism
There is no install spec (instruction-only), so the skill does not download arbitrary third-party binaries during install. The security surface is limited to the shipped scripts which will run on invocation; this is lower risk than executing code downloaded at install time, but runtime behavior still matters.
Credentials
Registry metadata lists no required env vars or config paths, yet SKILL.md and scripts rely on many environment variables (KNOWLEDGE_DB, KNOWLEDGE_KB_MODE, KNOWLEDGE_SHARED_NAME, AGENT_DIR, OPENCLAW_USER_MESSAGE, etc.). The skill will read/write filesystem locations under home and agent directories (e.g., ~/.openclaw/shared/knowledge-bases/...), but those config paths were not declared in metadata. Asking for or using broad filesystem paths and shared DBs is proportionate for a KB skill, but the lack of declared config requirements and the default to agent-shared locations is a privacy/clarity concern.
Persistence & Privilege
The skill is not force-included (always: false) and uses standard autonomous invocation for hooks (normal). However, its purpose is to auto-run on hooks (before_agent_start / after_turn) and persist conversation content. That persistent, automatic capture — especially when shared-KB mode is enabled — increases the blast radius of any mistakes or abuse. The skill does not modify other skills' configs but will create and write DB files in user/agent directories.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install kb-mini
  3. After installation, invoke the skill by name or use /kb-mini
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.3.0
**Refactored configuration and default storage for easier setup and sharing.** - Simplified default setup: KB now works out-of-the-box with its own internal data directory, no extra config needed. - Added support for shared knowledge bases via KNOWLEDGE_SHARED_NAME environment variable. - Explicit knowledge base path can be set with KNOWLEDGE_DB (takes highest priority). - Updated documentation to reflect new storage modes, priorities, and directory structure. - Removed deprecated keywords and streamlined trigger phrase list in SKILL.md.
v1.2.0
- Removed the legacy migration script: scripts/migrate_old_kb.sh. - Cleaned up deprecated migration process for older knowledge base formats.
v1.1.0
Version 1.1.0 introduces migration support. - Added _meta.json file. - Added scripts/migrate_old_kb.sh script for migrating old knowledge base data.
v1.0.0
Knowledge Base Skill v1.0.0 initial release - Provides commands to store and retrieve information in a knowledge base via bash scripts. - Supports keyword-based triggers for both storing and searching knowledge. - Integrates automatic recall before conversations and auto-capture after each turn with OpenClaw hooks. - Includes scripts for storage, retrieval, OpenClaw hooks integration, and lifecycle management. - Configurable for private or shared knowledge bases. - Requires bash, sqlite3, and python3 dependencies.
Metadata
Slug kb-mini
Version 1.3.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 4
Frequently Asked Questions

What is Kb Mini?

Store, search, and automatically manage a personal or shared knowledge base integrated with OpenClaw through before/after hooks. It is an AI Agent Skill for Claude Code / OpenClaw, with 148 downloads so far.

How do I install Kb Mini?

Run "/install kb-mini" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Kb Mini free?

Yes, Kb Mini is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Kb Mini support?

Kb Mini is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Kb Mini?

It is built and maintained by Thomas Lau (@thomasliu); the current version is v1.3.0.

💬 Comments