# graphiti - Doramagic AI Context Pack

> 定位：安装前体验与判断资产。它帮助宿主 AI 有一个好的开始，但不代表已经安装、执行或验证目标项目。

## 充分原则

- **充分原则，不是压缩原则**：AI Context Pack 应该充分到让宿主 AI 在开工前理解项目价值、能力边界、使用入口、风险和证据来源；它可以分层组织，但不以最短摘要为目标。
- **压缩策略**：只压缩噪声和重复内容，不压缩会影响判断和开工质量的上下文。

## 给宿主 AI 的使用方式

你正在读取 Doramagic 为 graphiti 编译的 AI Context Pack。请把它当作开工前上下文：帮助用户理解适合谁、能做什么、如何开始、哪些必须安装后验证、风险在哪里。不要声称你已经安装、运行或执行了目标项目。

## Claim 消费规则

- **事实来源**：Repo Evidence + Claim/Evidence Graph；Human Wiki 只提供显著性、术语和叙事结构。
- **事实最低状态**：`supported`
- `supported`：可以作为项目事实使用，但回答中必须引用 claim_id 和证据路径。
- `weak`：只能作为低置信度线索，必须要求用户继续核实。
- `inferred`：只能用于风险提示或待确认问题，不能包装成项目事实。
- `unverified`：不得作为事实使用，应明确说证据不足。
- `contradicted`：必须展示冲突来源，不得替用户强行选择一个版本。

## 它最适合谁

- **AI 研究者或研究型 Agent 构建者**：README 明确围绕研究、实验或论文工作流展开。 证据：`README.md` Claim：`clm_0002` supported 0.86
- **正在使用 Claude/Codex/Cursor/Gemini 等宿主 AI 的开发者**：README 或插件配置提到多个宿主 AI。 证据：`README.md` Claim：`clm_0003` supported 0.86

## 它能做什么

- **命令行启动或安装流程**（需要安装后验证）：项目文档中存在可执行命令，真实使用需要在本地或宿主环境中运行这些命令。 证据：`README.md` Claim：`clm_0001` supported 0.86

## 怎么开始

- `pip install graphiti-core` 证据：`README.md` Claim：`clm_0004` supported 0.86, `clm_0005` supported 0.86, `clm_0006` supported 0.86, `clm_0007` supported 0.86 等
- `pip install graphiti-core[falkordb]` 证据：`README.md` Claim：`clm_0005` supported 0.86, `clm_0012` supported 0.86
- `pip install graphiti-core[kuzu]` 证据：`README.md` Claim：`clm_0006` supported 0.86
- `pip install graphiti-core[neptune]` 证据：`README.md` Claim：`clm_0007` supported 0.86
- `pip install graphiti-core[anthropic]` 证据：`README.md` Claim：`clm_0008` supported 0.86, `clm_0011` supported 0.86
- `pip install graphiti-core[groq]` 证据：`README.md` Claim：`clm_0009` supported 0.86
- `pip install graphiti-core[google-genai]` 证据：`README.md` Claim：`clm_0010` supported 0.86, `clm_0013` supported 0.86
- `pip install graphiti-core[anthropic,groq,google-genai]` 证据：`README.md` Claim：`clm_0011` supported 0.86
- `pip install graphiti-core[falkordb,anthropic,google-genai]` 证据：`README.md` Claim：`clm_0012` supported 0.86
- `pip install "graphiti-core[google-genai]"` 证据：`README.md` Claim：`clm_0010` supported 0.86, `clm_0013` supported 0.86

## 继续前判断卡

- **当前建议**：需要管理员/安全审批
- **为什么**：继续前可能涉及密钥、账号、外部服务或敏感上下文，建议先经过管理员或安全审批。

### 30 秒判断

- **现在怎么做**：需要管理员/安全审批
- **最小安全下一步**：先跑 Prompt Preview；若涉及凭证或企业环境，先审批再试装
- **先别相信**：工具权限边界不能在安装前相信。
- **继续会触碰**：命令执行、宿主 AI 配置、本地环境或项目文件

### 现在可以相信

- **适合人群线索：AI 研究者或研究型 Agent 构建者**（supported）：有 supported claim 或项目证据支撑，但仍不等于真实安装效果。 证据：`README.md` Claim：`clm_0002` supported 0.86
- **适合人群线索：正在使用 Claude/Codex/Cursor/Gemini 等宿主 AI 的开发者**（supported）：有 supported claim 或项目证据支撑，但仍不等于真实安装效果。 证据：`README.md` Claim：`clm_0003` supported 0.86
- **能力存在：命令行启动或安装流程**（supported）：可以相信项目包含这类能力线索；是否适合你的具体任务仍要试用或安装后验证。 证据：`README.md` Claim：`clm_0001` supported 0.86
- **存在 Quick Start / 安装命令线索**（supported）：可以相信项目文档出现过启动或安装入口；不要因此直接在主力环境运行。 证据：`README.md` Claim：`clm_0004` supported 0.86, `clm_0005` supported 0.86, `clm_0006` supported 0.86, `clm_0007` supported 0.86

### 现在还不能相信

- **工具权限边界不能在安装前相信。**（unverified）：MCP/tool 类项目通常会触碰文件、网络、浏览器或外部 API，必须真实检查权限和日志。
- **真实输出质量不能在安装前相信。**（unverified）：Prompt Preview 只能展示引导方式，不能证明真实项目中的结果质量。
- **宿主 AI 版本兼容性不能在安装前相信。**（unverified）：Claude、Cursor、Codex、Gemini 等宿主加载规则和版本差异必须在真实环境验证。
- **不会污染现有宿主 AI 行为，不能直接相信。**（inferred）：Skill、plugin、AGENTS/CLAUDE/GEMINI 指令可能改变宿主 AI 的默认行为。 证据：`AGENTS.md`, `CLAUDE.md`
- **可安全回滚不能默认相信。**（unverified）：除非项目明确提供卸载和恢复说明，否则必须先在隔离环境验证。
- **真实安装后是否与用户当前宿主 AI 版本兼容？**（unverified）：兼容性只能通过实际宿主环境验证。
- **项目输出质量是否满足用户具体任务？**（unverified）：安装前预览只能展示流程和边界，不能替代真实评测。
- **安装命令是否需要网络、权限或全局写入？**（unverified）：这影响企业环境和个人环境的安装风险。 证据：`README.md`

### 继续会触碰什么

- **命令执行**：包管理器、网络下载、本地插件目录、项目配置或用户主目录。 原因：运行第一条命令就可能产生环境改动；必须先判断是否值得跑。 证据：`README.md`
- **宿主 AI 配置**：Claude/Codex/Cursor/Gemini/OpenCode 等宿主的 plugin、Skill 或规则加载配置。 原因：宿主配置会改变 AI 后续工作方式，可能和用户已有规则冲突。 证据：`AGENTS.md`, `CLAUDE.md`
- **本地环境或项目文件**：安装结果、插件缓存、项目配置或本地依赖目录。 原因：安装前无法证明写入范围和回滚方式，需要隔离验证。 证据：`README.md`
- **环境变量 / API Key**：项目入口文档明确出现 API key、token、secret 或账号凭证配置。 原因：如果真实安装需要凭证，应先使用测试凭证并经过权限/合规判断。 证据：`CLAUDE.md`, `README.md`, `examples/opentelemetry/README.md`, `examples/quickstart/README.md` 等
- **宿主 AI 上下文**：AI Context Pack、Prompt Preview、Skill 路由、风险规则和项目事实。 原因：导入上下文会影响宿主 AI 后续判断，必须避免把未验证项包装成事实。

### 最小安全下一步

