llm-wiki-builder
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "llm-wiki-builder" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-c8901826f293d130a4a13555a292c50b93d03971dd84e780bfa6a0a342ff6e00. Verify the upstream source and version against https://skillhub.cn/skills/user_7ffd653a/llm-wiki-builder before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Tool for building a Karpathy-style LLM Wiki knowledge base from scratch. Uses init.py to initialize directory structure, system files, page templates, CLAUDE.md behavior contract, lint.py health-check script, and to initialize a qmd vector index. Intended for creating new wiki/knowledge-base projects or related operations.
Introduction source: third_party · user_7ffd653a · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Software, accounts and paid services
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: llm-wiki-builder
description: >
从零构建 Karpathy 风格的 LLM Wiki 知识库。通过 init.py 一键初始化目录结构、系统文件、
页面模板、CLAUDE.md 行为契约、lint.py 健康检查脚本,并初始化 qmd 向量索引。当用户想要
搭建新的 wiki/知识库项目、提到"LLM Wiki"、"Karpathy wiki"、"知识库构建"、"初始化wiki"、
"查看我的知识库"、"切换知识库"、"列出所有知识库"时,使用此 skill。LLM Wiki 构建器 — 构建 Skill
构建 Karpathy 风格的 LLM Wiki 知识库。Wiki 是一个持久的、复合增长的制品:交叉引用已经存在,矛盾已经被标记,综合分析已经反映了你读过的一切。每次摄入和查询都让它变得更好。
系统架构
三层架构,严格所有权:
| 层级 | 目录 | 拥有者 | 权限 |
|---|---|---|---|
| 原始来源 | raw/ |
人类 | LLM 只读,绝不修改 |
| Wiki | wiki/ |
LLM | 完全读写 |
| 行为契约 | CLAUDE.md |
共同维护 | LLM 的行为规范 |
铁律:
- LLM 绝不自动执行不可逆操作(merge、删除、置信度升为 high)——必须等人类确认
- 人类绝不手动编辑
wiki/目录下的内容页——所有编辑通过 LLM 完成 - 人类只负责
raw/目录的文件管理 - 模板文件有
graph-excluded: true——根据模板创建的新页面必须删除此字段
构建步骤
第一步:理解核心理念
阅读 references/Karpathy-mapping.md,了解本系统与 Andrej Karpathy 的 LLM Wiki 方法论的对应关系。这有助于你向用户解释系统原理。
第二步:运行 init.py 初始化
前置步骤(强制):Agent 必须先询问用户知识库名称。 不能静默使用默认目录名。询问格式:
"请给这个知识库命名(当前目录名:
<目录名>),或直接回车使用默认名称?"
用户明确命名或确认后,再运行 python scripts/init.py <项目目录> --name "<用户指定的名称>"。
执行 python scripts/init.py [项目目录] --name "<名称>",脚本自动完成:
- 创建目录结构:raw/(6 个子目录 + originals/ 下 4 个子目录)、wiki/(5 个子目录)、outputs/、scripts/、.qmd/,每个目录放 .gitkeep
- 生成系统文件:复制 index.md、log.md、overview.md、QUESTIONS.md 到 wiki/,替换日期占位符
- 生成页面模板:复制 5 个页面模板到 wiki/templates/
- 生成 schema.md:复制到 wiki/schema.md
- 生成行为契约:复制 references/CLAUDE.md → CLAUDE.md + AGENTS.md(内容一致)
- 复制 lint.py:从
references/scripts/lint.py复制到scripts/lint.py(14 项检查 + --fix 安全修复模式),项目级可独立修改 - 复制 registry.py:从
references/scripts/registry.py复制到scripts/registry.py(知识库注册表管理工具),项目级可独立修改 - 复制 list-wikis.py:从
references/scripts/list-wikis.py复制到scripts/list-wikis.py(全局知识库列表工具),同时复制到~/.llm-wiki/scripts/(全局可用) - 生成 .gitignore:包含
.qmd/、.venv/、outputs/等忽略规则 - 注册知识库:用用户指定的名称将项目路径注册到全局注册表
~/.llm-wiki/registry.json。支持多知识库管理和切换。
格式转换流程:用户将原始文件(PDF/DOCX/PPTX 等)放入 raw/originals/ 对应子目录,ingest 时 LLM 按以下规则处理:
- 优先使用 markitdown(
pip install markitdown,支持多格式);转换失败或效果不好时再降级使用其他工具(如 marker、python-docx)或 LLM 视觉/OCR - 转换输出:markdown 保存到对应的
raw/子目录(如raw/originals/articles/paper.pdf→raw/articles/paper.md) - 转换目标:文本完整无乱码、图片正确提取到
raw/images/并用相对路径引用、图片顺序与原文档一致、无 base64 内嵌图片 - 转换后验证:检查 base64 残留、图片路径正确性、图片顺序,不通过则修复后重新验证
- 转换脚本保存到
scripts/目录,不内联执行一次性代码
第三步:qmd 检测与安装(可选,由 Agent 执行交互式步骤)
qmd 是语义搜索增强工具(BM25 + 向量嵌入 + LLM 重排序),不安装不影响核心功能(ingest、query、lint 仍可运行),只是搜索能力降级。
Agent 执行流程:
-
检测 qmd 是否已安装:执行
qmd --version-
若返回版本号(如
qmd 2.5.3)→ 已安装,跳到 Step 2 -
若报
command not found→ 未安装,向用户展示以下信息并询问:qmd 未安装。不安装不影响核心功能(ingest、query、lint 仍可运行),只是搜索能力降级。
安装需要:Node.js >= 22、npm 首次运行会下载 3 个本地模型(共约 2GB):
- embeddinggemma-300M ~300MB(向量嵌入)
- Qwen3-Reranker-0.6B ~640MB(结果重排)
- qmd-query-expansion-1.7B ~1.1GB(查询扩展)
是否安装 qmd?
-
-
用户确认后安装:若用户同意,执行
npm install -g @tobilu/qmd(国内网络建议先设置npm config set registry https://registry.npmmirror.com) -
项目索引初始化(qmd 已安装时):执行
qmd init && qmd collection add wiki wiki/ -
生成向量嵌入:执行
qmd embed(首次运行下载约 2GB 模型) -
验证:执行
qmd query "测试" -n 3确认正常工作
所有 qmd 命令前必须加 set CUDA_VISIBLE_DEVICES=(Windows)或 CUDA_VISIBLE_DEVICES=""(macOS/Linux)以强制 CPU 模式。
降级方案:若 qmd 不可用或用户选择不安装,知识库核心功能仍可运行。详见 references/setup-guide.md §降级策略。
第四步:安装 Python 依赖
- 创建虚拟环境:
python -m venv .venv - 激活虚拟环境:Windows
.\.venv\Scripts\activate,macOS/Linuxsource .venv/bin/activate - 安装依赖:
pip install pyyaml - 仅在无法创建虚拟环境时才使用系统 Python
scripts/lint.py 需要这些依赖。
第五步:执行系统审计
运行 python scripts/lint.py 检查系统健康状态,使用 references/audit-checklist.md 中的清单验证:
- 目录结构完整性
- CLAUDE.md 规则覆盖(27 项)
- 模板文件必需字段(5 个模板)
- 系统文件隔离状态(graph-excluded: true)
- lint.py 完整性(14 项检查)
- qmd 状态 + 测试查询
审计报告输出到 outputs/system-audit-YYYY-MM-DD.md。
使用命令(构建完成后)
注册表感知(每次操作前)
Agent 每次收到用户请求时,先读取全局注册表 ~/.llm-wiki/registry.json:
-
无注册知识库:提示用户先创建知识库(运行 init.py)
-
仅 1 个注册知识库:直接进入该知识库目录操作
-
≥ 2 个注册知识库:展示列表并询问用户要操作哪个:
已注册知识库: 1. [法律研究] → F:\Project\Law-Wiki(最后访问: 2024-06-20) 2. [AI论文] → F:\Project\AI-Papers(最后访问: 2024-06-21) 3. [个人笔记] → F:\Project\Notes(最后访问: 2024-06-15) 要操作哪个知识库?(输入编号或名称) -
用户未指定路径时:默认使用最近访问的知识库
用户命令
| 命令 | 触发词 | 功能 |
|---|---|---|
| 摄入 | ingest、摄入、处理这个 |
LLM 读取 raw 文件,提取概念,创建/更新页面 |
| 批量摄入 | batch ingest、批量摄入 |
多 subagent 并行处理,每个 subagent 执行完整 16 步流程 |
| 查询 | 直接提问、根据我的知识库 |
搜索 + 综合 + 溯源 |
| Lint | lint、检查、健康检查 |
运行 14 项健康检查报告 |
| Reflect | reflect、综合分析、发现规律 |
4 阶段深度分析 |
| Merge | merge、去重 |
页面去重(需确认) |
| 添加问题 | 我想搞清楚、add question |
添加到 QUESTIONS.md 追踪 |
| Audit | audit、系统核查 |
全系统验证 |
| 切换知识库 | 切换知识库、use wiki、换知识库 |
从注册表中选择另一个知识库 |
| 查看知识库 | 查看知识库、list wiki、我的知识库 |
列出所有注册的知识库 |
注册表管理命令(项目级 scripts/registry.py)
python scripts/registry.py list # 列出所有注册的知识库
python scripts/registry.py add <路径> [名称] # 注册新知识库
python scripts/registry.py use <名称> # 获取知识库路径
python scripts/registry.py remove <名称> # 取消注册(不删除文件)
python scripts/registry.py rename <旧名> <新名> # 重命名
python scripts/registry.py get-last # 获取最近访问的知识库
注册表位置:~/.llm-wiki/registry.json(跨所有知识库的全局注册表)
全局知识库列表(加载此 skill 后使用)
当用户说"查看我的知识库"、"列出所有知识库"、"切换知识库"时,先运行 list-wikis.py 获取注册表:
python scripts/list-wikis.py # 文本格式,供人类阅读
python scripts/list-wikis.py --json # JSON 格式,供 Agent 解析
python scripts/list-wikis.py --path <名称> # 获取指定知识库的路径
Agent 流程:
-
运行
python scripts/list-wikis.py --json获取所有知识库 -
解析 JSON,向用户展示列表:
已注册知识库: 1. [法律研究] → F:\Project\Law-Wiki(最后访问: 2024-06-20) 2. [AI论文] → F:\Project\AI-Papers(最后访问: 2024-06-21) 要操作哪个知识库?(输入编号或名称) -
用户选择后,进入对应知识库目录执行操作
注意:list-wikis.py 直接读取 ~/.llm-wiki/registry.json,不需要依赖任何知识库项目。
Wikilink 速查
完整规范详见 references/wikilink-rules.md。
核心规则:
- 默认中文 slug——
[[人民民主专政]]、[[行政许可法]] - 国际通用术语——英文 slug——
[[attention-mechanism]]、[[transformer]] - 专有名词/品牌名——英文 slug——
[[python]]、[[vue]]、[[docker]] - 禁止:驼峰、下划线、空格
- 禁止:wikilink 引用系统文件、lint 报告、操作名称
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供完整的 Karpathy 风格 LLM Wiki 知识库构建方案
- 包含初始化、索引、查询、维护等全生命周期管理
- 支持多知识库注册与切换,满足复杂使用场景
Highlights
- 触发词覆盖全面,包含"LLM Wiki"、"知识库构建"、"初始化wiki"等核心场景
- 支持"查看我的知识库"、"切换知识库"等管理类操作
- 边界清晰,不易与其他 Skill 重叠
Highlights
- 五步构建流程清晰完整,每步都有明确目标和产出
- 包含详细的系统架构说明和铁律规范
- 提供完整的命令速查和使用示例
Highlights
- init.py 脚本功能完整,覆盖目录创建、文件生成、注册等关键步骤
- qmd 安装流程包含降级方案和验证机制
- lint.py 提供 14 项健康检查,确保系统可靠性
- 注册表管理支持增删改查,具备完善的错误处理
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 58, 84, 100
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- registry.npmmirror.com
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Translation pending; see source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.