llm_wiki README

The project's README from github.com/nashsu/llm_wiki. As one markdown file: README.md.

LLM Wiki

LLM Wiki Logo

A personal knowledge base that builds itself.
LLM reads your documents, builds a structured wiki, and keeps it current.

What is this? • Features • Tech Stack • Installation • Credits • License

English | 中文 | 日本語 | 한국어


Overview

Features

What is this?

LLM Wiki is a cross-platform desktop application that turns your documents into an organized, interlinked knowledge base — automatically. Instead of traditional RAG (retrieve-and-answer from scratch every time), the LLM incrementally builds and maintains a persistent wiki from your sources. Knowledge is compiled once and kept current, not re-derived on every query.

This project is based on Karpathy's LLM Wiki pattern — a methodology for building personal knowledge bases using LLMs. llm_wiki is created and maintained by nash_su, who implemented the core ideas as a full desktop application with significant enhancements.

LLM Wiki Architecture

Credits

The foundational methodology comes from Andrej Karpathy's llm-wiki.md, which describes the pattern of using LLMs to incrementally build and maintain a personal wiki. The original document is an abstract design pattern; this project is a concrete implementation with substantial extensions.

What We Kept from the Original

The core architecture follows Karpathy's design faithfully:

Obsidian Compatibility

What We Changed & Added

1. From CLI to Desktop Application

The original is an abstract pattern document designed to be copy-pasted to an LLM agent. We built it into a full cross-platform desktop application with:

2. Purpose.md — The Wiki's Soul

The original has Schema (how the wiki works) but no formal place for why the wiki exists. We added purpose.md:

3. Two-Step Chain-of-Thought Ingest

The original describes a single-step ingest where the LLM reads and writes simultaneously. We split it into two sequential LLM calls for significantly better quality:

Step 1 (Analysis): LLM reads source → structured analysis
  - Key entities, concepts, arguments
  - Connections to existing wiki content
  - Contradictions & tensions with existing knowledge
  - Recommendations for wiki structure

Step 2 (Generation): LLM takes analysis → generates wiki files
  - Source summary with frontmatter (type, title, sources[])
  - Entity pages, concept pages with cross-references
  - Updated index.md, log.md, overview.md
  - Review items for human judgment
  - Search queries for Deep Research

Additional ingest enhancements beyond the original:

4. Knowledge Graph with Relevance Model

Knowledge Graph

The original mentions [[wikilinks]] for cross-references but has no graph analysis. We built a full knowledge graph visualization and relevance engine:

4-Signal Relevance Model:

Signal Weight Description
Direct link ×3.0 Pages linked via [[wikilinks]]
Source overlap ×4.0 Pages sharing the same raw source (via frontmatter sources[])
Adamic-Adar ×1.5 Pages sharing common neighbors (weighted by neighbor degree)
Type affinity ×1.0 Bonus for same page type (entity↔entity, concept↔concept)

Graph Visualization (sigma.js + graphology + ForceAtlas2):

5. Louvain Community Detection

Not in the original. Automatic discovery of knowledge clusters using the Louvain algorithm (graphology-communities-louvain):

Louvain Community Detection

6. Graph Insights — Surprising Connections & Knowledge Gaps

Not in the original. The system automatically analyzes graph structure to surface actionable insights:

Surprising Connections:

Knowledge Gaps:

Interactive:

Graph Insights

7. Optimized Query Retrieval Pipeline

The original describes a simple query where the LLM reads relevant pages. We built a multi-phase retrieval pipeline with optional vector search and budget control:

Phase 1: Tokenized Search
  - English: word splitting + stop word removal
  - Chinese: CJK bigram tokenization (每个 → [每个, 个…])
  - Title match bonus (+10 score)
  - Searches both wiki/ and raw/sources/

Phase 1.5: Vector Semantic Search (optional)
  - Embedding via any OpenAI-compatible /v1/embeddings endpoint
  - Stored in LanceDB (Rust backend) for fast ANN retrieval
  - Cosine similarity finds semantically related pages even without keyword overlap
  - Results merged into search: boosts existing matches + adds new discoveries

Phase 2: Graph Expansion
  - Top search results used as seed nodes
  - 4-signal relevance model finds related pages
  - 2-hop traversal with decay for deeper connections

Phase 3: Budget Control
  - Configurable context window: 4K → 1M tokens
  - Proportional allocation: 60% wiki pages, 20% chat history, 5% index, 15% system
  - Pages prioritized by combined search + graph relevance score

Phase 4: Context Assembly
  - Numbered pages with full content (not just summaries)
  - System prompt includes: purpose.md, language rules, citation format, index.md
  - LLM instructed to cite pages by number: [1], [2], etc.

