Fans the karpathy-graph pipeline across parallel agents that share the graph as memory. Useful for large-scale graph construction over hundreds of documents or a whole codebase.
Ships in karpathy-graph. 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.
None: SKILL.md is the whole skill.
Scale out only when the work is genuinely parallel and the reducer is defined before fan-out. More agents without a reducer produces activity, not progress.
The graph is what makes the swarm coherent: workers write findings as structured updates, and a synthesizer traverses the graph to combine them even though no single worker saw all the sources.
Answer all six. If any answer is missing, do not fan out yet.
Give each worker a unit that stands alone: one document, one module, one incident, one hypothesis. Never split a single document across workers — provenance blurs and neither worker sees enough context to resolve entities.
Overlap is not free. Two workers on the same source produce two surface forms of every entity, and stage 2 has to clean it up.
Workers never touch graph files. They return payloads. The orchestrator validates and applies them. That is what keeps the orchestrator's context clean — it never reads a worker transcript, only structured updates.
Worker output:
{
"run_id": "run_007",
"agent_id": "extractor-07",
"nodes": [{"type": "Source", "name": "doc-07.md"}, "…"],
"edges": [{"predicate": "SUPPORTS", "source": "doc-07.md", "target": "…"}]
}
Orchestrator applies it:
KG="${CLAUDE_PLUGIN_ROOT:-plugins/karpathy-graph}/scripts/kgraph.py"
python3 "$KG" --name "<graph>" --run-id run_007 ingest @worker-07.json
One --run-id per worker. Every node and edge carries it, so a bad worker's
writes can be found and retracted without touching anyone else's.
The store is append-only and single-writer. Run workers in parallel; apply their payloads sequentially. Extraction is the expensive part and it parallelizes; ingestion is fast and does not need to.
# workers run concurrently, each writing its own payload file
for i in $(seq 1 16); do
extract_worker "$i" > "worker-$i.json" &
done
wait
# orchestrator applies them one at a time
for i in $(seq 1 16); do
python3 "$KG" --name "<graph>" --run-id "run_$i" ingest "@worker-$i.json"
done
Do not have sixteen agents call ingest simultaneously.
Split roles only when specialization adds signal:
| Role | Returns |
|---|---|
| Extractor | typed nodes and edges from one unit |
| Resolver | canonical clusters with rationales |
| Verifier | supported / unsupported per claim, with edge citations |
| Synthesizer | one cited report traversing the assembled graph |
A verification wave only helps if the verifiers have a different prompt, evidence set, or role than the extractors. Running the same prompt twice produces correlated errors and false confidence.
After all payloads are applied:
python3 "$KG" --name "<graph>" query "" --type Entity --max-nodes 300 # find duplicates
# resolve clusters — see karpathy-graph-resolve
python3 "$KG" --name "<graph>" validate
python3 "$KG" --name "<graph>" render
Parallel extraction always produces duplicate surface forms. That is expected, not a failure — resolution is the reducer.
Declare limits up front:
python3 "$KG" --name "<graph>" init \
--budget '{"max_agents":16,"max_documents":200,"max_tokens":500000,"max_retries":2}'
Large fan-out consumes tokens fast. When the budget is exhausted, return:
Do not hide partial failure behind a fluent final answer. A report that reads as complete over half a corpus is the expensive failure mode here.
Some work needs one coherent context. Architecture decisions, tightly coupled reasoning, and narrative synthesis degrade when split into isolated units — each worker sees a fragment and none sees the argument.
Fan out extraction. Keep synthesis whole.
If the corpus is small enough for one pass, one agent is faster, cheaper, and produces a cleaner graph. Say so instead of parallelizing for its own sake.
What SKILL.md sets; muted values are Claude Code's defaults
7 skills in this plugin
/karpathy-graph-buildStage 3 of the karpathy-graph pipeline, and the end-to-end entry point. Create a graph, assemble validated writes with provenance, and produce the machine and human artifacts. Use when the user asks to build or create a knowledge graph from a context, to add facts to an existing graph, or when running the whole extract-resolve-assemble-query pipeline in one go./karpathy-graph-evaluateStage 5 of the karpathy-graph pipeline. Score graph quality across extraction, resolution, structure, query, and operations, and run a ratchet loop that keeps only changes which improve the metric. Use when the user asks how good the graph is, wants to tune extraction prompts or the ontology, asks to measure or improve graph quality, or wants to detect resolution regressions./karpathy-graph-extract/karpathy-graph:karpathy-graph-swarmfrom karpathy-graph
npx claudepluginhub andersonlimahw/lemon-ai-hub --plugin karpathy-graphOther plugins' skills for the same job