llm-wiki

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

LLM Wiki — Second Brain for Claude Code + Obsidian

LLM Wiki — 适用于Claude Code + Obsidian的第二大脑

Inspired by Andrej Karpathy's LLM Wiki pattern (gist). This skill turns Claude Code (or any agent CLI) into a disciplined wiki maintainer that incrementally builds and maintains a persistent, interlinked Obsidian vault as you feed it sources. The knowledge compounds — cross-references, contradictions, and synthesis are already there when you query.
灵感来自Andrej Karpathy的LLM Wiki模式(gist)。该技能可将Claude Code(或任何Agent CLI)转变为严谨的维基维护者,在你导入数据源时逐步构建并维护一个持久化、相互关联的Obsidian知识库。知识会不断复利——当你查询时,交叉引用、矛盾点和整合内容已准备就绪。

Core principle

核心原则

Most LLM+docs workflows are RAG: retrieve fragments at query time, synthesize from scratch, forget. The wiki is compounding: sources are read once, integrated into a persistent markdown knowledge base, and kept current. You curate and ask; the LLM reads, files, cross-references, and maintains.
Obsidian is the IDE. The LLM is the programmer. The wiki is the codebase.
大多数LLM+文档工作流采用RAG:查询时检索片段,从头整合,用完即忘。而本维基采用复利模式:数据源仅读取一次,整合到持久化Markdown知识库中并保持时效性。你负责策划和提问;LLM负责阅读、归档、交叉引用和维护。
Obsidian是集成开发环境(IDE),LLM是程序员,维基是代码库。

When to use

适用场景

  • Personal: track goals, health, psychology, journaling, self-improvement
  • Research: deep dives over weeks on a topic — papers, articles, reports, evolving thesis
  • Book companion: file chapters as you read; build a fan-wiki-style companion for characters, themes, plot threads
  • Business/team: internal wiki fed by Slack, meeting notes, calls — LLM does maintenance nobody else wants to do
  • Competitive analysis, due diligence, trip planning, course notes, hobby deep-dives
Do NOT use when: you need one-shot Q&A over a fixed document (use RAG), you don't plan to add sources over time, or you don't want Obsidian in the loop.
  • 个人场景:追踪目标、健康、心理状态、日志记录、自我提升
  • 研究场景:针对某一主题进行数周深度研究——论文、文章、报告、不断演进的论点
  • 书籍辅助:阅读时归档章节;构建类似粉丝维基的内容,涵盖角色、主题、情节线
  • 商务/团队场景:由Slack消息、会议记录、通话内容填充的内部维基——LLM承担无人愿意做的维护工作
  • 竞品分析、尽职调查、旅行规划、课程笔记、爱好深度研究
不适用场景:你需要对固定文档进行一次性问答(使用RAG即可)、不打算随时间添加数据源,或不想让Obsidian参与流程。

Architecture (three layers)

架构(三层)

vault/
├── raw/                    # Layer 1 — IMMUTABLE source of truth
│   ├── <source files>      # Articles, papers, PDFs, images, data
│   └── assets/             # Downloaded images from clipped articles
├── wiki/                   # Layer 2 — LLM-owned knowledge base
│   ├── index.md            # Content catalog (LLM updates every ingest)
│   ├── log.md              # Append-only timeline (## [YYYY-MM-DD] <op> | <title>)
│   ├── entities/           # Person/Org/Place pages
│   ├── concepts/           # Ideas, theories, frameworks
│   ├── sources/            # One summary page per ingested source
│   ├── comparisons/        # Cross-source analysis pages
│   └── synthesis/          # High-level syntheses, theses, overviews
├── CLAUDE.md               # Schema + conventions (Claude Code)
└── AGENTS.md               # Same content, for Codex/Cursor/Antigravity
  • Layer 1 (raw/) — you own. LLM only reads; never writes.
  • Layer 2 (wiki/) — LLM owns. It creates, updates, and cross-references pages. You read it.
  • Layer 3 (CLAUDE.md / AGENTS.md) — the schema. Conventions, workflows, frontmatter rules. Co-evolved by you and the LLM.
