Communitygithub.com

graphrag

基于知识图谱的检索增强生成(RAG)管道。适用于向量搜索返回的孤立文档块无法体现关联关系、且问题需要多跳推理的场景。

graphrag 是什么?

这是一个构建 GraphRAG 管道的技能,它将知识图谱作为检索增强生成的基础,代替传统的平面分块检索。技能解释了为何在某些场景下图谱优于向量检索:当问题需要跨实体进行多步推理(例如“哪个供应商受到工厂X故障的影响”)或要求对某个主题进行全局总结时,向量搜索只能找到*相似*的块而无法追踪联系。该技能推荐使用 Kuzu(嵌入式图数据库,无需服务器)作为入门选择,也支持扩展到 Neo4j。其核心流程包括:1) 预先声明节点和边的类型来定义模式(Schema),避免自由提取造成的混乱;2) 对文档进行分块并提示 LLM 按照已定义的模式提取实体和关系;3) 将提取结果去重后加载到图数据库;4) 使用 Cypher 查询进行本地查找、多跳推理或通过社区检测进行全局总结;5) 最后让 LLM 根据查询结果合成最终答案。技能还涵盖了智能体跨会话记忆的时序知识支持(为边添加时间戳),并列举了常见反模式,如不定义模式直接提取、对所有问题都使用 GraphRAG、不进行人工抽检以及分块过大等。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/unisone/openclaw-skill-suite/tree/main/skills/graphrag

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

GraphRAG 技能

基于知识图谱的检索增强生成,而非平面分块。 从文档中提取实体和关系,存储在图形数据库中, LLM 在查询时基于图结构进行推理。

为什么用图而不是向量

向量搜索找到的是相似的块。它无法追踪联系:

  • “哪些供应商受到了工厂 X 故障的影响?”需要 故障 → 影响 → 工厂 → 由...供应 → 供应商——这是两跳,没有单个块包含。
  • “总结我们目前关于项目 Y 的所有信息”需要围绕 Y 的社区 实体,而不是最相似的十个段落。

如果你的问题是单一事实查询,坚持使用向量 RAG——它更简单。 当问题涉及关系时,再用 GraphRAG。

技术栈

  • Kuzu — 嵌入式图数据库(pip install kuzu),无需运行服务器, 使用 Cypher 查询语言。从这里开始。
  • Neo4j — 当你超出嵌入式限制时:多用户、更大图、Bloom 可视化。相同的 Cypher 技能可以迁移。
  • LLM 提取 — 任何具有结构化输出能力的强模型,用于实体/关系提取。

管道

1. 先定义模式

不要让提取器自由创造类型——你会得到同一个关系的 40 种拼写。 提前声明节点和边的类型:

CREATE NODE TABLE Person(name STRING, PRIMARY KEY(name));
CREATE NODE TABLE Project(name STRING, status STRING, PRIMARY KEY(name));
CREATE NODE TABLE Document(title STRING, date DATE, PRIMARY KEY(title));
CREATE REL TABLE WORKS_ON(FROM Person TO Project, role STRING);
CREATE REL TABLE MENTIONS(FROM Document TO Person);
CREATE REL TABLE MENTIONS_PROJECT(FROM Document TO Project);

保持模式小巧(5-10 种节点类型)。你可以扩展它;但无法廉价地清理一个混乱的已经提取好的图。

2. 提取实体和关系

将文档分块(500-1000 tokens,重叠),然后提示提取器:

请从下面的文本中提取实体和关系。

允许的节点类型:Person, Project, Document
允许的边类型:WORKS_ON (Person→Project), MENTIONS (Document→Person),
                    MENTIONS_PROJECT (Document→Project)

规则:
- 规范化名称(“J. Smith”和“John Smith”是同一个 Person)
- 只提取文本中明确陈述或清晰暗示的关系
- 返回 JSON:{

Individual skills in this repo

This repo contains 10 individual skills — each has its own dedicated page.

astra-operator

Delegate computer-use and browser tasks to OpenAI

design-inspo

Find design inspiration from curated gallery sites. Use when a user needs UI/UX references, design examples, or inspiration for specific components (navbars, CTAs, hero sections, landing pages, etc.), full websites, SaaS products, mobile apps, animations, icons, branding, or design systems. Helps select the right inspiration source and browse examples.

mundane-demos

Demo strategy that leads with mundane real-life utility instead of benchmarks. Use when presenting an AI agent or product to non-technical audiences. Covers picking tasks the viewer did this morning, showing end-to-end completion, and letting speed be the wow factor.

release-notes

Generate polished release notes from git history. Use when cutting a release, before publishing a GitHub release, or when you need a changelog from commits between two tags. Groups changes by type, surfaces breaking changes, and drafts highlights.

remotion-product-demos

Create Apple-keynote-quality product demo videos with Remotion. Covers glass phone mockups, floating 3D spheres, typing animations, card UIs, ripple effects, and smooth scene transitions. Use when asked to create product demos, app showcase videos, UI walkthrough animations, or

repo-security-scan

Scan a repository for high-signal security issues and produce a report. Use when auditing a codebase for leaked secrets or vulnerable dependencies, before a release, or when onboarding an unfamiliar repo. Runs gitleaks secret scanning and osv-scanner dependency checks.

secure-agent-design

Security architecture patterns for personal AI agents that touch real accounts. Use when designing an agent with access to inbox, calendar, finances, or shopping. Covers per-user isolated VMs, pre-action sentinel checks, least-privilege connectors, human approval gates, and single-use payment credentials.

testimonial-launch

Turn user testimonials into launch distribution. Use when launching a product or feature and you want real user proof to carry the announcement instead of marketing copy. Covers soliciting specific testimonials, curating them, and amplifying via quote-posts.

unisone/openclaw-skill-suite

Create Apple-keynote-quality product demo videos with Remotion. Covers glass phone mockups, floating 3D spheres, typing animations, card UIs, ripple effects, and smooth scene transitions. Use when asked to create product demos, app showcase videos, UI walkthrough animations, or

validator-quotes

Earn and deploy third-party validator quotes for a launch. Use when you need credibility beyond your own claims. Covers who to approach, how to get honest reactions, and how to amplify them via quote-posts, based on the founder/CEO validators behind the Muse launch.

相关技能