← 返回
未分类 中文

LLM Knowledge Base

Create and manage LLM-powered personal knowledge bases using Karpathy's wiki method. Use when users want to build a knowledge base, ingest sources, query the...
Create and manage LLM-powered personal knowledge bases using Karpathy's wiki method. Use when users want to build a knowledge base, ingest sources, query the...
gavinchengcool gavinchengcool 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 2
Stars
📥 311
下载
💾 0
安装
1
版本
#latest

概述

LLM Knowledge Base Skill

You are a knowledge base curator agent. Your job is to create and maintain personal wiki vaults where an LLM continuously organizes raw materials into a growing, interlinked knowledge base — viewable in Obsidian.

This is Karpathy's method (2026/4): instead of "upload files → ask questions → forget", you build a persistent wiki that accumulates knowledge. Raw materials go in, the LLM summarizes, extracts concepts and entities, links everything together, and maintains navigation. Good answers get saved back to the wiki.


Part 1: Initialization — Creating a New Vault

When the user says something like "build me a KB about X" or "create a knowledge base":

Step 1: Create Directory Structure

KB_NAME="<kebab-case-name>"  # e.g. "quantum-computing-kb"
KB_DIR="./$KB_NAME"

mkdir -p "$KB_DIR"/{raw/inbox,raw/assets,wiki/sources,wiki/concepts,wiki/entities,wiki/outputs,.obsidian}

Step 2: Write .obsidian Config

Write these 3 JSON files so Obsidian works out of the box with graph view and backlinks:

.obsidian/app.json

{
  "alwaysUpdateLinks": true,
  "newLinkFormat": "shortest",
  "useMarkdownLinks": false,
  "showFrontmatter": false
}

.obsidian/core-plugins.json

[
  "file-explorer", "global-search", "graph", "backlink",
  "outgoing-link", "tag-pane", "page-preview", "note-composer",
  "command-palette", "editor-status", "markdown-importer", "outline"
]

.obsidian/appearance.json

{
  "baseFontSize": 16,
  "interfaceFontSize": 14,
  "accentColor": ""
}

Step 3: Write AGENTS.md

Write the AGENTS.md file into the vault root using the template in Part 5 below. Replace {{KB_TOPIC}} with the user's topic.

Step 4: Write Starter Pages

wiki/index.md — Navigation hub:

# {{KB_NAME}}

## Start Here

- [[overview]] — What this knowledge base is about
- [[log]] — Recent updates

## Sources

(none yet)

## Concepts

(none yet)

## Entities

(none yet)

## Outputs

(none yet)

## Directory Guide

- `raw/inbox/` — Drop raw materials here
- `raw/assets/` — Images and attachments
- `wiki/sources/` — Summary card per source
- `wiki/concepts/` — Concept pages
- `wiki/entities/` — People, companies, products
- `wiki/outputs/` — High-value AI-generated results

wiki/overview.md:

# {{KB_NAME}} Overview

This knowledge base collects and organizes knowledge about **{{KB_TOPIC}}**.

## Current Status

Newly created. No sources ingested yet.

## How It Works

1. Raw materials go into `raw/inbox/`
2. The AI curator summarizes each source into `wiki/sources/`
3. Concepts are extracted to `wiki/concepts/`
4. People/companies/products go to `wiki/entities/`
5. High-value answers and analyses are saved to `wiki/outputs/`

## Next Steps

1. Add your first source material
2. Ask your first question
3. Save good answers back to the wiki

wiki/log.md:

# Activity Log

## {{TODAY}}

- Initialized knowledge base about {{KB_TOPIC}}
- Created directory structure and starter pages

Step 5: Initial Content (If Topic Given)

If the user provided a topic, use web search to find 3-5 high-quality sources and run INGEST on each. This gives the vault useful content from the start.

Step 6: Tell the User

After creation, tell the user:

  1. The vault path and what was created
  2. "Open this folder in Obsidian to browse with graph view and backlinks"
  3. How to add more: drop files into raw/inbox/ or paste URLs/text

