An LLM-maintained personal knowledge graph. Incrementally build a structured wiki of markdown files — reading sources, extracting knowledge, updating pages, and keeping everything connected.
Based on the LLM Wiki pattern by Andrej Karpathy.
MyKG provides tools for AI agents to maintain a persistent knowledge base:
- Universal Skill - General KG operations, ingestion, querying, linting
- Project Skills - Domain-specific instructions for research, reading, personal tracking
Three-layer architecture:
- Raw sources — immutable source documents (papers, articles, transcripts)
- Wiki — LLM-generated pages (entities, concepts, synthesis)
- Schema — configuration telling the LLM how to maintain the wiki
# 1. Install the skill
mkdir -p ~/.opencode/skills/mykg
cp SKILL.md ~/.opencode/skills/mykg/SKILL.md
# 2. Install commands
mkdir -p ~/.config/opencode/command
cp commands/*.md ~/.config/opencode/command//plugin marketplace add https://github.com/Ethics03/kgskill
/plugin install mykg@kgskill
npx skills add https://github.com/Ethics03/kgskill.git
# Copy skills into your .claude folder
cp -r skills/ ~/.claude/skills/
# Copy commands
mkdir -p ~/.claude/commands
cp commands/*.md ~/.claude/commands/The skill and commands are platform-agnostic markdown files. Adapt for your agent:
- Skill file (
SKILL.md) — Load as system instructions or context - Commands (
commands/*.md) — Register as slash commands
The commands are shell scripts wrapped in markdown — extract the bash sections and adapt to your platform.
/kg-init [path] # Create new KG
/kg-setup # Configure existing KG
/kg-init ~/MyKG
Creates:
MyKG/
├── index.md
├── log.md
├── Active.md
├── AGENTS.md
├── raw/
│ ├── articles/
│ ├── papers/
│ └── transcripts/
└── wiki/
├── entities/
├── concepts/
├── synthesis/
└── comparisons/
/kg-ingest raw/articles/my-article.md
The LLM will:
- Read the source
- Extract entities and concepts
- Create/update wiki pages
- Link related pages
- Update index and log
/kg search <term> # Search wiki pages
/kg recent # Recent changes
/kg entities # List entities
/kg concepts # List concepts
/kg-project research-paper-x "Research on quantum computing"
Creates project-specific workspace with custom SKILL.md.
| Command | Description |
|---|---|
/kg-setup |
Configure KG path |
/kg-init [path] |
Initialize new KG |
/kg-project <name> |
Create project workspace |
/kg-ingest <source> |
Ingest source into wiki |
/kg-lint |
Health check wiki |
/kg recent |
Recent changes |
/kg search <term> |
Search wiki |
/kg entities |
List entity pages |
/kg concepts |
List concept pages |
/kg active |
Current focus items |
KG path resolved in order:
MYKG_PATHenvironment variable~/.config/mykg/configfile- Common locations:
~/MyKG,~/Dev/Obsidian/MyKG
Read source → extract knowledge → update wiki:
- Create summary page
- Extract entities (people, orgs, tools)
- Extract concepts (ideas, topics, themes)
- Note contradictions with existing pages
- Update index and log
Search wiki → synthesize answer → cite sources:
- Read index to find relevant pages
- Drill into specific pages
- Synthesize with
[[citations]] - Optionally save answer as new page
Health check the wiki:
- Orphan pages (no inbound links)
- Contradictions between pages
- Missing cross-references
- Stale claims
- Gaps to investigate
kgskills/
├── .claude-plugin/plugin.json # Claude Code plugin manifest
├── SKILL.md # Universal skill
├── commands/ # Slash commands
├── skills/mykg/ # Plugin skill entry (symlink to SKILL.md)
├── templates/kg-init/ # New KG scaffold
├── project-templates/init/ # New project scaffold
└── docs/
├── concepts.md
└── examples.md
Loaded once. Teaches the agent:
- KG structure and conventions
- Ingest, query, lint operations
- Standard page types
- Wikilink syntax
Loaded per-project. Contains:
- Domain-specific page types
- Custom ingestion workflows
- Domain terminology
- Project-specific formatting
Example:
MyKG/
├── index.md
├── raw/
├── wiki/
├── ProjectA/
│ ├── SKILL.md # "Research paper on X"
│ ├── raw/papers/
│ └── wiki/
└── ProjectB/
├── SKILL.md # "Reading The Lord of the Rings"
├── raw/chapters/
└── wiki/
- Raw: papers, articles, transcripts
- Wiki: paper summaries, researcher entities, concept synthesis
- Use: track evolving thesis across sources
- Raw: chapter notes
- Wiki: characters, themes, plot threads
- Use: build companion wiki as you read
- Raw: journal entries, health data
- Wiki: patterns, insights over time
- Use: self-knowledge accumulation
- Obsidian Web Clipper — save web articles as markdown
- Graph view — see wiki structure, find orphans
- Git repo — version history for free
- Good answers → wiki pages — queries compound knowledge too
Install skills from kepano/obsidian-skills for enhanced mykg workflows:
| Skill | Benefit |
|---|---|
obsidian-markdown |
Correct wikilink, frontmatter, and callout syntax when writing wiki pages |
obsidian-cli |
Open and search notes directly when the KG lives in an Obsidian vault |
defuddle |
Clean markdown extraction from URLs when ingesting web sources |
This pattern is inspired by Andrej Karpathy's approach to knowledge management. His insight was that knowledge bases should be living artifacts that grow with you — not static repositories that rot.
The insight: LLMs are great at the tedious work — touching 15 files in one pass, maintaining consistency, updating cross-references. They don't get bored.
I extended this with project-specific customization. A research project needs different entity types than reading a novel. The two-tier skill system lets each project have its own domain model while sharing the universal infrastructure.
This is for people who want a knowledge base that grows with them — that compounds knowledge rather than just storing it.
Credit: The core structure and philosophy come from Karpathy's work. I adapted it with the two-tier skill system for project-specific customization.
MIT