/graphanything
Build a knowledge graph from arbitrary inputs — markdown vaults, OpenAPI
specs, contracts, meeting notes, chat logs, filesystem trees — by picking
a schema preset, sampling, reviewing, and running. The graph comes out
with full provenance: every node and edge knows who extracted it, when,
from which file, and (for LLM extractions) what evidence span justified
it.
LLM-driven extraction goes through GraphAnything's built-in
OpenAI-compatible client, which talks to any chat.completions-shaped
endpoint (vLLM serve, llama.cpp, Ollama, LM Studio, OpenAI, …). Configure
via GA_API_BASE / GA_MODEL / GA_API_KEY (legacy
OPENAI_* / API_KEY/API_BASE/SUMMARY_MODEL_NAME are also accepted).
When to invoke
Trigger on any of:
- "graph this vault / spec / folder"
- "build a knowledge graph of …"
- "turn these files into a graph"
- "extract entities and relations from …"
- The user types
/graphanything …
What graphanything is for
The Skill exposes 17 MCP tools that map onto the same Session state machine
the CLI uses. The basic loop is:
open_session → propose_schema → sample → review
(or pick preset) ↓ ↓
refine_schema run → graph.json
↓
update / versions / diff
Tools (17 total):
- graphanything_open_session(inputs, preset?, extractor?) — start. Returns
session_id.
- graphanything_list_presets() — 10 built-in presets to choose from.
- graphanything_list_extractors() — 8 extractors (rule + LLM + VLM stub).
- graphanything_propose_schema(session_id, n=3, llm=False) — fill in an empty schema.
- graphanything_refine_schema(session_id, instruction, llm=False) —
add Foo entity, rename A to B, …
- graphanything_sample(session_id, n=5) — extract from N inputs into pending. Returns preview.
- graphanything_review(session_id, actions[]) — accept_all / accept / reject / merge / rule.
- graphanything_run(session_id, out_dir?) — full extraction →
graph.json + version snapshot.
- graphanything_status(session_id) — counts + schema + running cost.
- graphanything_ask(session_id, question, llm=False) — natural-language query over the graph.
- graphanything_explain(session_id, target) — full provenance for one node / edge.
- graphanything_update(session_id, out_dir?) — re-extract only inputs whose
source_hash changed.
- graphanything_versions(out_root?) — list snapshots written by run / update.
- graphanything_diff(v_old, v_new) — diff two snapshots (added / removed / modified).
- graphanything_federate(graphs, out, fuzzy?, llm?) — merge multiple graphs into one universe.
- graphanything_eval(session_id, llm=False, judge_n=20) — coverage / dedup / per-extractor / sampled LLM-judge.
- graphanything_render(session_id, fmt="mermaid") — 9 formats: mermaid / html / svg / cypher / graphml / ascii / json / canvas / timeline.
What you must do when invoked
Ask the user ONE question to disambiguate scope, only if it's ambiguous:
"Should I graph as <preset_a> or <preset_b>?" — pick from
graphanything_list_presets. Skip if the user already named a preset
or it's obvious from the inputs (*.md vault → obsidian-vault,
openapi.yaml → openapi, *.jsonl chat → chat-log).
Call graphanything_open_session(inputs=…, preset=…).
If the schema is empty AND no preset matched:
call graphanything_propose_schema(session_id, llm=True).
Otherwise skip — the preset already filled the schema.
Call graphanything_sample(session_id, n=5) to see a preview.
Show the preview to the user (use graphanything_render with
fmt="mermaid" for ≤60 nodes; otherwise just summarise types/counts).
Ask if anything in the schema needs refining.
If yes → graphanything_refine_schema(...), then re-sample.
If no → graphanything_review(session_id, actions=[{"op":"accept_all"}]),
then graphanything_run(session_id, out_dir=...).
After run, paste the resulting out_path and a mermaid render of the
final graph back to the user.
Available schema presets
Use graphanything_list_presets to see live state. The built-ins as of 0.1.0:
| Preset |
Use when |
obsidian-vault |
A folder of .md notes (Obsidian / Notion exports) |
openapi |
An OpenAPI / Swagger spec |
papers |
Generic LLM-driven paper extraction |
codebase |
Source-code repo (LLM-driven) |
contracts |
Legal contracts (parties / clauses / amounts / governing law) |
pr-review |
A PR review thread (files / functions / reviewers / concerns) |
meeting |
Meeting notes / transcripts |
chat-log |
Slack / Claude Code .jsonl / Discord transcripts |
db-schema |
SQL DDL / migrations / ORM models |
fstree |
Plain filesystem tree exploration |
Notes for Claude
Provenance: every node/edge in graph.json is stamped with
extractor_id, extractor_version, extraction_time, source_hash.
LLM-extracted edges additionally carry rationale and evidence_span.
Use graphanything_explain to show this when the user asks "where did
this come from?".
LLM endpoint: LLM-gated calls go through any OpenAI-compatible
chat-completions endpoint (GA_API_BASE / GA_MODEL / GA_API_KEY).
If the env vars aren't set, LLM ops error out cleanly — fall back to
rule-based presets / extractors.
Cost control: open_session accepts budget={max_tokens, max_dollars, max_api_calls}. Honour it when the user mentions a cap.
Big inputs: don't render >60 nodes as mermaid — call render with
fmt="ascii" or fmt="html" (returns a file path) instead. Pass
budget_tokens=N to PageRank-prune large graphs to a target size.
Multiple sessions: each call to open_session creates a new one.
The session_id is the only handle you need — pass it to every other tool.
Updating: when source files change, graphanything_update re-extracts
only the changed ones and writes a new version snapshot;
graphanything_diff <v_old> <v_new> shows what's different.
1---2name: graphanything3description: Turn anything into a navigable knowledge graph. 10 schema presets, 8 extractors (markdown / json-yaml / openapi / fstree / chatlog / LLM-entity / VLM-stub / noop), human-in-the-loop review.4---56# /graphanything78Build a knowledge graph from arbitrary inputs — markdown vaults, OpenAPI9specs, contracts, meeting notes, chat logs, filesystem trees — by picking10a schema preset, sampling, reviewing, and running. The graph comes out11with full provenance: every node and edge knows who extracted it, when,12from which file, and (for LLM extractions) what evidence span justified13it.1415LLM-driven extraction goes through GraphAnything's built-in16OpenAI-compatible client, which talks to any `chat.completions`-shaped17endpoint (vLLM serve, llama.cpp, Ollama, LM Studio, OpenAI, …). Configure18via `GA_API_BASE` / `GA_MODEL` / `GA_API_KEY` (legacy19`OPENAI_*` / `API_KEY`/`API_BASE`/`SUMMARY_MODEL_NAME` are also accepted).2021## When to invoke2223Trigger on any of:2425- "graph this vault / spec / folder"26- "build a knowledge graph of …"27- "turn these files into a graph"28- "extract entities and relations from …"29- The user types `/graphanything …`3031## What graphanything is for3233The Skill exposes 17 MCP tools that map onto the same Session state machine34the CLI uses. The basic loop is:3536```37open_session → propose_schema → sample → review38 (or pick preset) ↓ ↓39 refine_schema run → graph.json40 ↓41 update / versions / diff42```4344Tools (17 total):4546- **graphanything_open_session(inputs, preset?, extractor?)** — start. Returns `session_id`.47- **graphanything_list_presets()** — 10 built-in presets to choose from.48- **graphanything_list_extractors()** — 8 extractors (rule + LLM + VLM stub).49- **graphanything_propose_schema(session_id, n=3, llm=False)** — fill in an empty schema.50- **graphanything_refine_schema(session_id, instruction, llm=False)** — `add Foo entity`, `rename A to B`, …51- **graphanything_sample(session_id, n=5)** — extract from N inputs into pending. Returns preview.52- **graphanything_review(session_id, actions[])** — accept_all / accept / reject / merge / rule.53- **graphanything_run(session_id, out_dir?)** — full extraction → `graph.json` + version snapshot.54- **graphanything_status(session_id)** — counts + schema + running cost.55- **graphanything_ask(session_id, question, llm=False)** — natural-language query over the graph.56- **graphanything_explain(session_id, target)** — full provenance for one node / edge.57- **graphanything_update(session_id, out_dir?)** — re-extract only inputs whose `source_hash` changed.58- **graphanything_versions(out_root?)** — list snapshots written by run / update.59- **graphanything_diff(v_old, v_new)** — diff two snapshots (added / removed / modified).60- **graphanything_federate(graphs, out, fuzzy?, llm?)** — merge multiple graphs into one universe.61- **graphanything_eval(session_id, llm=False, judge_n=20)** — coverage / dedup / per-extractor / sampled LLM-judge.62- **graphanything_render(session_id, fmt="mermaid")** — 9 formats: mermaid / html / svg / cypher / graphml / ascii / json / canvas / timeline.6364## What you must do when invoked65661. Ask the user ONE question to disambiguate scope, only if it's ambiguous:67 "Should I graph as `<preset_a>` or `<preset_b>`?" — pick from68 `graphanything_list_presets`. Skip if the user already named a preset69 or it's obvious from the inputs (`*.md` vault → `obsidian-vault`,70 `openapi.yaml` → `openapi`, `*.jsonl` chat → `chat-log`).71722. Call `graphanything_open_session(inputs=…, preset=…)`.73743. If the schema is empty AND no preset matched:75 call `graphanything_propose_schema(session_id, llm=True)`.76 Otherwise skip — the preset already filled the schema.77784. Call `graphanything_sample(session_id, n=5)` to see a preview.79805. Show the preview to the user (use `graphanything_render` with81 `fmt="mermaid"` for ≤60 nodes; otherwise just summarise types/counts).82 Ask if anything in the schema needs refining.83846. If yes → `graphanything_refine_schema(...)`, then re-sample.85 If no → `graphanything_review(session_id, actions=[{"op":"accept_all"}])`,86 then `graphanything_run(session_id, out_dir=...)`.87887. After `run`, paste the resulting `out_path` and a mermaid render of the89 final graph back to the user.9091## Available schema presets9293Use `graphanything_list_presets` to see live state. The built-ins as of 0.1.0:9495| Preset | Use when |96|---|---|97| `obsidian-vault` | A folder of `.md` notes (Obsidian / Notion exports) |98| `openapi` | An OpenAPI / Swagger spec |99| `papers` | Generic LLM-driven paper extraction |100| `codebase` | Source-code repo (LLM-driven) |101| `contracts` | Legal contracts (parties / clauses / amounts / governing law) |102| `pr-review` | A PR review thread (files / functions / reviewers / concerns) |103| `meeting` | Meeting notes / transcripts |104| `chat-log` | Slack / Claude Code `.jsonl` / Discord transcripts |105| `db-schema` | SQL DDL / migrations / ORM models |106| `fstree` | Plain filesystem tree exploration |107108## Notes for Claude109110- **Provenance**: every node/edge in `graph.json` is stamped with111 `extractor_id`, `extractor_version`, `extraction_time`, `source_hash`.112 LLM-extracted edges additionally carry `rationale` and `evidence_span`.113 Use `graphanything_explain` to show this when the user asks "where did114 this come from?".115116- **LLM endpoint**: LLM-gated calls go through any OpenAI-compatible117 chat-completions endpoint (`GA_API_BASE` / `GA_MODEL` / `GA_API_KEY`).118 If the env vars aren't set, LLM ops error out cleanly — fall back to119 rule-based presets / extractors.120121- **Cost control**: `open_session` accepts `budget={max_tokens, max_dollars,122 max_api_calls}`. Honour it when the user mentions a cap.123124- **Big inputs**: don't render >60 nodes as mermaid — call `render` with125 `fmt="ascii"` or `fmt="html"` (returns a file path) instead. Pass126 `budget_tokens=N` to PageRank-prune large graphs to a target size.127128- **Multiple sessions**: each call to `open_session` creates a new one.129 The session_id is the only handle you need — pass it to every other tool.130131- **Updating**: when source files change, `graphanything_update` re-extracts132 only the changed ones and writes a new version snapshot;133 `graphanything_diff <v_old> <v_new>` shows what's different.