nashsu / llm_wiki

nashsu / llm_wiki

LLM Wiki: A personal knowledge base that builds itself. LLM reads your documents, builds a structured wiki, and keeps it current. LLM Wiki:一个能够自我构建的个人知识库。LLM 会读取你的文档,构建结构化的维基,并保持其内容实时更新。


Features / 功能特性

Two-Step Chain-of-Thought Ingest — LLM analyzes first, then generates wiki pages with source traceability and incremental cache. 两步思维链摄入 — LLM 先进行分析,随后生成带有来源可追溯性和增量缓存的维基页面。

Multimodal Image Ingestion — extract embedded images from PDFs, generate factual captions with a vision LLM, surface them in image-aware search results with lightbox preview and jump-to-source. 多模态图像摄入 — 从 PDF 中提取嵌入图像,利用视觉 LLM 生成事实性标题,并在支持图像感知的搜索结果中展示,支持灯箱预览和跳转至源文件。

Multi-format Document Parsing — ingest PDF, Office documents, EPUB/MOBI, Org mode, images, media, web clips, and batches of URLs, with built-in, cloud, or local MinerU PDF processing. 多格式文档解析 — 支持摄入 PDF、Office 文档、EPUB/MOBI、Org mode、图像、媒体、网页剪辑及批量 URL,并内置云端或本地 MinerU PDF 处理功能。

Flexible Model Configuration — configure models per project, route Chat and Ingest independently, and manage custom providers, headers, and streaming output. 灵活的模型配置 — 支持按项目配置模型,独立路由聊天与摄入任务,并管理自定义提供商、请求头及流式输出。

Source-grounded Retrieval — use Read Sources Only mode to answer exclusively from original imported material. 基于来源的检索 — 使用“仅读取来源”模式,确保回答仅基于原始导入的材料。

Project Management & Migration — export and import complete project archives across devices, and rebuild the Wiki index from existing pages. 项目管理与迁移 — 支持跨设备导出和导入完整项目归档,并可根据现有页面重建维基索引。

4-Signal Knowledge Graph — relevance model with direct links, source overlap, Adamic-Adar, and type affinity. 四信号知识图谱 — 包含直接链接、来源重叠、Adamic-Adar 指数和类型亲和力的相关性模型。

Louvain Community Detection — automatic knowledge cluster discovery with cohesion scoring. Louvain 社区发现 — 带有凝聚力评分的自动知识集群发现功能。

Graph Insights — surprising connections and knowledge gaps with one-click Deep Research. 图谱洞察 — 通过一键式深度研究发现意想不到的联系和知识缺口。

Vector Semantic Search — optional embedding-based retrieval via LanceDB, supports any OpenAI-compatible endpoint. 向量语义搜索 — 通过 LanceDB 实现的可选嵌入式检索,支持任何兼容 OpenAI 的端点。

Persistent Ingest Queue — serial processing with crash recovery, cancel, retry, and progress visualization. 持久化摄入队列 — 支持崩溃恢复、取消、重试和进度可视化的串行处理。

Folder Import — recursive folder import preserving directory structure, folder context as LLM classification hint. 文件夹导入 — 递归导入文件夹并保留目录结构,将文件夹上下文作为 LLM 分类的提示。

Source Folder Auto-Watch — detects external changes in raw/sources/ and keeps ingest/delete cleanup in sync. 源文件夹自动监控 — 检测 raw/sources/ 目录下的外部变更,并同步执行摄入/删除清理。

Deep Research — LLM-optimized search topics, multi-query web search via Tavily, SerpApi, or SearXNG, auto-ingest results into wiki. 深度研究 — LLM 优化的搜索主题,通过 Tavily、SerpApi 或 SearXNG 进行多查询网络搜索,并将结果自动摄入维基。

Rust Backend Chat Agent — tool-using chat runtime with wiki/source/graph/web retrieval, workspace file generation, shell approval, cancellation, and streaming tool events. Rust 后端聊天代理 — 具备工具使用能力的聊天运行时,支持维基/来源/图谱/网络检索、工作区文件生成、Shell 命令审批、取消操作及流式工具事件。

Agent Skills — scan and enable local SKILL.md folders, select skills with /skill, and let the Agent read skill instructions on demand. 代理技能 — 扫描并启用本地 SKILL.md 文件夹,通过 /skill 选择技能,并允许代理按需读取技能指令。

Generated Outputs Preview — Agent-created Markdown, HTML, images, and other workspace files appear as outputs with preview and quick folder access. 生成内容预览 — 代理创建的 Markdown、HTML、图像及其他工作区文件以输出形式呈现,支持预览和快速文件夹访问。

Mermaid Diagram Rendering — render Mermaid code blocks directly in chat and preview, with compact syntax-error cards instead of raw parser output. Mermaid 图表渲染 — 直接在聊天和预览中渲染 Mermaid 代码块,并以紧凑的语法错误卡片代替原始解析器输出。

Async Review System — LLM flags items for human judgment, predefined actions, pre-generated search queries. 异步审查系统 — LLM 标记需人工判断的项目,支持预定义操作和预生成搜索查询。

