Retrieves bounded subgraphs from a knowledge graph to answer multi-hop questions and ground claims with edge citations. Useful for fact-checking and connecting entities across multiple facts.
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.
The graph exists so agents stop replaying transcripts. That only works if retrieval stays bounded.
Never dump the graph into a prompt.
Not graph.json, not the full node list, not "just this once because it's
small". Retrieve the connected state needed for the current decision, and
nothing else. A graph used as a context dump is worse than no graph — it costs
the same tokens plus the build.
KG="${CLAUDE_PLUGIN_ROOT:-plugins/karpathy-graph}/scripts/kgraph.py"
python3 "$KG" --name "<graph>" query "vendor X" \
--hops 2 \
--edge-type SUPPORTS --edge-type MENTIONS \
--max-nodes 40 \
--format context
| Hops | Use for |
|---|---|
| 1 | "what is directly attached to X" |
| 2 | most questions — the default |
| 3 | explicit multi-hop chains (X → Y → Z) |
| 4+ | almost never; you are retrieving the whole graph with extra steps |
If two hops returns nothing useful, the problem is usually missing edges, not an insufficient radius. Widening the radius to compensate for a thin graph retrieves noise.
--format context — entities plus relations with [edge:...] citations.
This is what you paste into a worker's prompt.
## Entities
- [Entity] Vendor X (aliases: VendorX Ltd) — component supplier `ent_0269238d2ffa`
- [Claim] Vendor X supplied Component Z `cla_f9ab59811007`
## Relations
(incident-report.md) -SUPPORTS-> (Vendor X supplied Component Z) (src: incident-report.md) [edge:e_22a78d1f9eeb]
(Vendor X supplied Component Z) -MENTIONS-> (Vendor X) [edge:e_401a5179c882]
--format triples — relations only, when entity descriptions are noise.
--format json — full node and edge objects, for programmatic use.
Watch for "truncated": true. It means --max-nodes cut the neighbourhood —
either raise the budget deliberately or narrow the question. Never present a
truncated result as complete.
To verify "Vendor X supplied the component involved in Incident Y", ask the graph for a path, not a model for an opinion.
python3 "$KG" --name "<graph>" path <vendor_x_id> <incident_y_id>
Path found — the claim is supported. Cite the returned edge ids.
No path — return structured feedback naming the missing evidence:
{
"decision": "revise",
"claim": "Vendor X supplied the component involved in Incident Y",
"reason": "No supported path from Vendor X to Incident Y",
"required_evidence": [
"A source-backed supplied relation from Vendor X to a component",
"A source-backed involved_in relation from that component to Incident Y"
]
}
This is actionable. "I could not verify this" is not.
A valid multi-hop answer must:
Both the answer and the path are being evaluated. A fluent answer citing irrelevant edges is a failure, not a partial success.
Say so. Then say precisely what is missing: which entity is absent, which relation has no source, which document was never ingested.
Do not fall back to model priors and present the result as graph-grounded. The whole point of the graph plane is that answers are traceable — an untraceable answer wearing a citation is the failure mode this system exists to prevent.
Next stage: karpathy-graph-evaluate.
What SKILL.md sets; muted values are Claude Code's defaults
/karpathy-graph:karpathy-graph-queryfrom karpathy-graph
npx claudepluginhub andersonlimahw/lemon-ai-hub --plugin karpathy-graph7 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-extractOther plugins' skills for the same job