A GraphRAG pipeline built around GitHub Copilot instead of a hosted LLM
API: you supply Markdown articles, Copilot extracts entities and
relationships from them straight in your editor, and a small deterministic
Python script merges everything into a queryable, visualized knowledge
graph. No OpenAI/Anthropic key, no LangChain, no LlamaIndex — the only
"intelligence" in this repo is Copilot itself, guided by
.github/copilot-instructions.md.
- You collect the data. Drop one Markdown file per article/source into
data/, with YAML front-matter fortitle/source/date— or just hand Copilot a URL (e.g. "extract this: https://example.com/article") and it fetches the page and writes the Markdown file itself, per.github/copilot-instructions.md. - Copilot extracts. Ask Copilot (chat or agent mode) to process a file
per
.github/copilot-instructions.md— it readsontology.json, extracts entities/relationships from the article, and writes a matchingdata/<name>.entities.jsonsidecar. build_graph.pymerges, deterministically. No LLM calls — it parses the Markdown + sidecar JSON, validates every entity/relation type againstontology.json, builds the graph with NetworkX, runs Louvain community detection (also NetworkX), and writesgraph_data.json+ai_copyright_graph.html.- You ask Copilot questions. There's no query engine — just ask Copilot
about
graph_data.jsondirectly in chat; it groups by thecommunityfield on each node to reason about clusters, or answers cross-cutting questions from the whole graph.
| Layer | Tools |
|---|---|
| Extraction / Q&A | GitHub Copilot, interactively — no API calls in code |
| Graph build | NetworkX (graph structure + Louvain community detection) |
| Validation | Pydantic (validates extraction sidecars against ontology.json) |
| Visualization | D3.js v7, vis-network 9.1.2 |
graphrag/
├── data/
│ ├── example-lawsuit.md # example article (front-matter + body)
│ └── example-lawsuit.entities.json # matching Copilot-extracted sidecar
├── ontology.json # allowed entity/relationship types — single source of truth
├── build_graph.py # deterministic merge → graph_data.json + html, no LLM
├── graph_data.json # extracted knowledge graph (generated)
├── ai_copyright_graph.html # interactive visualization (generated)
├── graph_template.html # D3.js template for visualization
├── .github/copilot-instructions.md # tells Copilot how to extract + how to answer questions
└── lib/
├── bindings/utils.js # graph interaction utilities
├── vis-9.1.2/ # vis-network library
└── tom-select/ # dropdown UI component
- Python 3.10+
- GitHub Copilot in your editor (chat or agent mode)
- No API keys — nothing in this repo calls an LLM over the network
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtCreate a Markdown file per article in data/:
---
title: "Article title"
source: "where it's from"
date: "2026-01-15"
---
The article body goes here.Or skip the manual step and ask Copilot directly:
Extract this: https://example.com/some-article
It fetches the page and writes the Markdown file for you (see "Your job:
ingest a website" in .github/copilot-instructions.md).
Ask Copilot to process the file, e.g. in chat:
Extract entities and relationships from
data/my-article.mdper.github/copilot-instructions.md.
Copilot writes data/my-article.entities.json. See
data/example-lawsuit.md + data/example-lawsuit.entities.json for a
worked example (fictional content, just to show the format).
python build_graph.pyMerges every data/*.md + sidecar pair, runs community detection, and
(re)writes graph_data.json and ai_copyright_graph.html. Deterministic
and cheap — re-run any time you add or re-extract an article.
Open ai_copyright_graph.html in a browser:
- Force-directed graph layout (D3.js)
- Filter nodes by entity type via the sidebar legend
- Search nodes by name
- Click a node to highlight its direct connections
- Hover for entity details in a tooltip
- Adjust link distance with the slider
Or just ask Copilot questions about graph_data.json directly in chat.