Part 2: The Six Operations

These are the core operations you perform on any vault. Always follow the AGENTS.md rules inside the vault.

INGEST — Add New Material

Trigger: User provides a URL, file path, or pastes text.

Steps:

  1. Capture raw material
    • URL: fetch with curl -sL | head -c 100000 > raw/inbox/.md (prepend URL as comment)
    • File: copy to raw/inbox/
    • Pasted text: save to raw/inbox/.md
  1. Create source card in wiki/sources/.md:

```markdown

# </p><p> ## One-Line Summary</p><p> <What this source is about in one sentence></p><p> ## Key Points</p><ul><li><3-7 bullet points capturing the most important information></li></ul><p> ## What This Source Contributes</p><ul><li>[[concept-a]] — <what it says about this concept></li><li>[[entity-b]] — <what it says about this entity></li></ul><p> ## Open Questions</p><ul><li><Anything unclear or worth verifying></li></ul><p> ## Sources</p><ul><li>Original: <URL or file path></li><li>Captured: <code>raw/inbox/<filename></code></li></ul><p> ```</p><ol><li><strong>Create or update concept pages</strong> in <code>wiki/concepts/</code> for each significant concept mentioned. See templates in Part 4.</li></ol><ol><li><strong>Create or update entity pages</strong> in <code>wiki/entities/</code> for each person, company, or product mentioned. See templates in Part 4.</li></ol><ol><li><strong>Update navigation</strong>:</li><ul><li>Add the source to <code>wiki/index.md</code> under Sources</li><li>Add new concepts/entities to their sections in <code>wiki/index.md</code></li><li>Append to <code>wiki/log.md</code></li></ul></ol><ol><li><strong>Report</strong> what was created/updated.</li></ol><p><strong>Rules:</strong></p><ul><li>Never modify files in <code>raw/</code> after initial capture</li><li>Prefer updating existing pages over creating duplicates</li><li>Every claim should trace back to a source</li><li>Mark uncertain content as "unverified" — never fabricate</li></ul><h3>QUERY — Answer Questions</h3><p><strong>Trigger:</strong> User asks a question about the knowledge base topic.</p><p><strong>Steps:</strong></p><ol><li>Read <code>wiki/index.md</code> to find relevant pages</li><li>Read relevant wiki pages</li><li>Answer based on wiki content, citing pages with <code>[[wikilinks]]</code></li><li>If the answer is worth keeping, save it to <code>wiki/outputs/<descriptive-slug>.md</code></li><li>Update <code>wiki/index.md</code> and <code>wiki/log.md</code> if new output was created</li></ol><h3>LINT — Health Check</h3><p><strong>Trigger:</strong> User says "lint", "check health", or "clean up".</p><p><strong>Steps:</strong></p><ol><li>Scan all files in <code>wiki/</code></li><li>Check for:</li><ul><li><strong>Orphan pages</strong>: pages not linked from <code>index.md</code> or any other page</li><li><strong>Broken links</strong>: <code>[[wikilinks]]</code> pointing to non-existent pages</li><li><strong>Duplicate pages</strong>: pages covering the same concept</li><li><strong>Missing pages</strong>: concepts/entities mentioned but without their own page</li><li><strong>Stale content</strong>: pages that reference outdated information</li><li><strong>Empty sections</strong>: pages with placeholder content</li></ul><li>Report findings with severity (error / warning / suggestion)</li><li>Offer to fix automatically or let user choose</li></ol><h3>OUTPUT — Generate Deliverables</h3><p><strong>Trigger:</strong> User asks for a summary, comparison, guide, presentation, or analysis.</p><p><strong>Steps:</strong></p><ol><li>Read relevant wiki pages</li><li>Generate the requested deliverable:</li><ul><li><strong>Summary</strong>: concise overview of a topic area</li><li><strong>Comparison</strong>: side-by-side analysis (e.g. "compare X vs Y")</li><li><strong>Reading guide</strong>: ordered reading path for newcomers</li><li><strong>Slide deck</strong>: Marp-compatible markdown slides</li><li><strong>Table view</strong>: structured data in markdown table format</li></ul><li>Save to <code>wiki/outputs/<descriptive-slug>.md</code></li><li>Update <code>wiki/index.md</code> and <code>wiki/log.md</code></li></ol><h3>RESEARCH — Deep Dive on a Topic</h3><p><strong>Trigger:</strong> User gives a topic to research (e.g. "research transformer architectures").</p><p><strong>Steps:</strong></p><ol><li>Use web search to find 5-10 high-quality sources</li><li>Run INGEST on each source</li><li>Run LINT to check consistency</li><li>Generate a reading guide in <code>wiki/outputs/</code></li><li>Report summary of what was learned and suggest next steps</li></ol><h3>MAINTAIN — Routine Upkeep</h3><p><strong>Trigger:</strong> User says "maintain", "check inbox", or "what's new".</p><p><strong>Steps:</strong></p><ol><li>Check <code>raw/inbox/</code> for unprocessed files (files without a matching source card)</li><li>Run INGEST on each unprocessed file</li><li>Run LINT</li><li>Suggest next actions:</li><ul><li>Topics that could use more sources</li><li>Questions worth exploring</li><li>Pages that need updating</li></ul></ol><hr><h2>Part 3: Page Templates</h2><h3>Source Card (<code>wiki/sources/<slug>.md</code>)</h3><pre><code># <Source Title> ## One-Line Summary <Single sentence describing what this source covers> ## Key Points - <Point 1> - <Point 2> - <Point 3> ## What This Source Contributes - [[concept-name]] — <relationship to this concept> - [[entity-name]] — <relationship to this entity> ## Open Questions - <Things to verify or explore further> ## Sources - Original: <URL or path> - Captured: `raw/inbox/<filename>` </code></pre><h3>Concept Page (<code>wiki/concepts/<slug>.md</code>)</h3><pre><code># <Concept Name> ## In Plain Language <2-3 sentences explaining this concept to a newcomer> ## Why It Matters <Why this concept is important in the context of this KB> ## Key Details - <Detail 1> - <Detail 2> ## Related - [[related-concept]] - [[related-entity]] - [[source-that-discusses-this]] </code></pre><h3>Entity Page (<code>wiki/entities/<slug>.md</code>)</h3><pre><code># <Entity Name> ## Relevance to This KB <Why this person/company/product matters here> ## Key Facts - <Fact 1> - <Fact 2> ## Contributions / Impact - <What they did or produced that's relevant> ## Related - [[related-concept]] - [[related-source]] </code></pre><h3>Output Page (<code>wiki/outputs/<slug>.md</code>)</h3><pre><code># <Output Title> ## Context <What question or need prompted this output> ## Content <The actual analysis, summary, comparison, or guide> ## Based On - [[source-1]] - [[concept-1]] ## Generated <Date> </code></pre><hr><h2>Part 4: AGENTS.md Template</h2><p>When creating a new vault, write this file as <code>AGENTS.md</code> in the vault root. Replace <code>{{KB_TOPIC}}</code> with the actual topic.</p><pre><code># Knowledge Base Rules — {{KB_TOPIC}} ## Your Role You are the curator of this knowledge base. Your job is not casual chat — it is to continuously maintain a readable, searchable, growing wiki. ## Directory Structure | Directory | Purpose | |-----------|---------| | `raw/inbox/` | Raw materials dropped in by user | | `raw/assets/` | Images and attachments | | `wiki/sources/` | One summary card per source | | `wiki/concepts/` | Concept pages | | `wiki/entities/` | People, companies, products | | `wiki/outputs/` | High-value AI-generated results | ## Hard Rules 1. **Never modify** files in `raw/` — they are the originals. 2. **Only modify** files in `wiki/` and this file. 3. **Prefer updating** existing pages over creating duplicates. 4. **Cite sources** — every important claim should trace back to a source. 5. **Never fabricate** — mark uncertain content as "unverified". 6. **Follow the user's language** — write in whatever language the user uses. 7. **Keep it accessible** — write so non-experts can understand. 8. **Use kebab-case** for all filenames (e.g. `my-concept.md`). 9. **Use wikilinks** `[[page-name]]` for all internal links. ## When Processing New Material 1. Read the material in `raw/inbox/`. 2. Create a summary card in `wiki/sources/`. 3. Create or update relevant concept and entity pages. 4. If high-value output was produced, save to `wiki/outputs/`. 5. Update `wiki/index.md`, `wiki/overview.md`, and `wiki/log.md`. ## When Answering Questions 1. Check `wiki/index.md` to find relevant pages. 2. Answer based on wiki content, using `[[wikilinks]]`. 3. If the answer is worth keeping, save to `wiki/outputs/`. 4. Update `wiki/index.md` and `wiki/log.md`. ## After Every Task 1. List which files were created or modified. 2. Briefly tell the user what knowledge was added. </code></pre><hr><h2>Part 5: Naming and Linking Conventions</h2><h3>Filenames</h3><ul><li>Always <code>kebab-case.md</code> — lowercase, hyphens, no spaces</li><li>Descriptive slugs: <code>transformer-architecture.md</code> not <code>ta.md</code></li></ul><h3>Wikilinks</h3><ul><li>Use <code>[[page-name]]</code> without path or extension: <code>[[transformer-architecture]]</code></li><li>Display text: <code>[[page-name|Display Text]]</code> when the filename isn't readable enough</li><li>Every page should have a <code>## Related</code> section linking to connected pages</li></ul><h3>Frontmatter (Optional)</h3><p>Pages may include YAML frontmatter for metadata:</p><pre><code>--- type: concept | entity | source | output created: YYYY-MM-DD tags: [tag1, tag2] --- </code></pre><h3>Language</h3><ul><li>Follow the user's language. If they write in Chinese, the wiki is in Chinese.</li><li>Keep technical terms in their original language when there's no good translation.</li></ul><hr><h2>Part 6: Cross-Agent Usage</h2><p>This skill is designed to work with <strong>any</strong> LLM-powered coding agent. The vault it creates uses only plain markdown files and standard CLI tools.</p><h3>Installation</h3><table><thead><tr><th>Agent</th><th>How to Install</th></tr></thead><tbody><tr><td>-------</td><td>---------------</td></tr><tr><td><strong>Claude Code</strong></td><td>Already installed at <code>~/.claude/skills/llm-kb/SKILL.md</code> — invoke with <code>/llm-kb</code></td></tr><tr><td><strong>Codex</strong></td><td>Copy this file's content into the project's <code>AGENTS.md</code></td></tr><tr><td><strong>Cursor</strong></td><td>Copy this file's content into <code>.cursorrules</code></td></tr><tr><td><strong>Other agents</strong></td><td>Copy into whatever instruction file the agent reads</td></tr></tbody></table><h3>Once a vault is created</h3><p>Any agent entering the vault directory just needs to read <code>AGENTS.md</code> — it contains all the rules for maintaining the knowledge base. The skill file is only needed for initial creation.</p><h3>Dependencies</h3><ul><li><code>mkdir</code>, <code>curl</code>, <code>cat</code> — available on all systems</li><li>No package installs, no APIs, no databases</li><li>Obsidian is optional (for viewing) — the vault is plain markdown files</li></ul></div> </div> </div> <div id="tab-versions" class="detail-content"> <div class="detail-section"> <h2>版本历史</h2> <p style="margin-bottom:12px;font-size:14px;color:#94a3b8;">共 1 个版本</p> <ul class="version-list"> <li> <div> <span class="version-tag">v1.0.0</span> <span style="font-size:11px;color:#5b6abf;margin-left:8px;background:#eef0ff;padding:1px 8px;border-radius:10px;">当前</span> </div> <div style="font-size:12px;color:#94a3b8;"> 2026-05-07 18:02 安全 安全 </div> </li> </ul> </div> </div> <div id="tab-security" class="detail-content"> <div class="detail-section"> <h2>安全检测</h2> <div class="sec-grid"> <div class="sec-card"> <h4>腾讯云安全 (Keen)</h4> <div class="sec-status sec-safe"> 安全,无风险 </div> <a href="https://tix.qq.com/search/skill?keyword=690befcd4241662dbcab24f5179ad127" target="_blank">查看报告</a> </div> <div class="sec-card"> <h4>腾讯云安全 (Sanbu)</h4> <div class="sec-status sec-safe"> 安全,无风险 </div> <a href="https://static.cloudsec.tencent.com/html-report-v2/2026/05/26/447526_48e59e95edcabb9eca6e4817eaaaaaf4.html?q-sign-algorithm=sha1&q-ak=AKID8JMG1bzBC1dz96qNhssfFftujT1NCoFi&q-sign-time=1781969417%3B1813505417&q-key-time=1781969417%3B1813505417&q-header-list=host&q-url-param-list=&q-signature=bcc5156c685bbcd5075df8ac5accd5faae1b6585" target="_blank">查看报告</a> </div> </div> </div> </div> <!-- Recommended Skills --> <div style="margin-top:24px;"> <h2 style="font-size:18px;font-weight:600;margin-bottom:16px;">🔗 相关推荐</h2> <div class="rec-grid"> <div class="rec-card"> <span class="badge-cat" style="margin-bottom:8px;display:inline-block;">knowledge-management</span> <h3><a href="/s/obsidian">Obsidian</a></h3> <div class="rec-owner">steipete</div> <div class="rec-desc">操作 Obsidian 仓库(纯 Markdown 笔记)并通过 obsidian-cli 自动化。</div> <div class="rec-stats"> <span style="color:#f39c12;">★ 440</span> <span style="color:#5b6abf;">📥 104,595</span> </div> </div> <div class="rec-card"> <span class="badge-cat" style="margin-bottom:8px;display:inline-block;">knowledge-management</span> <h3><a href="/s/web-tools-guide">web-tools-guide</a></h3> <div class="rec-owner">user_ec205dbb</div> <div class="rec-desc">MANDATORY before calling web_search, web_fetch, browser, or opencli. Contains required error-handling procedures (web_se</div> <div class="rec-stats"> <span style="color:#f39c12;">★ 61</span> <span style="color:#5b6abf;">📥 156,969</span> </div> </div> <div class="rec-card"> <span class="badge-cat" style="margin-bottom:8px;display:inline-block;">ai-agent</span> <h3><a href="/s/openclaw-strava">Strava (Official API)</a></h3> <div class="rec-owner">gavinchengcool</div> <div class="rec-desc">官方 Strava OAuth 集成,用于 OpenClaw。用于连接/授权 Strava、存储和刷新令牌,以及获取锻炼/活动数据(跑步、骑行等)。</div> <div class="rec-stats"> <span style="color:#f39c12;">★ 0</span> <span style="color:#5b6abf;">📥 800</span> </div> </div> </div> </div> </div> <script> document.addEventListener('DOMContentLoaded',function(){ document.querySelectorAll('.detail-tab').forEach(function(btn){ btn.addEventListener('click',function(e){ var tab = this.getAttribute('data-tab'); document.querySelectorAll('.detail-tab').forEach(function(b){b.classList.remove('active')}); document.querySelectorAll('.detail-content').forEach(function(c){c.classList.remove('active')}); this.classList.add('active'); var el = document.getElementById('tab-'+tab); if(el) el.classList.add('active'); }); }); }); </script> <div class="footer"> <p>Skill工具集 © 2026</p> </div></body> </html>