Chrome Web Clipper — one-click web page capture with auto-ingest into knowledge base. Chrome 网页剪辑器 — 一键网页捕获,并自动摄入知识库。

Local HTTP API + MCP Server + AI Agent Skill — built-in 127.0.0.1:19828 JSON API and bundled MCP server for hybrid search, file read, graph traversal, and source rescan; ready-made agent skill installs into Claude Code / Codex with one command (npx skills add …). 本地 HTTP API + MCP 服务器 + AI 代理技能 — 内置 127.0.0.1:19828 JSON API 和捆绑的 MCP 服务器,用于混合搜索、文件读取、图谱遍历和源文件重扫描;现成的代理技能可通过一条命令 (npx skills add …) 安装到 Claude Code / Codex 中。


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 是一款跨平台桌面应用程序,它能自动将你的文档转化为一个有组织、互联的知识库。与传统的 RAG(每次都从头检索并回答)不同,LLM 会根据你的来源增量构建并维护一个持久化的维基。知识只需编译一次并保持更新,无需在每次查询时重新推导。本项目基于 Karpathy 的 LLM Wiki 模式——一种使用 LLM 构建个人知识库的方法论。llm_wiki 由 nash_su 创建并维护,他将这些核心理念实现为一款功能完备且经过重大增强的桌面应用程序。


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. 基础方法论源自 Andrej Karpathy 的 llm-wiki.md,该文档描述了利用 LLM 增量构建和维护个人维基的模式。原始文档是一个抽象的设计模式;本项目则是对其的具体实现,并进行了大量的扩展。

What We Kept from the Original / 我们保留的内容 The core architecture follows Karpathy’s design faithfully: 核心架构忠实于 Karpathy 的设计:

  • Three-layer architecture: Raw Sources (immutable) → Wiki (LLM-generated) → Schema (rules & config) 三层架构:原始来源(不可变)→ 维基(LLM 生成)→ 模式(规则与配置)
  • Three core operations: Ingest, Query, Lint 三个核心操作:摄入、查询、检查(Lint)
  • index.md as the content catalog and LLM navigation entry point index.md 作为内容目录和 LLM 导航入口点
  • log.md as the chronological operation record with parseable format log.md 作为带有可解析格式的时间顺序操作记录
  • [[wikilink]] syntax for cross-references 用于交叉引用的 [[wikilink]] 语法
  • YAML frontmatter on every wiki page 每个维基页面上的 YAML 元数据(frontmatter)
  • Obsidian compatibility — the wiki directory works as an Obsidian vault Obsidian 兼容性——维基目录可直接作为 Obsidian 库使用
  • Human curates, LLM maintains — the fundamental role division 人工策划,LLM 维护——这是基本的角色分工

What We Changed & Added / 我们更改与增加的内容

  1. From CLI to Desktop Application 从 CLI 到桌面应用程序 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: 原始文档是一个抽象的模式文档,旨在复制粘贴给 LLM 代理使用。我们将其构建为功能完备的跨平台桌面应用,具备:

    • Three-column layout: Knowledge Tree / File Tree (left) + Chat (center) + Preview (right) 三栏布局:知识树/文件树(左)+ 聊天(中)+ 预览(右)
    • Icon sidebar for switching between Wiki, Sources, Search, Graph, Lint, Review, Deep Research, Settings 用于切换维基、来源、搜索、图谱、检查、审查、深度研究、设置的图标侧边栏
    • Custom resizable panels — drag-to-resize left and right panels with min/max constraints 自定义可调整面板——支持拖拽调整左右面板大小,并带有最小/最大约束
    • Activity panel — real-time processing status showing file-by-file ingest progress 活动面板——实时处理状态,显示逐文件的摄入进度
    • All state persisted — conversations, settings, review items, project config survive restarts 所有状态持久化——对话、设置、审查项目、项目配置在重启后依然保留
    • Scenario templates — Research, Reading, Personal Growth, Business, General — each pre-configures purpose.md and schema.md 场景模板——研究、阅读、个人成长、商业、通用——每个模板都预配置了 purpose.md 和 schema.md
  2. Purpose.md — The Wiki’s Soul Purpose.md — 维基的灵魂 The original has Schema (how the wiki works) but no formal place for why the wiki exists. We added purpose.md: 原始模式有 Schema(维基如何工作),但没有正式的地方说明维基为何存在。我们增加了 purpose.md:

    • Defines goals, key questions, research scope, evolving thesis 定义目标、关键问题、研究范围、不断演进的论点
    • LLM reads it during every ingest and query for context LLM 在每次摄入和查询时都会读取它以获取上下文
    • LLM can suggest updates based on usage patterns LLM 可以根据使用模式建议更新
    • Different from schema — schema is structural rules, purpose is directional intent 与 Schema 不同——Schema 是结构规则,Purpose 是方向性意图
  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: 原始模式描述的是单步摄入,即 LLM 同时进行读取和写入。我们将其拆分为两个连续的 LLM 调用,从而显著提升了质量:

    • Step 1 (Analysis): LLM reads source → structured… 第一步(分析):LLM 读取来源 → 结构化……