vault/
├── raw/                    # 第一层 — 不可变的事实来源
│   ├── <source files>      # 文章、论文、PDF、图片、数据
│   └── assets/             # 从截取文章中下载的图片
├── wiki/                   # 第二层 — LLM专属知识库
│   ├── index.md            # 内容目录(LLM每次导入时更新)
│   ├── log.md              # 仅追加的时间线(## [YYYY-MM-DD] <操作> | <标题>)
│   ├── entities/           # 人物/组织/地点页面
│   ├── concepts/           # 观点、理论、框架
│   ├── sources/            # 每个导入数据源对应的摘要页面
│   ├── comparisons/        # 跨数据源分析页面
│   └── synthesis/          # 高层级整合内容、论点、概述
├── CLAUDE.md               #  Schema + 约定规则(供Claude Code使用)
└── AGENTS.md               # 相同内容,供Codex/Cursor/Antigravity使用
  • 第一层(raw/) — 由你掌控。LLM仅读取,绝不写入。
  • 第二层(wiki/) — 由LLM掌控。它负责创建、更新和交叉引用页面。你可以阅读这些内容。
  • 第三层(CLAUDE.md / AGENTS.md)Schema。包含约定规则、工作流、前置元数据规则。由你和LLM共同演进。

Three core operations

三项核心操作

  1. Ingest — LLM reads a source, discusses takeaways with you, writes a source summary, updates 10-15 relevant pages, updates index, appends to log. See
    references/ingest-workflow.md
    .
  2. Query — LLM reads
    index.md
    first, drills into relevant pages, synthesizes with citations. Good answers get filed back into the wiki so explorations compound. See
    references/query-workflow.md
    .
  3. Lint — Health check: contradictions, stale claims, orphan pages, missing cross-refs, concepts mentioned but lacking their own page, data gaps to fill with web search. See
    references/lint-workflow.md
    .
  1. 导入(Ingest) — LLM读取数据源,与你讨论要点,撰写数据源摘要,更新10-15个相关页面,更新目录,追加到日志。详见
    references/ingest-workflow.md
  2. 查询(Query) — LLM先读取
    index.md
    ,深入相关页面,结合引用内容生成整合答案。优质答案会重新归档到维基,让探索内容持续复利。详见
    references/query-workflow.md
  3. 检查(Lint) — 健康检查:识别矛盾点、过时声明、孤立页面、缺失的交叉引用、被提及但未创建独立页面的概念、需通过网络搜索填补的数据缺口。详见
    references/lint-workflow.md

Quick start

快速开始

bash
undefined
bash
undefined

