# flashrag - Doramagic AI Context Pack

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

## 充分原则

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

## 给宿主 AI 的使用方式

你正在读取 Doramagic 为 flashrag 编译的 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

## 它能做什么

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

## 怎么开始

- `pip install flashrag-dev --pre` 证据：`README.md` Claim：`clm_0003` supported 0.86
- `git clone https://github.com/RUC-NLPIR/FlashRAG.git` 证据：`README.md` Claim：`clm_0004` supported 0.86
- `pip install -e .` 证据：`README.md` Claim：`clm_0005` supported 0.86
- `pip install flashrag-dev[full]` 证据：`README.md` Claim：`clm_0006` supported 0.86
- `pip install vllm>=0.4.1` 证据：`README.md` Claim：`clm_0007` supported 0.86
- `pip install sentence-transformers` 证据：`README.md` Claim：`clm_0008` supported 0.86
- `pip install pyserini` 证据：`README.md` Claim：`clm_0009` supported 0.86
- `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Install Rust for compiling` 证据：`README.md` Claim：`clm_0010` supported 0.86
- `pip install pyseismic-lsr # Install Seismic` 证据：`README.md` Claim：`clm_0011` supported 0.86

## 继续前判断卡

- **当前建议**：先做角色匹配试用
- **为什么**：这个项目更像角色库，核心风险是选错角色或把角色文案当执行能力；先用 Prompt Preview 试角色匹配，再决定是否沙盒导入。

### 30 秒判断

- **现在怎么做**：先做角色匹配试用
- **最小安全下一步**：先用 Prompt Preview 试角色匹配；满意后再隔离导入
- **先别相信**：角色质量和任务匹配不能直接相信。
- **继续会触碰**：角色选择偏差、命令执行、本地环境或项目文件

### 现在可以相信

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

### 现在还不能相信

- **角色质量和任务匹配不能直接相信。**（unverified）：角色库证明有很多角色，不证明每个角色都适合你的具体任务，也不证明角色能产生高质量结果。
- **不能把角色文案当成真实执行能力。**（unverified）：安装前只能判断角色描述和任务画像是否匹配，不能证明它能在宿主 AI 里完成任务。
- **真实输出质量不能在安装前相信。**（unverified）：Prompt Preview 只能展示引导方式，不能证明真实项目中的结果质量。
- **宿主 AI 版本兼容性不能在安装前相信。**（unverified）：Claude、Cursor、Codex、Gemini 等宿主加载规则和版本差异必须在真实环境验证。
- **不会污染现有宿主 AI 行为，不能直接相信。**（inferred）：Skill、plugin、AGENTS/CLAUDE/GEMINI 指令可能改变宿主 AI 的默认行为。
- **可安全回滚不能默认相信。**（unverified）：除非项目明确提供卸载和恢复说明，否则必须先在隔离环境验证。
- **真实安装后是否与用户当前宿主 AI 版本兼容？**（unverified）：兼容性只能通过实际宿主环境验证。
- **项目输出质量是否满足用户具体任务？**（unverified）：安装前预览只能展示流程和边界，不能替代真实评测。

### 继续会触碰什么

- **角色选择偏差**：用户对任务应该由哪个专家角色处理的判断。 原因：选错角色会让 AI 从错误专业视角回答，浪费时间或误导决策。
- **命令执行**：包管理器、网络下载、本地插件目录、项目配置或用户主目录。 原因：运行第一条命令就可能产生环境改动；必须先判断是否值得跑。 证据：`README.md`
- **本地环境或项目文件**：安装结果、插件缓存、项目配置或本地依赖目录。 原因：安装前无法证明写入范围和回滚方式，需要隔离验证。 证据：`README.md`
- **宿主 AI 上下文**：AI Context Pack、Prompt Preview、Skill 路由、风险规则和项目事实。 原因：导入上下文会影响宿主 AI 后续判断，必须避免把未验证项包装成事实。

### 最小安全下一步

- **先跑 Prompt Preview**：先用交互式试用验证任务画像和角色匹配，不要先导入整套角色库。（适用：任何项目都适用，尤其是输出质量未知时。）
- **只在隔离目录或测试账号试装**：避免安装命令污染主力宿主 AI、真实项目或用户主目录。（适用：存在命令执行、插件配置或本地写入线索时。）
- **安装后只验证一个最小任务**：先验证加载、兼容、输出质量和回滚，再决定是否深用。（适用：准备从试用进入真实工作流时。）

### 退出方式

- **保留安装前状态**：记录原始宿主配置和项目状态，后续才能判断是否可恢复。
- **保留原始角色选择记录**：如果输出偏题，可以回到任务画像阶段重新选择角色，而不是继续沿着错误角色推进。
- **记录安装命令和写入路径**：没有明确卸载说明时，至少要知道哪些目录或配置需要手动清理。
- **如果没有回滚路径，不进入主力环境**：不可回滚是继续前阻断项，不应靠信任或运气继续。

## 哪些只能预览

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

## 哪些必须安装后验证

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

## 边界与风险判断卡

- **把安装前预览误认为真实运行**：用户可能高估项目已经完成的配置、权限和兼容性验证。 处理方式：明确区分 prompt_preview_can_do 与 runtime_required。 Claim：`clm_0012` inferred 0.45
- **命令执行会修改本地环境**：安装命令可能写入用户主目录、宿主插件目录或项目配置。 处理方式：先在隔离环境或测试账号中运行。 证据：`README.md` Claim：`clm_0013` 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

### 上下文规模

