# LLM Wiki

> Maintain a persistent, compounding LLM-maintained markdown wiki for daily AI conversations and sources. Use when the user asks to 沉淀/记录/归档/整理 AI 对话、更新或查询 llm_wiki、ingest a source into the wiki, file an answer back into the knowledge base, run wiki lint/health checks, or apply Karpathy's LLM Wiki pattern to personal/team/research notes.

- Skill: `myersguo/llm-wiki` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add myersguo/llm-wiki`
- Raw SKILL.md: https://api.skillmd.com/api/skills/myersguo/llm-wiki/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: myersguo (https://skillmd.com/u/myersguo)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/myersguo/llm-wiki

---


# LLM Wiki

Use this skill to maintain a persistent wiki that compounds knowledge from AI conversations and curated sources.

## Wiki root

Resolution order (used by all scripts):

1. `--root <path>` CLI flag
2. `LLM_WIKI_ROOT` environment variable
3. `$HOME/.llm-wiki` (default)

Set `LLM_WIKI_ROOT` once per shell/session if you want a non-default location, e.g. `export LLM_WIKI_ROOT=/path/to/wiki`.

## Core model

Follow the LLM Wiki pattern: raw sources are immutable, the wiki is LLM-maintained markdown synthesis, and `AGENTS.md` is the operating schema. Prefer compiling knowledge into maintained pages over leaving it trapped in chat history.

Read `references/karpathy-pattern.md` when you need the rationale or operation details. Use scripts without reading them unless they fail or need changes.

## Directory contract

- Raw layer: `raw/conversations/`, `raw/sources/`, `raw/assets/`; never rewrite existing raw files except to fix a capture error from the current turn.
- Wiki layer: `wiki/index.md`, `wiki/log.md`, and categorized pages under:
  - `wiki/topics/` for durable concepts and factual knowledge
  - `wiki/workflows/` for repeatable procedures and playbooks
  - `wiki/tools/` for tools, commands, products, APIs, libraries
  - `wiki/decisions/` for explicit choices, tradeoffs, and rationale
  - `wiki/sessions/` for notable conversation/session summaries
  - `wiki/sources/` for source-document summaries
  - `wiki/questions/` for open questions and investigation backlog
- Schema layer: `AGENTS.md`; update it only when the wiki operating convention changes.

## Workflows

### Bootstrap or repair structure

Run:

```bash
python3 scripts/bootstrap_llm_wiki.py            # uses $LLM_WIKI_ROOT or ~/.llm-wiki
python3 scripts/bootstrap_llm_wiki.py --root /custom/path
```

This creates missing directories and starter `AGENTS.md`, `wiki/index.md`, and `wiki/log.md` without overwriting existing files.

### File a conversation or answer

1. Capture the raw source first. If the user asks to file the current conversation, write a short raw transcript/summary to `raw/conversations/YYYY-MM-DD-short-title.md`. If ingesting an external source, put or preserve it under `raw/sources/` and summarize it in `wiki/sources/`.
2. Extract durable knowledge, not just a chat summary. Separate: facts/concepts, workflows, tool notes, decisions, open questions, and session context.
3. Update existing pages before creating new pages. Create a new page only for a durable topic likely to be referenced again.
4. On each touched wiki page, include a concise `Evidence` or `Sources` section linking back to raw conversation/source files or source summary pages.
5. Maintain cross-links between related pages using relative markdown links.
6. Update `wiki/index.md` with each created or materially changed page and one-line summary.
7. Append exactly one chronological entry to `wiki/log.md` using `## [YYYY-MM-DD HH:MM] <operation> | <title>`.
8. Run the lint script and fix issues caused by this update.

### Answer from the wiki

1. Read `wiki/index.md` first.
2. Read only the relevant pages and, when needed, their linked evidence.
3. Answer with citations to wiki pages or raw/source files.
4. If the answer produces reusable synthesis, ask or decide (for low-risk cases) to file it back into the wiki as a new or updated page.

### Lint / health check

Run:

```bash
python3 scripts/lint_llm_wiki.py                 # uses $LLM_WIKI_ROOT or ~/.llm-wiki
python3 scripts/lint_llm_wiki.py --root /custom/path
python3 scripts/lint_llm_wiki.py --strict        # treat warnings as errors (CI mode)
```

Fix broken links, missing index entries, stale contradictions, orphan pages, and uncategorized knowledge that matter for actual use. Do not churn wording or formatting just to make pages look uniform.

## Page conventions

Use frontmatter for wiki pages except `index.md` and `log.md`:

```yaml
---
title: Page Title
category: topics|workflows|tools|decisions|sessions|sources|questions
status: active|draft|archived
created: YYYY-MM-DD
updated: YYYY-MM-DD
---
```

Keep pages concise and maintainable:

- Start with a 2-5 bullet `Summary`.
- Add `Details` only when useful.
- Add `Links` for related wiki pages.
- Add `Evidence`/`Sources` for raw backing material.
- Mark contradictions explicitly instead of silently replacing claims: `Conflict: ...` with links to both sources.

## Constraints

- Do not overwrite raw sources.
- Do not invent citations or source links.
- Do not create broad abstractions for one-off notes; prefer a session page plus index/log entry.
- Keep every edit traceable to the user request or the current ingest/query/lint workflow.

