Personal Lightweight Knowledge Base Skill: Retrieval-Index-Driven Agent Knowledge Base Operations

Preface

When personal notes, PDF textbooks, and scattered Markdown files pile up on the disk, common practices are full-library vectorization or having the model answer based on conversational memory—the former has high operational costs, while the latter easily drifts from the original text. If you want the Agent to answer based only on imported materials and explicitly refuse when information is not found, you need a set of reproducible directory conventions, index maintenance, and query protocols.

Below introduces the “Personal Lightweight Knowledge Base skill” on SkillHub (coordinates @user_692685e1/llmwikiyuyu). It combines Karpathy LLM Wiki repository concepts with the retrieval-style INDEX.md solution, covering the full process of knowledge base initialization, import, query, and maintenance through 25 engineering scripts under scripts/; the design principle is to index original text without compiling it, and to strictly refuse when a match is not found rather than fabricating information.

What is this

One-sentence positioning: A retrieval-based knowledge base operation skill for Coding Agents (internal name knowledge-base-operator), managing original text, indexes, Wiki-derived pages, and notes within the local knowledge-base/ skeleton.

Source & Version: Community source (community), publisher user_692685e1; SkillHub current version 1.0.6, category knowledge-management, tags requires_api_key=false (installing the Skill itself does not require an API Key; OCR and other local scripts have additional Python dependencies).

Official Links:

  • SkillHub Page: https://www.skillhub.cn/skills/user_692685e1/llmwikiyuyu
  • API Coordinate: https://api.skillhub.cn/user_692685e1/llmwikiyuyu

Core Features

Capabilities all come from the SKILL.md and scripts/ directory within the skill package, which can be understood by the following categories.

Directory and Data Model

The skill specifies standard directories: textbooks/ (OKF format original text, Agent is read-only), INDEX.md (retrieval mapping from knowledge points to files), wiki/ (entities / concepts / topics / analysis), notes/ (including qa/ archive), raw/, figures/, as well as scripts/ distributed with the skill.

The original text uses Open Knowledge Format (OKF) v0.1 compatible frontmatter; the index line format is “Standard Term | Synonym → File Path”, maintained by scripts rather than manual table editing.

Query Protocol

When a user asks a question, the Agent should extract 3–5 keywords, execute the query script in the knowledge base root directory, and then answer by reading 2–4 file snippets based on the output:

cd knowledge-base
./scripts/q.sh keyword1 keyword2 keyword3

q.sh searches Wiki, INDEX.md, and notes in priority order, falling back to full-text search in textbooks/. When a match is found, the source must be cited; if neither the index, textbooks, Wiki, nor notes contain relevant content, the skill requires refusal to answer, and the model’s memory must not be used to complete the answer.

Initialization and Import

  • Initialization: Copy the skill package’s scripts/, create the directory tree, generate empty INDEX.md, CHANGELOG.md, .wiki-state.json, etc. (executed by the Agent according to SKILL.md steps when the user says “Initialize / Create Knowledge Base”).
  • PDF Pipeline: Detect PDF type → Extract figures → Convert to image/OCR or extract text layer → Write to textbooks/ → index-add.sh appends points → wiki-update syncs Wiki.
  • Markdown / Word: import-md.sh, import-docx.sh (docx depends on pandoc or python-docx).

Example (Markdown direct import):

./scripts/import-md.sh physiology 04 "respiration" "raw/respiratory-system.md"

OCR-related Python dependencies (install as needed):

pip install rapidocr-onnxruntime pillow numpy PyMuPDF

Maintenance and Health Checks

  • New knowledge points must use index-add.sh; modifying INDEX.md directly is prohibited.
  • Sync changes and clean invalid indexes: sync.sh, wiki-clean.sh, etc.
  • Health check: ./scripts/index-check.sh (coverage, orphaned paths, unindexed files, note linkages, etc.).

Wiki and notes also have scripts like wiki-build.sh, wiki-update.sh, note-link.sh, etc. For the full list, see Section 7 “Quick Reference” in SKILL.md inside the skill.

Installation and Enablement

Before installing, confirm that SkillHub CLI is already installed on the machine (see SkillHub Installation Guide). Must use --dir to point to the current Agent’s skills directory, otherwise the default installation to ./skills/ may fail to load.

command -v skillhub && skillhub --version
skillhub install llmwikiyuyu --namespace user_692685e1 --dir <your skills directory>

Common Agent skills directories (excerpted from official installation docs):

Environment Directory
Cursor ~/.cursor/skills/
Claude Code ~/.claude/skills/
Codex ~/.codex/skills/ or .agents/skills/ under the project

After installation, enable the Skill in the corresponding Agent. Skill trigger words include “Knowledge Base”, “Initialize”, “Import Textbook”, “Query Knowledge”, “Health Check”, etc. (see trigger configuration in skill.yaml).

When deploying the knowledge base for the first time, you also need to copy the scripts/ from the skill package to your knowledge-base/scripts/ and chmod +x (step 1 of SKILL.md initialization). This is separate from the Skill installation directory: the Skill guides Agent behavior, while the engineering scripts are version-controlled with the knowledge base project.

Typical Usage

Below is the minimal path, excerpted from the official SKILL.md, that can be reproduced locally.

  1. After installing the Skill, say “Initialize Knowledge Base” to the workspace, and the Agent will create the knowledge-base/ skeleton and copy the scripts.

  2. Import existing Markdown:

cd knowledge-base
./scripts/import-md.sh subject 01 "chapter name" "/path/to/chapter.md"
  1. Ask the Agent a question; the Agent should call q.sh in the background to retrieve information before answering. You can verify the refusal strategy yourself: asking about a topic that hasn’t been imported should yield a response like “Relevant content not found” rather than speculation.

  2. Periodic maintenance:

./scripts/index-check.sh
./scripts/sync.sh --status textbooks/subject/some-file.md

Use Cases and Notes

Who is it for: Developers who need to build a personal or small-team knowledge base with auditability and citable sources for textbooks, lecture notes, and internal documents, and are willing to use natural language to drive import and query within Agent conversations; especially for scenarios that care about “refusing to answer if no match is found”.

Limitations and Pitfalls:

  • Retrieval depends on INDEX.md and script quality; if index-add.sh is not executed after import, queries are prone to missing hits.
  • Scanned PDFs go through the OCR pipeline and require installing RapidOCR, PyMuPDF, etc.; on Linux, Word import prefers apt install pandoc or pip install python-docx.
  • textbooks/ is considered the source of truth for original text: the Agent should not be allowed to tamper with it or “compile” textbooks into a substitute Wiki; Wiki is incrementally maintained by scripts like wiki-update.
  • Skill ratings and download counts are based on the SkillHub page (score is 100000, downloads approx. 599); when inconsistent with old cached data, refer to the official website.

Conclusion

The “Personal Lightweight Knowledge Base skill” binds retrieval-based indexing, the OKF original text layer, and 25 operational scripts into an executable knowledge base paradigm for Agents: index original text, scripts hard-constrain the query path, and refuse if not found. To install or view updates, please visit SkillHub: https://www.skillhub.cn/skills/user_692685e1/llmwikiyuyu .

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye