package-extensions
Build and diagnose GraphRAG lower-level package extensions: custom caches, storage and table providers, input readers, chunkers, vector stores and filters, LLM completion/embedding providers, tokenizers, metrics/retry/rate-limit/template factories, graph helpers, and indexing workflow factories.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- package-extensions
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Build and diagnose GraphRAG lower-level package extensions: custom caches, storage and table providers, input readers, chunkers, vector stores and filters, LLM completion/embedding providers, tokenizers, metrics/retry/rate-limit/template factories, graph helpers, and indexing workflow factories.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/factory-extension-recipes.md7.0 KB
- 参考文档references/package-optional-dependencies.md4.5 KB
- 参考文档references/troubleshooting.md5.9 KB
- 脚本scripts/register_mock_extensions.py11.0 KB
- 脚本scripts/validate_graph_helpers.py3.4 KB
03 SKILL.md 正文
GraphRAG Package Extensions
Use this sub-skill when the task mentions custom providers, factory registration, extension points, offline mocks, graph helper validation, vector-store filters, timestamp/date fields, chunkers, or low-level package diagnostics.
For user-facing YAML/config selection, route to ../configuration-data/. For indexing orchestration or running pipelines, route to ../indexing/. For query APIs and result-table requirements, route to ../querying/.
Core Pattern
GraphRAG package extensions usually follow the same pattern:
- Implement the package interface or subclass the base class.
- Register it under a stable string key with the package
register_*function. - Use the matching config model or
create_*helper so GraphRAG instantiates it. - Keep optional services behind explicit dependency and credential checks.
The shared factory base supports scope="transient" and scope="singleton". create() removes init args whose value is None, so use a sentinel or explicit default if an initializer must distinguish "unset" from None. Singleton instances are cached by strategy plus init args; avoid singleton scope for mutable per-run state unless the init args fully identify the state.
Common Extension Points
- Cache: implement
graphrag_cache.Cache, register withregister_cache(type, initializer, scope="transient"), create withcreate_cache(CacheConfig(...), storage=...). - Storage: implement
graphrag_storage.Storage, register withregister_storage(type, initializer), create withcreate_storage(StorageConfig(...)). - Table provider: implement
graphrag_storage.tables.TableProvider, register withregister_table_provider(type, initializer), create withcreate_table_provider(TableProviderConfig(...), storage=...). - Input reader: subclass or implement
graphrag_input.InputReader, register withregister_input_reader(type, initializer), create withcreate_input_reader(InputConfig(...), storage). - Chunker: implement
graphrag_chunking.Chunker, register withregister_chunker(type, initializer), create withcreate_chunker(ChunkingConfig(...), encode=..., decode=...). - Vector store: subclass
graphrag_vectors.VectorStore, register withregister_vector_store(type, initializer), create withcreate_vector_store(VectorStoreConfig(...), IndexSchema(...)). - LLM providers: implement completion or embedding interfaces, register with
register_completionorregister_embedding; model configmodel_extrafields are passed through to initializers. - LLM utilities: tokenizer, retry, rate-limit, metrics store/processor/writer, template manager/engine factories have analogous
register_*andcreate_*helpers. - Index workflows: register workflow callables with
PipelineFactory.register(name, workflow)and methods withPipelineFactory.register_pipeline(name, [workflow_names...]). - Graph helpers: use deterministic DataFrame helpers such as
compute_degree,connected_components,largest_connected_component, andstable_lccfor offline graph checks.
Recommended Workflow
- Identify the package boundary first: storage/cache/input/chunking/vector/LLM/graph/workflow.
- Inspect the initializer signature of the target base or built-in implementation.
- Decide factory scope: transient for fresh state, singleton only for shareable clients keyed by complete init args.
- Register a unique key before calling
create_*; duplicate keys overwrite the previous initializer in the process. - Create a tiny offline mock before adding optional cloud/database dependencies.
- Add a smoke check for
--help, factory registration, and one deterministic operation. - If wiring through GraphRAG config, move user-facing config guidance to
../configuration-data/.
Bundled Scripts
scripts/register_mock_extensions.pydemonstrates offline custom storage, cache, input reader, vector store, and direct factory patterns.scripts/validate_graph_helpers.pychecks degree, connected components, stable LCC normalization/order, timestamp explosion, and filter expressions on deterministic in-memory data.
Both scripts are examples for future agents to copy or adapt inside their own workspace. They do not require external services.
References
references/factory-extension-recipes.mdfor concrete registration recipes and design notes.references/package-optional-dependencies.mdfor guarded dependency and service guidance.references/troubleshooting.mdfor factory, config, service, vector filter, and graph-helper failures.
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).