# langfuse - Doramagic AI Context Pack

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

## 充分原则

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

## 给宿主 AI 的使用方式

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

## Claim 消费规则

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

## 它最适合谁

- **希望把专业流程带进宿主 AI 的用户**：仓库包含 Skill 文档。 证据：`.agents/skills/add-model-price/SKILL.md`, `.agents/skills/agent-setup-maintenance/SKILL.md`, `.agents/skills/analyze-cloud-costs/SKILL.md`, `.agents/skills/backend-dev-guidelines/SKILL.md` 等 Claim：`clm_0003` supported 0.86

## 它能做什么

- **AI Skill / Agent 指令资产库**（可做安装前预览）：项目包含可被宿主 AI 读取的 Skill 或 Agent 指令文件，可用于把专业流程带入 Claude、Codex、Cursor 等宿主。 证据：`.agents/skills/add-model-price/SKILL.md`, `.agents/skills/agent-setup-maintenance/SKILL.md`, `.agents/skills/analyze-cloud-costs/SKILL.md`, `.agents/skills/backend-dev-guidelines/SKILL.md` 等 Claim：`clm_0001` supported 0.86
- **命令行启动或安装流程**（需要安装后验证）：项目文档中存在可执行命令，真实使用需要在本地或宿主环境中运行这些命令。 证据：`README.md` Claim：`clm_0002` supported 0.86

## 怎么开始

- `git clone https://github.com/langfuse/langfuse.git` 证据：`README.md` Claim：`clm_0004` supported 0.86
- `pip install langfuse openai` 证据：`README.md` Claim：`clm_0005` supported 0.86

## 继续前判断卡

- **当前建议**：先做权限沙盒试用
- **为什么**：项目存在安装命令、宿主配置或本地写入线索，不建议直接进入主力环境，应先在隔离环境试装。

### 30 秒判断

- **现在怎么做**：先做权限沙盒试用
- **最小安全下一步**：先跑 Prompt Preview；若仍要安装，只在隔离环境试装
- **先别相信**：工具权限边界不能在安装前相信。
- **继续会触碰**：命令执行、宿主 AI 配置、本地环境或项目文件

### 现在可以相信

