← back to Knowledge Layer Skill
README.md
54 lines
# knowledge-layer-skill
A Claude Code **skill** that builds and maintains an **AI Knowledge Layer** — a
plain-directory, LLM-compiled wiki (the Karpathy / "gBrain" pattern) that agents
read *first* before any task. No RAG, no vector database: the LLM reads curated
sources once and compiles them into typed, cross-referenced, contradiction-aware
entries. The **structure is the index**.
> Pattern credit: Andrej Karpathy's LLM knowledge-base workflow, and Shann
> Holmberg ([@shannholmberg](https://x.com/shannholmberg)), who popularized the
> "gBrain" / AI-Knowledge-Layer framing.
## Layout
```
knowledge-layer-skill/ ← this git repo
└── knowledge-layer/ ← the skill package (symlinked into ~/.claude/skills/)
├── SKILL.md ← metadata + workflow
├── scripts/ ← stdlib-only Python 3, $0 to run
│ ├── kl_init.py ← scaffold a new knowledge layer
│ ├── kl_scan.py ← incremental compile work-list (content-hash diff)
│ ├── kl_query.py ← read-first retrieval (keyword/frontmatter, no vectors)
│ └── kl_status.py ← health report (drift / contradictions / orphans)
├── references/
│ ├── compile-protocol.md ← the exact LLM compile procedure
│ └── wiki-principles.md ← "a layer you keep vs. one you abandon"
└── assets/template/ ← seed docs copied into each new layer
```
## Quick start
```bash
cd knowledge-layer
python3 scripts/kl_init.py mybrain # scaffold
# … drop sources into mybrain/sources/ …
python3 scripts/kl_scan.py mybrain # what changed?
# … compile per references/compile-protocol.md, then:
python3 scripts/kl_scan.py mybrain --commit
python3 scripts/kl_query.py "some question" mybrain --print
python3 scripts/kl_status.py mybrain # health
```
## Install as a skill
The package is symlinked into `~/.claude/skills/knowledge-layer` so Claude Code
discovers it. To install elsewhere, symlink or copy the `knowledge-layer/`
folder into any `skills/` directory, or run
`skill-creator/scripts/package_skill.py knowledge-layer` to produce a
distributable `.zip`.
## License
MIT — see `LICENSE`.