/karpathy:karpathy-wikifrom karpathy
Build, maintain, query, and health-check a local repo wiki / LLM knowledge base for coding agents. Use when the user says "/karpathy:wiki", "/karpathy wiki", "karpathy wiki", asks to set up a repo wiki, asks a repo question that should use a wiki first, wants a task brief before coding, wants wiki updates after code changes, or asks for wiki doctor/lint/health. Implements an OKF-compatible Markdown knowledge bundle under knowledge/wiki with citations to source files, task briefs, surgical updates, and optional advisory stale-wiki reminders.
Ships in karpathy. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Maintain a local Markdown repo wiki that helps coding agents orient before editing. The wiki is an LLM-maintained knowledge layer, not a replacement for source code.
/karpathy:wiki or the human phrase
/karpathy wiki.scripts/wiki_tool.py as an internal helper for the agent. Do not make
the user run helper commands during normal setup, question, task brief,
update, or doctor flows. Run the helper yourself, then report the result in
plain language./karpathy wiki as a slash command, tell the user to
use /karpathy:wiki or type karpathy wiki as plain text. Do not invent a
second command family.knowledge/raw/; repo code stays authoritative through
path and commit citations.CLAUDE.md, AGENTS.md, .cursor/rules, or other
agent instruction / memory files.Resolve bundled resources relative to this SKILL.md. Use
scripts/wiki_tool.py for deterministic repo/wiki operations.
/karpathy:wiki is the product. wiki_tool.py is plumbing.
The skill can dogfood itself by writing local improvement notes when real usage exposes reusable product lessons. This is for local learning, not telemetry.
Use knowledge/outputs/wiki-improvements.md as the default append-only log.
When writing through the helper, run internally:
python3 <skill-dir>/scripts/wiki_tool.py note-improvement --repo . --title "<short title>" --body "<observation>" --suggestion "<suggested skill change>" --evidence "<path>" --tag "<tag>"
Write an improvement note only when the run reveals a reusable problem or opportunity in the karpathy-wiki skill itself, such as:
Do not write improvement notes for ordinary repo facts, user preferences, raw transcripts, secrets, personal data, or large source excerpts. Keep entries short and actionable: observation, evidence path(s), and a concrete suggested skill change. Never stage or commit the improvement log automatically.
Scaling rule: keep this local by default. If more users adopt the skill, collect these notes only through an explicit export or issue-filing flow; do not add background network upload or cross-user aggregation.
Create and maintain this structure:
knowledge/
raw/
tickets/
screenshots/
external-docs/
wiki/
index.md
log.md
components/
workflows/
invariants/
decisions/
tests/
recipes/
failure-modes/
.karpathy-wiki.json
outputs/
task-briefs/
qa-reports/
diagrams/
rules.md
The wiki should be OKF-compatible Markdown with YAML frontmatter. Use these
concept types: Component, Workflow, Invariant, Decision,
Test Surface, Task Recipe, and Failure Mode.
Supported frontmatter subset for the helper script:
type, title, description, resource, timestamp,
source_commit, confidencetags: [auth, security], verified_by: ["npm test"]type, title, description, timestampThe manifest at knowledge/wiki/.karpathy-wiki.json is generated from concept
frontmatter and citations. It contains version, generated_at,
source_commit, wiki_root, concept_count, concepts, and source_map.
Do not edit the manifest manually; regenerate it with refresh-manifest.
doctor reports when the saved manifest is stale, but it does not rewrite it.
Raw ingest is only for non-Git sources: tickets, screenshots, external docs,
meeting notes, transcripts, pasted user context, and other material that lacks
repo history. Use raw records to preserve external evidence, then cite raw IDs
from wiki concepts as raw:<source_id> or in raw_source / raw_sources
frontmatter.
Run raw helper commands internally when needed:
python3 <skill-dir>/scripts/wiki_tool.py raw-add --repo . --kind <kind> --title <title> --body-file <path> --json
python3 <skill-dir>/scripts/wiki_tool.py raw-correct --repo . --source-id <id> --body-file <path> --json
python3 <skill-dir>/scripts/wiki_tool.py raw-redact --repo . --source-id <id> --reason "<reason>" --json
python3 <skill-dir>/scripts/wiki_tool.py raw-show --repo . --source-id <id> --json
Do not expose these as public slash commands. Summarize helper results to the user. Corrections create new records that supersede older raw IDs. Redaction is the safety exception: it may replace stored body content when secrets or personal data slipped into a raw record.
Before turning external or repo source material into concept text, run the read-only compile planner internally:
python3 <skill-dir>/scripts/wiki_tool.py compile-plan --repo . --source <git-tracked-file-or-directory> --json
python3 <skill-dir>/scripts/wiki_tool.py compile-plan --repo . --source-id <raw-source-id> --json
Use the output to name the exact source paths, candidate concepts, and questions
the semantic wiki edit must answer. The helper does not generate claims; the
agent must read the bounded source unit and write cited wiki prose. If a concept
needs more than one source unit, do multiple compile passes and cite each unit
explicitly.
If source_truncated is true, treat source_paths as a partial bounded set:
compile that set first, then run additional compile passes for the remaining
source files instead of implying the directory was fully covered.
Internally run:
python3 <skill-dir>/scripts/wiki_tool.py status --repo . --json
Use the result to choose a mode:
setup_state is missing or incomplete-setup, or the user
says setup/init.setup_state is needs-starter-concepts.If status reports no wiki, incomplete setup, or no starter concepts and the user asked a question or task, explain that the wiki must be finished first and ask whether to set it up or add starter concepts.
Mode precedence:
?, starting with how/why/what/where/when/who, or asking
for explanation are questions.Say what will be created under knowledge/. If the user explicitly asked to
set up the wiki, this is enough context to proceed with wiki file writes. If
setup is inferred from an ambiguous request, ask one clarifying question.
Run internally:
python3 <skill-dir>/scripts/wiki_tool.py init --repo .
Read the repo's high-signal files: README*, package/build config, docs,
tests, and obvious source entry points.
Start with the read-only scan and concept-plan helpers:
python3 <skill-dir>/scripts/wiki_tool.py scan --repo . --json
python3 <skill-dir>/scripts/wiki_tool.py concept-plan --repo . --json
When recent Git history is available and starter page choice is not obvious, use history as an additional read-only ranking signal:
python3 <skill-dir>/scripts/wiki_tool.py concept-plan --repo . --json --include-history
Create only a small starter wiki in the same flow:
knowledge/wiki/index.md with repo overview, known commands, and links.knowledge/wiki/log.md with the setup entry.read files.Run refresh-manifest and doctor internally. Report whether doctor is
clean and how many concepts are indexed.
Ask whether to enable automation:
If the user chooses stale reminders, ask approval, then run:
python3 <skill-dir>/scripts/wiki_tool.py install-hook --repo .
If the user explicitly chooses strict stale reminders, ask approval and run:
python3 <skill-dir>/scripts/wiki_tool.py install-hook --repo . --strict
Git hooks must stay non-semantic: they can remind or block in strict mode, but they must not run an LLM update, edit wiki pages, stage files, or change agent instruction files. Do not run deep graph/index lint from hooks; keep that in doctor mode.
Agent-instruction setup is proposal-only. If CLAUDE.md, AGENTS.md, or rule
files exist, offer this snippet, but do not edit unless the user approves:
## Repo Wiki
Use /karpathy:wiki before non-trivial code changes to orient on relevant
components, invariants, tests, and risks. You can also type "karpathy wiki" as
plain text. If code changes affect documented
concepts, update the affected wiki pages before finishing. Treat the wiki as
advisory: read cited source files before editing, and keep changes surgical.
Do not stage or commit those instruction files.
Use this when status reports setup_state: needs-starter-concepts. The
scaffold is healthy, but the wiki is not useful yet.
Run or reuse scan output:
python3 <skill-dir>/scripts/wiki_tool.py scan --repo . --json
python3 <skill-dir>/scripts/wiki_tool.py concept-plan --repo . --json
If static repo shape alone does not make the top 2-5 pages clear, also run:
python3 <skill-dir>/scripts/wiki_tool.py concept-plan --repo . --json --include-history
Use concept-plan candidates as concrete options, not as generated content
or a mandate. History-aware scores, evidence, and acceptance queries help
prioritize what to inspect, but they are not wiki content.
Read each chosen candidate's read files before writing claims. Use
starter_candidates only as the simpler fallback when the concept plan
finds nothing useful.
Propose 2-5 small concept pages. Prefer:
If the user explicitly asked for setup or starter concepts, create only the proposed pages after briefly listing them. If the intent is ambiguous, ask whether to create the starter concepts. Do not create every candidate in the plan just because it was detected.
Create the agreed concept pages yourself, then run internally:
python3 <skill-dir>/scripts/wiki_tool.py refresh-manifest --repo .
python3 <skill-dir>/scripts/wiki_tool.py doctor --repo .
Stop after the starter set is useful. Do not grow the wiki into a broad repo summary during this pass.
Search the wiki:
python3 <skill-dir>/scripts/wiki_tool.py search --repo . --limit 8 "<question>"
Read the top matching concepts and their cited source files.
Search results include resources and confidence; prioritize high
confidence concepts with concrete resources.
Answer from the wiki first, then source where needed.
Include citations to concept pages and source files.
If the wiki appears stale or thin, say so and propose a focused update.
Do not make implementation claims from the wiki alone. Read the cited source before claiming how code currently behaves.
knowledge/outputs/task-briefs/<slug>.md.# Task Brief: <task>
## Likely Files
- <file> - <why>
## Relevant Concepts
- [Concept](../../wiki/<path>.md) - <why it matters>
## Invariants
- <rule to preserve, with citation>
## Risks
- <likely mistake or ambiguity>
## Verification
- <test/typecheck/lint/build command>
## Source Check
- Read the cited source files before editing. The wiki narrows the search; it is
not the authority.
End by asking whether to proceed with coding if the user has not already asked for implementation.
Use this when status reports changed files that map to concept pages.
Run the read-only update planner:
python3 <skill-dir>/scripts/wiki_tool.py update-plan --repo . --scope all --json
Read the changed files and affected concept pages.
Propose the smallest wiki edits that make those concept pages current.
If the user invoked update mode or asked to update the wiki, make those
minimal edits after listing the affected wiki files. If /karpathy:wiki
inferred update mode from repo state with no explicit update request, ask
before editing.
Update only affected wiki files and append log.md.
Re-run doctor or status.
Do not rewrite unrelated wiki pages. If changed files do not map to concepts,
say no wiki update is required and recommend adding a concept only if the
change introduced a durable new component, invariant, workflow, or test surface.
Never auto-stage wiki changes. Never update CLAUDE.md, AGENTS.md, or rule
files as part of an update pass.
Run:
python3 <skill-dir>/scripts/wiki_tool.py doctor --repo .
Report:
source_commit, uncited
concepts, unreachable concept pages, unresolved raw source IDs, stale
manifests, and stale changed-file mappings.Favor minimal repair: fix a link, add a missing frontmatter field, refresh the manifest, or mark low-confidence content. If the user explicitly asked for doctor fixes, apply minimal wiki-file repairs after listing them. Ask before larger semantic rewrites, Git hooks, or agent instruction edits.
/karpathy:wiki in a repo with no wiki: setup mode. Explain the
knowledge/ structure, run the helper internally, read high-signal sources,
then create a small cited starter wiki if setup was explicitly requested or
accepted./karpathy:wiki after init but before concept pages: starter concepts
mode. Say the scaffold is healthy but empty, propose 2-5 cited pages from
scan, write the accepted starter pages yourself, then refresh the manifest and
run doctor internally./karpathy wiki add trial expiration handling: task brief mode. Search the
wiki, read cited source files, return likely files, invariants, risks, and
verification commands with citations.karpathy wiki how does auth work?: question mode. Search concepts, read
resources, answer from wiki first and source second, with stale/thin warnings
when needed./karpathy:wiki after a diff: update mode. Run update-plan internally,
read only the changed files and affected concepts, then make or propose the
smallest wiki edits depending on whether update intent was explicit./karpathy:wiki doctor: doctor mode. Report broken links, stale manifest,
missing frontmatter, missing citations, and proposed minimal fixes./karpathy:wiki auth: ambiguous. If answering is safe and read-only, treat it
as a question. If the next step would write files, ask whether the user wants
a task brief, update, or health check.Use this compact template for concept pages:
---
type: Component
title: Example Component
description: One sentence describing what this owns.
resource: ../../../src/example.ts
tags: [example]
timestamp: 2026-06-19T00:00:00Z
source_commit: abc123
confidence: medium
verified_by: ["npm test"]
---
# Role
# Public Surface
# Invariants
# Depends On
# Common Changes
# Citations
[1] [source](../../../src/example.ts)
Use the right type for the page. Keep claims short, cited, and useful for a
future coding agent.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
5 skills in this plugin
/karpathy-auditAudit a CLAUDE.md, AGENTS.md, .cursor/rules file, or other AI-agent instruction/memory file against Andrej Karpathy's four LLM-coding principles. Checks two things: whether the file tells the agent to follow the principles (coverage), and whether the file itself earns its context budget - lean, unambiguous, current, contradiction-free, well-layered, and sized for every model that reads it (quality). Use this whenever the user wants to review, audit, critique, tighten, clean up, or improve a CLAUDE.md / AGENTS.md / .cursor/rules / agent memory file, says "karpathy audit" or "/karpathy:audit", asks to configure or set up Karpathy audit checks, asks whether their agent instructions are any good, or wants to apply Karpathy or vibe-coding guidelines to a project. Trigger even if they just say "check my CLAUDE.md" without naming Karpathy./karpathy-diffReview an in-progress code change (a git diff) against Andrej Karpathy's principles before you commit or accept it. Catches scope creep, collateral file edits, drive-by refactors, reformatting, deletions of code or comments the task never called for, over-engineered new code, and missing verification. Use this whenever the user wants to review a diff or their changes, check whether a change is safe to commit or accept, asks "did the agent touch anything it shouldn't", "review my changes", "check this before I commit", says "karpathy diff" or "/karpathy:diff", or has just had an agent make a batch of edits. Trigger before commits and after agent-made edits even if the user doesn't mention Karpathy.npx claudepluginhub jokim1/karpathy-skills --plugin karpathy