Command Palette

Search for a command to run...

Назад к скиллам
скилл № 83416

karpathy-graph

Build typed, provenance-tracked knowledge graphs from any context — documents, codebases, incidents, research — so one or many AI agents share durable memory…

БесплатноЗапускает вложенные скрипты
Andersonlimahwот Andersonlimahw★ 19 звёзд на GitHub

Установить karpathy-graph в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Karpathy Graph

You are building the graph plane of an agentic system: the layer that remembers what the context window forgets.

The agent forgets, the graph does not.

This skill turns any context — a folder of documents, a codebase, an incident, a research thread — into a typed graph that both machines and humans can read. One agent can build it. Many agents can build it concurrently. A human opens graph.html and sees the same thing the agents queried.

The one rule that matters

Never write an unsourced fact.

Every Claim node either points at a Source, or is explicitly marked inference=true. The engine enforces this — kgraph validate fails otherwise. If you cannot cite where a fact came from, it does not enter the graph.

Before you build: does this need a graph?

A graph earns its cost when connected queries, evolving relations, provenance, or shared world state are central. Skip it when tasks are independent, answers come from one document, no cross-session state is needed, or a flat table would answer every question. Say so plainly and stop — do not build a graph just because agents are involved.

Read references/decision-framework.md when unsure.

Where the graph goes

Situation Location
User gave a path exactly that path
No path given ./.karpathy-graphs/<graph-name>/ from the project root

<graph-name> is the slugified graph name. Never invent a different root, and never write graph files outside the graph directory.

Each graph directory holds:

manifest.json   name, objective, budget, counters
log.jsonl       append-only event log — the source of truth, reversible
graph.json      materialized nodes + edges
REPORT.md       human summary: health, composition, invariant violations
graph.html      interactive explorer (search, type filter, click-to-inspect)
graph.mmd       Mermaid diagram for docs and PRs

log.jsonl is what makes bad writes undoable. Never hand-edit it, never delete it to "clean up" — retract instead.

The engine

Everything runs through one stdlib-only Python CLI. No dependencies, no network, works identically under Claude Code, Codex, OpenCode, Antigravity, Gemini, or a plain shell.

KG="${CLAUDE_PLUGIN_ROOT:-plugins/karpathy-graph}/scripts/kgraph.py"

python3 "$KG" --name "<graph>" init --objective "<what this graph answers>"
python3 "$KG" --name "<graph>" --run-id run_001 ingest @payload.json
python3 "$KG" --name "<graph>" validate
python3 "$KG" --name "<graph>" query "<text>" --hops 2 --format context
python3 "$KG" --name "<graph>" render

Every command prints one JSON object. validate exits non-zero when an invariant is violated — wire it into CI or a loop as the metric.

Full command surface: references/cli.md.

The pipeline

Five stages. Run them in order the first time; afterwards any stage can run alone against an existing graph.

Stage Skill What it does
1. Extract karpathy-graph-extract Context → typed entities and S-P-O relations
2. Resolve karpathy-graph-resolve Surface forms → canonical entities, reversibly
3. Assemble karpathy-graph-build Validated write into the graph with provenance
4. Query karpathy-graph-query Bounded subgraph retrieval with edge citations
5. Evaluate karpathy-graph-evaluate Score extraction, resolution, and cited paths

Plus two that sit alongside:

  • karpathy-graph-visualize — render for humans, explain what the picture shows
  • karpathy-graph-swarm — fan the pipeline out across parallel agents

Invoke the sub-skill when you are doing that stage's work. Each one carries the prompts, schemas, and failure modes for its stage.

Ontology

Nine node types, eleven edge types. Do not invent new ones — put anything extra in attrs.

Nodes: Entity Claim Source Artifact AgentRun Evaluation Task Commit Metric

Edges: MENTIONS SUPPORTS CONTRADICTS DERIVED_FROM PRODUCED EVALUATES REVISES SUPERSEDES DEPENDS_ON PARENT_OF RESOLVED_TO

Semantics and worked examples: references/ontology.md.

The four write invariants

Every write must satisfy all four. kgraph validate checks them.

  1. I1 — every Claim has a Source edge, or inference=true
  2. I2 — every Artifact has an authoring AgentRun and a version
  3. I3 — every Evaluation identifies a rubric
  4. I4 — every superseded object stays addressable

A violation is a bug in your write, not a warning to note and move past. Fix it before rendering.

Retrieval discipline

The graph must not become a new way to dump context.

Never paste graph.json into a prompt. Resolve the task's entities, expand one or two hops over the edge types that matter, serialize inside a token budget, and keep the edge ids so the answer can cite them.

python3 "$KG" --name "<graph>" query "vendor X" --hops 2 \
  --edge-type SUPPORTS --edge-type MENTIONS --max-nodes 40 --format c
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • AGENTS.md
  • README.md
  • agents/graph-builder.md
  • agents/graph-orchestrator.md
  • agents/graph-querier.md
  • plugin.json
  • references/cli.md
  • references/decision-framework.md
  • references/grounding.md
  • references/multi-agent.md
  • references/ontology.md
  • scripts/kgraph.py
  • skills/karpathy-graph-build/SKILL.md
  • skills/karpathy-graph-evaluate/SKILL.md
  • skills/karpathy-graph-extract/SKILL.md
  • skills/karpathy-graph-query/SKILL.md
  • skills/karpathy-graph-resolve/SKILL.md
  • skills/karpathy-graph-swarm/SKILL.md
  • skills/karpathy-graph-visualize/SKILL.md

FAQ

Что делает скилл karpathy-graph?

Build typed, provenance-tracked knowledge graphs from any context — documents, codebases, incidents, research — so one or many AI agents share durable memory instead of copying transcripts. Use when the user says "build a knowledge graph", "criar grafo", "map this codebase/domain", "graph these documents", "extract entities and relations", "ground this claim", "visualize the graph", or asks how facts, sources and experiments connect. Every claim carries a source, every merge is reversible, every answer cites edge ids. Writes to the given path, or to ./.karpathy-graphs/<graph-name>/ by default, and renders an interactive HTML explorer for humans.

Как установить скилл karpathy-graph?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл karpathy-graph запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить karpathy-graph с