LLM Knowledge Bases
by @harrylabsj
Inspired by a public workflow shared by Andrej Karpathy (@karpathy). From raw research to a living Markdown knowledge base that compounds with every question...
clawhub install llm-knowledge-bases📖 About This Skill
name: llm-knowledge-bases description: Inspired by a public workflow shared by Andrej Karpathy (@karpathy). Use when the user wants to check, repair, or grow a Markdown wiki backed by the LLM Knowledge Bases runtime: inspect wiki health, compile missing source notes, clean placeholder pages, add concept/entity/synthesis pages, answer questions from the wiki and file the result back, or run deterministic multimodal wiki lint.
LLM Knowledge Bases
Use this skill to operate a Vault that is managed by the LLM Knowledge Bases runtime.
The operating model is:
raw/ stores captured source material from the outside worldwiki/sources/ stores compiled source noteswiki/outputs/ stores archived answer noteswiki/concepts/ stores durable concept pageswiki/entities/ stores durable entity pageswiki/syntheses/ stores cross-source synthesis pageswiki/_indexes/ stores generated collection indexeswiki/index.md stores the generated home indexwiki/log.md stores the generated run log page.llm-kb/ stores runtime state.llm-kb/representations/ stores runtime-managed OCR, vision, metadata, and profiling artifacts for non-text raw assetsThe runtime owns Vault I/O. The agent owns understanding, synthesis, linking, and deciding which pages the wiki should gain or improve.
Important Model
kb_* tools for all Vault reads and writes.raw/.wiki/ or .llm-kb/representations/ with generic file tools.source_refs.asset_paths accurate and include visible review notes, usually # Visual Notes, whenever the source depends on a human or model review pass outside the stored representation files.Required Tools
kb_statuskb_list_rawkb_read_rawkb_get_raw_assetkb_prepare_sourcekb_prepare_source_bundlekb_prepare_representationkb_upsert_representationkb_read_representationskb_upsert_source_notekb_prepare_outputkb_upsert_outputkb_prepare_derived_notekb_upsert_derived_notekb_searchkb_read_noteskb_map_gapskb_promote_gapkb_repair_source_idskb_rebuild_indexeskb_lintIf these tools are unavailable, say so clearly instead of pretending the workflow can proceed.
Natural-Language Entry Points
Users do not need to name canonical actions.
Map short natural-language requests to the closest workflow.
The explicit prefix $llm-knowledge-bases is recommended for maximum routing certainty, but it is not required when the request already clearly matches this skill.
check my wiki, look over my knowledge base, 检查我的 wiki, 总览检查:kb_status plus kb_lint, report counts, the top issues, and the best next step
fill missing source notes, continue the backlog, 补缺失 source notes, 继续推进这份库:ingest-source, call kb_status, then kb_list_raw(changed_only=true) with an explicit limit large enough for the batch, prioritize missing_source_note, honor directory/topic filters, compile in small batches, then kb_rebuild_indexes
clean up these pages, fix placeholder titles, 只修 AI 相关内容, 做一次维护清理:maintain-wiki, start with kb_lint, then use kb_search plus kb_read_notes to target placeholder titles, placeholder summaries, placeholder open questions, placeholder related links, stale navigation, and missing high-value derived pages
add concept pages, add entity pages, add synthesis pages, what pages are missing?, 补 concept/entity/synthesis:map-gaps, search first, read the evidence, then call kb_map_gaps; use kb_promote_gap when a candidate can land directly, otherwise refine it through kb_prepare_derived_note plus kb_upsert_derived_note
repair source ids, repair manifest drift, 修 source id / manifest 漂移:kb_repair_source_ids as a dry run first, explain the plan, apply only if the repair set looks correct, then kb_rebuild_indexes
answer this from the wiki and save it back, 问答并沉淀成页面:ask-and-file, read the evidence first, then choose output for query-specific archives or concept/entity/synthesis for reusable knowledgeImportant:
top 5, first 10, only AI-related, only raw/书评 1/, or do not modify yetChinese Intent Lexicon
Treat the following Chinese phrases as strong routing hints, even when the user does not mention tools or page types explicitly.
看一下, 检查一下, 盘一下, 总览, 扫一眼, 先看看:kb_status plus kb_lint
先别改, 先不要修改, 只看不改, 先给我报告:补缺失, 补 source, 补书评, 编译缺的, 继续补 source note:ingest-source focused on missing_source_note
整理一下, 清理一下, 修一下占位内容, 只修 AI 相关内容, 把这部分弄干净:maintain-wiki with topic filters and placeholder cleanup
补概念页, 补 entity, 补 synthesis, 沉淀成页面, 把这个主题写成 page:kb_map_gaps or direct derived-note creation
修漂移, 修 source id, 修 manifest, 先 dry run:kb_repair_source_ids with a dry run before any apply step
继续推进这份库, 继续往前做, 接着跑一轮, 往前推进一批:Continuation Defaults
When the user says 继续推进这份库 or an equivalent continuation request without enough scope detail, run a conservative default batch:
1. call kb_status
2. call kb_list_raw with changed_only=true and an explicit limit
3. call kb_lint
4. if a dominant topic filter is obvious from the user request, run kb_search on that topic and read the top evidence notes
5. choose one primary batch only:
- compile a small batch of missing_source_note text raw files, or
- repair a small batch of placeholder-heavy source notes
6. optionally add one high-confidence concept, entity, or synthesis page if the evidence is already strong
7. call kb_rebuild_indexes
8. report what changed, what still looks weak, and the next best batch
Do not silently expand an underspecified continuation request into a large multi-hour rewrite.
Scenario Presets
Use these presets when a short request clearly matches one of the common recurring workflows.
ai-topic-cleanup
Strong triggers:
整理一下 AI 相关内容只修 AI 相关补 AI 概念页把 AI 这部分做扎实继续推进 AI 主题Default topic cluster:
AIAIGCChatGPTprompt engineeringAGIAI hype vs real valueDefault batch:
1. call kb_lint
2. run topic-focused kb_search
3. read the top evidence notes with kb_read_notes
4. repair a small batch of placeholder-heavy source notes first
5. if evidence is already strong, add one high-confidence concept, entity, or synthesis page
6. call kb_rebuild_indexes
Priority order:
book-review-batch
Strong triggers:
补书评继续编译书评把书评编进 wiki书评批处理补书评 source notesDefault scope:
raw/书评 1/missing_source_noteDefault batch:
1. call kb_status
2. call kb_list_raw(changed_only=true) with an explicit limit
3. filter to raw/书评 1/
4. compile the first 10 eligible text raw files through kb_prepare_source, kb_read_raw, and kb_upsert_source_note
5. call kb_rebuild_indexes
Writing expectations:
元数据Summary, Key Points, Evidence, Open Questions, and Related Linkscontinue-this-library
Strong triggers:
继续推进我的这份库接着跑一轮再往前推进一批今天继续做这个库Default decision rule:
missing_source_note backlog is obviously dominant, prefer a small ingest batchDefault batch cap:
Do not mix all three into one large batch unless the user explicitly asks for a broader sweep.
One-Line Shortcuts
These are valid compact requests. Treat them as sufficient instructions unless the user adds more scope.
用 $llm-knowledge-bases 检查一下我的 wiki,先别改。用 $llm-knowledge-bases 补书评前 10 个。用 $llm-knowledge-bases 整理一下 AI 相关内容。用 $llm-knowledge-bases 补 3 个 concept pages。用 $llm-knowledge-bases 修一下 source id 漂移,先 dry run。用 $llm-knowledge-bases 继续推进我的这份库。Canonical Actions
Treat the following as the four canonical high-level actions for this skill.
ingest-source
Use this when the user wants to ingest, compile, or refresh changed raw material.
Sequence:
1. call kb_status
2. call kb_list_raw with changed_only=true
3. for each changed raw file:
- if the raw file is text or structured data:
- call kb_prepare_source
- call kb_read_raw
- compile the raw content into one grounded source note
- if the raw file is a PDF or image:
- call kb_prepare_source_bundle
- call kb_get_raw_asset
- if compile_readiness is not ready, create the missing representation trail with:
- kb_prepare_representation
- kb_upsert_representation
- call kb_read_representations
- compile the source note from the raw metadata plus the reviewed representations
- call kb_upsert_source_note
4. after the batch, call kb_rebuild_indexes
5. report what was compiled, what remains partial, and which raw assets still need representation work
Important:
kb_upsert_source_notekb_read_raw is only for text-readable raw filesnative_text, ocr_text, or page_notesvision_notesmetadata or data_profile can still improve later maintenanceconcept, entity, or synthesis pagesask-and-file
Use this when the user wants a grounded answer and the answer may deserve a durable artifact.
Sequence:
1. call kb_search
2. read only the most relevant notes with kb_read_notes
3. answer only from retrieved notes
4. decide the best write-back target:
- use kb_prepare_output + kb_upsert_output for question-specific answer archives
- use kb_prepare_derived_note + kb_upsert_derived_note when the answer should become a durable concept, entity, or synthesis page
5. call kb_rebuild_indexes if the wiki changed materially
Important:
output when preserving the exact query mattersconcept/entity/synthesis when the answer is reusable beyond the original querymaintain-wiki
Use this when the user wants cleanup, organization, or a quality pass.
Sequence:
1. call kb_lint
2. inspect wiki/index.md, wiki/log.md, and the most relevant collection indexes with kb_read_notes
3. identify weak pages, missing derived pages, stale navigation, or grounding gaps
4. if source note ids, manifest entries, source note paths, or stored raw hashes have drifted, call kb_repair_source_ids first as a dry run and only apply it when the plan is correct
5. if the user wants fixes, repair narrowly through the appropriate kb_* write tools
6. call kb_rebuild_indexes
Important:
concept/entity/synthesis pages to absorb recurring structure instead of repeating the same reasoning in outputskb_lint warnings as signals about wiki health, not only schema correctnesskb_lint surfaces missing_representation, representation_stale, unreviewed_asset_source, stale source coverage, unresolved research gaps, unsupported claims, contradiction candidates, or missing high-value pageskb_repair_source_ids for deterministic source-note/manifest repair instead of hand-editing ids, paths, or raw hashesmap-gaps
Use this when the user wants to know what the wiki is missing.
Sequence:
1. call kb_search
2. read the relevant source, output, and derived pages
3. call kb_map_gaps
4. identify:
- repeated ideas that deserve a concept page
- repeated named items that deserve an entity page
- cross-source themes that deserve a synthesis page
5. if the user wants the page landed immediately, call kb_promote_gap with the candidate note_id
6. otherwise propose the best next pages in priority order
Important:
source_refs coveragekb_promote_gap when a current candidate should be landed as-is into the wikikb_upsert_derived_noteWriting Rules
Source Notes
Required frontmatter fields:
idtype: sourcetitleraw_pathraw_hashsource_kindtagscreated_atupdated_atstatusStrongly recommended frontmatter fields:
raw_kindmime_typeasset_pathsRequired headings:
# Summary# Key Points# Evidence# Open Questions# Related LinksMultimodal guidance:
asset_paths should include the primary reviewed raw asset# Visual Notes when the note depends on multimodal review details that are not already obvious from the stored representation filesOutput Notes
Required frontmatter fields:
idtype: outputtitlequerysource_refscreated_atupdated_atRequired headings:
# Answer# Sources Used# Follow-up QuestionsDerived Notes
Derived pages are for durable wiki structure, not ephemeral chat residue.
Supported kinds:
conceptentitysynthesisShared frontmatter fields:
idtypetitlealiasessource_refstagscreated_atupdated_atstatusRequired headings by kind:
concept: # Summary, # Definition, # Key Points, # Evidence, # Open Questions, # Related Notesentity: # Summary, # Who or What, # Key Facts, # Evidence, # Open Questions, # Related Notessynthesis: # Summary, # Thesis, # Supporting Evidence, # Tensions, # Open Questions, # Related NotesGuidance:
concept pages capture reusable ideas or framesentity pages capture named things that recursynthesis pages capture higher-level cross-source conclusions that should survive beyond any one querysynthesis pages capture multi-source analysis, tradeoffs, or contested viewssource_refs aligned with real source notesSafety Boundaries
raw/.wiki/ directly.Failure Handling
If a runtime tool fails:
Language Policy
Finish Standard
When you finish a task with this skill, report:
kb_* tools were used