- **先跑 Prompt Preview**：用安装前交互式试用判断工作方式是否匹配，不需要授权或改环境。（适用：任何项目都适用，尤其是输出质量未知时。）
- **只在隔离目录或测试账号试装**：避免安装命令污染主力宿主 AI、真实项目或用户主目录。（适用：存在命令执行、插件配置或本地写入线索时。）
- **先备份宿主 AI 配置**：Skill、plugin、规则文件可能改变 Claude/Cursor/Codex 的默认行为。（适用：存在插件 manifest、Skill 或宿主规则入口时。）
- **不要使用真实生产凭证**：环境变量/API key 一旦进入宿主或工具链，可能产生账号和合规风险。（适用：出现 API、TOKEN、KEY、SECRET 等环境线索时。）
- **安装后只验证一个最小任务**：先验证加载、兼容、输出质量和回滚，再决定是否深用。（适用：准备从试用进入真实工作流时。）

### 退出方式

- **保留安装前状态**：记录原始宿主配置和项目状态，后续才能判断是否可恢复。
- **准备移除宿主 plugin / Skill / 规则入口**：如果试装后行为异常，可以把宿主 AI 恢复到试装前状态。
- **记录安装命令和写入路径**：没有明确卸载说明时，至少要知道哪些目录或配置需要手动清理。
- **准备撤销测试 API key 或 token**：测试凭证泄露或误用时，可以快速止损。
- **如果没有回滚路径，不进入主力环境**：不可回滚是继续前阻断项，不应靠信任或运气继续。

## 哪些只能预览

- 解释项目适合谁和能做什么
- 基于项目文档演示典型对话流程
- 帮助用户判断是否值得安装或继续研究

## 哪些必须安装后验证

- 真实安装 Skill、插件或 CLI
- 执行脚本、修改本地文件或访问外部服务
- 验证真实输出质量、性能和兼容性

## 边界与风险判断卡

- **把安装前预览误认为真实运行**：用户可能高估项目已经完成的配置、权限和兼容性验证。 处理方式：明确区分 prompt_preview_can_do 与 runtime_required。 Claim：`clm_0014` inferred 0.45
- **命令执行会修改本地环境**：安装命令可能写入用户主目录、宿主插件目录或项目配置。 处理方式：先在隔离环境或测试账号中运行。 证据：`README.md` Claim：`clm_0015` supported 0.86
- **待确认**：真实安装后是否与用户当前宿主 AI 版本兼容？。原因：兼容性只能通过实际宿主环境验证。
- **待确认**：项目输出质量是否满足用户具体任务？。原因：安装前预览只能展示流程和边界，不能替代真实评测。
- **待确认**：安装命令是否需要网络、权限或全局写入？。原因：这影响企业环境和个人环境的安装风险。

## 开工前工作上下文

### 加载顺序

- 先读取 how_to_use.host_ai_instruction，建立安装前判断资产的边界。
- 读取 claim_graph_summary，确认事实来自 Claim/Evidence Graph，而不是 Human Wiki 叙事。
- 再读取 intended_users、capabilities 和 quick_start_candidates，判断用户是否匹配。
- 需要执行具体任务时，优先查 role_skill_index，再查 evidence_index。
- 遇到真实安装、文件修改、网络访问、性能或兼容性问题时，转入 risk_card 和 boundaries.runtime_required。

### 任务路由

- **命令行启动或安装流程**：先说明这是安装后验证能力，再给出安装前检查清单。 边界：必须真实安装或运行后验证。 证据：`README.md` Claim：`clm_0001` supported 0.86

### 上下文规模

- 文件总数：272
- 重要文件覆盖：40/272
- 证据索引条目：80
- 角色 / Skill 条目：18

### 证据不足时的处理

- **missing_evidence**：说明证据不足，要求用户提供目标文件、README 段落或安装后验证记录；不要补全事实。
- **out_of_scope_request**：说明该任务超出当前 AI Context Pack 证据范围，并建议用户先查看 Human Manual 或真实安装后验证。
- **runtime_request**：给出安装前检查清单和命令来源，但不要替用户执行命令或声称已执行。
- **source_conflict**：同时展示冲突来源，标记为待核实，不要强行选择一个版本。

## Prompt Recipes

### 适配判断

- 目标：判断这个项目是否适合用户当前任务。
- 预期输出：适配结论、关键理由、证据引用、安装前可预览内容、必须安装后验证内容、下一步建议。

```text
请基于 graphiti 的 AI Context Pack，先问我 3 个必要问题，然后判断它是否适合我的任务。回答必须包含：适合谁、能做什么、不能做什么、是否值得安装、证据来自哪里。所有项目事实必须引用 evidence_refs、source_paths 或 claim_id。
```

### 安装前体验

- 目标：让用户在安装前感受核心工作流，同时避免把预览包装成真实能力或营销承诺。
- 预期输出：一段带边界标签的体验剧本、安装后验证清单和谨慎建议；不含真实运行承诺或强营销表述。

```text
请把 graphiti 当作安装前体验资产，而不是已安装工具或真实运行环境。

请严格输出四段：
1. 先问我 3 个必要问题。
2. 给出一段“体验剧本”：用 [安装前可预览]、[必须安装后验证]、[证据不足] 三种标签展示它可能如何引导工作流。
3. 给出安装后验证清单：列出哪些能力只有真实安装、真实宿主加载、真实项目运行后才能确认。
4. 给出谨慎建议：只能说“值得继续研究/试装”“先补充信息后再判断”或“不建议继续”，不得替项目背书。

硬性边界：
- 不要声称已经安装、运行、执行测试、修改文件或产生真实结果。
- 不要写“自动适配”“确保通过”“完美适配”“强烈建议安装”等承诺性表达。
- 如果描述安装后的工作方式，必须使用“如果安装成功且宿主正确加载 Skill，它可能会……”这种条件句。
- 体验剧本只能写成“示例台词/假设流程”：使用“可能会询问/可能会建议/可能会展示”，不要写“已写入、已生成、已通过、正在运行、正在生成”。
- Prompt Preview 不负责给安装命令；如用户准备试装，只能提示先阅读 Quick Start 和 Risk Card，并在隔离环境验证。
- 所有项目事实必须来自 supported claim、evidence_refs 或 source_paths；inferred/unverified 只能作风险或待确认项。

```

### 角色 / Skill 选择

- 目标：从项目里的角色或 Skill 中挑选最匹配的资产。
- 预期输出：候选角色或 Skill 列表，每项包含适用场景、证据路径、风险边界和是否需要安装后验证。

```text
请读取 role_skill_index，根据我的目标任务推荐 3-5 个最相关的角色或 Skill。每个推荐都要说明适用场景、可能输出、风险边界和 evidence_refs。
```

### 风险预检

- 目标：安装或引入前识别环境、权限、规则冲突和质量风险。
- 预期输出：环境、权限、依赖、许可、宿主冲突、质量风险和未知项的检查清单。

```text
请基于 risk_card、boundaries 和 quick_start_candidates，给我一份安装前风险预检清单。不要替我执行命令，只说明我应该检查什么、为什么检查、失败会有什么影响。
```

### 宿主 AI 开工指令

- 目标：把项目上下文转成一次对话开始前的宿主 AI 指令。
- 预期输出：一段边界明确、证据引用明确、适合复制给宿主 AI 的开工前指令。

```text
请基于 graphiti 的 AI Context Pack，生成一段我可以粘贴给宿主 AI 的开工前指令。这段指令必须遵守 not_runtime=true，不能声称项目已经安装、运行或产生真实结果。
```


## 角色 / Skill 索引

- 共索引 18 个角色 / Skill / 项目文档条目。