Vector Search is fully optional — disabled by default, enabled in Settings with independent endpoint, API key, and model configuration. When disabled, the pipeline falls back to tokenized search + graph expansion. Benchmark: overall recall improved from 58.2% to 71.4% with vector search enabled.

8. Multi-Conversation Chat with Persistence

The original has a single query interface. We built full multi-conversation support:

9. Rust Backend Chat Agent & Skills

Not in the original. Chat now runs through a Rust backend Agent runtime rather than a browser-only TypeScript loop:

10. Thinking / Reasoning Display

Not in the original. For LLMs that emit <think> blocks (DeepSeek, QwQ, etc.):

11. Markdown Rendering: KaTeX Math & Mermaid Diagrams

Not in the original. Rich Markdown rendering across chat and preview:

12. Review System (Async Human-in-the-Loop)

The original suggests staying involved during ingest. We added an asynchronous review queue:

13. Deep Research

Deep Research

Not in the original. When the LLM identifies knowledge gaps:

14. Browser Extension (Web Clipper)

Chrome Extension Web Clipper

The original mentions Obsidian Web Clipper. We built a dedicated Chrome Extension (Manifest V3):

llm_wiki (nashsu/llm_wiki)

Searching Database…

20.7K ·GitHub
Что это такое?LLM Wiki — это кроссплатформенное настольное приложение, которое превращает ваши документы в постоянную базу знаний с перекрёстными ссылками. Вместо того чтобы каждый раз заново выводить ответы с нуля, как в традиционном RAG, LLM постепенно создаёт и поддерживает в актуальном состоянии вики на основе ваших источников.
Это просто ещё один чат-бот на основе RAG?Нет — вместо того чтобы при каждом запросе искать и формировать ответ заново, приложение один раз компилирует постоянную вики (страницы, ссылки, граф знаний) и поддерживает её в актуальном виде; поиск по векторам — лишь необязательное дополнение к поиску по графу и поиску по токенам.
Как начать создавать свою вики?Вы импортируете источники — PDF, документы Office, EPUB/MOBI, файлы Org mode, изображения, веб-клипы, URL-адреса или целые папки — а двухэтапный конвейер ingest приложения читает каждый из них, после чего автоматически создаёт или обновляет соответствующие страницы вики.
Нужен ли мне конкретный провайдер LLM или API-ключ?Модели настраиваются для каждого проекта; можно направлять Chat и Ingest к разным провайдерам, включая любую конечную точку, совместимую с OpenAI, с пользовательскими заголовками. Необязательный векторный поиск тоже работает с любой конечной точкой эмбеддингов, совместимой с OpenAI, через LanceDB.
Обязателен ли семантический или векторный поиск для работы с приложением?Нет, векторный поиск необязателен и по умолчанию выключен; без него система использует поиск по токенам с расширением через граф. По собственному бенчмарку проекта полнота выдачи (recall) падает с 71,4% до 58,2%, когда векторный поиск отключён.
Мои данные вики остаются на моём компьютере?Созданная вики хранится в виде обычных файлов Markdown, совместимых с хранилищами Obsidian, а приложение открывает локальный HTTP API только на 127.0.0.1 для поиска и доступа к навыкам; фактические вызовы LLM отправляются туда, куда вы настроили провайдера модели.
Чем особенен его граф знаний?Страницы связываются по модели релевантности из четырёх сигналов: прямые викиссылки, совпадение общих источников, общие соседи (Adamic-Adar) и близость по типу страниц. Граф отрисовывается с помощью sigma.js и graphology, а кластеры выделяются автоматически алгоритмом обнаружения сообществ Louvain.
Можно ли использовать это внутри Claude Code или Codex?Да — встроенный сервер MCP и готовый навык для агентов можно установить в Claude Code или Codex одной командой (npx skills add ...), что даёт этим агентам гибридный поиск, обход графа и доступ к источникам.
Можно ли сохранять веб-страницы прямо в вики?Да, есть Chrome Web Clipper, который захватывает страницу одним кликом и автоматически импортирует её в базу знаний.
Зачем это создано — основано ли это на чужой идее?Это реализация и расширение шаблона llm-wiki.md Андрея Карпаты: сохраняются трёхслойная архитектура Raw Sources / Wiki / Schema (исходные материалы, вики, схема) и соглашения о викиссылках и метаданных frontmatter, но поверх добавлены полноценный настольный интерфейс, граф знаний, среда выполнения агентов на Rust и постоянная очередь ingest.
Creator
nashsu
Size
39.3 MB
Stars
20.7K
Age
6mo
Commits · 90 Days