English | 中文
A coding agent skill (Node.js/TypeScript version). Drop source documents into raw/ and tell the agent to ingest — it reads them, extracts knowledge, and builds a persistent interlinked wiki. Every new source makes the wiki richer. You never write it.
A Node.js/TypeScript based wiki agent with architectural improvements: shared modules, type safety, and better performance.
💡 Philosophy & Concept: See LLM Wiki Pattern to understand why building a persistent, compounding knowledge base with LLMs is more powerful than query-time RAG.
pnpm dev:ingest raw/papers/attention-is-all-you-need.md
wiki/
├── index.md catalog of all pages — updated on every ingest
├── log.md append-only record of every operation
├── overview.md living synthesis across all sources
├── sources/ one summary page per source document
├── entities/ people, companies, projects — auto-created
├── concepts/ ideas, frameworks, methods — auto-created
└── syntheses/ query answers filed back as wiki pages
graph/
├── graph.json persistent node/edge data (SHA256-cached)
└── graph.html interactive vis.js visualization — open in any browser
Requires: Node.js >= 22.16.0, pnpm
cd llm-wiki-agent-nodejs
pnpm installThe recommended path is to open this repo in a Code Agent IDE and use the built-in skills from the chat window. In that mode, the agent reads AGENTS.md, follows the wiki workflows, and you can operate the whole wiki in plain English without wiring up CLI commands first.
- Open this repository in a Code Agent IDE that supports project instructions and skills, such as Codex, Cursor, OpenCode, or Claude Code.
- In the chat window, ask the agent directly, for example:
ingest raw/AMS项目架构与业务分析报告.md - Continue from chat with commands like
query: what does the wiki say about AMS?,lint, orbuild graph
After the wiki pages are generated, you can open the wiki/ folder as a vault in Obsidian to browse backlinks and the graph view.
Open in any of these agents — no API key setup needed for agent-native use:
| IDE / Agent | Instruction File | Extra Config |
|---|---|---|
| Claude Code | CLAUDE.md |
.claude/commands/ (slash commands) |
| Cursor | AGENTS.md + .cursor/rules/ |
.cursor/rules/*.mdc (project rules) |
| Codex (OpenAI) | AGENTS.md |
— |
| OpenCode | AGENTS.md |
— |
| Antigravity | GEMINI.md + AGENTS.md |
.agent/rules/ (supplementary rules) |
| Gemini CLI | GEMINI.md |
— |
claude # reads CLAUDE.md + .claude/commands/
cursor # reads AGENTS.md + .cursor/rules/
codex # reads AGENTS.md
opencode # reads AGENTS.md
gemini # reads GEMINI.md
# Antigravity reads GEMINI.md → AGENTS.md → .agent/rules/All IDE instruction files reference WIKI_SCHEMA.md — the single source of truth for wiki data model, page formats, and naming conventions. This file is also used by the CLI tools as the prompt schema.
This is the default workflow. Use the chat window and let the agent call the relevant skill/workflow for you.
Tell the agent what you want:
ingest raw/papers/my-paper.md # ingest a source into the wiki
query: what are the main themes? # synthesize answer from wiki pages
lint # find orphans, contradictions, gaps
build graph # build graph.html from all wikilinks
Claude Code also supports slash commands: /wiki-ingest, /wiki-query, /wiki-lint, /wiki-graph.
# Development mode (tsx)
pnpm dev:ingest raw/papers/my-paper.md
pnpm dev:query "what are the main themes?"
pnpm dev:lint
pnpm dev:graph --open
# Build & run compiled
pnpm build
node dist/cli/ingest.js raw/papers/my-paper.mdsrc/
├── shared/ # Shared modules
│ ├── types.ts # All TypeScript interfaces
│ ├── constants.ts # Paths, colors, model names
│ ├── file-utils.ts # readFile, writeFile, appendLog
│ ├── wiki-utils.ts # extractWikilinks, pageNameToPath, allWikiPages
│ └── llm-utils.ts # parseJsonFromResponse, API client
│
├── workflows/ # Four core workflows
│ ├── ingest.ts # Knowledge ingestion
│ ├── query.ts # Knowledge query
│ ├── lint.ts # Health check
│ └── graph.ts # Knowledge graph building
│
└── cli/ # CLI entry points
├── ingest.ts
├── query.ts
├── lint.ts
└── graph.ts
| Aspect | Detail |
|---|---|
| Code reuse | Shared file-utils.ts module |
| Type safety | TypeScript strict mode |
| Model management | constants.ts central config |
| Lint performance | buildPageNameMap() O(1) lookup |
| Project structure | src/{shared,workflows,cli}/ layered logic |
| Code standards | ESLint + Prettier |
| IDE support | Claude Code, Cursor, Codex, Antigravity, Gemini CLI |
- Runtime: Node.js 22.16.0 + TypeScript
- LLM: Anthropic Claude (via
@anthropic-ai/sdk) - Graph: graphology + graphology-communities-louvain + vis.js
- CLI: commander
- Dev tools: ESLint, Prettier, tsx
pnpm typecheck # TypeScript type checking
pnpm lint # ESLint
pnpm format # Prettier formatting
pnpm build # Compile to dist/See the docs/ directory for detailed documentation:
- LLM Wiki Pattern Philosophy — The core idea of compounding knowledge bases vs RAG
- Getting Started — Quick start guide
- IDE Setup Guide — IDE-specific configuration
- Workflows Reference — Detailed workflow documentation
- CLI Reference — Command-line interface usage
- Architecture — System architecture and extension guide
MIT License — see LICENSE for details.