1. Initialize a vault (in Obsidian's vault directory)

1. 初始化知识库(在Obsidian的知识库目录中)

python scripts/init_vault.py --path ~/vaults/research --topic "LLM interpretability"
python scripts/init_vault.py --path ~/vaults/research --topic "LLM interpretability"

2. Drop a source into raw/, then ingest

2. 将数据源放入raw/,然后导入

/wiki-ingest ~/vaults/research/raw/anthropic-monosemanticity.pdf
/wiki-ingest ~/vaults/research/raw/anthropic-monosemanticity.pdf

3. Ask questions (answers can be re-filed into the wiki)

3. 提问(答案可重新归档到维基)

/wiki-query "how does monosemanticity compare to mechanistic interpretability?"
/wiki-query "how does monosemanticity compare to mechanistic interpretability?"

4. Periodic health check

4. 定期健康检查

/wiki-lint
/wiki-lint

5. See the timeline

5. 查看时间线

/wiki-log --last 10
undefined
/wiki-log --last 10
undefined

Slash commands (this plugin ships)

斜杠命令(本插件内置)

CommandPurpose
/wiki-init
Bootstrap a fresh vault with schema files + starter structure
/wiki-ingest <path>
Read a source, discuss, update wiki, log it
/wiki-query <question>
Search wiki, synthesize answer, offer to file back
/wiki-lint
Run health check — contradictions, orphans, stale claims, gaps
/wiki-log
Show recent log entries (uses unix tools on
log.md
)
命令用途
/wiki-init
用Schema文件和初始结构引导创建新知识库
/wiki-ingest <路径>
读取数据源,讨论内容,更新维基,记录日志
/wiki-query <问题>
搜索维基,生成整合答案,提供归档选项
/wiki-lint
运行健康检查——识别矛盾点、孤立页面、过时声明、缺口
/wiki-log
显示近期日志条目(基于
log.md
使用Unix工具)

Sub-agents (this plugin ships)

子Agent(本插件内置)

AgentWhen dispatched
wiki-ingestor
Delegated ingest flow — reads source, proposes updates, applies after your approval
wiki-linter
Runs the health-check workflow independently, reports findings
wiki-librarian
Answers queries using index-first search, synthesizes with citations
Agent调度时机
wiki-ingestor
委托导入流程——读取数据源,提议更新内容,经你批准后应用
wiki-linter
独立运行健康检查工作流,报告发现的问题
wiki-librarian
使用目录优先搜索回答问题,结合引用内容生成整合答案

Python tools (
scripts/
)

Python工具(
scripts/
目录)

All tools are standard library only (no pip installs). Run with
python scripts/<tool>.py --help
.
ScriptPurpose
init_vault.py
Create folder structure + seed CLAUDE.md, AGENTS.md, index.md, log.md
ingest_source.py
Helper: extract text/frontmatter from a source file, ready for LLM review
update_index.py
Regenerate
index.md
from wiki page frontmatter (category, date, source count)
append_log.py
Append a standardized log entry
## [YYYY-MM-DD] <op> | <title>
wiki_search.py
BM25 search over wiki pages (standalone fallback when index.md isn't enough)
lint_wiki.py
Find orphans (no inbound links), stale pages, missing cross-refs, broken links
graph_analyzer.py
Compute link graph stats — hubs, orphans, clusters, disconnected components
export_marp.py
Render a wiki page (or subtree) to a Marp slide deck
所有工具仅依赖标准库(无需pip安装)。运行方式:
python scripts/<工具名>.py --help
脚本用途
init_vault.py
创建文件夹结构 + 初始化CLAUDE.md、AGENTS.md、index.md、log.md
ingest_source.py
辅助工具:从数据源文件提取文本/前置元数据,供LLM审阅
update_index.py
根据维基页面的前置元数据(分类、日期、数据源数量)重新生成
index.md
append_log.py
追加标准化日志条目
## [YYYY-MM-DD] <操作> | <标题>
wiki_search.py
对维基页面进行BM25搜索(当index.md不足以满足需求时的独立备选方案)
lint_wiki.py
查找孤立页面(无入站链接)、过时页面、缺失的交叉引用、失效链接
graph_analyzer.py
计算链接图统计数据——枢纽页面、孤立页面、集群、断开的组件
export_marp.py
将维基页面(或子树)渲染为Marp幻灯片

Cross-tool compatibility

跨工具兼容性

The vault's schema lives in CLAUDE.md (Claude Code) or AGENTS.md (Codex/Cursor/Antigravity/OpenCode). The same content works in both. This plugin ships both templates. For per-tool setup instructions see
references/cross-tool-setup.md
.
CLAUDE.md       → Claude Code
AGENTS.md       → Codex CLI, Cursor, Antigravity, OpenCode, Gemini CLI
.cursorrules    → legacy Cursor (pre-AGENTS.md)
The scripts are pure Python stdlib → run identically everywhere. Only the loader file changes per tool.
知识库的Schema存储在CLAUDE.md(供Claude Code使用)或AGENTS.md(供Codex/Cursor/Antigravity/OpenCode使用)中。两份内容完全通用。本插件内置两种模板。各工具的设置说明详见
references/cross-tool-setup.md
CLAUDE.md       → Claude Code
AGENTS.md       → Codex CLI、Cursor、Antigravity、OpenCode、Gemini CLI
.cursorrules    → 旧版Cursor(AGENTS.md之前的版本)
脚本为纯Python标准库实现 → 在所有环境中运行方式一致。仅加载文件会因工具而异。

Obsidian setup (recommended)

Obsidian推荐设置

  • Obsidian Web Clipper — browser extension; converts web articles to markdown and drops them in
    raw/
  • Download images locally — Settings → Files and links → Attachment folder path =
    raw/assets/
    . Settings → Hotkeys → bind "Download attachments for current file" to
    Ctrl+Shift+D
  • Graph view — see hubs/orphans; essential for spotting structural problems
  • Marp plugin — Markdown-based slide decks directly from wiki pages
  • Dataview plugin — dynamic tables/lists over page frontmatter (tags, dates, source counts)
  • Git — the vault is a plain markdown repo; version it
Full setup walkthrough:
references/obsidian-setup.md
  • Obsidian Web Clipper — 浏览器扩展;将网页文章转换为Markdown并放入
    raw/
    目录
  • 本地下载图片 — 设置 → 文件与链接 → 附件文件夹路径 =
    raw/assets/
    。设置 → 快捷键 → 将“下载当前文件的附件”绑定为
    Ctrl+Shift+D
  • 图谱视图 — 查看枢纽/孤立页面;对发现结构问题至关重要
  • Marp插件 — 直接从维基页面生成基于Markdown的幻灯片
  • Dataview插件 — 基于页面前置元数据(标签、日期、数据源数量)生成动态表格/列表
  • Git — 知识库是纯Markdown仓库;进行版本控制
完整设置指南:
references/obsidian-setup.md

Why this works (vs plain RAG)

为何该方案优于普通RAG

Plain RAGLLM Wiki
Rediscover knowledge each queryKnowledge accumulates
Cross-references re-computed every timeCross-references pre-written and maintained
Contradictions surface only if you askContradictions flagged during ingest
Exploration disappears into chat historyGood answers re-filed as new pages
Scales by embeddings infrastructureScales by markdown +
index.md
+ optional local search
At ~100 sources / hundreds of pages,
index.md
+ filesystem search is enough. Past that, layer in a local search tool like qmd or use
scripts/wiki_search.py
.
普通RAGLLM Wiki
每次查询都需重新检索知识知识持续积累
交叉引用每次查询都需重新计算交叉引用已预先撰写并维护
仅当你主动提问时才会发现矛盾点导入时即标记矛盾点
探索内容仅存在于聊天记录中优质答案会重新归档为新页面
依赖嵌入向量基础设施实现扩展通过Markdown +
index.md
+ 可选本地搜索实现扩展
当数据源达到约100个/页面达到数百个时,
index.md
+ 文件系统搜索已足够。超过该规模后,可添加本地搜索工具如qmd或使用
scripts/wiki_search.py

Related skills (chains via
context: fork
)

相关技能(通过
context: fork
链式调用)

This skill is marked
context: fork
so other skills can chain into it:
  • para-memory-files
    — PARA-method memory; complementary as long-term personal memory that feeds sources into the wiki
  • obsidian-vault
    (mattpocock) — lightweight Obsidian note helper; this skill is the maintained-wiki layer on top
  • rag-design
    — when wiki outgrows ~500 pages, use rag-design to bolt on a retrieval layer
  • mcp-design
    — expose the wiki as an MCP tool
  • agent-communication
    — for multi-agent wiki maintenance (ingestor + linter + librarian)
本技能标记为
context: fork
,因此其他技能可链式调用它:
  • para-memory-files
    — PARA方法记忆库;作为长期个人记忆库,可将数据源导入维基,形成互补
  • obsidian-vault
    (mattpocock) — 轻量级Obsidian笔记助手;本技能是其上层的维基维护层
  • rag-design
    — 当维基规模超过约500个页面时,使用rag-design添加检索层
  • mcp-design
    — 将维基作为MCP工具暴露
  • agent-communication
    — 用于多Agent维基维护(导入器 + 检查器 + 管理员)

Reference docs

参考文档

  • references/wiki-schema.md
    — full vault layout, page frontmatter, naming conventions
  • references/page-formats.md
    — entity, concept, source, comparison, synthesis templates
  • references/ingest-workflow.md
    — the detailed ingest flow the wiki-ingestor agent follows
  • references/query-workflow.md
    — query patterns, citation format, re-filing answers
  • references/lint-workflow.md
    — health-check heuristics
  • references/obsidian-setup.md
    — Obsidian plugins, hotkeys, vault config
  • references/cross-tool-setup.md
    — per-tool setup (Codex, Cursor, Antigravity, etc.)
  • references/memex-principles.md
    — Bush's Memex, why the LLM changes the maintenance math
  • references/wiki-schema.md
    — 完整知识库布局、页面前置元数据、命名约定
  • references/page-formats.md
    — 实体、概念、数据源、对比、整合内容的模板
  • references/ingest-workflow.md
    — wiki-ingestor Agent遵循的详细导入流程
  • references/query-workflow.md
    — 查询模式、引用格式、答案重新归档规则
  • references/lint-workflow.md
    — 健康检查启发式规则
  • references/obsidian-setup.md
    — Obsidian插件、快捷键、知识库配置
  • references/cross-tool-setup.md
    — 各工具设置说明(Codex、Cursor、Antigravity等)
  • references/memex-principles.md
    — Bush的Memex原理,为何LLM改变了维护逻辑

Templates (
assets/
)

模板(
assets/
目录)

  • CLAUDE.md.template
    ,
    AGENTS.md.template
    ,
    .cursorrules.template
    — schema loaders per tool
  • index.md.template
    ,
    log.md.template
    — starter index and log
  • page-templates/
    — entity, concept, source-summary, comparison, synthesis
  • example-vault/
    — small worked example you can study or copy
  • CLAUDE.md.template
    ,
    AGENTS.md.template
    ,
    .cursorrules.template
    — 各工具对应的Schema加载器
  • index.md.template
    ,
    log.md.template
    — 初始目录和日志模板
  • page-templates/
    — 实体、概念、数据源摘要、对比、整合内容的模板
  • example-vault/
    — 可研究或复制的小型示例知识库

Iron rule

铁则

The LLM never edits files in
raw/
.
Ever. Sources are immutable. All LLM writes go to
wiki/
. If you need to correct a source, do it in
raw/
yourself — then re-ingest.
LLM绝不编辑
raw/
目录下的文件。
永远不会。数据源是不可变的。所有LLM写入操作都仅针对
wiki/
目录。若需修正数据源,请自行在
raw/
目录中修改——然后重新导入。