You are maintaining an LLM Wiki (per Karpathy's spec) that compiles the user's Claude Code session history into a structured, interlinked markdown knowledge base.
raw/ IMMUTABLE. Session transcripts converted from ~/.claude/projects/*/*.jsonl.
Flat naming: YYYY-MM-DDTHH-MM-project-slug.md (no subdirectories).
Never modify files here. Treat as source-of-truth for facts.
wiki/ YOU OWN THIS. LLM-generated pages that summarise, cross-reference, and
synthesise the raw layer. All of your writes go here.
index.md Catalog of every page in the wiki. Update on every ingest.
log.md Append-only chronological record of every operation.
overview.md Living synthesis across all sources.
sources/ One summary page per raw source (kebab-case slug).
entities/ People, companies, projects, products (TitleCase.md).
concepts/ Ideas, frameworks, methods, theories (TitleCase.md).
syntheses/ Saved query answers (kebab-case slug).
comparisons/ Side-by-side diffs of two or more entities/concepts (kebab-case slug). [v0.2+]
questions/ First-class open questions with state tracking (kebab-case slug). [v0.2+]
archive/ Deprecated / demoted pages preserved for history. [v0.2+]
site/ GENERATED. Static HTML from `python3 -m llmwiki build`. Do not edit by hand.
| Command | Intent | Workflow |
|---|---|---|
/wiki-sync |
Convert new .jsonl sessions into raw/sessions/ AND ingest them into wiki/ |
Runs python3 -m llmwiki sync, then executes the Ingest Workflow below for each new file |
/wiki-ingest <path> |
Ingest one source or folder | Executes the Ingest Workflow for the given path |
/wiki-query <question> |
Answer a question from the wiki | Executes the Query Workflow below |
/wiki-lint |
Find orphans, broken links, stale pages | Executes the Lint Workflow below |
/wiki-build |
Regenerate the static HTML site | Runs python3 -m llmwiki build |
/wiki-serve |
Start the local HTTP server | Runs python3 -m llmwiki serve |
/wiki-update |
Update one wiki page in place (v0.2+) | Surgical edit of one page without re-ingest |
/wiki-graph |
Build the knowledge graph (v0.2+) | Walks [[wikilinks]] → graph/graph.json + graph.html |
/wiki-reflect |
Higher-order self-reflection over the wiki (v0.2+) | Finds gaps, patterns, and suggests new pages |
Triggered by /wiki-ingest <path> or /wiki-sync.
- Read the source file(s) under
raw/using the Read tool. - Read wiki context —
wiki/index.mdandwiki/overview.md— so you know what's already there. - For each source file, write
wiki/sources/<slug>.mdusing the Source Page Format below.<slug>comes from the YAML frontmatter'sslugfield when present, otherwise from the filename. - Update
wiki/index.md— add the new source under## Sources. - Update
wiki/overview.md— revise the synthesis if the new source adds substantial new information. Don't rewrite for trivia. - Create/update entity pages (
wiki/entities/<Name>.md) for any people, companies, projects, products, tools, libraries mentioned. TitleCase filename. - Create/update concept pages (
wiki/concepts/<Name>.md) for any ideas, patterns, frameworks, or decisions mentioned. - Cross-link everything with
[[wikilinks]]under## Connectionson every page. - Flag contradictions — if a new source contradicts existing wiki content, add a
## Contradictionssection to the affected page and leave BOTH claims visible. Do not silently overwrite. - Append to
wiki/log.mdwith the format:## [YYYY-MM-DD] ingest | <title>
Files under raw/sessions/<YYYY-MM-DDTHH-MM>-<project>-<slug>.md are auto-generated from .jsonl transcripts (flat naming, no subdirectories). They have rich YAML frontmatter (project, slug, started, model, tools_used, gitBranch, etc.). When ingesting these:
- Trust the frontmatter — don't re-infer metadata from the body
- Do NOT copy the Conversation section verbatim — treat it as raw material to summarize
- Create or update a project entity page at
wiki/entities/<ProjectSlug>.mdwith a bulleted session list under## Sessions - Extract decisions — anything the user explicitly locked ("decision locked", "let's go with", "I decided...") goes into
wiki/concepts/ - Extract tools + libraries — every
tools_usedentry and every library mentioned in code previews becomes a potential entity page - If
is_subagent: true— link the page as a child of its parent session rather than a standalone entity
---
title: "Source Title"
type: source
tags: [claude-code, session-transcript]
date: YYYY-MM-DD
source_file: raw/sessions/<YYYY-MM-DDTHH-MM>-<project>-<slug>.md
project: <project-slug>
model: <model-id>
---
## Summary
2–4 sentence synthesis of what the session accomplished.
## Key Claims
- Claim 1
- Claim 2
- Claim 3
## Key Quotes
> "Quote here" — context
## Connections
- [[EntityName]] — how they relate
- [[ConceptName]] — how it connects
## Contradictions
- Contradicts [[OtherPage]] on: ...---
title: "Entity Name"
type: entity # or: concept
tags: []
sources: [source-slug-1, source-slug-2]
last_updated: YYYY-MM-DD
---
# Entity Name
One-paragraph description.
## Key Facts
- Fact 1
- Fact 2
## Sessions
- [[session-slug]] (YYYY-MM-DD) — what happened
## Connections
- [[RelatedEntity]]
- [[RelatedConcept]]Triggered by /wiki-query <question>.
- Read
wiki/index.mdandwiki/overview.mdto identify relevant pages. - (v0.5, #60) Before descending into a folder, read its
_context.mdif one exists (e.g.wiki/entities/_context.md,wiki/concepts/_context.md). The context file is a one- or two-paragraph description of what lives in that folder — use it to decide whether the folder is worth walking into for the current query, and which of its pages to read in full versus skip. This saves context tokens on every deep query. - Use Read on the matching pages.
- Synthesise an answer with inline
[[wikilink]]citations. - If the answer is substantial (3+ paragraphs), ask the user if they want it saved to
wiki/syntheses/<slug>.md. - Append to
wiki/log.mdwith## [YYYY-MM-DD] query | <question>.
Triggered by /wiki-lint.
Use Grep and Read to find:
- Orphan pages — wiki pages with no inbound
[[links]]from any other page. - Broken wikilinks —
[[Name]]pointing to a page that does not exist. - Contradictions — claims that conflict across pages.
- Stale summaries — pages whose
last_updatedis older than the newest source that contributes to them. - Missing entity pages — entities mentioned in 3+ source pages but lacking their own page.
- Data gaps — questions the wiki can't answer; suggest new sources or queries.
- (v0.5, #60) Uncontexted folders — any
wiki/subfolder containing >10.mdfiles that lacks a_context.mdstub. Large knowledge folders without a context description make deep queries more expensive per call — suggest creating a stub that describes what lives there. Usepython3 -c "from llmwiki.context_md import find_uncontexted_folders; from pathlib import Path; print(list(find_uncontexted_folders(Path('wiki'))))"or load the helper directly.
Output a report to the chat. Ask the user if they want it saved to wiki/lint-report.md.
- Source slugs:
kebab-case(matches the raw filename without.md) - Entity pages:
TitleCase.md(e.g.,OpenAI.md,AndrejKarpathy.md) - Concept pages:
TitleCase.md(e.g.,ReinforcementLearning.md,RAG.md) - Synthesis pages:
kebab-case.md
Every section heading carries a (count) of pages in that section. Update the count when adding/removing a page so the index stays scannable past ~50 pages (#387 U6).
# Wiki Index
## Overview (1)
- [Overview](overview.md)
## Sources (N)
- [Source Title](sources/slug.md) — one-line summary
## Entities (N)
- [Entity Name](entities/EntityName.md) — one-line description
## Projects (N)
- [project-slug](projects/project-slug.md) — one-line description
## Concepts (N)
- [Concept Name](concepts/ConceptName.md) — one-line description
## Syntheses (N)
- [Analysis Title](syntheses/slug.md) — what question it answersEach entry starts with ## [YYYY-MM-DD] <operation> | <title> so it's grep-parseable:
grep "^## \[" wiki/log.md | tail -10
Operations: sync, ingest, query, lint, build.
raw/is immutable. Never modify files underraw/. If source data is wrong, fix the converter, not the output. Enforced at runtime as of #326:llmwiki syncrefuses to overwrite an existingraw/file unless you pass--force; failures go into.llmwiki-quarantine.jsonso you can see what didn't sync and why. Non-AI adapters (Obsidian, Jira, Meeting, PDF) are opt-in only — they never fire on a defaultsyncwithout explicitenabled: trueinsessions_config.json.- No silent overwrites. When ingest conflicts with existing wiki content, record both claims under
## Contradictions. - Cross-link everything. Every page should have a
## Connectionssection with at least one[[wikilink]]. - Frontmatter is authoritative. Always fill
title,type,tags,sources(where applicable), andlast_updated. - One commit per page group when publishing to git — match the PR rules in the open-source framework.