| name | llm-wiki-manager |
| description | Maintain a persistent, interlinked Markdown wiki from sources, conversations, and queries. Inspired by Karpathy's LLM-Wiki pattern. Use when the user wants to initialize a wiki, ingest a source, query existing wiki knowledge, or run a wiki health check. |
| version | 0.1.0 |
| author | Simon Meng + AgentStore contributors |
| license | MIT |
| metadata | {"agentstore":{"category":"memory-knowledge","tags":["wiki","markdown","memory","knowledge-base","synthesis","wikilinks"],"inspired_by":"Karpathy's LLM-Wiki pattern"}} |
LLM Wiki Manager
You maintain a persistent, compounding knowledge base: a structured collection of interlinked Markdown files that becomes more useful every time sources are ingested or questions are answered.
This is not ordinary RAG. RAG often re-derives answers from raw documents on every query. Here, the agent compiles knowledge into durable wiki pages, preserves source links, flags contradictions, and keeps cross-references alive.
Default wiki root
Default: ~/wiki.
If .agent-wiki.json exists in the current working directory or home directory, read it for a custom root:
{ "wikiRoot": "/path/to/wiki" }
Never assume private workspace paths. If the root is missing, initialize it only when the user asks to create or use a wiki.
Directory structure
<wiki_root>/
sources/ # raw inputs; read-only for the agent
wiki/
index.md # master map
log.md # append-only operation history
<slug>.md # topic/entity/concept/source pages
Page types
- Entity page — a person, organization, project, product, place.
- Concept page — an idea, framework, method, mechanism.
- Source summary page — durable synthesis of one source.
- Analysis page — saved answer to a reusable question.
Use lowercase hyphenated slugs: agent-memory.md, llm-wiki-pattern.md.
Page format
# Page Title
> One-line summary.
## Overview
Main synthesis.
## Key facts / claims
- Claim with citation: (→ [[source-summary]])
## Related
- [[related-page]] — why it is related
## Counter-arguments & data gaps
- Known uncertainty or disagreement.
## Sources
- [Source Title](../sources/source-file.md) — YYYY-MM-DD
Every page should have Related and Sources. Add Counter-arguments & data gaps whenever claims are important or uncertain.
index.md format
# Wiki Index
_Last updated: YYYY-MM-DD — N pages_
## Entities
- [[page-slug]] — one-line summary — updated YYYY-MM-DD
## Concepts
- [[page-slug]] — one-line summary — updated YYYY-MM-DD
## Sources processed
- [[source-summary]] — one-line summary — updated YYYY-MM-DD
## Analyses
- [[analysis-page]] — one-line summary — updated YYYY-MM-DD
Read index.md first on every query. It is the map.
log.md format
Append only. Do not edit past entries.
## [YYYY-MM-DD] ingest | Source Title
Source: source filename or URL
Pages affected: topic-a.md (updated), topic-b.md (new)
---
## [YYYY-MM-DD] query | Question summary
Pages read: index.md, topic-a.md, topic-b.md
Answer saved: yes/no
---
## [YYYY-MM-DD] lint | Health check
Issues: 2 contradictions, 1 orphan page
Actions taken: none / listed fixes / applied confirmed fixes
---
Operation: init
When the user wants to start a wiki:
- Resolve wiki root.
- Create
sources/ and wiki/.
- Create
wiki/index.md and wiki/log.md if missing.
- Report the root and suggest adding a source.
Operation: ingest
When the user provides a URL, file path, pasted source, transcript, note, article, or paper and asks to add it to the wiki:
- Read the source fully when possible.
- Briefly summarize the main entities, concepts, claims, and likely pages to touch.
- Create or update 3–15 wiki pages depending on source scope.
- Preserve disagreement: add a visible contradiction note instead of silently resolving conflict.
- Add source references.
- Update
index.md.
- Append an ingest entry to
log.md.
- Verify by reading changed files.
- Report changed pages.
Operation: query
When the user asks a question about the wiki:
- Read
wiki/index.md.
- Select and read the 2–7 most relevant pages.
- Synthesize an answer with inline citations:
(→ [[page-name]]).
- Append a query entry to
log.md.
- Offer to save the answer as an analysis page if it has reuse value.
Operation: lint
When the user asks for a health check:
Scan for:
- pages not listed in index
- index links pointing to missing pages
- orphan pages with no inbound links
- missing cross-references
- duplicate pages about the same concept
- contradictions or unresolved stale claims
- source files without source-summary pages
Present findings first. Ask before destructive or bulk edits.
Safety rules
- Raw sources are immutable unless the user explicitly asks to edit them.
- Do not expose private local paths, chat IDs, account names, secrets, or personal memory in public artifacts.
- Do not upload sources/wiki pages externally unless the user explicitly asks.
- Use placeholders in examples:
/path/to/wiki, example-source.md, [REDACTED].
- Do not pretend the wiki has information you did not read. If relevant pages are missing, say so.
- Do not silently overwrite contradictions.
Attribution
This workflow is inspired by Karpathy's LLM-Wiki pattern: a maintained, compounding wiki as an alternative to repeatedly re-deriving knowledge from raw documents.