- 文件总数：146
- 重要文件覆盖：40/146
- 证据索引条目：79
- 角色 / Skill 条目：35

### 证据不足时的处理

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

## Prompt Recipes

### 适配判断

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

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

### 安装前体验

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

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

请严格输出四段：
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
请基于 flashrag 的 AI Context Pack，生成一段我可以粘贴给宿主 AI 的开工前指令。这段指令必须遵守 not_runtime=true，不能声称项目已经安装、运行或产生真实结果。
```

## 角色 / Skill 索引

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

- **Welcome to FlashRAG's documentation!**（project_doc）：Welcome to FlashRAG's documentation! 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/en-us/README.md`
- **欢迎来到 FlashRAG 的文档！**（project_doc）：FlashRAG 是一个用于重现和开发检索增强生成（RAG）研究的 Python 工具包。我们的工具包包括 36 个预处理的基准 RAG 数据集和 16 种最先进的 RAG 算法。我们的特点如下： 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/zh-cn/README.md`
- **⚡FlashRAG: A Python Toolkit for Efficient RAG Research**（project_doc）：⚡FlashRAG: A Python Toolkit for Efficient RAG Research \ English 中文 README zh.md \ 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`README.md`
- **Navbar**（project_doc）：- Translations - :cn: 中文 /zh-cn/ - :us: English /en-us/ 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/_navbar.md`
- **Sidebar**（project_doc）：Get Started Introduction en-us/introduction.md Installation en-us/installation.md Tutorial en-us/tutorial.md Webui en-us/webui.md 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/_sidebar.md`
- **RAG failure modes and debug checklist**（project_doc）：RAG failure modes and debug checklist 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/rag_failure_modes_and_debug_checklist.md`
- **Introduction**（project_doc）： 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/en-us/get_started/introduction.md`
- **Implementation Details for Benchmarking Experiments**（project_doc）：Implementation Details for Benchmarking Experiments 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/original_docs/baseline_details.md`
- **实验基准测试的实现细节**（project_doc）：我们在统一的设置下测试了所有实现的方法。用户只需要下载相应的模型并填写配置，就可以使用我们提供的脚本 这里 https://github.com/RUC-NLPIR/FlashRAG/blob/main/examples/methods/run exp.py 运行相应的结果。本章详细介绍了使用我们的工具包复现各种算法的具体实现细节，使用户能够轻松复制实验并将结果与我们的对齐。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/original_docs/baseline_details_zh.md`
- **RAG-Components Usage**（project_doc）：The retriever takes a series of queries and retrieves the top k documents from a corpus corresponding to each query. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/original_docs/basic_usage.md`
- **Indexing your own corpus**（project_doc）：Step1: Prepare corpus To build an index, you first need to save your corpus in jsonl format as follows, each line is a document. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/original_docs/building-index.md`
- **Chunking Document Corpus**（project_doc）：You can chunk your document corpus into smaller chunks by following these steps. This is useful in building an index over a large corpus of long documents for RAG, or if you want to make sure that the document length is not too long for the model. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/original_docs/chunk-doc-corpus.md`
- **Configuration and Parameters**（project_doc）：FlashRAG enables comprehensive management of various parameters for controlling the experiment. FlashRAG supports two types of parameter configurations: YAML config file and parameter dict . The parameters are assigned via the Config module. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/original_docs/configuration.md`
- **1. Overview**（project_doc）：This document aims to introduce various configurations and functionalities of this project using the Standard RAG process as an example. Additional documentation will be provided later to cover complex uses such as reproducing existing methods and detailed usage of individual components. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/original_docs/introduction_for_beginners_en.md`
- **1. 개요**（project_doc）：이 문서는 표준 RAG 프로세스를 예로 들어 이 프로젝트의 다양한 구성과 기능을 소개하는 것을 목표로 합니다. 기존 방법의 재현과 개별 구성 요소의 자세한 사용법 등 복잡한 사용법에 대해서는 추후 추가 문서가 제공될 예정입니다. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/original_docs/introduction_for_beginners_kr.md`
- **1. Overview**（project_doc）：本文旨在以Standard RAG流程为例进行介绍本项目所涉及的各种配置和功能。关于复现已有方法以及各个组件的详细用法等复杂用法，后续会有额外的文档来介绍。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/original_docs/introduction_for_beginners_zh.md`
- **Multi-Retriever Usage**（project_doc）：Using multiple retrievers simultaneously requires configuration in the multi retrieve section of the config file. Enable use multi retriever and configure it as follows: 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/original_docs/multi_retriever_usage.md`
- **Building Wiki Corpus**（project_doc）：You can create your own wiki corpus by following these steps. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/original_docs/process-wiki.md`
- **Guidelines for Reproduction Methods**（project_doc）：Guidelines for Reproduction Methods 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/original_docs/reproduce_experiment.md`
- **预备工作**（project_doc）：在本文档中，我们将介绍如何在统一的设置下复现我们表格中列出的各种方法的结果。有关每种方法的具体设置和解释，请参考 实现细节 ./baseline details.md 。建议事先对本仓库有一定的基本了解，可以在 初学者介绍 ./introduction for beginners en.md 中找到。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/original_docs/reproduce_experiment_zh.md`
- **Sidebar**（project_doc）：开始使用 介绍 zh-cn/get started/introduction.md 安装 zh-cn/get started/installation.md Webui zh-cn/get started/webui.md 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/zh-cn/_sidebar.md`
- **生成器（Generator）**（project_doc）：生成器（Generator）模块是FlashRAG框架中的一个核心组件，主要用于根据用户的输入生成文本内容。在RAG（检索增强生成）任务中，生成器接收由检索器提供的相关文档或信息，并根据这些信息生成最终的答案或文本输出。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/zh-cn/component/generator.md`
- **判别器**（project_doc）：在RAG过程中，并非所有的输入都需要进行检索增强。判别器的作用是对用户给出的query进行分类，为不同类型的query进行不同的检索增强流程。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/zh-cn/component/judger.md`
- **精炼器**（project_doc）：精炼器用于对检索结果进行后处理，包括压缩、精炼等。目前FlashRAG支持四种精炼器: 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/zh-cn/component/refiner.md`
- **检索器**（project_doc）：检索器（Retriever）是一个用于从大量文档或数据中高效检索相关信息的组件。其核心功能是根据用户输入的查询（如文本或图像），从预先构建的文档库中检索出最相关的文档或信息。 检索器的工作原理是通过计算查询和文档之间的相似度，并返回最相关的文档。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/zh-cn/component/retriever.md`
- **环境设置**（project_doc）：环境设置主要包含与组件无关的一些全局设置，包括自动路径设置，全局设置和评测设置。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/zh-cn/configuration/basic-settings.md`
- **配置设置**（project_doc）：FlashRAG通过实现的 Config 类对实验所需的所有参数进行管理。 Config 类支持两种类型的参数配置: YAML配置文件 和 参数字典 ，实验中需要的参数可以通过任一方式进行传递 参数字典优先级更高 。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/zh-cn/configuration/config-setting.md`
- **生成器设置**（project_doc）：- framework 设置LLM的推理框架。支持以下选项： - hf ：使用HuggingFace原生的transformers框架，不支持多卡并行。 - vllm ：VLLM框架。 - fschat ：使用FastChat推理框架。 - openai ：OpenAI 的推理框架，适用于使用OpenAI格式的API进行推理。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/zh-cn/configuration/generator-setting.md`
- **检索器设置**（project_doc）：检索器相关的参数主要包含四部分: 基本检索模型参数 检索涉及的超参数 重排器相关参数 多路检索功能参数 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/zh-cn/configuration/retriever-settings.md`
- **文档库准备**（project_doc）：在RAG流程中，我们会根据query从文档库中检索相应的文档，其中涉及了两部分数据的准备: 1. 文档库 : 包含了所有我们希望检索的数据。 2. 索引 : 为了提升检索过程的效率，往往需要基于文档库构建索引，不同检索方法和模型分别对应不同的索引。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/zh-cn/data_preparation/build-corpus.md`
- **索引构建**（project_doc）：基于准备好的检索文档库，可以对需要使用的检索方法构建索引。FlashRAG目前支持纯文本模态的检索 embedding & BM25 以及多模态检索方法 clip-based 。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/zh-cn/data_preparation/build-index.md`
- **数据集概况**（project_doc）：FlashRAG预处理了38个RAG中常用的数据集，并托管在 Huggingface https://huggingface.co/datasets/RUC-NLPIR/FlashRAG datasets 和 ModelScope https://www.modelscope.cn/datasets/hhjinjiajie/FlashRAG Dataset 双平台上。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/zh-cn/data_preparation/evaluation-datasets.md`
- **安装FlashRAG**（project_doc）：FlashRAG主体支持从PyPi和源码两种安装方式，需要Python版本 =3.10。默认安装的方式涵盖了FlashRAG本体以及所需要的大部分依赖，用户可以直接使用。由于部分依赖可能存在版本冲突，我们不设置自动安装，用户可以参考下文进行手动安装。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/zh-cn/get_started/installation.md`
- **FlashRAG 简介**（project_doc）：FlashRAG是一个用于复现和开发检索增强生成（RAG）流程的Python工具包。其集成了RAG流程中需要用到的数据集、文档库、组件实现、算法实现、评估指标以及可视化界面，力求实现更简单、更高效的RAG算法开发与研究。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/zh-cn/get_started/introduction.md`
- **WebUI**（project_doc）：FlashRAG提供了一个WebUI，用户可以通过WebUI界面来体验各类RAG流程以及运行实验，从而免去手动编写代码的繁琐过程。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/zh-cn/get_started/webui.md`

## 证据索引

- 共索引 79 条证据。

- **Welcome to FlashRAG's documentation!**（documentation）：Welcome to FlashRAG's documentation! 证据：`docs/en-us/README.md`
- **欢迎来到 FlashRAG 的文档！**（documentation）：FlashRAG 是一个用于重现和开发检索增强生成（RAG）研究的 Python 工具包。我们的工具包包括 36 个预处理的基准 RAG 数据集和 16 种最先进的 RAG 算法。我们的特点如下： 证据：`docs/zh-cn/README.md`
- **⚡FlashRAG: A Python Toolkit for Efficient RAG Research**（documentation）：⚡FlashRAG: A Python Toolkit for Efficient RAG Research \ English 中文 README zh.md \ 证据：`README.md`
- **License**（source_file）：Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files the "Software" , to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 证据：`LICENSE`
- **Navbar**（documentation）：- Translations - :cn: 中文 /zh-cn/ - :us: English /en-us/ 证据：`docs/_navbar.md`
- **Sidebar**（documentation）：Get Started Introduction en-us/introduction.md Installation en-us/installation.md Tutorial en-us/tutorial.md Webui en-us/webui.md 证据：`docs/_sidebar.md`
- **RAG failure modes and debug checklist**（documentation）：RAG failure modes and debug checklist 证据：`docs/rag_failure_modes_and_debug_checklist.md`
- **Implementation Details for Benchmarking Experiments**（documentation）：Implementation Details for Benchmarking Experiments 证据：`docs/original_docs/baseline_details.md`
- **实验基准测试的实现细节**（documentation）：我们在统一的设置下测试了所有实现的方法。用户只需要下载相应的模型并填写配置，就可以使用我们提供的脚本 这里 https://github.com/RUC-NLPIR/FlashRAG/blob/main/examples/methods/run exp.py 运行相应的结果。本章详细介绍了使用我们的工具包复现各种算法的具体实现细节，使用户能够轻松复制实验并将结果与我们的对齐。 证据：`docs/original_docs/baseline_details_zh.md`
- **RAG-Components Usage**（documentation）：The retriever takes a series of queries and retrieves the top k documents from a corpus corresponding to each query. 证据：`docs/original_docs/basic_usage.md`
- **Indexing your own corpus**（documentation）：Step1: Prepare corpus To build an index, you first need to save your corpus in jsonl format as follows, each line is a document. 证据：`docs/original_docs/building-index.md`
- **Chunking Document Corpus**（documentation）：You can chunk your document corpus into smaller chunks by following these steps. This is useful in building an index over a large corpus of long documents for RAG, or if you want to make sure that the document length is not too long for the model. 证据：`docs/original_docs/chunk-doc-corpus.md`
- **Configuration and Parameters**（documentation）：FlashRAG enables comprehensive management of various parameters for controlling the experiment. FlashRAG supports two types of parameter configurations: YAML config file and parameter dict . The parameters are assigned via the Config module. 证据：`docs/original_docs/configuration.md`
- **1. Overview**（documentation）：This document aims to introduce various configurations and functionalities of this project using the Standard RAG process as an example. Additional documentation will be provided later to cover complex uses such as reproducing existing methods and detailed usage of individual components. 证据：`docs/original_docs/introduction_for_beginners_en.md`
- **1. 개요**（documentation）：이 문서는 표준 RAG 프로세스를 예로 들어 이 프로젝트의 다양한 구성과 기능을 소개하는 것을 목표로 합니다. 기존 방법의 재현과 개별 구성 요소의 자세한 사용법 등 복잡한 사용법에 대해서는 추후 추가 문서가 제공될 예정입니다. 证据：`docs/original_docs/introduction_for_beginners_kr.md`
- **1. Overview**（documentation）：本文旨在以Standard RAG流程为例进行介绍本项目所涉及的各种配置和功能。关于复现已有方法以及各个组件的详细用法等复杂用法，后续会有额外的文档来介绍。 证据：`docs/original_docs/introduction_for_beginners_zh.md`
- **Multi-Retriever Usage**（documentation）：Using multiple retrievers simultaneously requires configuration in the multi retrieve section of the config file. Enable use multi retriever and configure it as follows: 证据：`docs/original_docs/multi_retriever_usage.md`
- **Building Wiki Corpus**（documentation）：You can create your own wiki corpus by following these steps. 证据：`docs/original_docs/process-wiki.md`
- **Guidelines for Reproduction Methods**（documentation）：Guidelines for Reproduction Methods 证据：`docs/original_docs/reproduce_experiment.md`
- **预备工作**（documentation）：在本文档中，我们将介绍如何在统一的设置下复现我们表格中列出的各种方法的结果。有关每种方法的具体设置和解释，请参考 实现细节 ./baseline details.md 。建议事先对本仓库有一定的基本了解，可以在 初学者介绍 ./introduction for beginners en.md 中找到。 证据：`docs/original_docs/reproduce_experiment_zh.md`
- **Sidebar**（documentation）：开始使用 介绍 zh-cn/get started/introduction.md 安装 zh-cn/get started/installation.md Webui zh-cn/get started/webui.md 证据：`docs/zh-cn/_sidebar.md`
- **生成器（Generator）**（documentation）：生成器（Generator）模块是FlashRAG框架中的一个核心组件，主要用于根据用户的输入生成文本内容。在RAG（检索增强生成）任务中，生成器接收由检索器提供的相关文档或信息，并根据这些信息生成最终的答案或文本输出。 证据：`docs/zh-cn/component/generator.md`
- **判别器**（documentation）：在RAG过程中，并非所有的输入都需要进行检索增强。判别器的作用是对用户给出的query进行分类，为不同类型的query进行不同的检索增强流程。 证据：`docs/zh-cn/component/judger.md`
- **精炼器**（documentation）：精炼器用于对检索结果进行后处理，包括压缩、精炼等。目前FlashRAG支持四种精炼器: 证据：`docs/zh-cn/component/refiner.md`
- **检索器**（documentation）：检索器（Retriever）是一个用于从大量文档或数据中高效检索相关信息的组件。其核心功能是根据用户输入的查询（如文本或图像），从预先构建的文档库中检索出最相关的文档或信息。 检索器的工作原理是通过计算查询和文档之间的相似度，并返回最相关的文档。 证据：`docs/zh-cn/component/retriever.md`
- **环境设置**（documentation）：环境设置主要包含与组件无关的一些全局设置，包括自动路径设置，全局设置和评测设置。 证据：`docs/zh-cn/configuration/basic-settings.md`
- **配置设置**（documentation）：FlashRAG通过实现的 Config 类对实验所需的所有参数进行管理。 Config 类支持两种类型的参数配置: YAML配置文件 和 参数字典 ，实验中需要的参数可以通过任一方式进行传递 参数字典优先级更高 。 证据：`docs/zh-cn/configuration/config-setting.md`
- **生成器设置**（documentation）：- framework 设置LLM的推理框架。支持以下选项： - hf ：使用HuggingFace原生的transformers框架，不支持多卡并行。 - vllm ：VLLM框架。 - fschat ：使用FastChat推理框架。 - openai ：OpenAI 的推理框架，适用于使用OpenAI格式的API进行推理。 证据：`docs/zh-cn/configuration/generator-setting.md`
- **检索器设置**（documentation）：检索器相关的参数主要包含四部分: 基本检索模型参数 检索涉及的超参数 重排器相关参数 多路检索功能参数 证据：`docs/zh-cn/configuration/retriever-settings.md`
- **文档库准备**（documentation）：在RAG流程中，我们会根据query从文档库中检索相应的文档，其中涉及了两部分数据的准备: 1. 文档库 : 包含了所有我们希望检索的数据。 2. 索引 : 为了提升检索过程的效率，往往需要基于文档库构建索引，不同检索方法和模型分别对应不同的索引。 证据：`docs/zh-cn/data_preparation/build-corpus.md`
- **索引构建**（documentation）：基于准备好的检索文档库，可以对需要使用的检索方法构建索引。FlashRAG目前支持纯文本模态的检索 embedding & BM25 以及多模态检索方法 clip-based 。 证据：`docs/zh-cn/data_preparation/build-index.md`
- **数据集概况**（documentation）：FlashRAG预处理了38个RAG中常用的数据集，并托管在 Huggingface https://huggingface.co/datasets/RUC-NLPIR/FlashRAG datasets 和 ModelScope https://www.modelscope.cn/datasets/hhjinjiajie/FlashRAG Dataset 双平台上。 证据：`docs/zh-cn/data_preparation/evaluation-datasets.md`
- **安装FlashRAG**（documentation）：FlashRAG主体支持从PyPi和源码两种安装方式，需要Python版本 =3.10。默认安装的方式涵盖了FlashRAG本体以及所需要的大部分依赖，用户可以直接使用。由于部分依赖可能存在版本冲突，我们不设置自动安装，用户可以参考下文进行手动安装。 证据：`docs/zh-cn/get_started/installation.md`
- **FlashRAG 简介**（documentation）：FlashRAG是一个用于复现和开发检索增强生成（RAG）流程的Python工具包。其集成了RAG流程中需要用到的数据集、文档库、组件实现、算法实现、评估指标以及可视化界面，力求实现更简单、更高效的RAG算法开发与研究。 证据：`docs/zh-cn/get_started/introduction.md`
- **WebUI**（documentation）：FlashRAG提供了一个WebUI，用户可以通过WebUI界面来体验各类RAG流程以及运行实验，从而免去手动编写代码的繁琐过程。 证据：`docs/zh-cn/get_started/webui.md`
- **Run Refiner**（source_file）：config dict = { ⋮---- config = Config 'my config.yaml', config dict ⋮---- refiner = LLMLinguaRefiner config ⋮---- prompt = "Answer the question based on the given document. Only give me the answer and do not output any other words.\n\nThe following are given documents.\n\nDoc 1 Title: \"Polish-Russian War film \" Polish-Russian War film Polish-Russian War Wojna polsko-ruska is a 2009 Polish film directed by Xawery \u017bu\u0142awski based on the novel Polish-Russian War under the white-red flag by Dorota Mas\u0142owska. The film's events take place over several days and they are set in the present time in a large Polish city. The main character is a bandit, a Polish dres a Polish chav calle… 证据：`examples/run_refiner.py`
- **Version**（source_file）：version = "0.3.0dev0" 证据：`flashrag/version.py`
- **Pyproject**（source_file）：tool.ruff.lint extend-select = "W291", "W293" 证据：`pyproject.toml`
- **Requirements**（source_file）：datasets base58 nltk numpy langid openai peft PyYAML rank bm25 rouge spacy tiktoken torch tqdm transformers =4.40.0 bm25s core ==0.2.1 fschat streamlit chonkie =1.0.2, =5.0.0 rouge-chinese jieba 证据：`requirements.txt`
- **text = re.sub ' ', ' ', text, flags=re.DOTALL might have useful information?**（source_file）：def load corpus dir path ⋮---- def iter files path ⋮---- def read jsonl file file path ⋮---- json data = json.loads line ⋮---- all files = file for file in iter files dir path corpus = ⋮---- def basic process title, text ⋮---- title = html.unescape title text = html.unescape text text = text.strip ⋮---- text = text : -len " References." .strip ⋮---- text = re.sub "\{\{cite . ?\}\}", " ", text, flags=re.DOTALL text = text.replace r"TABLETOREPLACE", " " text = text.replace r"'''", " " text = text.replace r" ", " " text = text.replace r" ", " " text = text.replace r"{{", " " text = text.replace r"}}", " " text = text.replace " ", " " text = text.replace "&quot;", '"' text = text.replace "&amp;… 证据：`scripts/preprocess_wiki.py`
- **Setup**（source_file）：requirements = fp.read .splitlines ⋮---- long description = fh.read version = {} ⋮---- extras require = { 证据：`setup.py`
- **Setup Conda**（source_file）：echo "Start the Conda environment setup for FlashRAG" conda create -n flashrag env python=3.11 -y source $ conda info --base /etc/profile.d/conda.sh conda activate flashrag env echo "📦 Installing FAISS-GPU" conda install -c pytorch -c nvidia faiss-gpu=1.8.0 -y echo "📦 Installing the core dependencies" pip install -e . core pip install vllm =0.4.1 sentence-transformers termcolor "numpy $CONDA PREFIX/etc/conda/activate.d/env vars.sh echo "✅ Setup completed successfully! Use ‘conda activate flashrag env’ to get started." 证据：`setup_conda.sh`
- **Chatter**（source_file）：class Chatter ⋮---- base output = "" 证据：`webui/chatter.py`
- **Engine**（source_file）：class Engine ⋮---- def init self - None ⋮---- output dict: Dict "Component", "Component" = {} ⋮---- elem = self.manager.get elem by id elem id ⋮---- def change lang self, lang: str ⋮---- def resume self ⋮---- base lang = 'en' init dict = {'basic.lang': {'value': base lang}} 证据：`webui/engine.py`
- **Interface**（source_file）：def create ui - "gr.Blocks" ⋮---- engine = Engine ⋮---- lang: "gr.Dropdown" = engine.manager.get elem by id "basic.lang" config file: "gr.Dropdown" = engine.manager.get elem by id "basic.config file" config save btn: "gr.Button" = engine.manager.get elem by id "preview.config save btn" output box = engine.manager.get elem by id "preview.output box" 证据：`webui/interface.py`
- **Manager**（source_file）：class Manager ⋮---- def init self - None ⋮---- def add elems self, tab name: str, elem dict: Dict str, "Component" - None ⋮---- r""" Adds elements to manager. """ ⋮---- elem id = f"{tab name}.{elem name}" ⋮---- def get elem list self - List "Component" ⋮---- r""" Returns the list of all elements. """ ⋮---- def get elem list without accordion self - List "Component" ⋮---- outputs = ⋮---- def get elem iter self - Generator Tuple str, "Component" , None, None ⋮---- r""" Returns an iterator over all elements with their names. """ ⋮---- def get elem iter full self - Generator Tuple str, "Component" , None, None ⋮---- def get elem by id self, elem id: str - "Component" ⋮---- r""" Gets element by… 证据：`webui/manager.py`
- **Runner**（source_file）：class Runner ⋮---- def init self, manager: Manager - None ⋮---- def parse pipeline args self, data: Dict "Component", Any - Dict str, Any ⋮---- get = lambda elem id: data self.manager.get elem by id elem id ⋮---- basic setting = dict ⋮---- retriever settring = dict ⋮---- reranker setting = dict ⋮---- generator setting = dict ⋮---- openai setting = dict ⋮---- generation params = dict ⋮---- llmlingua setting = dict ⋮---- recomp setting = dict ⋮---- sc setting = dict ⋮---- retrobust setting = dict ⋮---- skr setting = dict ⋮---- selfrag setting = dict ⋮---- flare setting = dict ⋮---- iterretgen setting = dict iter num=get "method.iterretgen iter num" ⋮---- ircot setting = dict max iter=get "met… 证据：`webui/runner.py`
- **Utils**（source_file）：text = f" {text} " ⋮---- text = f" {text} " ⋮---- def gen config args: Dict str, Any - str ⋮---- config lines = json.dumps args, indent = 4 ⋮---- def read yaml file file path: str - Dict str, Any ⋮---- data = yaml.safe load file ⋮---- flattened = {} ⋮---- new key = f"{parent key}{sep}{key}" if parent key else key ⋮---- class TeeStream ⋮---- def init self, queue, original stream ⋮---- def write self, message ⋮---- def flush self 证据：`webui/utils.py`
- **Run Exp**（source_file）：def naive args ⋮---- save note = "naive" config dict = {"save note": save note, "gpu id": args.gpu id, "dataset name": args.dataset name, "split": args.split} ⋮---- config = Config "my config.yaml", config dict all split = get dataset config test data = all split args.split ⋮---- pipeline = SequentialPipeline config ⋮---- result = pipeline.run test data ⋮---- def zero shot args ⋮---- save note = "zero-shot" ⋮---- templete = PromptTemplate pipeline = SequentialPipeline config, templete result = pipeline.naive run test data ⋮---- def aar args ⋮---- retrieval method = args.method name ⋮---- index path = "aar-contriever Flat.index" ⋮---- index path = "aar-ance Flat.index" ⋮---- model2path = {"A… 证据：`examples/methods/run_exp.py`
- **Get Lm Probs Dataset**（source_file）：class LMProbCalculator ⋮---- def init self, config ⋮---- def run self, dataset ⋮---- input query = dataset.question answers = answer 0 if len answer == 1 else random.choice answer for answer in dataset.golden answers retrieval results = self.retriever.batch search input query data ls = N = len answers ⋮---- docs = scores = ⋮---- input prompt = self.prompt template.get string question=q, retrieval result= res score = self.calculate prob input prompt, answer ⋮---- scores = torch.softmax torch.tensor scores , dim=-1 .tolist ⋮---- def calculate prob self, prompt, answer ⋮---- config dict = { config = Config "my config.yaml", config dict all split = get dataset config test data = all split split… 证据：`examples/methods/utils/get_lm_probs_dataset.py`
- **Simple Pipeline**（source_file）：parser = argparse.ArgumentParser ⋮---- args = parser.parse args ⋮---- config dict = { ⋮---- config = Config config dict=config dict ⋮---- all split = get dataset config test data = all split "test" prompt templete = PromptTemplate ⋮---- pipeline = SequentialPipeline config, prompt template=prompt templete ⋮---- output dataset = pipeline.run test data, do eval=True 证据：`examples/quick_start/simple_pipeline.py`
- **Basic Config**（source_file）：model2path: e5: "intfloat/e5-base-v2" bge: "BAAI/bge-base-en-v1.5" contriever: "facebook/contriever" llama2-7B-chat: "meta-llama/Llama-2-7b-chat-hf" llama2-7B: "meta-llama/Llama-2-7b-hf" llama2-13B: "meta-llama/Llama-2-13b-hf" llama2-13B-chat: "meta-llama/Llama-2-13b-chat-hf" model2pooling: e5: "mean" bge: "cls" contriever: "mean" jina: "mean" dpr: "pooler" method2index: e5: ~ bm25: ~ contriever: ~ clip: "text": "path/to/text index" "image": "path/to/image index" data dir: "dataset/" save dir: "output/" gpu id: "0,1,2,3" dataset name: "nq" split: "test" test sample num: ~ random sample: False seed: 2024 save intermediate data: True save note: "experiment" is reasoning: false retrieval metho… 证据：`flashrag/config/basic_config.yaml`
- **Dataset**（source_file）：class Item ⋮---- def init self, item dict: Dict str, Any - None ⋮---- def update output self, key: str, value: Any - None ⋮---- def update evaluation score self, metric name: str, metric score: float - None ⋮---- def getattr self, attr name: str - Any ⋮---- predefined attrs = "id", "question", "golden answers", "metadata", "output", "choices" ⋮---- output = self.output ⋮---- def setattr self, attr name: str, value: Any - None ⋮---- predefined attrs = "id", "question", "golden answers", "metadata", "output", "choices", 'data' ⋮---- def to dict self - Dict str, Any ⋮---- output = remove images self.data ⋮---- def str self - str ⋮---- class Dataset ⋮---- dataset name = config 'dataset name' if… 证据：`flashrag/dataset/dataset.py`
- **Utils**（source_file）：def convert numpy data: Any - Any ⋮---- def filter dataset dataset: Dataset, filter func=None ⋮---- data = dataset.data ⋮---- def split dataset dataset: Dataset, split symbol: list ⋮---- data split = {symbol: for symbol in set split symbol } ⋮---- symbol data = x for x, x symbol in zip data, split symbol if x symbol == symbol ⋮---- def merge dataset dataset split: dict, split symbol: list ⋮---- dataset split iter = {symbol: iter dataset.data for symbol, dataset in dataset split.items } ⋮---- final data = ⋮---- final dataset = Dataset config=list dataset split.values 0 .config, data=final data ⋮---- def get batch dataset dataset: Dataset, batch size=16 ⋮---- batched data = data idx : idx + b… 证据：`flashrag/dataset/utils.py`
- **Utils**（source_file）：def normalize answer s ⋮---- def remove articles text ⋮---- def white space fix text ⋮---- def remove punc text ⋮---- exclude = set string.punctuation ⋮---- def lower text 证据：`flashrag/evaluator/utils.py`
- **Both values are equal**（source_file）：def resolve max tokens params: dict, generation params: dict, prioritize new tokens: bool = False - dict ⋮---- def get token params param dict: dict - tuple ⋮---- def resolve tokens max tokens: int, max new tokens: int - int ⋮---- Both values are equal ⋮---- Try to resolve from params first, then fall back to generation params ⋮---- final max tokens = resolve tokens max tokens, max new tokens ⋮---- If no valid tokens found in params, try generation params ⋮---- def convert image to base64 image ⋮---- image = image.convert 'RGB' buffer = BytesIO ⋮---- image bs64 = base64.b64encode buffer.getvalue .decode 'utf-8' ⋮---- def process image pil image ⋮---- def process image content dict ⋮---- ima… 证据：`flashrag/generator/utils.py`
- **Regex pattern to match lines that start with "Thought X:", "Action X:", or "Observation X:".**（source_file）：class AgentUtilsBase ⋮---- def init self ⋮---- def truncate self, tokenizer, tokenized prompt, model max length ⋮---- half = int model max length/2 prompt = tokenizer.decode tokenized prompt :half , skip special tokens=False + \ ⋮---- def preprocess query self, query ⋮---- query = query.replace "'", "\\'" .replace '"', '\\"' ⋮---- def extract code self, text: str - str ⋮---- triple match = re.search r' ', text, re.DOTALL single match = re.search r' ^ ', text, re.DOTALL ⋮---- def postprocess agent response self, response ⋮---- """ Implement the postprocess agent response function """ ⋮---- class AgentUtils AgentUtilsBase ⋮---- def parse reasoning steps self, text: str ⋮---- """ Parse a strin… 证据：`flashrag/pipeline/ReaRAG_utils.py`
- **generation-augmented retrieval**（source_file）：class IterativePipeline BasicPipeline ⋮---- def init self, config, prompt template=None, iter num=3, retriever=None, generator=None ⋮---- generator = get generator config ⋮---- retriever = get retriever config ⋮---- def run self, dataset, do eval=True, pred process fun=None ⋮---- questions = dataset.question ⋮---- past generation result = ⋮---- input query = questions ⋮---- input query = f"{q} {r}" for q, r in zip questions, past generation result ⋮---- generation-augmented retrieval retrieval results = self.retriever.batch search input query ⋮---- retrieval-augmented generation input prompts = self.build prompt questions, retrieval results input prompts = ⋮---- past generation result = sel… 证据：`flashrag/pipeline/active_pipeline.py`
- **get summarization for each candidate**（source_file）：class REPLUGPipeline BasicPipeline ⋮---- def init self, config, prompt template=None, retriever=None, generator=None ⋮---- model = load replug model config "generator model path" generator = get generator config, model=model ⋮---- retriever = get retriever config ⋮---- def build single doc prompt self, question: str, doc list: List str ⋮---- def format reference self, doc item ⋮---- content = doc item "contents" title = content.split "\n" 0 text = "\n".join content.split "\n" 1: ⋮---- def run self, dataset, do eval=True, pred process fun=None ⋮---- input query = dataset.question ⋮---- pred answer list = ⋮---- docs = self.format reference doc item for doc item in item.retrieval result prompt… 证据：`flashrag/pipeline/branching_pipeline.py`
- **Mm Pipeline**（source_file）：class BasicMultiModalPipeline ⋮---- def init self, config, prompt template=None ⋮---- prompt template = MMPromptTemplate config ⋮---- def run self, dataset, pred process fun=None ⋮---- def evaluate self, dataset, do eval=True, pred process func=None ⋮---- dataset = pred process func dataset ⋮---- eval result = self.evaluator.evaluate dataset ⋮---- class MMSequentialPipeline BasicMultiModalPipeline ⋮---- PERFORM MODALITY DICT = { def init self, config, prompt template=None, retriever=None, generator=None ⋮---- def naive run self, dataset, do eval=True, pred process func=None ⋮---- input prompts = ⋮---- pred answer list = self.generator.generate input prompts ⋮---- dataset = self.evaluate dat… 证据：`flashrag/pipeline/mm_pipeline.py`
- 其余 19 条证据见 `AI_CONTEXT_PACK.json` 或 `EVIDENCE_INDEX.json`。

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

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

- **项目概述、环境安装与依赖配置**：importance `high`
  - source_paths: README.md, setup.py, requirements.txt, setup_conda.sh, pyproject.toml
- **核心组件、检索器与数据准备**：importance `high`
  - source_paths: flashrag/retriever/retriever.py, flashrag/retriever/index_builder.py, flashrag/retriever/encoder.py, flashrag/retriever/reranker.py, flashrag/refiner/refiner.py
- **Pipeline 类型与 23 种已实现方法**：importance `high`
  - source_paths: flashrag/pipeline/pipeline.py, flashrag/pipeline/active_pipeline.py, flashrag/pipeline/branching_pipeline.py, flashrag/pipeline/reasoning_pipeline.py, flashrag/pipeline/replug_utils.py
- **WebUI、多模态 RAG 与常见故障排查**：importance `high`
  - source_paths: webui/interface.py, webui/engine.py, webui/manager.py, webui/runner.py, webui/chatter.py

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

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `e0e73399ce8d4563397b5fb4980de72a9c5e15a6`
- inspected_files: `README.md`, `pyproject.toml`, `requirements.txt`, `docs/_navbar.md`, `docs/_sidebar.md`, `docs/en-us/README.md`, `docs/en-us/get_started/introduction.md`, `docs/original_docs/baseline_details.md`, `docs/original_docs/baseline_details_zh.md`, `docs/original_docs/basic_usage.md`, `docs/original_docs/building-index.md`, `docs/original_docs/chunk-doc-corpus.md`, `docs/original_docs/configuration.md`, `docs/original_docs/introduction_for_beginners_en.md`, `docs/original_docs/introduction_for_beginners_kr.md`, `docs/original_docs/introduction_for_beginners_zh.md`, `docs/original_docs/multi_retriever_usage.md`, `docs/original_docs/process-wiki.md`, `docs/original_docs/reproduce_experiment.md`, `docs/original_docs/reproduce_experiment_zh.md`

宿主 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: 来源证据：Positioning note: cognitive long-term memory (Vestige, MCP) as an optional companion for agentic RAG / 关于将认知型长期记忆 (Vest…

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Positioning note: cognitive long-term memory (Vestige, MCP) as an optional companion for agentic RAG / 关于将认知型长期记忆 (Vestige, MCP) 作为 agentic RAG 可选配套的说明
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/RUC-NLPIR/FlashRAG/issues/231 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 2: 来源证据：前端web-ui启动不了

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：前端web-ui启动不了
- Why it matters: 可能影响升级、迁移或版本选择。
- Evidence: community_evidence:github | https://github.com/RUC-NLPIR/FlashRAG/issues/217 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 3: 来源证据：配置环境有问题

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：配置环境有问题
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/RUC-NLPIR/FlashRAG/issues/215 | 来源类型 github_issue 暴露的待验证使用条件。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 4: 来源证据：web_questions test.jsonl is not Xet in HGF

- Trigger: GitHub 社区证据显示该项目存在一个配置相关的待验证问题：web_questions test.jsonl is not Xet in HGF
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/RUC-NLPIR/FlashRAG/issues/211 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 5: 来源证据：[Proposal] Standardize setup with Conda env & Fix UI deprecation

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：[Proposal] Standardize setup with Conda env & Fix UI deprecation
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/RUC-NLPIR/FlashRAG/issues/225 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 6: 来源证据：split 出错

- Trigger: GitHub 社区证据显示该项目存在一个配置相关的待验证问题：split 出错
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/RUC-NLPIR/FlashRAG/issues/214 | 来源类型 github_issue 暴露的待验证使用条件。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 7: 来源证据：wikiextractor version?

- Trigger: GitHub 社区证据显示该项目存在一个配置相关的待验证问题：wikiextractor version?
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能影响升级、迁移或版本选择。
- Evidence: community_evidence:github | https://github.com/RUC-NLPIR/FlashRAG/issues/232 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

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

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

### Constraint 9: 来源证据：Missing return in PromptTemplate.py

- Trigger: GitHub 社区证据显示该项目存在一个运行相关的待验证问题：Missing return in PromptTemplate.py
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/RUC-NLPIR/FlashRAG/issues/218 | 来源类型 github_issue 暴露的待验证使用条件。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

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

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