- **What is a Context Graph?**（project_doc）：Graphiti Build Temporal Context Graphs for AI Agents 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`README.md`
- **Graphiti MCP Server**（project_doc）：Graphiti is a framework for building and querying temporally-aware knowledge graphs, specifically tailored for AI agents operating in dynamic environments. Unlike traditional retrieval-augmented generation RAG methods, Graphiti continuously integrates user interactions, structured and unstructured enterprise data, and external information into a coherent, queryable graph. The framework supports incremental data upda… 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`mcp_server/README.md`
- **graph-service**（project_doc）：Graph service is a fast api server implementing the graphiti https://github.com/getzep/graphiti package. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`server/README.md`
- **Azure OpenAI with Neo4j Example**（project_doc）：This example demonstrates how to use Graphiti with Azure OpenAI and Neo4j to build a knowledge graph. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`examples/azure-openai/README.md`
- **GLiNER2 Hybrid LLM Client Example Experimental**（project_doc）：GLiNER2 Hybrid LLM Client Example Experimental 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`examples/gliner2/README.md`
- **OpenTelemetry Stdout Tracing Example**（project_doc）：OpenTelemetry Stdout Tracing Example 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`examples/opentelemetry/README.md`
- **Graphiti Quickstart Example**（project_doc）：This example demonstrates the basic functionality of Graphiti, including: 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`examples/quickstart/README.md`
- **Docker Deployment for Graphiti MCP Server**（project_doc）：Docker Deployment for Graphiti MCP Server 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`mcp_server/docker/README.md`
- **Graphiti MCP Server Integration Tests**（project_doc）：Graphiti MCP Server Integration Tests 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`mcp_server/tests/README.md`
- **Repository Guidelines**（project_doc）：Project Structure & Module Organization Graphiti's core library lives under graphiti core/ , split into domain modules such as nodes.py , edges.py , models/ , and search/ for retrieval pipelines. Database drivers in graphiti core/driver/ support Neo4j, FalkorDB, Kuzu, and Neptune. Additional core modules include cross encoder/ reranking via BGE, OpenAI, and Gemini , telemetry/ OpenTelemetry tracing , namespaces/ nam… 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`AGENTS.md`
- **CLAUDE.md**（project_doc）：This file provides guidance to Claude Code claude.ai/code when working with code in this repository. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`CLAUDE.md`
- **Contributing to Graphiti**（project_doc）：We're thrilled you're interested in contributing to Graphiti! As firm believers in the power of open source collaboration, we're committed to building not just a tool, but a vibrant community where developers of all experience levels can make meaningful contributions. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`CONTRIBUTING.md`
- **Instructions for Using Graphiti's MCP Tools for Agent Memory**（project_doc）：Instructions for Using Graphiti's MCP Tools for Agent Memory 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`mcp_server/docs/cursor_rules.md`
- **Contributor Covenant Code of Conduct**（project_doc）：Contributor Covenant Code of Conduct 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`CODE_OF_CONDUCT.md`
- **OpenTelemetry Tracing in Graphiti**（project_doc）：Graphiti supports OpenTelemetry distributed tracing. Tracing is optional - without a tracer, operations use no-op implementations with zero overhead. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`OTEL_TRACING.md`
- **Security Policy**（project_doc）：Use this section to tell people about which versions of your project are currently being supported with security updates. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`SECURITY.md`
- **Contributor License Agreement CLA**（project_doc）：In order to clarify the intellectual property license granted with Contributions from any person or entity, Zep Software, Inc. "Zep" must have a Contributor License Agreement "CLA" on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of Zep; it does not change your rights to use your own Contr… 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`Zep-CLA.md`
- **FalkorDB + Graphiti MCP Server Combined Image**（project_doc）：FalkorDB + Graphiti MCP Server Combined Image 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`mcp_server/docker/README-falkordb-combined.md`

## 证据索引

- 共索引 80 条证据。

