# Llm Wiki

> LLM-powered knowledge base from your Claude Code, Codex CLI, Copilot, Cursor & Gemini sessions. Karpathy's LLM Wiki pattern — implemented and shipped.

- **Type:** MCP server
- **Install:** `agentstack add mcp-pratiyush-llm-wiki`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [Pratiyush](https://agentstack.voostack.com/s/pratiyush)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [Pratiyush](https://github.com/Pratiyush)
- **Source:** https://github.com/Pratiyush/llm-wiki

## Install

```sh
agentstack add mcp-pratiyush-llm-wiki
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# llmwiki

> **LLM-powered knowledge base from your Claude Code, Codex CLI, Cursor, Gemini CLI, and Obsidian sessions.**
> Built on [Andrej Karpathy's LLM Wiki pattern](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f).

## 👉 Live demo: **[pratiyush.github.io/llm-wiki](https://pratiyush.github.io/llm-wiki/)**

Rebuilt on every `master` push from the synthetic sessions in [`examples/demo-sessions/`](examples/demo-sessions). No personal data. Shows every feature of the real tool (activity heatmap, tool charts, token usage, model info cards, vs-comparisons, project topics) running against safe reference data.

[](LICENSE)
[](https://www.python.org/)
[](CHANGELOG.md)
[](tests/)
[](https://github.com/Pratiyush/llm-wiki/actions/workflows/ci.yml)
[](https://github.com/Pratiyush/llm-wiki/actions/workflows/link-check.yml)
[](https://github.com/Pratiyush/llm-wiki/actions/workflows/wiki-checks.yml)
[](https://github.com/Pratiyush/llm-wiki/pkgs/container/llm-wiki)
[](https://claude.com/claude-code)
[](https://github.com/openai/codex)
[](https://github.com/features/copilot)
[](https://cursor.com)
[](https://ai.google.dev/gemini-api)
[](https://obsidian.md)

---

Every Claude Code, Codex CLI, Copilot, Cursor, and Gemini CLI session writes a full transcript to disk. You already have hundreds of them and never look at them again.

**llmwiki** turns that dormant history into a beautiful, searchable, interlinked knowledge base — locally, in two commands. Plus, it produces AI-consumable exports (`llms.txt`, `llms-full.txt`, JSON-LD graph, per-page `.txt` + `.json` siblings) so other AI agents can query your wiki directly.

```bash
./setup.sh                         # one-time install
./build.sh && ./serve.sh           # build + serve at http://127.0.0.1:8765
```

**Want LLM-enriched wiki pages from the CLI?** After `./setup.sh`, `llmwiki sync` only fills `raw/`. To populate `wiki/sources/` (semantic summaries), set `synthesis.backend` in `examples/sessions_config.json` (`ollama` for local Ollama, or keep `dummy` for stubs), then run `llmwiki synthesize` or chain it with `llmwiki all --with-synth`. See [docs/modes/api/](docs/modes/api/) and `llmwiki sync --status` for the current backend hint.

```bash
llmwiki sync
llmwiki all --with-synth --graph-engine builtin   # synthesize → build → graph → export → lint
```

**Contributing in one line:** read [`CONTRIBUTING.md`](CONTRIBUTING.md), keep PRs focused (one concern each), use `feat:` / `fix:` / `docs:` / `chore:` / `test:` commit prefixes, never commit real session data (`raw/` is gitignored), no new runtime deps. CI must be green to merge.

## Screenshots

All screenshots below are from the **public demo site** which is built on every `master` push from the dummy example sessions. Your own wiki will look identical — just with your real work.

### Home — projects overview with activity heatmap

### All sessions — filterable table across every project

### Session detail — full conversation + tool calls

### Changelog — renders `CHANGELOG.md` as a first-class page

### Projects index — freshness badges + per-project stats

## What you get

### Human-readable
- **All your sessions**, converted from `.jsonl` to clean, redacted markdown
- **A Karpathy-style wiki** — `sources/`, `entities/`, `concepts/`, `syntheses/`, `comparisons/`, `questions/` linked with `[[wikilinks]]`
- **A beautiful static site** you can browse locally or deploy to GitHub Pages
  - Global search (Cmd+K command palette with fuzzy match over pre-built index)
  - [highlight.js](https://highlightjs.org/) client-side syntax highlighting (light + dark themes)
  - Dark mode (system-aware + manual toggle with `data-theme`)
  - Keyboard shortcuts: `/` search · `g h/p/s` nav · `j/k` rows · `?` help
  - Collapsible tool-result sections (auto-expand > 500 chars)
  - Copy-as-markdown + copy-code buttons
  - Breadcrumbs + reading progress bar
  - Filter bar on sessions table (project/model/date/text)
  - Reading time estimates (`X min read`)
  - Related pages panel at the bottom of every session
  - Activity heatmap on the home page
  - Model info cards with structured schema (provider, pricing, benchmarks)
  - Auto-generated vs-comparison pages between AI models
  - Append-only changelog timeline with pricing sparkline
  - Project topic chips (GitHub-style tags on project cards)
  - Agent labels (colored badges: Claude/Codex/Copilot/Cursor/Gemini)
  - Recently-updated card on the home page
  - Dataview-style structured queries in the command palette
  - Hover-to-preview wikilinks
  - Deep-link icons next to every heading
  - Mobile-responsive + print-friendly

### AI-consumable (v0.4)
Every HTML page has sibling machine-readable files at the same URL:

- `.html` — human HTML with schema.org microdata
- `.txt` — plain text version (no HTML tags)
- `.json` — structured metadata + body

Site-level AI-agent entry points:

| File | What |
|---|---|
| [`/llms.txt`](https://llmstxt.org) | Short index per [llmstxt.org spec](https://llmstxt.org) |
| `/llms-full.txt` | Flattened plain-text dump (~5 MB cap) — paste into any LLM's context |
| `/graph.jsonld` | Schema.org JSON-LD entity/concept/source graph |
| `/sitemap.xml` | Standard sitemap with `lastmod` |
| `/rss.xml` | RSS 2.0 feed of newest sessions |
| `/robots.txt` | AI-friendly robots with llms.txt reference |
| `/ai-readme.md` | AI-specific navigation instructions |
| `/manifest.json` | Build manifest with SHA-256 hashes + perf budget |

Every page also includes an `` HTML comment that AI agents can parse without fetching the separate `.json` sibling.

#### Recipe — query `graph.jsonld` from your terminal

The JSON-LD graph isn't just for crawlers — you can ask quick questions about your wiki without leaving the shell. Example: print every session as a tree, grouped by project:

```bash
python3 examples/scripts/tree_from_graph.py
```

Output:

```
📚 8 sessions across 3 projects
   (site/graph.jsonld v1.3.0)

llmwiki/
├── demo-blog-engine/  (4 sessions)
│   ├── 2026-03-12  scaffolding-the-rust-blog-engine
│   ├── 2026-03-18  adding-syntax-highlighting
│   ├── 2026-03-25  rss-feed-and-sitemap
│   └── 2026-04-01  dark-mode-toggle
├── demo-ml-pipeline/  (2 sessions)
│   ├── 2026-01-20  training-data-pipeline
│   └── 2026-02-02  model-training-loop
└── demo-todo-api/  (2 sessions)
    ├── 2026-02-08  fastapi-project-bootstrap
    └── 2026-02-15  adding-oauth-login
```

The full script is **stdlib-only** at [`examples/scripts/tree_from_graph.py`](examples/scripts/tree_from_graph.py). Same recipe pattern works for any aggregation question — count sessions per model, find the largest project by token usage, list every entity that appears in 3+ sessions, etc. The graph is yours to slice.

### Quality & governance (v1.0)
- **4-factor confidence scoring** — source count, source quality, recency, cross-references; with Ebbinghaus-inspired decay per content-type
- **5-state lifecycle machine** — draft → reviewed → verified → stale → archived with 90-day auto-stale
- **16 lint rules** — 8 structural (frontmatter, link integrity, orphans, freshness, duplicates, index sync…) + 3 LLM-powered (contradictions, claim verification, summary accuracy) + stale_candidates (#51) + tags_topics_convention (#302) + stale_reference_detection (#303) + frontmatter_count_consistency (#378) + tools_consistency (#378)
- **Auto Dream** — MEMORY.md consolidation after 24h + 5 sessions: resolve relative dates, prune outdated, 200-line cap
- **9 navigation files** — CLAUDE.md, AGENTS.md, MEMORY.md, SOUL.md, CRITICAL_FACTS.md, hints.md, hot.md + per-project hot caches

### Obsidian-native experience (v1.0)
- **`link-obsidian` CLI** — symlinks the whole project into an Obsidian vault; graph view + backlinks + full-text search just work
- **Dataview dashboard** — 10 ready-to-use queries (recently updated, by confidence, by lifecycle, by project, by entity type, open questions, stale pages)
- **Templater templates** — 4 templates for source/entity/concept/synthesis pages, seeded with confidence + lifecycle + today's date
- **Category pages** — tag-based index pages in both Dataview (Obsidian) and static markdown (HTML) modes
- **Integration guide** — [`docs/obsidian-integration.md`](docs/obsidian-integration.md) covers 6 recommended plugins with per-plugin configs

### Automation
- **SessionStart hook** — auto-syncs new sessions in the background on every Claude Code launch
- **Auto-build on sync** — `/wiki-sync` triggers `/wiki-build` (configurable; default on)
- **One-shot pipeline** — `llmwiki all` runs build → graph → export → lint in a single command (`--strict` for CI)
- **MCP server** — 12 production tools (query, search, list, read, lint, sync, export, + confidence, lifecycle, dashboard, entity search, category browse) queryable from any MCP client (Claude Desktop, Cline, Cursor, ChatGPT desktop)
- **Pending ingest queue** — SessionStart hook converts + queues; `/wiki-sync` processes queue
- **No servers, no database, no npm** — Python stdlib + `markdown`. Syntax highlighting loads from a highlight.js CDN at view time.

## Tutorial — every command in 90 seconds

A guided tour. Run these in order and you'll have a fully working wiki at `http://127.0.0.1:8765/` by the end. Each command is idempotent and prints what it did.

A scripted recording of the same flow ships at [`docs/videos/cli-tutorial.gif`](docs/videos/cli-tutorial.gif) (31 seconds against an 8-session sandbox). The reproducible source is [`docs/videos/cli-tutorial.tape`](docs/videos/cli-tutorial.tape) — re-render anytime with `vhs docs/videos/cli-tutorial.tape`.

```bash
# 1. One-time scaffold (≈1 sec). Creates raw/, wiki/, site/, seed nav files.
llmwiki init

# 2. Pull in your sessions (≈1 sec / 100 sessions). Walks every adapter
#    that's "available" on this machine (Claude Code, Codex CLI, Cursor,
#    Gemini, Obsidian, Copilot Chat / CLI), converts new .jsonl files to
#    raw/sessions/*.md, then runs build + lint by default.
llmwiki sync

# 3. Compile the static HTML site (≈3 sec on a 500-session corpus).
#    Already runs as part of `sync`; call directly when you're iterating
#    on a wiki/ page and don't need a fresh sync.
llmwiki build

# 4. Browse it locally. Cmd+K opens the search palette; / focuses the
#    filter bar on /sessions/. Press Ctrl+C to stop.
llmwiki serve

# 5. (Optional) Generate the knowledge graph + AI-consumable exports.
#    `all` runs build → graph → export → lint in one shot.
llmwiki graph
llmwiki export all
llmwiki all     # one-shot equivalent of build + graph + export + lint
```

That's the entire happy path. Two more commands you'll reach for occasionally:

```bash
# Inspect what's installed + configured. Prints a per-adapter table:
# (available: yes/no, configured: yes/no, session-store path).
llmwiki adapters

# Lint the wiki. 16 rules — broken wikilinks, orphaned pages, stale
# summaries, duplicate detection, freshness, missing entities, etc.
# Runs as part of `sync` by default; call directly for a one-shot check.
llmwiki lint
```

Three optional flags you'll discover later:

- `--adapter ` — limit `sync` to one adapter (e.g. `--adapter claude_code`)
- `--vault PATH` — write into an Obsidian / Logseq vault overlay instead of `wiki/` (#54)
- `--synthesize` — call out to a local Claude / Ollama backend during `build` for an LLM-generated overview page

Each subcommand has its own `--help` with the rest. The CLI reference table below is the full list.

## How it works

```
┌─────────────────────────────────────┐
│  ~/.claude/projects/*/*.jsonl       │  ← Claude Code sessions
│  ~/.codex/sessions/**/*.jsonl       │  ← Codex CLI sessions
│  ~/Library/.../Cursor/workspaceS…   │  ← Cursor
│  ~/Documents/Obsidian Vault/        │  ← Obsidian
│  ~/.gemini/                         │  ← Gemini CLI
└──────────────┬──────────────────────┘
               │
               ▼   python3 -m llmwiki sync
┌─────────────────────────────────────┐
│  raw/sessions//            │  ← immutable markdown (Karpathy layer 1)
│     2026-04-08-.md            │
└──────────────┬──────────────────────┘
               │
               ▼   /wiki-ingest  (your coding agent)
┌─────────────────────────────────────┐
│  wiki/sources/.md             │  ← LLM-generated wiki (Karpathy layer 2)
│  wiki/entities/.md            │
│  wiki/concepts/.md            │
│  wiki/syntheses/.md           │
│  wiki/comparisons/.md         │
│  wiki/questions/.md           │
│  wiki/index.md, overview.md, log.md │
└──────────────┬──────────────────────┘
               │
               ▼   python3 -m llmwiki build
┌─────────────────────────────────────┐
│  site/                              │  ← static HTML + AI exports
│  ├── index.html, style.css, ...     │
│  ├── sessions//.html │
│  ├── sessions//.txt  │  (AI sibling)
│  ├── sessions//.json │  (AI sibling)
│  ├── llms.txt, llms-full.txt        │
│  ├── graph.jsonld                   │
│  ├── sitemap.xml, rss.xml           │
│  ├── robots.txt, ai-readme.md       │
│  ├── manifest.json                  │
│  └── search-index.json              │
└─────────────────────────────────────┘
```

See [docs/architecture.md](docs/architecture.md) for the full 3-layer Karpathy + 8-layer build breakdown.

## Documentation

Full production documentation lives under [`docs/`](docs/). The editorial
hub is **[`docs/index.md`](docs/index.md)** — tutorials, per-agent guides,
reference, and deployment, all in one place.

**Start here:**

| Goal | Read |
|---|---|
| Install and build your first site in 10 minutes | [Tutorial 01 → 02](docs/tutorials/01-installation.md) |
| Use llmwiki with Claude Code | [Tutorial 03](docs/tutorials/03-use-with-claude-code.md) |
| Use llmwiki with Codex CLI | [Tutorial 04](docs/tutorials/04-use-with-codex-cli.md) |
| Query / lint / review your wiki daily | [Tutorial 05](docs/tutorials/05-querying-your-wiki.md) |
| Point llmwiki at an existing Obsidian / Logseq vault | [Tutorial 06](docs/tutorials/06-bring-your-obsidian-vault.md) |
| See four real end-to-end workflows | [Tutorial 07](docs/tutorials/07-example-workflows.md) |

Contributing to docs? See the **[style guide](docs/style-guide.md)**.

## Install

### macOS / Linux

```bash
git clone https://github.com/Pratiyush/llm-wiki.git
cd llm-wiki
./setup.sh
```

### Windows

```cmd
git clone https://github.com/Pratiyush/llm-wiki.git
cd llm-wiki
setup.bat
```

### With pip (v0.3+)

```bash
pip install -e .                # basic — everything you need
pip install -e '.[graph]'       # + graphifyy AI-powered graph engine
pip install -e '.[dev]'         # + pytest + ruff
pip install -e '.[e2e]'         # + Playwright + pytest-bdd + pytest-html (E2E)
pip install -e '.[all]'         # graph + everything
```

Syntax highlighting is now powered by [highlight.js](https://highlightjs.org/), loaded from a CDN at view time — no optional deps required.

### What setup does

1. Creates `raw/`, `wiki/`, `site/` data directories
2. Installs the `llmwiki` Python package in-place
3. Detects your coding agents and enables matching adapters
4. Optionally offers to install the `SessionStart` hook into `~/.claude/settings.json` for auto-sync
5. Runs a first sync so you see output immediately

## For maintainers

Running the project? The governance scaffold lives under [`docs/maintainers/`](docs/maintainers) and is loaded by a dedicated skill:

| File | What it's for |
|---|---|
| [`CONTRIBUTING.md`](CONTRIBUTING.md) | Short rules for contributors — read this first |
| [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md) | Contributor Covenant 2.1 |
| [`SECURITY.md`](SECURITY.md) | Disclosure process for redaction bugs, XSS, data leaks |
| [`docs/maintainers/ARCHITECTURE.md`](docs/maintainers/ARCHITECTURE.md) | One-page system diagram + layer boundaries + what NOT to add |
| [`docs/maintainers/REVIEW_CHECKLIST.md`](docs/maintainers/REVIEW_CHECKLIST.md) | Canonical code-review criteria |
| [`docs/maintainers/RELEASE_PROCESS.md`](docs/maintainers/RELEASE_P

…

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Pratiyush](https://github.com/Pratiyush)
- **Source:** [Pratiyush/llm-wiki](https://github.com/Pratiyush/llm-wiki)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-pratiyush-llm-wiki
- Seller: https://agentstack.voostack.com/s/pratiyush
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