- **适合人群线索：希望把专业流程带进宿主 AI 的用户**（supported）：有 supported claim 或项目证据支撑，但仍不等于真实安装效果。 证据：`.agents/skills/add-model-price/SKILL.md`, `.agents/skills/agent-setup-maintenance/SKILL.md`, `.agents/skills/analyze-cloud-costs/SKILL.md`, `.agents/skills/backend-dev-guidelines/SKILL.md` 等 Claim：`clm_0003` supported 0.86
- **能力存在：AI Skill / Agent 指令资产库**（supported）：可以相信项目包含这类能力线索；是否适合你的具体任务仍要试用或安装后验证。 证据：`.agents/skills/add-model-price/SKILL.md`, `.agents/skills/agent-setup-maintenance/SKILL.md`, `.agents/skills/analyze-cloud-costs/SKILL.md`, `.agents/skills/backend-dev-guidelines/SKILL.md` 等 Claim：`clm_0001` supported 0.86
- **能力存在：命令行启动或安装流程**（supported）：可以相信项目包含这类能力线索；是否适合你的具体任务仍要试用或安装后验证。 证据：`README.md` Claim：`clm_0002` supported 0.86
- **存在 Quick Start / 安装命令线索**（supported）：可以相信项目文档出现过启动或安装入口；不要因此直接在主力环境运行。 证据：`README.md` Claim：`clm_0004` 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/skills/add-model-price/SKILL.md`, `.agents/skills/agent-setup-maintenance/SKILL.md`, `.agents/skills/analyze-cloud-costs/SKILL.md`, `.agents/skills/backend-dev-guidelines/SKILL.md` 等
- **可安全回滚不能默认相信。**（unverified）：除非项目明确提供卸载和恢复说明，否则必须先在隔离环境验证。
- **真实安装后是否与用户当前宿主 AI 版本兼容？**（unverified）：兼容性只能通过实际宿主环境验证。
- **项目输出质量是否满足用户具体任务？**（unverified）：安装前预览只能展示流程和边界，不能替代真实评测。
- **安装命令是否需要网络、权限或全局写入？**（unverified）：这影响企业环境和个人环境的安装风险。 证据：`README.md`

### 继续会触碰什么

- **命令执行**：包管理器、网络下载、本地插件目录、项目配置或用户主目录。 原因：运行第一条命令就可能产生环境改动；必须先判断是否值得跑。 证据：`README.md`
- **宿主 AI 配置**：Claude/Codex/Cursor/Gemini/OpenCode 等宿主的 plugin、Skill 或规则加载配置。 原因：宿主配置会改变 AI 后续工作方式，可能和用户已有规则冲突。 证据：`.agents/skills/add-model-price/SKILL.md`, `.agents/skills/agent-setup-maintenance/SKILL.md`, `.agents/skills/analyze-cloud-costs/SKILL.md`, `.agents/skills/backend-dev-guidelines/SKILL.md` 等
- **本地环境或项目文件**：安装结果、插件缓存、项目配置或本地依赖目录。 原因：安装前无法证明写入范围和回滚方式，需要隔离验证。 证据：`README.md`
- **宿主 AI 上下文**：AI Context Pack、Prompt Preview、Skill 路由、风险规则和项目事实。 原因：导入上下文会影响宿主 AI 后续判断，必须避免把未验证项包装成事实。

### 最小安全下一步

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

### 退出方式

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

## 哪些只能预览

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

## 哪些必须安装后验证

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

## 边界与风险判断卡

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

### 任务路由

- **AI Skill / Agent 指令资产库**：先基于 role_skill_index / evidence_index 帮用户挑选可用角色、Skill 或工作流。 边界：可做安装前 Prompt 体验。 证据：`.agents/skills/add-model-price/SKILL.md`, `.agents/skills/agent-setup-maintenance/SKILL.md`, `.agents/skills/analyze-cloud-costs/SKILL.md`, `.agents/skills/backend-dev-guidelines/SKILL.md` 等 Claim：`clm_0001` supported 0.86
- **命令行启动或安装流程**：先说明这是安装后验证能力，再给出安装前检查清单。 边界：必须真实安装或运行后验证。 证据：`README.md` Claim：`clm_0002` supported 0.86

### 上下文规模

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

### 证据不足时的处理

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

## Prompt Recipes

### 适配判断

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

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

### 安装前体验

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

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

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


## 角色 / Skill 索引

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

- **add-model-price**（skill）：Use when editing worker/src/constants/default-model-prices.json, packages/shared/src/server/llm/types.ts, pricing tiers, tokenizer IDs, or matchPattern regexes for OpenAI, Anthropic, Bedrock, Vertex, Azure, or Gemini model pricing. 激活提示：当用户任务与“add-model-price”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/add-model-price/SKILL.md`
- **agent-setup-maintenance**（skill）： 激活提示：当用户任务与“agent-setup-maintenance”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/agent-setup-maintenance/SKILL.md`
- **analyze-cloud-costs**（skill）： 激活提示：当用户任务与“analyze-cloud-costs”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/analyze-cloud-costs/SKILL.md`
- **backend-dev-guidelines**（skill）：Shared backend guide for Langfuse's Next.js, tRPC, BullMQ, and TypeScript monorepo. Use when creating or reviewing tRPC routers, public REST endpoints, BullMQ queue processors, backend services, middleware, Prisma or ClickHouse data access, OpenTelemetry instrumentation, Zod validation, env configuration, or backend tests across web, worker, or packages/shared. 激活提示：当用户任务与“backend-dev-guidelines”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/backend-dev-guidelines/SKILL.md`
- **changelog-writing**（skill）： 激活提示：当用户任务与“changelog-writing”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/changelog-writing/SKILL.md`
- **clickhouse-best-practices**（skill）：MUST USE when reviewing ClickHouse schemas, queries, or configurations. Contains 28 rules that MUST be checked before providing recommendations. Always read relevant rule files and cite specific rules in responses. 激活提示：当用户任务与“clickhouse-best-practices”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/clickhouse-best-practices/SKILL.md`
- **code-review**（skill）： 激活提示：当用户任务与“code-review”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/code-review/SKILL.md`
- **datadog-query-recipes**（skill）： 激活提示：当用户任务与“datadog-query-recipes”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/datadog-query-recipes/SKILL.md`
- **debug-issue-with-datadog**（skill）： 激活提示：当用户任务与“debug-issue-with-datadog”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/debug-issue-with-datadog/SKILL.md`
- **detect-prod-regressions**（skill）： 激活提示：当用户任务与“detect-prod-regressions”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/detect-prod-regressions/SKILL.md`
- **frontend-browser-review**（skill）： 激活提示：当用户任务与“frontend-browser-review”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/frontend-browser-review/SKILL.md`
- **linear-bug-triage**（skill）： 激活提示：当用户任务与“linear-bug-triage”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/linear-bug-triage/SKILL.md`
- **pnpm-upgrade-package**（skill）：Use when upgrading a dependency in this pnpm workspace, including requests to bump a package to a specific version, compare the registry latest version with the latest version installable under the current minimum-release-age window, or decide whether minimumReleaseAgeExclude in pnpm-workspace.yaml must change. Ask the user for the package name or target version when either is missing. 激活提示：当用户任务与“pnpm-upgrade-package”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/pnpm-upgrade-package/SKILL.md`
- **turborepo**（skill）： 激活提示：当用户任务与“turborepo”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/turborepo/SKILL.md`
- **vercel-composition-patterns**（skill）：Composition patterns for building flexible, maintainable React components. Avoid boolean prop proliferation by using compound components, lifting state, and composing internals. These patterns make codebases easier for both humans and AI agents to work with as they scale. 激活提示：当用户任务与“vercel-composition-patterns”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`web/.agents/skills/vercel-composition-patterns/SKILL.md`
- **vercel-react-best-practices**（skill）：React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements. 激活提示：当用户任务与“vercel-react-best-practices”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`web/.agents/skills/vercel-react-best-practices/SKILL.md`

