context-graph
Skill1 starsChanged 3 months agoMITView on GitHub
Build and query a knowledge graph from someone's own markdown notes — extracting people, companies, projects and the relationships between them, so answers are grounded in their actual notes instead of guessed or retrieved by keyword. Use this when a user wants to make an Obsidian vault or notes folder queryable, asks questions spanning many notes ("who do I know at X", "which contacts relate to this project"), wants Claude to stop re-reading whole files to answer, or asks to build a knowledge graph, context layer, or semantic index over their notes. Runs a structural pass with a script, then a model pass that extracts entities and relationships, and answers later questions from the graph.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- thistleknot/skillstheir own version, first seen Nov 8, 2026
- ryanmaclean/skillstheir own version, first seen Nov 1, 2026
- WellApp-ai/skillstheir own version, first seen Sep 10, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- WellApp-ai/skills★ 8same name
- ryanmaclean/skills★ 1same name
- thistleknot/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 27
No API key, no token, no scheduled job, no network access.
- Very specific: line 48
Read graph.json. For each note where "extracted": false, open the file at root + path, then write back into that note's record:
- Very specific: line 69
Batch the work: Read many notes, then write graph.json once.
- Distinctive: line 97
Never invent entities or relationships: Only what the notes say.
- Distinctive: line 99
Personal notes are private: Do not summarise their contents beyond what is needed to answer, and do not send them anywhere.
- Very specific: line 100
Be honest about coverage: If --stats shows 40 of 300 notes extracted, say so before answering, rather than implying the graph is complete.
- Distinctive: line 101
A graph is not a search engine: If someone asks something the graph cannot answer, say so and fall back to reading files — don't force a …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Context Graph
Turns a folder of markdown into a queryable graph of entities (people, companies, projects, concepts) and relationships between them, then answers questions by retrieving the relevant slice instead of reading whole files.
Two passes, deliberately separated:
| Pass | Who does it | What it produces |
| Structural | build_graph.py | files, wikilinks, tags, headings, backlinks — deterministic, free, instant |
| Semantic | you, the model | entities and relationships extracted from prose |
The structural pass is cheap and re-runnable. The semantic pass costs model calls, so it is incremental: only notes whose content changed are re-extracted.
Step 0 — Check before promising
python3—command -v python3. Ships with macOS and Linux; on Windows it may bepython.- A notes directory the user can point at.
No API key, no token, no scheduled job, no network access. Works on macOS, Linux and Windows.
Step 1 — Ask what matters
Two questions, no more:
- Where are the notes? A path. Confirm it exists before running anything.
- What do they actually want to ask it? This is the important one — it decides which entity types are worth extracting. Someone documenting an AI platform wants systems, models, datasets, metrics and owners. Someone doing research wants papers, authors and concepts. Do not extract generic "entities"; extract the kinds they will ask about.
Agree a small type list, 4–6 at most. More types make the graph noisier, not richer.
Step 2 — Structural pass
python3 scripts/build_graph.py "<notes_dir>" --out graph.jsonReports note count, resolved wikilink edges, and how many notes await extraction. Safe to re-run any time; it preserves extractions for unchanged notes.
Step 3 — Semantic pass (this is your job)
Read graph.json. For each note where "extracted": false, open the file at root + path, then write back into that note's record:
"entities": [
{"name": "coding-agent", "type": "system"},
{"name": "eval-harness", "type": "system"},
{"name": "hallucination-rate", "type": "metric"}
],
"relations": [
{"source": "coding-agent", "target": "eval-harness", "type": "evaluated_by"},
{"source": "eval-harness", "target": "hallucination-rate", "type": "reports", "date": "2026-06-02"}
],
"extracted": trueRules that keep the graph trustworthy:
- Extract only what the note states. If a note says a service "runs against the eval harness nightly," that is
evaluated_by. If it merely mentions two systems in one sentence, that is not a relationship. Never infer a relationship to make the graph look richer — a wrong edge is worse than a missing one, because it will be retrieved and believed later. - Normalise names. "eval-harness", "the eval service" and "EvalHarness" must become one entity, or traversal breaks. Keep the fullest form as
name. - Reuse types from the agreed list. A type used once is noise.
- Dates in relations are valuable — they let the user ask "what changed since the June migration."
- Batch the work. Read many notes, then write
graph.jsononce. Do not rewrite the file per note. - Say what it cost. Tell the user how many notes you extracted and roughly how long a full rebuild takes, so a large vault is not a surprise.
Set "extracted": true only for notes you genuinely processed.
Step 4 — Answer from the graph
python3 scripts/query_graph.py "which systems depend on the eval harness" --json
python3 scripts/query_graph.py --note "Architecture Overview" --hops 1 --json
python3 scripts/query_graph.py --entity "context-layer" --hops 2 --json
python3 scripts/query_graph.py --stats --jsonAlways pass --json. The default output is formatted for a human to read, and
parsing it back out of prose breaks the moment the formatting changes. With --json
you get labelled fields — entities, relations, notes, each with scores and note
ids — so nothing has to be inferred from layout. Drop the flag only when showing
output to the user directly.
Query the graph first, open files second. The point is to avoid reading whole notes. Use the returned subgraph to answer; open a file only when the graph shows a note is relevant but lacks the detail needed.
Step 5 — Keeping it current
Re-run Step 2 whenever notes change; unchanged notes keep their extractions and only changed ones come back as extracted: false for a cheap top-up. --rebuild discards everything and starts over — only use it when the entity type list changes.
Guardrails
- Never invent entities or relationships. Only what the notes say.
- Never write to the user's notes. This skill reads them and writes only
graph.json. - Personal notes are private. Do not summarise their contents beyond what is needed to answer, and do not send them anywhere.
- Be honest about coverage. If
--statsshows 40 of 300 notes extracted, say so before answering, rather than implying the graph is complete. - A graph is not a search engine. If someone asks something the graph cannot answer, say so and fall back to reading files — don't force a bad traversal.
Limitations
- First build is the expensive one — every note is read once. Incremental updates after that are cheap.
- Quality depends on the notes. Vague prose produces a vague graph. Vaults with existing wikilinks start with a real head start, since those edges come free.
- Markdown only. PDFs, images and databases are ignored.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