- **What is a Context Graph?**（documentation）：Graphiti Build Temporal Context Graphs for AI Agents 证据：`README.md`
- **Graphiti MCP Server**（documentation）：Graphiti is a framework for building and querying temporally-aware knowledge graphs, specifically tailored for AI agents operating in dynamic environments. Unlike traditional retrieval-augmented generation RAG methods, Graphiti continuously integrates user interactions, structured and unstructured enterprise data, and external information into a coherent, queryable graph. The framework supports incremental data updates, efficient retrieval, and precise historical queries without requiring complete graph recomputation, making it suitable for developing interactive, context-aware AI applications. 证据：`mcp_server/README.md`
- **graph-service**（documentation）：Graph service is a fast api server implementing the graphiti https://github.com/getzep/graphiti package. 证据：`server/README.md`
- **Azure OpenAI with Neo4j Example**（documentation）：This example demonstrates how to use Graphiti with Azure OpenAI and Neo4j to build a knowledge graph. 证据：`examples/azure-openai/README.md`
- **GLiNER2 Hybrid LLM Client Example Experimental**（documentation）：GLiNER2 Hybrid LLM Client Example Experimental 证据：`examples/gliner2/README.md`
- **OpenTelemetry Stdout Tracing Example**（documentation）：OpenTelemetry Stdout Tracing Example 证据：`examples/opentelemetry/README.md`
- **Graphiti Quickstart Example**（documentation）：This example demonstrates the basic functionality of Graphiti, including: 证据：`examples/quickstart/README.md`
- **Docker Deployment for Graphiti MCP Server**（documentation）：Docker Deployment for Graphiti MCP Server 证据：`mcp_server/docker/README.md`
- **Graphiti MCP Server Integration Tests**（documentation）：Graphiti MCP Server Integration Tests 证据：`mcp_server/tests/README.md`
- **Repository Guidelines**（documentation）：Project Structure & Module Organization Graphiti's core library lives under graphiti core/ , split into domain modules such as nodes.py , edges.py , models/ , and search/ for retrieval pipelines. Database drivers in graphiti core/driver/ support Neo4j, FalkorDB, Kuzu, and Neptune. Additional core modules include cross encoder/ reranking via BGE, OpenAI, and Gemini , telemetry/ OpenTelemetry tracing , namespaces/ namespace management , and migrations/ database migrations . Service adapters and API glue reside in server/graph service/ , while the MCP integration lives in mcp server/ with its own src/ , tests/ , config/ , and docker/ subdirectories . Shared assets sit in images/ and examples/… 证据：`AGENTS.md`
- **CLAUDE.md**（documentation）：This file provides guidance to Claude Code claude.ai/code when working with code in this repository. 证据：`CLAUDE.md`
- **Contributing to Graphiti**（documentation）：We're thrilled you're interested in contributing to Graphiti! As firm believers in the power of open source collaboration, we're committed to building not just a tool, but a vibrant community where developers of all experience levels can make meaningful contributions. 证据：`CONTRIBUTING.md`
- **License**（source_file）：Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ 证据：`LICENSE`
- **Instructions for Using Graphiti's MCP Tools for Agent Memory**（documentation）：Instructions for Using Graphiti's MCP Tools for Agent Memory 证据：`mcp_server/docs/cursor_rules.md`
- **Neo4j database connection**（source_file）：Neo4j database connection NEO4J URI= NEO4J PORT= NEO4J USER= NEO4J PASSWORD= 证据：`.env.example`
- **Docker Compose**（source_file）：services: graph: profiles: "" build: context: . ports: - "8000:8000" healthcheck: test: "CMD", "python", "-c", "import urllib.request; urllib.request.urlopen 'http://localhost:8000/healthcheck' ", interval: 10s timeout: 5s retries: 3 depends on: neo4j: condition: service healthy environment: - OPENAI API KEY=${OPENAI API KEY} - NEO4J URI=bolt://neo4j:${NEO4J PORT:-7687} - NEO4J USER=${NEO4J USER:-neo4j} - NEO4J PASSWORD=${NEO4J PASSWORD:-password} - PORT=8000 - db backend=neo4j neo4j: image: neo4j:5.26.2 profiles: "" healthcheck: test: "CMD-SHELL", "wget -qO- http://localhost:${NEO4J PORT:-7474} exit 1", interval: 1s timeout: 10s retries: 10 start period: 3s ports: - "7474:7474" - "${NEO4J… 证据：`docker-compose.yml`
- **Graphiti MCP Server Environment Configuration**（source_file）：Graphiti MCP Server Environment Configuration 证据：`mcp_server/.env.example`
- **pycodestyle**（source_file）：project name = "mcp-server" version = "1.0.2" description = "Graphiti MCP Server" readme = "README.md" requires-python = " =3.10, =1.9.4", "openai =1.91.0", "graphiti-core falkordb =0.28.2", "pydantic-settings =2.0.0", "pyyaml =6.0", "typing-extensions =4.0.0", 证据：`mcp_server/pyproject.toml`
- **pycodestyle**（source_file）：project name = "graphiti-core" description = "A temporal graph building library" version = "0.29.1" authors = { name = "Paul Paliychuk", email = "paul@getzep.com" }, { name = "Preston Rasmussen", email = "preston@getzep.com" }, { name = "Daniel Chalef", email = "daniel@getzep.com" }, readme = "README.md" license = "Apache-2.0" requires-python = " =3.10, =2.11.5", "neo4j =5.26.0", "openai =1.91.0", "tenacity =9.0.0", "numpy =1.0.0", "python-dotenv =1.0.1", "posthog =3.0.0" 证据：`pyproject.toml`
- **Only used if not running a neo4j container in docker**（source_file）：OPENAI API KEY= NEO4J PORT=7687 Only used if not running a neo4j container in docker NEO4J URI=bolt://localhost:7687 NEO4J USER=neo4j NEO4J PASSWORD=password 证据：`server/.env.example`
- **pycodestyle**（source_file）：project name = "graph-service" version = "0.1.0" description = "Zep Graph service implementing Graphiti package" authors = { "name" = "Paul Paliychuk", "email" = "paul@getzep.com" }, readme = "README.md" requires-python = " =3.10" dependencies = "fastapi =0.115.0", "graphiti-core =0.28.2", "pydantic-settings =2.4.0", "uvicorn =0.44.0", "httpx =0.28.1", 证据：`server/pyproject.toml`
- **Neo4j connection settings**（source_file）：Neo4j connection settings NEO4J URI=bolt://localhost:7687 NEO4J USER=neo4j NEO4J PASSWORD=password 证据：`examples/azure-openai/.env.example`
- **Neo4j connection settings**（source_file）：Neo4j connection settings NEO4J URI=bolt://localhost:7687 NEO4J USER=neo4j NEO4J PASSWORD=password 证据：`examples/gliner2/.env.example`
- **OpenAI API key required for LLM inference and embeddings**（source_file）：OpenAI API key required for LLM inference and embeddings OPENAI API KEY=your api key here 证据：`examples/opentelemetry/.env.example`
- **Pyproject**（source_file）：project name = "graphiti-otel-stdout-example" version = "0.1.0" requires-python = " =3.10" dependencies = "graphiti-core", "kuzu =0.11.2", "opentelemetry-api =1.20.0", "opentelemetry-sdk =1.20.0", 证据：`examples/opentelemetry/pyproject.toml`
- **Quickstart Falkordb**（source_file）：logger = logging.getLogger name ⋮---- falkor username = os.environ.get 'FALKORDB USERNAME', None falkor password = os.environ.get 'FALKORDB PASSWORD', None falkor host = os.environ.get 'FALKORDB HOST', 'localhost' falkor port = os.environ.get 'FALKORDB PORT', '6379' ⋮---- async def main ⋮---- falkor driver = FalkorDriver graphiti = Graphiti graph driver=falkor driver ⋮---- episodes = ⋮---- BASIC SEARCH ⋮---- The simplest way to retrieve relationships edges from Graphiti is using the search method, which performs a hybrid search combining semantic similarity and BM25 text retrieval. ⋮---- Perform a hybrid search combining semantic similarity and BM25 retrieval ⋮---- results = await graphiti.… 证据：`examples/quickstart/quickstart_falkordb.py`
- **Quickstart Neo4J**（source_file）：logger = logging.getLogger name ⋮---- neo4j uri = os.environ.get 'NEO4J URI', 'bolt://localhost:7687' neo4j user = os.environ.get 'NEO4J USER', 'neo4j' neo4j password = os.environ.get 'NEO4J PASSWORD', 'password' ⋮---- async def main ⋮---- graphiti = Graphiti neo4j uri, neo4j user, neo4j password ⋮---- episodes = ⋮---- BASIC SEARCH ⋮---- The simplest way to retrieve relationships edges from Graphiti is using the search method, which performs a hybrid search combining semantic similarity and BM25 text retrieval. ⋮---- Perform a hybrid search combining semantic similarity and BM25 retrieval ⋮---- results = await graphiti.search 'Who was the California Attorney General?' ⋮---- Print search res… 证据：`examples/quickstart/quickstart_neo4j.py`
- **Quickstart Neptune**（source_file）：logger = logging.getLogger name ⋮---- neptune uri = os.environ.get 'NEPTUNE HOST' neptune port = int os.environ.get 'NEPTUNE PORT', 8182 aoss host = os.environ.get 'AOSS HOST' ⋮---- async def main ⋮---- driver = NeptuneDriver host=neptune uri, aoss host=aoss host, port=neptune port ⋮---- graphiti = Graphiti graph driver=driver ⋮---- episodes = ⋮---- BASIC SEARCH ⋮---- The simplest way to retrieve relationships edges from Graphiti is using the search method, which performs a hybrid search combining semantic similarity and BM25 text retrieval. ⋮---- Perform a hybrid search combining semantic similarity and BM25 retrieval ⋮---- results = await graphiti.search 'Who was the California Attorney G… 证据：`examples/quickstart/quickstart_neptune.py`
- **Openai Reranker Client**（source_file）：logger = logging.getLogger name ⋮---- DEFAULT MODEL = 'gpt-4.1-nano' ⋮---- class OpenAIRerankerClient CrossEncoderClient ⋮---- config = LLMConfig ⋮---- async def rank self, query: str, passages: list str - list tuple str, float ⋮---- openai messages list: Any = ⋮---- responses = await semaphore gather ⋮---- responses top logprobs = scores: list float = ⋮---- norm logprobs = np.exp top logprobs 0 .logprob ⋮---- results = passage, score for passage, score in zip passages, scores, strict=True 证据：`graphiti_core/cross_encoder/openai_reranker_client.py`
- **Entity Edge Ops**（source_file）：logger = logging.getLogger name ⋮---- class FalkorEntityEdgeOperations EntityEdgeOperations ⋮---- edge data: dict str, Any = { ⋮---- query = get entity edge save query GraphProvider.FALKORDB ⋮---- batch size: int = 100, noqa: ARG002 ⋮---- prepared: list dict str, Any = ⋮---- query = get entity edge save bulk query GraphProvider.FALKORDB ⋮---- query = """ ⋮---- edges = entity edge from record r for r in records ⋮---- cursor clause = 'AND e.uuid < $uuid' if uuid cursor else '' limit clause = 'LIMIT $limit' if limit is not None else '' query = ⋮---- uuids = e.uuid for e in edges ⋮---- embedding map = {r 'uuid' : r 'fact embedding' for r in records} 证据：`graphiti_core/driver/falkordb/operations/entity_edge_ops.py`
- **Entity Node Ops**（source_file）：logger = logging.getLogger name ⋮---- class FalkorEntityNodeOperations EntityNodeOperations ⋮---- entity data: dict str, Any = { ⋮---- labels = ':'.join list set node.labels + 'Entity' ⋮---- query = get entity node save query GraphProvider.FALKORDB, labels ⋮---- batch size: int = 100, noqa: ARG002 ⋮---- prepared: list dict str, Any = ⋮---- queries: list tuple str, dict str, Any = get entity node save bulk query ⋮---- query = """ ⋮---- nodes = entity node from record r for r in records ⋮---- cursor clause = 'AND n.uuid < $uuid' if uuid cursor else '' limit clause = 'LIMIT $limit' if limit is not None else '' query = ⋮---- uuids = n.uuid for n in nodes ⋮---- embedding map = {r 'uuid' : r 'nam… 证据：`graphiti_core/driver/falkordb/operations/entity_node_ops.py`
- **Graph Ops**（source_file）：logger = logging.getLogger name ⋮---- class FalkorGraphMaintenanceOperations GraphMaintenanceOperations ⋮---- range indices = get range indices GraphProvider.FALKORDB fulltext indices = get fulltext indices GraphProvider.FALKORDB index queries = range indices + fulltext indices ⋮---- result = await executor.execute query 'CALL db.indexes ' ⋮---- drop tasks = ⋮---- label = record 'label' entity type = record 'entitytype' ⋮---- community clusters: list list EntityNode = ⋮---- group ids = group id values 0 'group ids' if group id values else ⋮---- resolved group ids: list str = group ids or ⋮---- projection: dict str, list Neighbor = {} ⋮---- nodes = entity node from record r for r in node rec… 证据：`graphiti_core/driver/falkordb/operations/graph_ops.py`
- **Remove stopwords and empty tokens**（source_file）：logger = logging.getLogger name ⋮---- MAX QUERY LENGTH = 128 ⋮---- SEPARATOR MAP = str.maketrans ⋮---- def sanitize query: str - str ⋮---- """Replace FalkorDB special characters with whitespace.""" sanitized = query.translate SEPARATOR MAP ⋮---- """Build a fulltext query string for FalkorDB using RedisSearch syntax.""" ⋮---- group filter = '' ⋮---- escaped group ids = f'"{gid}"' for gid in group ids group values = ' '.join escaped group ids group filter = f' @group id:{group values} ' ⋮---- sanitized query = sanitize query ⋮---- Remove stopwords and empty tokens query words = sanitized query.split filtered words = word for word in query words if word and word.lower not in STOPWORDS sanitize… 证据：`graphiti_core/driver/falkordb/operations/search_ops.py`
- **Convert the result header to a list of strings**（source_file）：logger = logging.getLogger name ⋮---- class FalkorDriverSession GraphDriverSession ⋮---- provider = GraphProvider.FALKORDB ⋮---- def init self, graph: FalkorGraph ⋮---- async def aenter self ⋮---- async def aexit self, exc type, exc, tb ⋮---- async def close self ⋮---- async def execute write self, func, args, kwargs ⋮---- async def run self, query: str list, kwargs: Any - Any ⋮---- params = convert datetimes to strings params ⋮---- params = dict kwargs ⋮---- class FalkorDriver GraphDriver ⋮---- default group id: str = '\\ ' fulltext syntax: str = '@' aoss client: None = None ⋮---- loop = asyncio.get running loop ⋮---- @property def entity node ops self - EntityNodeOperations ⋮---- @propert… 证据：`graphiti_core/driver/falkordb_driver.py`
- **Kuzu doesn't support UNWIND - iterate and save individually**（source_file）：logger = logging.getLogger name ⋮---- class KuzuEntityEdgeOperations EntityEdgeOperations ⋮---- params: dict str, Any = { ⋮---- query = get entity edge save query GraphProvider.KUZU ⋮---- Kuzu doesn't support UNWIND - iterate and save individually ⋮---- query = """ ⋮---- edges = parse kuzu entity edge r for r in records ⋮---- cursor clause = 'AND e.uuid < $uuid' if uuid cursor else '' limit clause = 'LIMIT $limit' if limit is not None else '' query = ⋮---- uuids = e.uuid for e in edges ⋮---- embedding map = {r 'uuid' : r 'fact embedding' for r in records} 证据：`graphiti_core/driver/kuzu/operations/entity_edge_ops.py`
- **Kuzu doesn't support UNWIND - iterate and save individually**（source_file）：logger = logging.getLogger name ⋮---- class KuzuEntityNodeOperations EntityNodeOperations ⋮---- attrs json = json.dumps node.attributes or {} params: dict str, Any = { ⋮---- query = get entity node save query GraphProvider.KUZU, '' ⋮---- Kuzu doesn't support UNWIND - iterate and save individually ⋮---- cleanup query = """ delete query = """ ⋮---- Clean up RelatesToNode intermediates first ⋮---- query = """ ⋮---- nodes = parse kuzu entity node r for r in records ⋮---- cursor clause = 'AND n.uuid < $uuid' if uuid cursor else '' limit clause = 'LIMIT $limit' if limit is not None else '' query = ⋮---- uuids = n.uuid for n in nodes ⋮---- embedding map = {r 'uuid' : r 'name embedding' for r in re… 证据：`graphiti_core/driver/kuzu/operations/entity_node_ops.py`
- **Graph Ops**（source_file）：logger = logging.getLogger name ⋮---- class KuzuGraphMaintenanceOperations GraphMaintenanceOperations ⋮---- range indices = get range indices GraphProvider.KUZU fulltext indices = get fulltext indices GraphProvider.KUZU index queries = range indices + fulltext indices ⋮---- community clusters: list list EntityNode = ⋮---- group ids = group id values 0 'group ids' if group id values else ⋮---- resolved group ids: list str = group ids or ⋮---- projection: dict str, list Neighbor = {} ⋮---- nodes = parse kuzu entity node r for r in node records ⋮---- cluster uuids = label propagation projection ⋮---- episode uuids = episode.uuid for episode in episodes ⋮---- node uuids = node.uuid for node in… 证据：`graphiti_core/driver/kuzu/operations/graph_ops.py`
- **Kuzu uses RelatesToNode as an intermediate node for edges, so each**（source_file）：logger = logging.getLogger name ⋮---- MAX QUERY LENGTH = 128 ⋮---- words = query.split ⋮---- words = words :max query length truncated = ' '.join words ⋮---- class KuzuSearchOperations SearchOperations ⋮---- fuzzy query = build kuzu fulltext query query, group ids ⋮---- filter query = '' ⋮---- filter query = ' WHERE ' + ' AND '.join filter queries ⋮---- cypher = ⋮---- search vector var = f'CAST $search vector AS FLOAT {len search vector } ' ⋮---- filter query = ' AND ' + ' AND '.join filter queries ⋮---- Kuzu uses RelatesToNode as an intermediate node for edges, so each logical hop is actually 2 hops in the graph. We need 3 separate MATCH queries UNIONed together: 1. Episodic - MENTIONS - E… 证据：`graphiti_core/driver/kuzu/operations/search_ops.py`
- **Entity Edge Ops**（source_file）：logger = logging.getLogger name ⋮---- class Neo4jEntityEdgeOperations EntityEdgeOperations ⋮---- edge data: dict str, Any = { ⋮---- query = get entity edge save query GraphProvider.NEO4J ⋮---- prepared: list dict str, Any = ⋮---- query = get entity edge save bulk query GraphProvider.NEO4J ⋮---- query = """ ⋮---- edges = entity edge from record r for r in records ⋮---- cursor clause = 'AND e.uuid < $uuid' if uuid cursor else '' limit clause = 'LIMIT $limit' if limit is not None else '' query = ⋮---- uuids = e.uuid for e in edges ⋮---- embedding map = {r 'uuid' : r 'fact embedding' for r in records} 证据：`graphiti_core/driver/neo4j/operations/entity_edge_ops.py`
- **Entity Node Ops**（source_file）：logger = logging.getLogger name ⋮---- class Neo4jEntityNodeOperations EntityNodeOperations ⋮---- entity data: dict str, Any = { ⋮---- labels = ':'.join list set node.labels + 'Entity' ⋮---- query = get entity node save query GraphProvider.NEO4J, labels ⋮---- prepared: list dict str, Any = ⋮---- query = get entity node save bulk query GraphProvider.NEO4J, prepared ⋮---- query = """ ⋮---- nodes = entity node from record r for r in records ⋮---- cursor clause = 'AND n.uuid < $uuid' if uuid cursor else '' limit clause = 'LIMIT $limit' if limit is not None else '' query = ⋮---- uuids = n.uuid for n in nodes ⋮---- embedding map = {r 'uuid' : r 'name embedding' for r in records} 证据：`graphiti_core/driver/neo4j/operations/entity_node_ops.py`
- **Graph Ops**（source_file）：logger = logging.getLogger name ⋮---- class Neo4jGraphMaintenanceOperations GraphMaintenanceOperations ⋮---- range indices = get range indices GraphProvider.NEO4J fulltext indices = get fulltext indices GraphProvider.NEO4J index queries = range indices + fulltext indices ⋮---- community clusters: list list EntityNode = ⋮---- group ids = group id values 0 'group ids' if group id values else ⋮---- resolved group ids: list str = group ids or ⋮---- projection: dict str, list Neighbor = {} ⋮---- nodes = entity node from record r for r in node records ⋮---- cluster uuids = label propagation projection ⋮---- episode uuids = episode.uuid for episode in episodes ⋮---- node uuids = node.uuid for node… 证据：`graphiti_core/driver/neo4j/operations/graph_ops.py`
- **--- Node search ---**（source_file）：logger = logging.getLogger name ⋮---- MAX QUERY LENGTH = 128 ⋮---- group ids filter list = f'group id:"{g}"' for g in group ids if group ids is not None else group ids filter = '' ⋮---- lucene query = lucene sanitize query ⋮---- full query = group ids filter + ' ' + lucene query + ' ' ⋮---- class Neo4jSearchOperations SearchOperations ⋮---- --- Node search --- ⋮---- fuzzy query = build neo4j fulltext query query, group ids ⋮---- filter query = '' ⋮---- filter query = ' WHERE ' + ' AND '.join filter queries ⋮---- cypher = ⋮---- filter query = ' AND ' + ' AND '.join filter queries ⋮---- filter params: dict str, Any = {} group filter query = '' ⋮---- group filter query = 'WHERE c.group id IN $… 证据：`graphiti_core/driver/neo4j/operations/search_ops.py`
- **Instantiate Neo4j operations**（source_file）：logger = logging.getLogger name ⋮---- class Neo4jDriver GraphDriver ⋮---- provider = GraphProvider.NEO4J default group id: str = '' ⋮---- Instantiate Neo4j operations ⋮---- Schedule the indices and constraints to be built ⋮---- Try to get the current event loop loop = asyncio.get running loop Schedule the build indices and constraints to run ⋮---- No event loop running, this will be handled later ⋮---- --- Operations properties --- ⋮---- @property def entity node ops self - EntityNodeOperations ⋮---- @property def episode node ops self - EpisodeNodeOperations ⋮---- @property def community node ops self - CommunityNodeOperations ⋮---- @property def saga node ops self - SagaNodeOperations ⋮--… 证据：`graphiti_core/driver/neo4j_driver.py`
- **Entity Edge Ops**（source_file）：logger = logging.getLogger name ⋮---- class NeptuneEntityEdgeOperations EntityEdgeOperations ⋮---- edge data: dict str, Any = { ⋮---- query = get entity edge save query GraphProvider.NEPTUNE ⋮---- prepared: list dict str, Any = ⋮---- query = get entity edge save bulk query GraphProvider.NEPTUNE ⋮---- query = """ ⋮---- edges = entity edge from record r for r in records ⋮---- cursor clause = 'AND e.uuid < $uuid' if uuid cursor else '' limit clause = 'LIMIT $limit' if limit is not None else '' query = ⋮---- uuids = e.uuid for e in edges ⋮---- embedding map = {r 'uuid' : r 'fact embedding' for r in records} 证据：`graphiti_core/driver/neptune/operations/entity_edge_ops.py`
- **Entity Node Ops**（source_file）：logger = logging.getLogger name ⋮---- class NeptuneEntityNodeOperations EntityNodeOperations ⋮---- entity data: dict str, Any = { ⋮---- labels = ':'.join list set node.labels + 'Entity' ⋮---- query = get entity node save query GraphProvider.NEPTUNE, labels ⋮---- prepared: list dict str, Any = ⋮---- queries = get entity node save bulk query GraphProvider.NEPTUNE, prepared ⋮---- query = """ ⋮---- nodes = entity node from record r for r in records ⋮---- cursor clause = 'AND n.uuid < $uuid' if uuid cursor else '' limit clause = 'LIMIT $limit' if limit is not None else '' query = ⋮---- uuids = n.uuid for n in nodes ⋮---- embedding map = {r 'uuid' : r 'name embedding' for r in records} 证据：`graphiti_core/driver/neptune/operations/entity_node_ops.py`
- **Graph Ops**（source_file）：logger = logging.getLogger name ⋮---- class NeptuneGraphMaintenanceOperations GraphMaintenanceOperations ⋮---- def init self, driver: NeptuneDriver None = None ⋮---- community clusters: list list EntityNode = ⋮---- group ids = group id values 0 'group ids' if group id values else ⋮---- resolved group ids: list str = group ids or ⋮---- projection: dict str, list Neighbor = {} ⋮---- nodes = entity node from record r for r in node records ⋮---- cluster uuids = label propagation projection ⋮---- episode uuids = episode.uuid for episode in episodes ⋮---- node uuids = node.uuid for node in nodes 证据：`graphiti_core/driver/neptune/operations/graph_ops.py`
- **Neptune: fetch all embeddings, compute cosine in Python**（source_file）：logger = logging.getLogger name ⋮---- class NeptuneSearchOperations SearchOperations ⋮---- def init self, driver: NeptuneDriver None = None ⋮---- driver = self. driver res = driver.run aoss query 'node name and summary', query, limit=limit ⋮---- input ids = ⋮---- cypher = ⋮---- filter query = '' ⋮---- filter query = ' WHERE ' + ' AND '.join filter queries ⋮---- Neptune: fetch all embeddings, compute cosine in Python query = ⋮---- score = calculate cosine similarity ⋮---- filter query = ' AND ' + ' AND '.join filter queries ⋮---- --- Edge search --- ⋮---- res = driver.run aoss query 'edge name and fact', query ⋮---- Fetch all embeddings, compute cosine similarity in Python ⋮---- cypher = """… 证据：`graphiti_core/driver/neptune/operations/search_ops.py`
- **Entity Edge Ops**（source_file）：class EntityEdgeOperations ABC 证据：`graphiti_core/driver/operations/entity_edge_ops.py`
- **Entity Node Ops**（source_file）：class EntityNodeOperations ABC 证据：`graphiti_core/driver/operations/entity_node_ops.py`
- **Graph Ops**（source_file）：class GraphMaintenanceOperations ABC 证据：`graphiti_core/driver/operations/graph_ops.py`
- **Search Ops**（source_file）：class SearchOperations ABC ⋮---- @abstractmethod def build node search filters self, search filters: SearchFilters - Any: ... ⋮---- @abstractmethod def build edge search filters self, search filters: SearchFilters - Any: ... 证据：`graphiti_core/driver/operations/search_ops.py`
- **Search Interface**（source_file）：class SearchInterface BaseModel ⋮---- def build node search filters self, search filters: Any - Any ⋮---- def build edge search filters self, search filters: Any - Any ⋮---- class Config ⋮---- arbitrary types allowed = True 证据：`graphiti_core/driver/search_interface/search_interface.py`
- **Node Db Queries**（source_file）：def validate entity labels labels: str list str - list str ⋮---- resolved labels = labels.split ':' if isinstance labels, str else labels filtered labels = label for label in resolved labels if label ⋮---- def get episode node save query provider: GraphProvider - str ⋮---- def get episode node save bulk query provider: GraphProvider - str ⋮---- EPISODIC NODE RETURN = """ ⋮---- EPISODIC NODE RETURN NEPTUNE = """ ⋮---- def get entity node save query provider: GraphProvider, labels: str, has aoss: bool = False - str ⋮---- validated labels = validate entity labels labels labels = ':'.join validated labels ⋮---- label subquery = '' ⋮---- save embedding query = ⋮---- queries = ⋮---- labels = '' ⋮… 证据：`graphiti_core/models/nodes/node_db_queries.py`
- **Search**（source_file）：logger = logging.getLogger name ⋮---- def enum value value: Any - Any ⋮---- def resolve tracer search tracer: Tracer None - Tracer ⋮---- start = time ⋮---- driver = driver or clients.driver embedder = clients.embedder cross encoder = clients.cross encoder search tracer = resolve tracer getattr clients, 'tracer', None ⋮---- search vector = ⋮---- search vector = 0.0 EMBEDDING DIM ⋮---- group ids = group ids if group ids and group ids != '' else None ⋮---- results = SearchResults ⋮---- latency = time - start 1000 ⋮---- search tracer = resolve tracer search tracer ⋮---- search tasks = ⋮---- search results: list list EntityEdge = ⋮---- search results = list await semaphore gather search tasks ⋮-… 证据：`graphiti_core/search/search.py`
- **Search Config**（source_file）：DEFAULT SEARCH LIMIT = 10 ⋮---- class EdgeSearchMethod Enum ⋮---- cosine similarity = 'cosine similarity' bm25 = 'bm25' bfs = 'breadth first search' ⋮---- class NodeSearchMethod Enum ⋮---- class EpisodeSearchMethod Enum ⋮---- class CommunitySearchMethod Enum ⋮---- class EdgeReranker Enum ⋮---- rrf = 'reciprocal rank fusion' node distance = 'node distance' episode mentions = 'episode mentions' mmr = 'mmr' cross encoder = 'cross encoder' ⋮---- class NodeReranker Enum ⋮---- class EpisodeReranker Enum ⋮---- class CommunityReranker Enum ⋮---- class EdgeSearchConfig BaseModel ⋮---- search methods: list EdgeSearchMethod reranker: EdgeReranker = Field default=EdgeReranker.rrf sim min score: float =… 证据：`graphiti_core/search/search_config.py`
- **Search Config Recipes**（source_file）：COMBINED HYBRID SEARCH RRF = SearchConfig ⋮---- COMBINED HYBRID SEARCH MMR = SearchConfig ⋮---- COMBINED HYBRID SEARCH CROSS ENCODER = SearchConfig ⋮---- EDGE HYBRID SEARCH RRF = SearchConfig ⋮---- EDGE HYBRID SEARCH MMR = SearchConfig ⋮---- EDGE HYBRID SEARCH NODE DISTANCE = SearchConfig ⋮---- EDGE HYBRID SEARCH EPISODE MENTIONS = SearchConfig ⋮---- EDGE HYBRID SEARCH CROSS ENCODER = SearchConfig ⋮---- NODE HYBRID SEARCH RRF = SearchConfig ⋮---- NODE HYBRID SEARCH MMR = SearchConfig ⋮---- NODE HYBRID SEARCH NODE DISTANCE = SearchConfig ⋮---- NODE HYBRID SEARCH EPISODE MENTIONS = SearchConfig ⋮---- NODE HYBRID SEARCH CROSS ENCODER = SearchConfig ⋮---- COMMUNITY HYBRID SEARCH RRF = SearchCon… 证据：`graphiti_core/search/search_config_recipes.py`
- **Search Filters**（source_file）：class ComparisonOperator Enum ⋮---- equals = '=' not equals = '< ' greater than = ' ' less than = ' =' less than equal = ' list str None ⋮---- def cypher to opensearch operator op: ComparisonOperator - str ⋮---- mapping = { ⋮---- filter queries: list str = filter params: dict str, Any = {} ⋮---- node label filter = 'list has all n.labels, $labels ' ⋮---- node labels = ' '.join filters.node labels node label filter = 'n:' + node labels ⋮---- query = ' ' + value name + ' ' ⋮---- edge types = filters.edge types ⋮---- node label filter = ⋮---- node label filter = 'n:' + node labels + ' AND m:' + node labels ⋮---- valid at filter = ' ' ⋮---- and filters = and filter query = '' ⋮---- invalid at f… 证据：`graphiti_core/search/search_filters.py`
- **If a single sentence is too large, split it by fixed size**（source_file）：logger = logging.getLogger name ⋮---- CHARS PER TOKEN = 4 ⋮---- def estimate tokens text: str - int ⋮---- def tokens to chars tokens: int - int ⋮---- def should chunk content: str, episode type: EpisodeType - bool ⋮---- tokens = estimate tokens content ⋮---- def estimate high density content: str, episode type: EpisodeType, tokens: int - bool ⋮---- def json likely dense content: str, tokens: int - bool ⋮---- data = json.loads content ⋮---- element count = len data ⋮---- density = element count / tokens 1000 if tokens 0 else 0 ⋮---- key count = count json keys data, max depth=2 density = key count / tokens 1000 if tokens 0 else 0 ⋮---- def count json keys data: dict, max depth: int = 2, curr… 证据：`graphiti_core/utils/content_chunking.py`
- **Docker Compose**（source_file）：services: graphiti-falkordb: image: zepai/knowledge-graph-mcp:latest build: context: .. dockerfile: docker/Dockerfile args: GRAPHITI CORE VERSION: ${GRAPHITI CORE VERSION:-0.28.1} MCP SERVER VERSION: ${MCP SERVER VERSION:-1.0.0} BUILD DATE: ${BUILD DATE:-} VCS REF: ${VCS REF:-} env file: - path: ../.env required: false environment: - FALKORDB PASSWORD=${FALKORDB PASSWORD:-} - BROWSER=${BROWSER:-1} - FALKORDB URI=redis://localhost:6379 - FALKORDB DATABASE=${FALKORDB DATABASE:-default db} - GRAPHITI GROUP ID=${GRAPHITI GROUP ID:-main} - SEMAPHORE LIMIT=${SEMAPHORE LIMIT:-10} - CONFIG PATH=/app/mcp/config/config.yaml - PATH=/root/.local/bin:${PATH} volumes: - falkordb data:/var/lib/falkordb/da… 证据：`mcp_server/docker/docker-compose.yml`
- **Create embedder client based on configured provider**（source_file）：mcp server dir = Path file .parent.parent env file = mcp server dir / '.env' ⋮---- SEMAPHORE LIMIT = int os.getenv 'SEMAPHORE LIMIT', 10 ⋮---- LOG FORMAT = '% asctime s - % name s - % levelname s - % message s' DATE FORMAT = '%Y-%m-%d %H:%M:%S' ⋮---- def configure uvicorn logging ⋮---- uvicorn logger = logging.getLogger logger name ⋮---- handler = logging.StreamHandler sys.stderr ⋮---- logger = logging.getLogger name ⋮---- config: GraphitiConfig ⋮---- GRAPHITI MCP INSTRUCTIONS = """ ⋮---- mcp = FastMCP ⋮---- graphiti service: Optional 'GraphitiService' = None queue service: QueueService None = None ⋮---- graphiti client: Graphiti None = None semaphore: asyncio.Semaphore ⋮---- class Graphiti… 证据：`mcp_server/src/graphiti_mcp_server.py`
- 其余 20 条证据见 `AI_CONTEXT_PACK.json` 或 `EVIDENCE_INDEX.json`。

## 宿主 AI 必须遵守的规则

- **把本资产当作开工前上下文，而不是运行环境。**：AI Context Pack 只包含证据化项目理解，不包含目标项目的可执行状态。 证据：`README.md`, `mcp_server/README.md`, `server/README.md`
- **回答用户时区分可预览内容与必须安装后才能验证的内容。**：安装前体验的消费者价值来自降低误装和误判，而不是伪装成真实运行。 证据：`README.md`, `mcp_server/README.md`, `server/README.md`

## 用户开工前应该回答的问题

- 你准备在哪个宿主 AI 或本地环境中使用它？
- 你只是想先体验工作流，还是准备真实安装？
- 你最在意的是安装成本、输出质量、还是和现有规则的冲突？

## 验收标准

- 所有能力声明都能回指到 evidence_refs 中的文件路径。
- AI_CONTEXT_PACK.md 没有把预览包装成真实运行。
- 用户能在 3 分钟内看懂适合谁、能做什么、如何开始和风险边界。

---

## Doramagic Context Augmentation

下面内容用于强化 Repomix/AI Context Pack 主体。Human Manual 只提供阅读骨架；踩坑日志会被转成宿主 AI 必须遵守的工作约束。

## Human Manual 骨架

使用规则：这里只是项目阅读路线和显著性信号，不是事实权威。具体事实仍必须回到 repo evidence / Claim Graph。

宿主 AI 硬性规则：
- 不得把页标题、章节顺序、摘要或 importance 当作项目事实证据。
- 解释 Human Manual 骨架时，必须明确说它只是阅读路线/显著性信号。
- 能力、安装、兼容性、运行状态和风险判断必须引用 repo evidence、source path 或 Claim Graph。

- **Introduction to Graphiti**：importance `high`
  - source_paths: README.md, graphiti_core/__init__.py, graphiti_core/graphiti.py
- **Installation Guide**：importance `high`
  - source_paths: pyproject.toml, .env.example, docker-compose.yml
- **Quick Start Guide**：importance `high`
  - source_paths: examples/quickstart/quickstart_neo4j.py, examples/quickstart/quickstart_falkordb.py, examples/quickstart/quickstart_neptune.py, examples/quickstart/README.md
- **Temporal Context Graphs**：importance `high`
  - source_paths: graphiti_core/nodes.py, graphiti_core/edges.py, graphiti_core/graphiti_types.py, graphiti_core/models/nodes/node_db_queries.py, graphiti_core/models/edges/edge_db_queries.py
- **Data Models**：importance `high`
  - source_paths: graphiti_core/nodes.py, graphiti_core/edges.py, graphiti_core/graphiti_types.py, graphiti_core/namespaces/nodes.py, graphiti_core/namespaces/edges.py
- **System Architecture**：importance `high`
  - source_paths: graphiti_core/graphiti.py, graphiti_core/driver/driver.py, graphiti_core/driver/query_executor.py, graphiti_core/driver/search_interface/search_interface.py, graphiti_core/search/search.py
- **Ingestion Pipeline**：importance `high`
  - source_paths: graphiti_core/utils/maintenance/combined_extraction.py, graphiti_core/utils/maintenance/node_operations.py, graphiti_core/utils/maintenance/edge_operations.py, graphiti_core/utils/maintenance/community_operations.py, graphiti_core/prompts/extract_nodes_and_edges.py
- **Search System**：importance `high`
  - source_paths: graphiti_core/search/search.py, graphiti_core/search/search_config.py, graphiti_core/search/search_config_recipes.py, graphiti_core/search/search_filters.py, graphiti_core/driver/search_interface/search_interface.py

## Repo Inspection Evidence / 源码检查证据

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `34f56e65e0fe2096132c8d16f3a1a4ac9300a5f6`
- inspected_files: `pyproject.toml`, `Dockerfile`, `README.md`, `docker-compose.yml`, `uv.lock`, `examples/azure-openai/azure_openai_neo4j.py`, `examples/azure-openai/README.md`, `examples/quickstart/quickstart_falkordb.py`, `examples/quickstart/dense_vs_normal_ingestion.py`, `examples/quickstart/quickstart_neptune.py`, `examples/quickstart/README.md`, `examples/quickstart/quickstart_neo4j.py`, `examples/ecommerce/runner.py`, `examples/podcast/podcast_runner.py`, `examples/podcast/transcript_parser.py`, `examples/data/manybirds_products.json`, `examples/gliner2/gliner2_neo4j.py`, `examples/gliner2/README.md`, `examples/opentelemetry/pyproject.toml`, `examples/opentelemetry/otel_stdout_example.py`

宿主 AI 硬性规则：
- 没有 repo_clone_verified=true 时，不得声称已经读过源码。
- 没有 repo_inspection_verified=true 时，不得把 README/docs/package 文件判断写成事实。
- 没有 quick_start_verified=true 时，不得声称 Quick Start 已跑通。

## Doramagic Pitfall Constraints / 踩坑约束

这些规则来自 Doramagic 发现、验证或编译过程中的项目专属坑点。宿主 AI 必须把它们当作工作约束，而不是普通说明文字。

### Constraint 1: 来源证据：NaN/Inf values from embedder silently break entity deduplication and propagate to graph storage

- Trigger: GitHub 社区证据显示该项目存在一个配置相关的待验证问题：NaN/Inf values from embedder silently break entity deduplication and propagate to graph storage
- Host AI rule: 来源问题仍为 open，Pack Agent 需要复核是否仍影响当前版本。
- Why it matters: 可能影响升级、迁移或版本选择。
- Evidence: community_evidence:github | cevd_2328466b52aa45579865c00657e318dd | https://github.com/getzep/graphiti/issues/1505 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 2: 来源证据：[BUG] FalkorDriver.build_fulltext_query fails on hyphens in group_id (RediSearch syntax error)

- Trigger: GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：[BUG] FalkorDriver.build_fulltext_query fails on hyphens in group_id (RediSearch syntax error)
- Host AI rule: 来源问题仍为 open，Pack Agent 需要复核是否仍影响当前版本。
- Why it matters: 可能影响授权、密钥配置或安全边界。
- Evidence: community_evidence:github | cevd_a31b49c7d71646a48dec968318e0ba8b | https://github.com/getzep/graphiti/issues/1483 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 3: 来源证据：Neo4jDriver.__init__:57 schedules orphan create_task without cancel/await pair

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Neo4jDriver.__init__:57 schedules orphan create_task without cancel/await pair
- Host AI rule: 来源问题仍为 open，Pack Agent 需要复核是否仍影响当前版本。
- Why it matters: 可能影响升级、迁移或版本选择。
- Evidence: community_evidence:github | cevd_b128cabe853b4492945c209b962d8457 | https://github.com/getzep/graphiti/issues/1513 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 4: 来源证据：Suggestion: Standardized retrieval quality benchmarks for temporal knowledge graph queries

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Suggestion: Standardized retrieval quality benchmarks for temporal knowledge graph queries
- Host AI rule: 来源问题仍为 open，Pack Agent 需要复核是否仍影响当前版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | cevd_a62b375e05dd49d18f6807c575566949 | https://github.com/getzep/graphiti/issues/1515 | 来源讨论提到 node 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 5: 来源证据：Your project is ranked #16 on HVTracker — embed a trust badge?

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Your project is ranked #16 on HVTracker — embed a trust badge?
- Host AI rule: 来源问题仍为 open，Pack Agent 需要复核是否仍影响当前版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | cevd_c1d4750319b947bd96a2308a6fe6d3b7 | https://github.com/getzep/graphiti/issues/1518 | 来源类型 github_issue 暴露的待验证使用条件。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 6: 来源证据：add_episode is impractically slow for >5KB content — proposal: skip_extraction parameter

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：add_episode is impractically slow for >5KB content — proposal: skip_extraction parameter
- Host AI rule: 来源问题仍为 open，Pack Agent 需要复核是否仍影响当前版本。
- Why it matters: 可能阻塞安装或首次运行。
- Evidence: community_evidence:github | cevd_752fa6d991e844c599853b3d9f69b47e | https://github.com/getzep/graphiti/issues/1516 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 7: 能力判断依赖假设

- Trigger: README/documentation is current enough for a first validation pass.
- Host AI rule: 将假设转成下游验证清单。
- Why it matters: 假设不成立时，用户拿不到承诺的能力。
- Evidence: capability.assumptions | github_repo:840056306 | https://github.com/getzep/graphiti | README/documentation is current enough for a first validation pass.
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 8: 来源证据：FalkorDriver.default_group_id ('\_') is rejected by validate_group_id

- Trigger: GitHub 社区证据显示该项目存在一个维护/版本相关的待验证问题：FalkorDriver.default_group_id ('\_') is rejected by validate_group_id
- Host AI rule: 来源问题仍为 open，Pack Agent 需要复核是否仍影响当前版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | cevd_2126d3011d414eaf8bd9ce77b0d0ce6f | https://github.com/getzep/graphiti/issues/1517 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 9: 维护活跃度未知

- Trigger: 未记录 last_activity_observed。
- Host AI rule: 补 GitHub 最近 commit、release、issue/PR 响应信号。
- Why it matters: 新项目、停更项目和活跃项目会被混在一起，推荐信任度下降。
- Evidence: evidence.maintainer_signals | github_repo:840056306 | https://github.com/getzep/graphiti | last_activity_observed missing
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 10: 下游验证发现风险项

- Trigger: no_demo
- Host AI rule: 进入安全/权限治理复核队列。
- Why it matters: 下游已经要求复核，不能在页面中弱化。
- Evidence: downstream_validation.risk_items | github_repo:840056306 | https://github.com/getzep/graphiti | no_demo; severity=medium
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。
