From cbae32a583b53c2da846147ade2f28c96a6ac85c Mon Sep 17 00:00:00 2001 From: yuta Date: Sun, 28 Jun 2026 19:03:31 +0900 Subject: [PATCH] init --- SCHEMA.md | 54 +++++++++++++++++ concepts/llm-wiki-pattern.md | 23 ++++++++ concepts/rag-vs-compiled-wiki.md | 26 +++++++++ concepts/wiki-maintenance-loop.md | 19 ++++++ entities/obsidian.md | 17 ++++++ index.md | 19 ++++++ log.md | 16 +++++ raw/articles/karpathy-llm-wiki-2026.md | 81 ++++++++++++++++++++++++++ 8 files changed, 255 insertions(+) create mode 100644 SCHEMA.md create mode 100644 concepts/llm-wiki-pattern.md create mode 100644 concepts/rag-vs-compiled-wiki.md create mode 100644 concepts/wiki-maintenance-loop.md create mode 100644 entities/obsidian.md create mode 100644 index.md create mode 100644 log.md create mode 100644 raw/articles/karpathy-llm-wiki-2026.md diff --git a/SCHEMA.md b/SCHEMA.md new file mode 100644 index 0000000..0be0484 --- /dev/null +++ b/SCHEMA.md @@ -0,0 +1,54 @@ +# Wiki Schema + +## Domain +LLM Wiki の試用・運用メモ。対象は「LLM が保守する持続的な Markdown 知識ベース」というパターン、その運用方法、関連ツール、比較対象。 + +## Conventions +- File names: lowercase, hyphens, no spaces (e.g., `llm-wiki-pattern.md`) +- Every wiki page starts with YAML frontmatter. +- Use Obsidian-style double-bracket links between pages; aim for at least 2 outbound links per page. +- When updating a page, always bump the `updated` date. +- Every new page must be added to `index.md` under the correct section. +- Every action must be appended to `log.md`. +- Raw sources under `raw/` are immutable after ingest. + +## Frontmatter +```yaml +--- +title: Page Title +created: YYYY-MM-DD +updated: YYYY-MM-DD +type: entity | concept | comparison | query | summary +tags: [from taxonomy below] +sources: [raw/articles/source-name.md] +confidence: high | medium | low +--- +``` + +## raw/ Frontmatter +```yaml +--- +source_url: https://example.com/article +ingested: YYYY-MM-DD +sha256: +--- +``` + +## Tag Taxonomy +- Methods: wiki, knowledge-base, retrieval, synthesis, maintenance +- Tools: obsidian, markdown, git, cli +- Roles: agent, human-in-the-loop +- Meta: comparison, workflow, source + +## Page Thresholds +- Create a page when an entity/concept is central to one source or appears in 2+ sources. +- Add to an existing page when a source mentions something already covered. +- Do not create pages for passing mentions. +- Split a page when it exceeds ~200 lines. + +## Update Policy +When new information conflicts with existing content: +1. Check source dates. +2. Note both positions with dates and sources. +3. Mark contested pages with `contested: true` and/or `contradictions:`. +4. Flag for user review in lint output. diff --git a/concepts/llm-wiki-pattern.md b/concepts/llm-wiki-pattern.md new file mode 100644 index 0000000..cdf1dcd --- /dev/null +++ b/concepts/llm-wiki-pattern.md @@ -0,0 +1,23 @@ +--- +title: LLM Wiki Pattern +created: 2026-06-28 +updated: 2026-06-28 +type: concept +tags: [wiki, knowledge-base, synthesis, agent, markdown] +sources: [raw/articles/karpathy-llm-wiki-2026.md] +confidence: medium +--- + +# LLM Wiki Pattern + +LLM Wiki は、LLM が curated raw sources を読み、持続的な Markdown wiki に統合していく知識管理パターン。通常の [[rag-vs-compiled-wiki|RAG]] のように質問ごとに断片検索からやり直すのではなく、source ingest 時点で entity page、concept page、comparison、index、log を更新し、知識を「蓄積済みの synthesis」として残す。 + +このパターンの価値は compounding にある。cross-reference、矛盾、更新履歴、既存 synthesis が wiki 内に残るため、後続の query や ingest が過去の作業を再利用できる。[[wiki-maintenance-loop]] が回るほど、単なるファイル置き場ではなく、読みやすい中間知識層になる。 + +人間の役割は source selection、問いの設計、レビュー、方向づけ。LLM の役割は要約、相互リンク、既存ページ更新、矛盾検出、index/log 更新などの bookkeeping。閲覧・探索には [[obsidian]] のような wikilink 対応エディタが合う。 + +## Open Questions + +- どの粒度でページを分けると、後から検索・更新しやすいか。 +- チーム運用では、LLM 更新をどこまで自動化し、どこを人間レビューにするか。 +- 小規模 wiki では index.md だけで十分か、いつ CLI/MCP search が必要になるか。 diff --git a/concepts/rag-vs-compiled-wiki.md b/concepts/rag-vs-compiled-wiki.md new file mode 100644 index 0000000..29764d4 --- /dev/null +++ b/concepts/rag-vs-compiled-wiki.md @@ -0,0 +1,26 @@ +--- +title: RAG vs Compiled Wiki +created: 2026-06-28 +updated: 2026-06-28 +type: concept +tags: [retrieval, wiki, comparison, synthesis] +sources: [raw/articles/karpathy-llm-wiki-2026.md] +confidence: medium +--- + +# RAG vs Compiled Wiki + +RAG は query-time retrieval が中心で、質問ごとに raw documents から relevant chunks を探し、都度 synthesis する。これは手軽だが、過去の読み込み・統合・矛盾検出が artifact として残りにくい。 + +Compiled wiki 型の [[llm-wiki-pattern]] は ingest-time synthesis が中心。source を追加した時点で [[wiki-maintenance-loop]] に沿って wiki page、cross-reference、index、log を更新する。後の質問では raw source だけでなく、すでに整理された中間知識を読める。 + +## Comparison + +| Dimension | RAG | LLM Wiki | +|---|---|---| +| Main timing | Query time | Ingest + query time | +| Persistence | Index/chunks are persistent, synthesis is often transient | Synthesis, links, contradictions, log are persistent | +| Human role | Upload/ask | Curate/review/direct | +| Best for | Fast Q&A over docs | Long-running research and compounding knowledge | + +[[obsidian]] や git と組み合わせると、LLM Wiki は読む・編集する・差分を見る、という通常の Markdown workflow に乗せやすい。 diff --git a/concepts/wiki-maintenance-loop.md b/concepts/wiki-maintenance-loop.md new file mode 100644 index 0000000..c51f3cc --- /dev/null +++ b/concepts/wiki-maintenance-loop.md @@ -0,0 +1,19 @@ +--- +title: Wiki Maintenance Loop +created: 2026-06-28 +updated: 2026-06-28 +type: concept +tags: [workflow, maintenance, wiki, agent] +sources: [raw/articles/karpathy-llm-wiki-2026.md] +confidence: medium +--- + +# Wiki Maintenance Loop + +LLM Wiki の基本運用は ingest / query / lint のループ。 + +1. **Ingest**: raw source を保存し、既存の [[llm-wiki-pattern|wiki]] を読んで重複を避け、関連 entity/concept ページを作成・更新する。 +2. **Query**: index と関連ページを読み、回答を synthesis する。価値のある回答は `queries/` や `comparisons/` に保存する。 +3. **Lint**: broken links、orphan pages、古い主張、矛盾、frontmatter 不備、肥大化ページを点検する。 + +この loop によって、[[rag-vs-compiled-wiki|query-time retrieval]] だけでは残りにくい知識整理が継続的に蓄積される。[[obsidian]] の graph view や backlinks は、orphan や hub page を見つける補助になる。 diff --git a/entities/obsidian.md b/entities/obsidian.md new file mode 100644 index 0000000..43d085c --- /dev/null +++ b/entities/obsidian.md @@ -0,0 +1,17 @@ +--- +title: Obsidian +created: 2026-06-28 +updated: 2026-06-28 +type: entity +tags: [obsidian, markdown, wiki, tool] +sources: [raw/articles/karpathy-llm-wiki-2026.md] +confidence: medium +--- + +# Obsidian + +Obsidian は Markdown files と Obsidian-style wikilinks を扱える note-taking app。[[llm-wiki-pattern]] では、人間が wiki を読む・辿る・graph view で構造を見るための IDE 的な役割を持つ。 + +LLM が [[wiki-maintenance-loop]] に従って Markdown files を更新し、人間が Obsidian で browse/review する構成にすると、agent が書く層と人間が探索する層を分けやすい。 + +関連する比較軸として、RAG だけで raw documents に質問する方式との違いは [[rag-vs-compiled-wiki]] にまとめている。 diff --git a/index.md b/index.md new file mode 100644 index 0000000..3f5eece --- /dev/null +++ b/index.md @@ -0,0 +1,19 @@ +# Wiki Index + +> Content catalog. Every wiki page listed under its type with a one-line summary. +> Read this first to find relevant pages for any query. +> Last updated: 2026-06-28 | Total pages: 4 + +## Entities + +- [[obsidian]] — LLM Wiki を閲覧・編集するための Markdown/リンク対応ノートアプリ。 + +## Concepts + +- [[llm-wiki-pattern]] — LLM が raw source を読み、持続的な相互リンク付き Markdown wiki にコンパイルする運用パターン。 +- [[rag-vs-compiled-wiki]] — RAG と LLM Wiki の違いを「毎回検索」vs「蓄積済み synthesis」として比較。 +- [[wiki-maintenance-loop]] — ingest/query/lint によって wiki を継続的に健康に保つループ。 + +## Comparisons + +## Queries diff --git a/log.md b/log.md new file mode 100644 index 0000000..71e52d0 --- /dev/null +++ b/log.md @@ -0,0 +1,16 @@ +# Wiki Log + +> Chronological record of all wiki actions. Append-only. +> Format: `## [YYYY-MM-DD] action | subject` +> Actions: ingest, update, query, lint, create, archive, delete + +## [2026-06-28] create | Wiki initialized +- Domain: LLM Wiki の試用・運用メモ +- Structure created with SCHEMA.md, index.md, log.md, raw/, entities/, concepts/, comparisons/, queries/ + +## [2026-06-28] ingest | Karpathy LLM Wiki gist +- Source saved: raw/articles/karpathy-llm-wiki-2026.md +- Created: concepts/llm-wiki-pattern.md +- Created: concepts/rag-vs-compiled-wiki.md +- Created: concepts/wiki-maintenance-loop.md +- Created: entities/obsidian.md diff --git a/raw/articles/karpathy-llm-wiki-2026.md b/raw/articles/karpathy-llm-wiki-2026.md new file mode 100644 index 0000000..5d88abc --- /dev/null +++ b/raw/articles/karpathy-llm-wiki-2026.md @@ -0,0 +1,81 @@ +--- +source_url: https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f +ingested: 2026-06-28 +sha256: dc3efe98ae62f23dd08acad13aba2e95287beb20b6bec2f4af0423557fe37401 +--- + +# LLM Wiki + +A pattern for building personal knowledge bases using LLMs. + +This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you. + +## The core idea + +Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way. + +The idea here is different. Instead of just retrieving from raw documents at query time, the LLM **incrementally builds and maintains a persistent wiki** — a structured, interlinked collection of markdown files that sits between you and the raw sources. When you add a new source, the LLM doesn't just index it for later retrieval. It reads it, extracts the key information, and integrates it into the existing wiki — updating entity pages, revising topic summaries, noting where new data contradicts old claims, strengthening or challenging the evolving synthesis. The knowledge is compiled once and then *kept current*, not re-derived on every query. + +This is the key difference: **the wiki is a persistent, compounding artifact.** The cross-references are already there. The contradictions have already been flagged. The synthesis already reflects everything you've read. The wiki keeps getting richer with every source you add and every question you ask. + +You never (or rarely) write the wiki yourself — the LLM writes and maintains all of it. You're in charge of sourcing, exploration, and asking the right questions. The LLM does all the grunt work — the summarizing, cross-referencing, filing, and bookkeeping that makes a knowledge base actually useful over time. In practice, I have the LLM agent open on one side and Obsidian open on the other. The LLM makes edits based on our conversation, and I browse the results in real time — following links, checking the graph view, reading the updated pages. Obsidian is the IDE; the LLM is the programmer; the wiki is the codebase. + +This can apply to a lot of different contexts. A few examples: + +- **Personal**: tracking your own goals, health, psychology, self-improvement — filing journal entries, articles, podcast notes, and building up a structured picture of yourself over time. +- **Research**: going deep on a topic over weeks or months — reading papers, articles, reports, and incrementally building a comprehensive wiki with an evolving thesis. +- **Reading a book**: filing each chapter as you go, building out pages for characters, themes, plot threads, and how they connect. By the end you have a rich companion wiki. Think of fan wikis like [Tolkien Gateway](https://tolkiengateway.net/wiki/Main_Page) — thousands of interlinked pages covering characters, places, events, languages, built by a community of volunteers over years. You could build something like that personally as you read, with the LLM doing all the cross-referencing and maintenance. +- **Business/team**: an internal wiki maintained by LLMs, fed by Slack threads, meeting transcripts, project documents, customer calls. Possibly with humans in the loop reviewing updates. The wiki stays current because the LLM does the maintenance that no one on the team wants to do. +- **Competitive analysis, due diligence, trip planning, course notes, hobby deep-dives** — anything where you're accumulating knowledge over time and want it organized rather than scattered. + +## Architecture + +There are three layers: + +**Raw sources** — your curated collection of source documents. Articles, papers, images, data files. These are immutable — the LLM reads from them but never modifies them. This is your source of truth. + +**The wiki** — a directory of LLM-generated markdown files. Summaries, entity pages, concept pages, comparisons, an overview, a synthesis. The LLM owns this layer entirely. It creates pages, updates them when new sources arrive, maintains cross-references, and keeps everything consistent. You read it; the LLM writes it. + +**The schema** — a document (e.g. CLAUDE.md for Claude Code or AGENTS.md for Codex) that tells the LLM how the wiki is structured, what the conventions are, and what workflows to follow when ingesting sources, answering questions, or maintaining the wiki. This is the key configuration file — it's what makes the LLM a disciplined wiki maintainer rather than a generic chatbot. You and the LLM co-evolve this over time as you figure out what works for your domain. + +## Operations + +**Ingest.** You drop a new source into the raw collection and tell the LLM to process it. An example flow: the LLM reads the source, discusses key takeaways with you, writes a summary page in the wiki, updates the index, updates relevant entity and concept pages across the wiki, and appends an entry to the log. A single source might touch 10-15 wiki pages. Personally I prefer to ingest sources one at a time and stay involved — I read the summaries, check the updates, and guide the LLM on what to emphasize. But you could also batch-ingest many sources at once with less supervision. It's up to you to develop the workflow that fits your style and document it in the schema for future sessions. + +**Query.** You ask questions against the wiki. The LLM searches for relevant pages, reads them, and synthesizes an answer with citations. Answers can take different forms depending on the question — a markdown page, a comparison table, a slide deck (Marp), a chart (matplotlib), a canvas. The important insight: **good answers can be filed back into the wiki as new pages.** A comparison you asked for, an analysis, a connection you discovered — these are valuable and shouldn't disappear into chat history. This way your explorations compound in the knowledge base just like ingested sources do. + +**Lint.** Periodically, ask the LLM to health-check the wiki. Look for: contradictions between pages, stale claims that newer sources have superseded, orphan pages with no inbound links, important concepts mentioned but lacking their own page, missing cross-references, data gaps that could be filled with a web search. The LLM is good at suggesting new questions to investigate and new sources to look for. This keeps the wiki healthy as it grows. + +## Indexing and logging + +Two special files help the LLM (and you) navigate the wiki as it grows. They serve different purposes: + +**index.md** is content-oriented. It's a catalog of everything in the wiki — each page listed with a link, a one-line summary, and optionally metadata like date or source count. Organized by category (entities, concepts, sources, etc.). The LLM updates it on every ingest. When answering a query, the LLM reads the index first to find relevant pages, then drills into them. This works surprisingly well at moderate scale (~100 sources, ~hundreds of pages) and avoids the need for embedding-based RAG infrastructure. + +**log.md** is chronological. It's an append-only record of what happened and when — ingests, queries, lint passes. A useful tip: if each entry starts with a consistent prefix (e.g. `## [2026-04-02] ingest | Article Title`), the log becomes parseable with simple unix tools — `grep "^## \[" log.md | tail -5` gives you the last 5 entries. The log gives you a timeline of the wiki's evolution and helps the LLM understand what's been done recently. + +## Optional: CLI tools + +At some point you may want to build small tools that help the LLM operate on the wiki more efficiently. A search engine over the wiki pages is the most obvious one — at small scale the index file is enough, but as the wiki grows you want proper search. [qmd](https://github.com/tobi/qmd) is a good option: it's a local search engine for markdown files with hybrid BM25/vector search and LLM re-ranking, all on-device. It has both a CLI (so the LLM can shell out to it) and an MCP server (so the LLM can use it as a native tool). You could also build something simpler yourself — the LLM can help you vibe-code a naive search script as the need arises. + +## Tips and tricks + +- **Obsidian Web Clipper** is a browser extension that converts web articles to markdown. Very useful for quickly getting sources into your raw collection. +- **Download images locally.** In Obsidian Settings → Files and links, set "Attachment folder path" to a fixed directory (e.g. `raw/assets/`). Then in Settings → Hotkeys, search for "Download" to find "Download attachments for current file" and bind it to a hotkey (e.g. Ctrl+Shift+D). After clipping an article, hit the hotkey and all images get downloaded to local disk. This is optional but useful — it lets the LLM view and reference images directly instead of relying on URLs that may break. Note that LLMs can't natively read markdown with inline images in one pass — the workaround is to have the LLM read the text first, then view some or all of the referenced images separately to gain additional context. It's a bit clunky but works well enough. +- **Obsidian's graph view** is the best way to see the shape of your wiki — what's connected to what, which pages are hubs, which are orphans. +- **Marp** is a markdown-based slide deck format. Obsidian has a plugin for it. Useful for generating presentations directly from wiki content. +- **Dataview** is an Obsidian plugin that runs queries over page frontmatter. If your LLM adds YAML frontmatter to wiki pages (tags, dates, source counts), Dataview can generate dynamic tables and lists. +- The wiki is just a git repo of markdown files. You get version history, branching, and collaboration for free. + +## Why this works + +The tedious part of maintaining a knowledge base is not the reading or the thinking — it's the bookkeeping. Updating cross-references, keeping summaries current, noting when new data contradicts old claims, maintaining consistency across dozens of pages. Humans abandon wikis because the maintenance burden grows faster than the value. LLMs don't get bored, don't forget to update a cross-reference, and can touch 15 files in one pass. The wiki stays maintained because the cost of maintenance is near zero. + +The human's job is to curate sources, direct the analysis, ask good questions, and think about what it all means. The LLM's job is everything else. + +The idea is related in spirit to Vannevar Bush's Memex (1945) — a personal, curated knowledge store with associative trails between documents. Bush's vision was closer to this than to what the web became: private, actively curated, with the connections between documents as valuable as the documents themselves. The part he couldn't solve was who does the maintenance. The LLM handles that. + + +## Note + +This document is intentionally abstract. It describes the idea, not a specific implementation. The exact directory structure, the schema conventions, the page formats, the tooling — all of that will depend on your domain, your preferences, and your LLM of choice. Everything mentioned above is optional and modular — pick what's useful, ignore what isn't. For example: your sources might be text-only, so you don't need image handling at all. Your wiki might be small enough that the index file is all you need, no search engine required. You might not care about slide decks and just want markdown pages. You might want a completely different set of output formats. The right way to use this is to share it with your LLM agent and work together to instantiate a version that fits your needs. The document's only job is to communicate the pattern. Your LLM can figure out the rest.