## 证据索引

- 共索引 80 条证据。

- **Agent Guidelines for Langfuse**（documentation）：This is the canonical root agent guide for the repo. The root AGENTS.md should remain only as a discovery symlink so tools that require that filename continue to work while .agents/ stays the source of truth. 证据：`.agents/AGENTS.md`
- **Shared Agent Setup**（documentation）：This directory is the neutral, repo-owned source of truth for agent behavior in Langfuse. 证据：`.agents/README.md`
- **✨ Core Features**（documentation）：Langfuse Is Doubling Down On Open Source Langfuse Cloud · Self Host · Demo 证据：`README.md`
- **Codex Guidelines for ee**（documentation）：This file covers package-local guidance for this package. Use root AGENTS.md ../AGENTS.md for monorepo-level rules. 证据：`ee/AGENTS.md`
- **Enterprise Edition**（documentation）：This folder includes features that are only available in the Enterprise Edition of Langfuse and on Langfuse Cloud. 证据：`ee/README.md`
- **Codex Guidelines for web**（documentation）：This file covers package-local guidance for this package. Use root AGENTS.md ../AGENTS.md for monorepo-level rules. 证据：`web/AGENTS.md`
- **CLAUDE.md**（documentation）：Claude Code should treat this file as the package entrypoint for web/ . 证据：`web/CLAUDE.md`
- **Codex Guidelines for worker**（documentation）：This file covers package-local guidance for this package. Use root AGENTS.md ../AGENTS.md for monorepo-level rules. 证据：`worker/AGENTS.md`
- **Shared Skills**（documentation）：Shared repo skills for any coding agent working in Langfuse. 证据：`.agents/skills/README.md`
- **Add Model Price**（documentation）：Guide for adding or updating model pricing entries in Langfuse. Use this when editing worker/src/constants/default-model-prices.json , packages/shared/src/server/llm/types.ts , model matchPattern values, tokenizer IDs, or pricing tiers. 证据：`.agents/skills/add-model-price/AGENTS.md`
- **Backend Development Guidelines**（documentation）：Establish consistency and best practices across Langfuse's backend packages web , worker , packages/shared using Next.js, tRPC, BullMQ, and TypeScript patterns. Check package manifests such as web/package.json for current framework versions before version-sensitive work. Keep this file as an entrypoint; open reference files only when the task needs their details. 证据：`.agents/skills/backend-dev-guidelines/AGENTS.md`
- **ClickHouse Best Practices**（documentation）：Start with SKILL.md for the ClickHouse review workflow, rule-selection process, and response format. This file exists as a concise compatibility entrypoint for agents that open AGENTS.md directly. 证据：`.agents/skills/clickhouse-best-practices/AGENTS.md`
- **ClickHouse Best Practices**（documentation）：Agent skill providing comprehensive ClickHouse guidance for schema design, query optimization, and data ingestion. 证据：`.agents/skills/clickhouse-best-practices/README.md`
- **PNPM Upgrade Package**（documentation）：Use this workflow when a user wants to upgrade a dependency in the Langfuse pnpm workspace. 证据：`.agents/skills/pnpm-upgrade-package/AGENTS.md`
- **Codex Guidelines for @langfuse/shared**（documentation）：Codex Guidelines for @langfuse/shared 证据：`packages/shared/AGENTS.md`
- **Langfuse Seeder System**（documentation）：System for generating test data in ClickHouse and PostgreSQL for Langfuse development and testing. 证据：`packages/shared/scripts/seeder/utils/README.md`
- **Framework Traces**（documentation）：This folder contains real traces produced through framework instrumentation. Most of them stem from here: https://langfuse.com/integrations/frameworks/agno-agents and so on. 证据：`packages/shared/scripts/seeder/utils/framework-traces/README.md`
- **Score Interfaces**（documentation）：This directory contains all type definitions, schemas, and validation logic for Langfuse scores. 证据：`packages/shared/src/features/scores/interfaces/README.md`
- **Instrumentation at Langfuse**（documentation）：Throughout our applications we want to use as much Otel as possible. This helps us to be flexible choosing our observability backend, and we will benefit from features and packages built by the Otel community. 证据：`packages/shared/src/server/instrumentation/README.md`
- **Repository docs**（documentation）：Guarantees for relating data within Langfuse 证据：`packages/shared/src/server/repositories/README.md`
- **React Composition Patterns**（documentation）：Version 1.0.0 Engineering January 2026 证据：`web/.agents/skills/vercel-composition-patterns/AGENTS.md`
- **React Best Practices**（documentation）：Version 1.0.0 Vercel Engineering January 2026 证据：`web/.agents/skills/vercel-react-best-practices/AGENTS.md`
- **Design System**（documentation）：This folder contains reusable, primitive, presentational UI components . 证据：`web/src/components/design-system/README.md`
- **📦 Langfuse Layout Components**（documentation）：📌 Overview: Page - Standard Page Wrapper 证据：`web/src/components/layouts/README.md`
- **Peek View Table State Management**（documentation）：This document describes how table state filters, sorting, pagination, search is managed and persisted in peek views when navigating between items using K/J keyboard shortcuts. 证据：`web/src/components/table/peek/README.md`
- **Table View Presets**（documentation）：This module provides a flexible and robust way to manage and persist table states across sessions. Users can save, load, and share specific table configurations including column visibility, ordering, filters, and search queries. 证据：`web/src/components/table/table-view-presets/README.md`
- **AdvancedJsonViewer**（documentation）：A high-performance JSON viewer component built for rendering large datasets 10K+ nodes with virtualization, search, and near-instant expand/collapse operations. 证据：`web/src/components/ui/AdvancedJsonViewer/README.md`
- **Enterprise Edition**（documentation）：This folder includes features that are only available in the Enterprise Edition of Langfuse and on Langfuse Cloud. 证据：`web/src/ee/README.md`
- **Billing**（documentation）：Stripe Billing powers subscriptions and usage-based pricing for organizations. We primarily use the new flexible billing model plan + usage and still handle legacy, single-item metered subscriptions during migration. 证据：`web/src/ee/features/billing/README.md`
- **Public API**（documentation）：- Wrap with withMiddleware - Type-safe and authed API Route with createAuthedAPIRoute - Add zod types to /features/public-api/types folder. 证据：`web/src/features/README.md`
- **Batch Exports**（documentation）：- Find types in shared - Actual export logic in worker 证据：`web/src/features/batch-exports/README.md`
- **Dataset Mutations**（documentation）：Always use functions in this directory. Never use direct Prisma calls. 证据：`web/src/features/datasets/server/actions/README.md`
- **Entitlements**（documentation）：This feature allows to control for availability of features. Entitlements are managed on the organization level. 证据：`web/src/features/entitlements/README.md`
- **Feature Flags**（documentation）：Configure feature flags in the available-flags.ts file. 证据：`web/src/features/feature-flags/README.md`
- **Langfuse MCP Server**（documentation）：Model Context Protocol MCP server for Langfuse, enabling AI assistants to interact with your Langfuse prompts programmatically. 证据：`web/src/features/mcp/README.md`
- **Caching Strategy of Prompts**（documentation）：The caching strategy for prompts is implemented in the PromptService class and is utilized in the createPrompt function. Here is an overview of how the caching mechanism works: 证据：`web/src/features/prompts/README.md`
- **Prompt Mutations**（documentation）：Always use functions in this directory. Never use direct Prisma calls. 证据：`web/src/features/prompts/server/actions/README.md`
- **Caching Strategy of API Keys**（documentation）：The cache for API keys is managed using Redis. The cache key looks like the following: api-key: : . The hash is the fastHashedSecretKey from postgres. Hence, we can easily find the key in Redis. 证据：`web/src/features/public-api/README.md`
- **Score Analytics - Architecture Guide**（documentation）：Score Analytics - Architecture Guide 证据：`web/src/features/score-analytics/README.md`
- **Slack Integration Setup Guide**（documentation）：This guide walks you through setting up and testing the Langfuse Slack integration for local development. 证据：`web/src/features/slack/README.md`
- **Telemetry service for Docker deployments**（documentation）：Telemetry service for Docker deployments 证据：`web/src/features/telemetry/README.md`
- **Readme**（documentation）：These APIs are implemented via the NextJS App router in src/app/api/billing. 证据：`web/src/pages/api/billing/README.md`
- **otlp-proto**（documentation）：This directory contains compiled opentelemetry protobuf files. Those should correspond to the definitions in https://github.com/open-telemetry/opentelemetry-proto/tree/v1.5.0 and are copied from the generated contents of https://www.npmjs.com/package/@opentelemetry/otlp-transformer. The file was converted from .js to .ts and the export statements were modified to make them Next.js compatible. 证据：`web/src/pages/api/public/otel/otlp-proto/README.md`
- **ChatML Normalization System**（documentation）：Normalizes LLM provider/framework data traces, observations to ChatML format for display and, partly, playground. In general, provider adapters preprocess data → ChatMlSchema validates → UI renders 证据：`web/src/utils/chatml/README.md`
- **Readme**（documentation）：Those traces are used to test the chatML adapters. They comes for the various framework intragration examples in Langfuse's doc for example https://langfuse.com/integrations/frameworks/agno-agents . Use download traces.js to generate the files. 证据：`worker/src/__tests__/chatml/framework-traces/README.md`
- **Background Migrations**（documentation）：Background migrations are longer running jobs that must not be complete before a new application version can be served correctly. They are used to fill new optional columns, migrate data between tables or systems, or perform other actions that would take too long to run in a standard migration. A good threshold is something that takes more than 5 minutes to run or is not an atomic operation. 证据：`worker/src/backgroundMigrations/README.md`
- **Refill Queue Event**（documentation）：This is a utility script to backfill any queue with events from local machines. It validates events against the queue's schema and processes them in batches for efficient ingestion. 证据：`worker/src/scripts/refillQueueEvent/README.md`
- **Replay Ingestion Events from S3 v2**（documentation）：Replays failed ingestion events by reading S3 keys from a CSV and submitting them to Langfuse via an admin API endpoint. This replaces the v1 script ../replayIngestionEvents/README.md , which required direct Redis, ClickHouse, and PostgreSQL access plus a full repo clone. 证据：`worker/src/scripts/replayIngestionEventsV2/README.md`
- **Verify Clickhouse Records**（documentation）：This script is used to compare Clickhouse records to our Postgres records. Per default, it draws a sample of observations, traces, and scores from the Postgres tables and executes single queries on Clickhouse to compare the individual fields. It is possible to overwrite the selection process using the overwriteIds per type. 证据：`worker/src/scripts/verifyClickhouseRecords/README.md`
- **Package**（package_manifest）：{ "name": "@langfuse/ee", "version": "1.0.0", "private": true, "main": "./dist/src/index.js", "types": "./dist/src/index.d.ts", "exports": { ".": { "import": "./dist/src/index.js", "require": "./dist/src/index.js" }, "./sso": { "import": "./dist/src/sso/index.js", "require": "./dist/src/sso/index.js" } }, "engines": { "node": "24" }, "scripts": { "build": "tsc", "build:check": "tsc", "typecheck": "dotenv -e ../../.env -- tsgo --noEmit --skipLibCheck --incremental --tsBuildInfoFile .tsbuildinfo", "dev": "tsc --watch", "lint": "eslint . --cache --cache-location dist/.eslintcache --max-warnings 0", "lint:fix": "eslint . --cache --cache-location dist/.eslintcache --fix" }, "dependencies": { "@l… 证据：`ee/package.json`
- **Package**（package_manifest）：{ "name": "langfuse", "version": "3.174.1", "author": "engineering@langfuse.com", "license": "MIT", "private": true, "engines": { "node": "24" }, "scripts": { "agents:check": "node scripts/agents/sync-agent-shims.mjs --check", "agents:sync": "node scripts/agents/sync-agent-shims.mjs", "postinstall": "node -e \"const fs = require 'node:fs' ; const cp = require 'node:child process' ; if !fs.existsSync 'scripts/postinstall.sh' { console.log 'Skipping repo postinstall helper: scripts/postinstall.sh is not present in this install context.' ; process.exit 0 ; } cp.execSync 'bash scripts/postinstall.sh', { stdio: 'inherit' } ;\"", "preinstall": "npx only-allow pnpm", "infra:dev:up": "docker compos… 证据：`package.json`
- **Package**（package_manifest）：{ "name": "web", "version": "3.174.1", "private": true, "license": "MIT", "engines": { "node": "24" }, "scripts": { "build": "INLINE RUNTIME CHUNK=false dotenv -e ../.env -- next build", "build:check": "NEXT DIST DIR=.next-check INLINE RUNTIME CHUNK=false dotenv -e ../.env -- next build", "typecheck": "dotenv -e ../.env -- tsgo -p tsconfig.build.json --noEmit --skipLibCheck --incremental --tsBuildInfoFile .tsbuildinfo", "dev": "dotenv -e ../.env -- next dev", "dev:http": "dotenv -e ../.env -- next dev --experimental-https --experimental-https-key ./localhost+1-key.pem --experimental-https-cert ./localhost+1.pem", "lint": "dotenv -e ../.env -- eslint . --cache --cache-location .next/cache/es… 证据：`web/package.json`
- **Package**（package_manifest）：{ "name": "worker", "version": "3.174.1", "description": "", "license": "MIT", "private": true, "files": "dist/ ", "entrypoint.sh" , "engines": { "node": "24" }, "scripts": { "test": "vitest run", "test:exclude-llm-connections": "vitest run --exclude ' /llmConnections.test.ts'", "test:llm-connections-only": "vitest run llmConnections.test.ts", "coverage": "vitest run --coverage", "start": "dotenv -e ../.env -- node dist/index.js", "build": "tsc", "build:check": "tsc", "typecheck": "dotenv -e ../.env -- tsgo --noEmit --skipLibCheck --incremental --tsBuildInfoFile .tsbuildinfo", "dev": "dotenv -e ../.env -- tsx watch --clear-screen=false --include '../packages/shared/dist/ ' src/index.ts", "l… 证据：`worker/package.json`
- **Contributing to Langfuse**（documentation）：! Langfuse GitHub Banner https://github.com/langfuse/langfuse/assets/121163007/6035f0f3-d691-4963-b5d0-10cf506e9d42 证据：`CONTRIBUTING.md`
- **Package**（package_manifest）：{ "name": "@repo/eslint-config", "version": "0.0.0", "license": "MIT", "private": true, "type": "module", "exports": { ".": "./index.js", "./base": "./base.js", "./next": "./next.js" }, "files": "index.js", "base.js", "next.js" , "dependencies": { "@eslint/js": "^9.39.2", "@repo/eslint-plugin": "workspace: ", "eslint-config-next": "16.2.6", "eslint-config-prettier": "^10.1.8", "eslint-config-turbo": "2.9.12", "eslint-plugin-only-warn": "^1.1.0", "eslint-plugin-prettier": "^5.5.4", "globals": "^16.0.0", "typescript-eslint": "^8.57.1" }, "peerDependencies": { "eslint": "^9.39.0", "typescript": " =5.0.0" } } 证据：`packages/config-eslint/package.json`
- **Package**（package_manifest）：{ "name": "@repo/typescript-config", "license": "MIT", "version": "0.0.0", "private": true, "publishConfig": { "access": "public" } } 证据：`packages/config-typescript/package.json`
- **Package**（package_manifest）：{ "name": "@repo/eslint-plugin", "version": "0.0.0", "license": "MIT", "private": true, "type": "module", "main": "dist/index.js", "scripts": { "test": "vitest run", "build": "tsc" }, "devDependencies": { "@repo/typescript-config": "workspace: ", "@types/node": "^24.3.0", "@typescript-eslint/parser": "^8.59.0", "@typescript-eslint/rule-tester": "^8.59.0", "@typescript-eslint/utils": "^8.59.0", "typescript": "^5.9.2", "vitest": "^4.1.4" } } 证据：`packages/eslint-plugin/package.json`
- **Package**（package_manifest）：{ "name": "@langfuse/shared", "version": "1.0.0", "license": "MIT", "private": true, "files": "dist/ ", "prisma/ ", "clickhouse/ ", "scripts/cleanup.sql" , "main": "./dist/src/index.js", "types": "./dist/src/index.d.ts", "engines": { "node": "24" }, "exports": { ".": { "import": "./dist/src/index.js", "require": "./dist/src/index.js" }, "./src/db": { "import": "./dist/src/db.js", "require": "./dist/src/db.js" }, "./src/env": { "import": "./dist/src/env.js", "require": "./dist/src/env.js" }, "./src/server": { "import": "./dist/src/server/index.js", "require": "./dist/src/server/index.js" }, "./src/server/auth/apiKeys": { "import": "./dist/src/server/auth/apiKeys.js", "require": "./dist/src/s… 证据：`packages/shared/package.json`
- **Add Model Price**（skill_instruction）：Use this skill for model pricing changes in worker/ and shared LLM type updates in packages/shared/ . 证据：`.agents/skills/add-model-price/SKILL.md`
- **Agent Setup Maintenance**（skill_instruction）：Use this skill when changing the shared agent setup for the repository. 证据：`.agents/skills/agent-setup-maintenance/SKILL.md`
- 其余 20 条证据见 `AI_CONTEXT_PACK.json` 或 `EVIDENCE_INDEX.json`。

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

- **把本资产当作开工前上下文，而不是运行环境。**：AI Context Pack 只包含证据化项目理解，不包含目标项目的可执行状态。 证据：`.agents/AGENTS.md`, `.agents/README.md`, `README.md`
- **回答用户时区分可预览内容与必须安装后才能验证的内容。**：安装前体验的消费者价值来自降低误装和误判，而不是伪装成真实运行。 证据：`.agents/AGENTS.md`, `.agents/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, package.json, pnpm-workspace.yaml
- **仓库结构**：importance `high`
  - source_paths: turbo.json, docker-compose.yml, pnpm-workspace.yaml
- **系统架构**：importance `high`
  - source_paths: packages/shared/src/server/redis/redis.ts, packages/shared/src/server/clickhouse/client.ts, packages/shared/src/db.ts, worker/src/app.ts, web/next.config.mjs
- **数据库设计**：importance `high`
  - source_paths: packages/shared/prisma/schema.prisma, packages/shared/clickhouse/migrations/clustered, packages/shared/src/server/repositories, packages/shared/src/tableDefinitions
- **追踪系统**：importance `high`
  - source_paths: packages/shared/src/domain/traces.ts, packages/shared/src/domain/observations.ts, packages/shared/src/server/ingestion, packages/shared/src/server/otel, packages/shared/src/server/repositories/traces.ts
- **提示词管理**：importance `high`
  - source_paths: packages/shared/src/domain/prompts.ts, packages/shared/src/features/prompts, packages/shared/src/server/services/PromptService, web/src/features/prompts, packages/shared/src/tableDefinitions/promptsTable.ts
- **评估系统**：importance `high`
  - source_paths: packages/shared/src/domain/score-configs.ts, packages/shared/src/domain/scores.ts, worker/src/features/evaluation, packages/shared/src/features/scores
- **数据集管理**：importance `high`
  - source_paths: packages/shared/src/domain/dataset-items.ts, packages/shared/src/domain/dataset-run-items.ts, packages/shared/src/server/services/DatasetService, web/src/features/datasets, worker/src/features/experiments

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

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `da8a4f54c92bc5f16415f1a039ca5530aa62298b`
- inspected_files: `pnpm-lock.yaml`, `package.json`, `README.md`, `docker-compose.yml`, `packages/eslint-plugin/vitest.config.ts`, `packages/eslint-plugin/vitest.setup.ts`, `packages/eslint-plugin/package.json`, `packages/eslint-plugin/tsconfig.json`, `packages/shared/AGENTS.md`, `packages/shared/package.json`, `packages/shared/tsconfig.json`, `packages/config-typescript/package.json`, `packages/config-typescript/nextjs.json`, `packages/config-typescript/base.json`, `packages/config-eslint/base.js`, `packages/config-eslint/index.js`, `packages/config-eslint/index.d.ts`, `packages/config-eslint/package.json`, `packages/config-eslint/next.d.ts`, `packages/config-eslint/base.d.ts`

宿主 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: 来源证据：bug: Using client with context manager breaks the scoring

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：bug: Using client with context manager breaks the scoring
- Host AI rule: 来源问题仍为 open，Pack Agent 需要复核是否仍影响当前版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | cevd_5afee24537ba47369cc4621f7fb18122 | https://github.com/langfuse/langfuse/issues/8138 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 2: 来源证据：bug: unnamed trace name in Langfuse UI

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

### Constraint 3: 来源证据：bug: AsyncStream' object has no attribute 'usage' when integrated with Semantic Kernel and Openlit

- Trigger: GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：bug: AsyncStream' object has no attribute 'usage' when integrated with Semantic Kernel and Openlit
- Host AI rule: 来源问题仍为 open，Pack Agent 需要复核是否仍影响当前版本。
- Why it matters: 可能影响授权、密钥配置或安全边界。
- Evidence: community_evidence:github | cevd_8657d86702904e90b9d448770e618256 | https://github.com/langfuse/langfuse/issues/8173 | 来源类型 github_issue 暴露的待验证使用条件。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 4: 来源证据：bug: Worker shutdown takes ~1 hour in self hosted kubernetes

- Trigger: GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：bug: Worker shutdown takes ~1 hour in self hosted kubernetes
- Host AI rule: 来源问题仍为 open，Pack Agent 需要复核是否仍影响当前版本。
- Why it matters: 可能影响授权、密钥配置或安全边界。
- Evidence: community_evidence:github | cevd_cff1b1d1a1ca4eb892563c33d3aa62e9 | https://github.com/langfuse/langfuse/issues/8156 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 5: 来源证据：bug: Socket timeout. Expecting data, but didn't receive any in 30000ms on idle BullMQ queues

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：bug: Socket timeout. Expecting data, but didn't receive any in 30000ms on idle BullMQ queues
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | cevd_49a69075a1c346789a28db93c9ec6f3f | https://github.com/langfuse/langfuse/issues/13601 | 来源讨论提到 node 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 6: 来源证据：v3.169.0

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

### Constraint 7: 来源证据：v3.172.0

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

### Constraint 8: 来源证据：v3.173.0

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

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

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

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

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