llmwiki-cli

A CLI tool for LLM agents to build and maintain personal knowledge bases.
Inspired by Andrej Karpathy's LLM Wiki.
Overview
The CLI is the hands -- it reads, writes, searches, and manages wiki files. The LLM is the brain -- it decides what to create, update, and connect.
LLM Agent (Claude Code / Codex)
|
| shells out to:
| $ wiki init my-wiki --domain "machine learning"
| $ wiki write wiki/concepts/attention.md <<'EOF' ... EOF
| $ wiki index add "concepts/attention.md" "Overview of attention"
| $ wiki search "scaling laws"
| $ wiki lint
| $ wiki commit "ingest: attention paper"
| $ wiki push
|
v
wiki CLI (pure filesystem + git)
|
v
Wiki Repo (markdown files + .git + GitHub)
Key principle: The CLI never calls any LLM API. It is a pure filesystem + git tool.
Install
npm install -g llmwiki-cli
This gives you two commands: wiki (primary, 4 chars) and llmwiki (fallback if wiki conflicts).
Quick Start
wiki init my-wiki --name "My Notes" --domain "research"
wiki write wiki/concepts/attention.md <<'EOF'
---
title: Attention Mechanism
created: 2025-01-20
tags: [transformers, NLP]
---
The attention mechanism allows models to focus on relevant parts of the input.
See also [[transformers]] and [[self-attention]].
EOF
wiki index add "concepts/attention.md" "Overview of attention mechanisms"
wiki log append ingest "Attention mechanism page"
wiki search "attention"
wiki lint
wiki commit "ingest: attention mechanism"
Wiki Structure
When you run wiki init, it creates:
my-wiki/
├── .git/
├── .llmwiki.yaml # Wiki config
├── SCHEMA.md # Instructions for LLM agents
├── raw/ # Immutable source documents
│ └── assets/ # Downloaded images
└── wiki/ # LLM-generated pages
├── index.md # Master index of all pages
├── log.md # Chronological activity log
├── entities/ # People, orgs, products
├── concepts/ # Ideas, frameworks, theories
├── sources/ # One summary per ingested source
└── synthesis/ # Cross-cutting analysis
Commands
Wiki Management
wiki init [dir] --name <name> --domain <domain>
wiki registry
wiki use [wiki-id]
Reading & Writing
wiki read <path>
wiki write <path>
wiki append <path>
wiki list [dir] [--tree] [--json]
wiki search <query> [--limit N] [--all] [--json]
Index & Log
wiki index show
wiki index add <path> <summary>
wiki index remove <path>
wiki log show [--last N] [--type T]
wiki log append <type> <message>
wiki commit [message]
wiki history [path] [--last N]
wiki diff [ref]
Health & Links
wiki lint [--json]
wiki links <path>
wiki backlinks <path>
wiki orphans
wiki status [--json]
GitHub Sync
wiki auth login
wiki auth status
wiki auth logout
wiki repo list [--all] [--filter]
wiki repo create <name> [--domain] [--public]
wiki repo clone [name] [--dir]
wiki repo connect [wiki-id]
wiki push
wiki pull
wiki sync
How LLM Agents Use This
The generated SCHEMA.md in each wiki contains complete instructions. Here are the typical workflows:
Ingest a Source
wiki write raw/paper.md <<'EOF'
<paste full text of paper>
EOF
wiki write wiki/sources/attention-paper.md <<'EOF'
---
title: Attention Is All You Need
created: 2025-01-20
tags: [transformers, attention, NLP]
source: https://arxiv.org/abs/1706.03762
---
Summary of the attention paper...
Links to [[transformers]] and [[self-attention]].
EOF
wiki index add "sources/attention-paper.md" "Attention Is All You Need (2017)"
wiki log append ingest "Attention paper"
wiki commit "ingest: attention paper"
Answer a Question
wiki search "attention mechanism"
wiki read wiki/concepts/attention.md
wiki links wiki/concepts/attention.md
wiki log append query "How does multi-head attention work?"
Maintain Wiki Health
wiki lint
wiki orphans
wiki status
wiki commit "maintenance: fix lint issues"
Sync to GitHub
wiki auth login
wiki repo create research
wiki push
wiki sync
Multi-Wiki Support
The CLI supports multiple wikis via a global registry at ~/.config/llmwiki/:
wiki init ~/wikis/ml --name ml --domain "machine learning"
wiki init ~/wikis/personal --name personal --domain "personal notes"
wiki registry
wiki use ml
wiki --wiki personal read wiki/index.md
wiki search "neural networks" --all
Wiki resolution order: --wiki flag > cwd .llmwiki.yaml > walk up directories > registry default.
Requirements
- Node.js >= 18 (or Bun)
- Git (optional but recommended for version control)
Development
git clone https://github.com/doum1004/llmwiki-cli
cd llmwiki-cli
bun install
bun test
bun run build
bun run dev -- --help
License
MIT