nano-graphrag
Use nano-graphrag for lightweight GraphRAG indexing, querying, provider customization, storage backend selection, prompt/entity extraction tuning, and troubleshooting.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- nano-graphrag
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use nano-graphrag for lightweight GraphRAG indexing, querying, provider customization, storage backend selection, prompt/entity extraction tuning, and troubleshooting.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/package-overview.md4.3 KB
- 参考文档references/repo-provenance.md1.9 KB
- 参考文档references/repo-routing-metadata.json407 B
- 参考文档references/troubleshooting.md5.7 KB
- 脚本scripts/check_nano_graphrag_env.py4.1 KB
03 SKILL.md 正文
nano-graphrag
Use this repo skill when a task involves the nano-graphrag Python package, lightweight GraphRAG/RAG indexing, graph-backed retrieval, local/global/naive query modes, custom LLM or embedding providers, storage backend swaps, entity-extraction troubleshooting, or GraphML knowledge graph inspection.
The root stays a router. Open the focused sub-skill for the workflow you need, then use its bundled references and scripts instead of reopening the source repository.
Quick environment check
Install the package in the active project environment with one of:
pip install nano-graphrag
# or, for a checkout you are actively editing:
pip install -e .
Then verify importability:
from nano_graphrag import GraphRAG, QueryParam
print(QueryParam(mode="global"))
If import fails with ModuleNotFoundError: No module named 'transformers', install transformers; this repository version imports transformers.AutoTokenizer at module import time even though the package metadata may not list it explicitly.
Run scripts/check_nano_graphrag_env.py when you need a safe no-network import/API/storage sanity check before following deeper recipes.
Route by task
| User task | Read first |
|---|---|
Build a GraphRAG, insert text, query global/local/naive modes, use async methods, reuse a working_dir, or validate custom chunking. |
sub-skills/core-graphrag-workflows/SKILL.md |
| Replace OpenAI with Azure OpenAI, Amazon Bedrock, DeepSeek/OpenAI-compatible APIs, Ollama, local embeddings, or debug provider kwargs/credentials. | sub-skills/provider-and-model-integrations/SKILL.md |
| Choose JSON/NanoVectorDB/HNSW/NetworkX/Neo4j storage, adapt FAISS/Milvus/Qdrant-style vector stores, or visualize GraphML. | sub-skills/storage-backends/SKILL.md |
| Change prompts, repair malformed JSON, customize entity extraction/DSPy, or recover from zero entities / empty graph / Leiden failures. | sub-skills/customization-and-troubleshooting/SKILL.md |
Read these root references
- Read references/package-overview.md for package purpose, public API surface, default components, install caveats, and how the sub-skills fit together.
- Read references/troubleshooting.md for cross-cutting install/import, provider, storage, empty-graph, and optional dependency triage before choosing a deeper troubleshooting page.
- Read references/repo-provenance.md before deciding whether this skill is current for a checkout or whether
refresh-repo-skillis needed. references/repo-routing-metadata.jsonis structured metadata consumed by the repo-skills router import process; do not edit it casually.
High-confidence operating rules
- Use a stable
working_dirfor persistent state. The default local stack writes JSON KV stores, NanoVectorDB JSON files, and NetworkX GraphML under that directory. - Do not run hosted-provider examples until credentials, network policy, model IDs, and rate limits are explicit. For no-network validation, use fake LLM/embedding helpers from the core sub-skill.
- Enable
enable_naive_rag=Truebefore insertion if you will later queryQueryParam(mode="naive"). - Treat Neo4j, Ollama, Bedrock, FAISS, Milvus, Qdrant, and downloaded local embedding models as optional integrations with their own services, packages, or credentials.
- If insertion produces no entities/relations, debug provider output format and context length before replacing graph storage.
- Keep any generated application scripts independent of this source checkout; copy or adapt needed patterns into the application or use the bundled scripts here.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).