# crush - Doramagic AI Context Pack

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

## 充分原则

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

## 给宿主 AI 的使用方式

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

## Claim 消费规则

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

## 它最适合谁

- **正在使用 Claude/Codex/Cursor/Gemini 等宿主 AI 的开发者**：README 或插件配置提到多个宿主 AI。 证据：`README.md` Claim：`clm_0003` supported 0.86
- **希望把专业流程带进宿主 AI 的用户**：仓库包含 Skill 文档。 证据：`.agents/skills/builtin-skills/SKILL.md`, `.agents/skills/shell-builtins/SKILL.md`, `internal/skills/builtin/crush-config/SKILL.md`, `internal/skills/builtin/crush-hooks/SKILL.md` 等 Claim：`clm_0004` supported 0.86

## 它能做什么

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

## 怎么开始

- `npm install -g @charmland/crush` 证据：`README.md` Claim：`clm_0005` supported 0.86
- `curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/charm.gpg` 证据：`README.md` Claim：`clm_0006` supported 0.86
- `git clone https://github.com/anthropics/skills.git _temp` 证据：`README.md` Claim：`clm_0007` supported 0.86

## 继续前判断卡

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

### 30 秒判断

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

### 现在可以相信

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

### 继续会触碰什么

- **命令执行**：包管理器、网络下载、本地插件目录、项目配置或用户主目录。 原因：运行第一条命令就可能产生环境改动；必须先判断是否值得跑。 证据：`README.md`
- **宿主 AI 配置**：Claude/Codex/Cursor/Gemini/OpenCode 等宿主的 plugin、Skill 或规则加载配置。 原因：宿主配置会改变 AI 后续工作方式，可能和用户已有规则冲突。 证据：`.agents/skills/builtin-skills/SKILL.md`, `.agents/skills/shell-builtins/SKILL.md`, `AGENTS.md`, `internal/skills/builtin/crush-config/SKILL.md` 等
- **本地环境或项目文件**：安装结果、插件缓存、项目配置或本地依赖目录。 原因：安装前无法证明写入范围和回滚方式，需要隔离验证。 证据：`README.md`
- **环境变量 / API Key**：项目入口文档明确出现 API key、token、secret 或账号凭证配置。 原因：如果真实安装需要凭证，应先使用测试凭证并经过权限/合规判断。 证据：`README.md`, `internal/skills/builtin/crush-config/SKILL.md`, `schema.json`
- **宿主 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_0008` inferred 0.45
- **命令执行会修改本地环境**：安装命令可能写入用户主目录、宿主插件目录或项目配置。 处理方式：先在隔离环境或测试账号中运行。 证据：`README.md` Claim：`clm_0009` 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/builtin-skills/SKILL.md`, `.agents/skills/shell-builtins/SKILL.md`, `internal/skills/builtin/crush-config/SKILL.md`, `internal/skills/builtin/crush-hooks/SKILL.md` 等 Claim：`clm_0001` supported 0.86
- **命令行启动或安装流程**：先说明这是安装后验证能力，再给出安装前检查清单。 边界：必须真实安装或运行后验证。 证据：`README.md` Claim：`clm_0002` supported 0.86

### 上下文规模

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

### 证据不足时的处理

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

## Prompt Recipes

### 适配判断

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

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

### 安装前体验

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

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

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


## 角色 / Skill 索引

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

- **builtin-skills**（skill）：Crush embeds skills directly into the binary via internal/skills/builtin/ . These are always available without user configuration. 激活提示：当用户任务与“builtin-skills”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/builtin-skills/SKILL.md`
- **shell-builtins**（skill）：Use when creating a new shell builtin command for Crush internal/shell/ , editing an existing one, or when the user needs to understand how commands are intercepted in Crush's embedded shell. 激活提示：当用户任务与“shell-builtins”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/shell-builtins/SKILL.md`
- **crush-config**（skill）：Use when the user needs help configuring Crush — working with crush.json, setting up providers, configuring LSPs, adding MCP servers, managing skills or permissions, or changing Crush behavior. 激活提示：当用户任务与“crush-config”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`internal/skills/builtin/crush-config/SKILL.md`
- **crush-hooks**（skill）：Use when the user wants to add, write, debug, or configure a Crush hook — gating or blocking tool calls, approving or rewriting tool input before execution, injecting context into tool results, or troubleshooting hook behavior in crush.json. 激活提示：当用户任务与“crush-hooks”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`internal/skills/builtin/crush-hooks/SKILL.md`
- **jq**（skill）：Use when the user needs to query, filter, reshape, extract, create, or construct JSON data — including API responses, config files, log output, or any structured data — or when helping the user write or debug JSON transformations. 激活提示：当用户任务与“jq”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`internal/skills/builtin/jq/SKILL.md`

## 证据索引

- 共索引 80 条证据。

- **Hooks**（documentation）：!NOTE This document was designed for both humans and agents. 证据：`docs/hooks/README.md`
- **Crush**（documentation）：Your new coding bestie, now available in your favourite terminal. Your tools, your code, and your workflows, wired into your LLM of choice. 终端里的编程新搭档， 无缝接入你的工具、代码与工作流，全面兼容主流 LLM 模型。 证据：`README.md`
- **Builtin Skills**（skill_instruction）：Crush embeds skills directly into the binary via internal/skills/builtin/ . These are always available without user configuration. 证据：`.agents/skills/builtin-skills/SKILL.md`
- **Shell Builtins**（skill_instruction）：Crush's shell internal/shell/ uses mvdan.cc/sh/v3 for POSIX shell emulation. Commands can be intercepted before they reach the OS by adding builtins — functions handled in-process. 证据：`.agents/skills/shell-builtins/SKILL.md`
- **Crush Configuration**（skill_instruction）：Crush uses JSON configuration files with the following priority highest to lowest : 证据：`internal/skills/builtin/crush-config/SKILL.md`
- **Crush Hooks**（skill_instruction）：Hooks are user-defined commands in crush.json that fire at specific points during execution, giving deterministic control over tool behavior. They run before permission checks and only on the top-level agent's tool calls — sub-agent calls task tool, agentic fetch, etc. are not intercepted, though the sub-agent tool call itself is. 证据：`internal/skills/builtin/crush-hooks/SKILL.md`
- **jq — Built-in JSON Processor**（skill_instruction）：Crush ships a built-in jq command via github.com/itchyny/gojq available in the bash tool. No external binary is required. 证据：`internal/skills/builtin/jq/SKILL.md`
- **Crush Development Guide**（documentation）：Crush is a terminal-based AI coding assistant built in Go by Charm https://charm.land . It connects to LLMs and gives them tools to read, write, and execute code. It supports multiple providers Anthropic, OpenAI, Gemini, Bedrock, Copilot, Hyper, MiniMax, Vercel, and more , integrates with LSPs for code intelligence, and supports extensibility via MCP servers and agent skills. 证据：`AGENTS.md`
- **General Guidelines**（documentation）：- always format CSS, HTML, and JS files with prettier 证据：`internal/cmd/stats/AGENTS.md`
- **UI Development Instructions**（documentation）：- Never use commands to send messages when you can directly mutate children or state. - Keep things simple; do not overcomplicate. - Create files if needed to separate logic; do not nest models. - Never do IO or expensive work in Update ; always use a tea.Cmd . - Never change the model state inside of a command. Use messages and update the state in the main Update loop. - Use the github.com/charmbracelet/x/ansi package for any string manipulation that might involve ANSI codes. Do not manipulate ANSI strings at byte level! Some useful functions: - ansi.Cut - ansi.StringWidth - ansi.Strip - ansi.Truncate 证据：`internal/ui/AGENTS.md`
- **Hooks: Future Work**（documentation）：This document tracks planned features and design notes for hooks that are not yet implemented. Nothing here is part of the current contract. Treat it as a scratchpad for what's next, not as documentation of current behavior. 证据：`docs/hooks/FUTURE.md`
- **Crush**（structured_config）：{ "$schema": "https://charm.land/crush.json", "lsp": { "gopls": { "options": { "gofumpt": true, "codelenses": { "gc details": true, "generate": true, "run govulncheck": true, "test": true, "tidy": true, "upgrade dependency": true }, "hints": { "assignVariableTypes": true, "compositeLiteralFields": true, "compositeLiteralTypes": true, "constantValues": true, "functionTypeParameters": true, "parameterNames": true, "rangeVariableTypes": true }, "analyses": { "nilness": true, "unusedparams": true, "unusedvariable": true, "unusedwrite": true, "useany": true }, "staticcheck": true, "directoryFilters": "-.git", "-node modules" , "semanticTokens": true } } } } 证据：`crush.json`
- **Schema**（structured_config）：{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://github.com/charmbracelet/crush/internal/config/config", "$ref": " /$defs/Config", "$defs": { "Attribution": { "properties": { "trailer style": { "type": "string", "enum": "none", "co-authored-by", "assisted-by" , "description": "Style of attribution trailer to add to commits", "default": "assisted-by" }, "co authored by": { "type": "boolean", "description": "Deprecated: use trailer style instead", "deprecated": true }, "generated with": { "type": "boolean", "description": "Add Generated with Crush line to commit messages and issues and PRs", "default": true } }, "additionalProperties": false, "type": "object" }, "C… 证据：`schema.json`
- **.Goreleaser**（source_file）：version: 2 project name: crush includes: - from url: url: charmbracelet/meta/main/notarize.yaml metadata: mod timestamp: "{{ .CommitTimestamp }}" license: "FSL-1.1-MIT" homepage: "https://charm.sh/crush" description: "A powerful terminal-based AI assistant for developers, providing intelligent coding assistance directly in your terminal." full description: "A powerful terminal-based AI assistant for developers, providing intelligent coding assistance directly in your terminal." maintainers: - "kujtimiihoxha " - "caarlos0 " nightly: publish release: true keep single release: true version template: "{{ incminor .Version }}-nightly" snapshot: version template: "0.0.0-{{ .Timestamp }}" before:… 证据：`.goreleaser.yml`
- **Taskfile**（source_file）：version: "3" vars: VERSION: sh: git describe --long 2 /dev/null echo "" RACE: sh: test -f race.log && echo "1" echo "" env: CGO ENABLED: 0 GOEXPERIMENT: greenteagc tasks: lint:install: desc: Install golangci-lint cmds: - go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest env: GOTOOLCHAIN: go1.25.0 lint: desc: Run base linters cmds: - task: lint:log - golangci-lint run --path-mode=abs --config=".golangci.yml" --timeout=5m env: GOEXPERIMENT: null lint:log: desc: Check that log messages start with capital letters cmds: - ./scripts/check log capitalization.sh lint:fix: desc: Run base linters and fix issues cmds: - golangci-lint run --path-mode=abs --config=".golangci.yml"… 证据：`Taskfile.yaml`
- **Go toolchain**（source_file）：{ description = "Crush development environment"; 证据：`flake.nix`
- **Provider**（source_file）：package hyper ⋮---- import "cmp" "context" "embed" "encoding/json" "fmt" "log/slog" "net/http" "os" "sync" "time" "charm.land/catwalk/pkg/catwalk" ⋮---- "cmp" "context" "embed" "encoding/json" "fmt" "log/slog" "net/http" "os" "sync" "time" ⋮---- "charm.land/catwalk/pkg/catwalk" ⋮---- //go:generate wget -O provider.json https: ⋮---- //go:embed provider.json var embedded byte ⋮---- var Embedded = sync.OnceValue func catwalk.Provider { ⋮---- var provider catwalk.Provider ⋮---- const Name = "hyper" DisplayName = "Charm Hyper" defaultBaseURL = "https://hyper.charm.land" ⋮---- var BaseURL = sync.OnceValue func string { ⋮---- func FetchCredits ctx context.Context, apiKey string int, error ⋮---- va… 证据：`internal/agent/hyper/provider.go`
- **Download**（source_file）：package tools ⋮---- import "cmp" "context" "embed" "fmt" "html/template" "io" "net/http" "os" "path/filepath" "strings" "time" "charm.land/fantasy" "github.com/charmbracelet/crush/internal/filepathext" "github.com/charmbracelet/crush/internal/permission" ⋮---- "cmp" "context" "embed" "fmt" "html/template" "io" "net/http" "os" "path/filepath" "strings" "time" ⋮---- "charm.land/fantasy" "github.com/charmbracelet/crush/internal/filepathext" "github.com/charmbracelet/crush/internal/permission" ⋮---- type DownloadParams struct { URL string json:"url" description:"The URL to download from" FilePath string json:"file path" description:"The local file path where the downloaded content should be sav… 证据：`internal/agent/tools/download.go`
- **Init**（source_file）：package mcp ⋮---- import "cmp" "context" "errors" "fmt" "io" "log/slog" "net/http" "os" "os/exec" "strings" "sync" "time" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/home" "github.com/charmbracelet/crush/internal/permission" "github.com/charmbracelet/crush/internal/pubsub" "github.com/charmbracelet/crush/internal/version" "github.com/modelcontextprotocol/go-sdk/mcp" ⋮---- "cmp" "context" "errors" "fmt" "io" "log/slog" "net/http" "os" "os/exec" "strings" "sync" "time" ⋮---- "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crus… 证据：`internal/agent/tools/mcp/init.go`
- **App**（source_file）：package app ⋮---- import "context" "database/sql" "errors" "fmt" "io" "log/slog" "os" "strings" "sync" "time" tea "charm.land/bubbletea/v2" "charm.land/catwalk/pkg/catwalk" "charm.land/fantasy" "charm.land/lipgloss/v2" "github.com/charmbracelet/crush/internal/agent" "github.com/charmbracelet/crush/internal/agent/notify" "github.com/charmbracelet/crush/internal/agent/tools/mcp" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/db" "github.com/charmbracelet/crush/internal/event" "github.com/charmbracelet/crush/internal/filetracker" "github.com/charmbracelet/crush/internal/format" "github.com/charmbracelet/crush/internal/history" "github.com/charmbracele… 证据：`internal/app/app.go`
- **Lsp Events**（source_file）：package app ⋮---- import "context" "time" "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/lsp" "github.com/charmbracelet/crush/internal/pubsub" ⋮---- "context" "time" ⋮---- "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/lsp" "github.com/charmbracelet/crush/internal/pubsub" ⋮---- type LSPEventType string ⋮---- const LSPEventStateChanged LSPEventType = "state changed" LSPEventDiagnosticsChanged LSPEventType = "diagnostics changed" ⋮---- type LSPEvent struct { Type LSPEventType Name string State lsp.ServerState Error error DiagnosticCount int } ⋮---- type LSPClientInfo struct { Name string State lsp.ServerState… 证据：`internal/app/lsp_events.go`
- **Provider**（source_file）：package app ⋮---- import "fmt" "strings" "github.com/charmbracelet/crush/internal/config" xstrings "github.com/charmbracelet/x/exp/strings" ⋮---- "fmt" "strings" ⋮---- "github.com/charmbracelet/crush/internal/config" xstrings "github.com/charmbracelet/x/exp/strings" ⋮---- func parseModelStr providers map string config.ProviderConfig, modelStr string providerFilter, modelID string ⋮---- // Check if the first part is a valid provider name ⋮---- // First part is not a valid provider, treat entire string as model ID ⋮---- // modelMatch represents a found model. type modelMatch struct { provider string modelID string } ⋮---- func findModels providers map string config.ProviderConfig, largeModel,… 证据：`internal/app/provider.go`
- **Backend**（source_file）：package backend ⋮---- import "context" "errors" "fmt" "log/slog" "path/filepath" "runtime" "sync" "time" "github.com/charmbracelet/crush/internal/app" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/db" "github.com/charmbracelet/crush/internal/proto" "github.com/charmbracelet/crush/internal/skills" "github.com/charmbracelet/crush/internal/ui/util" "github.com/charmbracelet/crush/internal/version" "github.com/google/uuid" ⋮---- "context" "errors" "fmt" "log/slog" "path/filepath" "runtime" "sync" "time" ⋮---- "github.com/charmbracelet/crush/internal/app" "github.com/charmbracelet/crush/internal/config" "… 证据：`internal/backend/backend.go`
- **Backend Test**（source_file）：package backend ⋮---- import "bytes" "context" "errors" "log/slog" "os" "path/filepath" "runtime" "strings" "sync" "sync/atomic" "testing" "time" "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/proto" "github.com/google/uuid" "github.com/stretchr/testify/require" ⋮---- "bytes" "context" "errors" "log/slog" "os" "path/filepath" "runtime" "strings" "sync" "sync/atomic" "testing" "time" ⋮---- "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/proto" "github.com/google/uuid" "github.com/stretchr/testify/require" ⋮---- func newTestBackend t testing.T Backend, atomic.Int32 ⋮---- var shutdownCount atomic.Int32 ⋮---- fun… 证据：`internal/backend/backend_test.go`
- **Config**（source_file）：package backend ⋮---- import "context" "errors" "fmt" "github.com/charmbracelet/crush/internal/agent" mcptools "github.com/charmbracelet/crush/internal/agent/tools/mcp" "github.com/charmbracelet/crush/internal/commands" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/oauth" "github.com/charmbracelet/crush/internal/proto" "github.com/charmbracelet/crush/internal/pubsub" "github.com/charmbracelet/crush/internal/skills" ⋮---- "context" "errors" "fmt" ⋮---- "github.com/charmbracelet/crush/internal/agent" mcptools "github.com/charmbracelet/crush/internal/agent/tools/mcp" "github.com/charmbracelet/crush/internal/commands" "github.com/charmbracelet/crush/i… 证据：`internal/backend/config.go`
- **Events**（source_file）：package backend ⋮---- import "context" tea "charm.land/bubbletea/v2" mcptools "github.com/charmbracelet/crush/internal/agent/tools/mcp" "github.com/charmbracelet/crush/internal/app" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/pubsub" ⋮---- "context" ⋮---- tea "charm.land/bubbletea/v2" ⋮---- mcptools "github.com/charmbracelet/crush/internal/agent/tools/mcp" "github.com/charmbracelet/crush/internal/app" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/pubsub" ⋮---- func b Backend SubscribeEvents ctx context.Context, workspaceID string <-chan pubsub.Event tea.Msg , error ⋮---- func b Backend GetLSPStates wor… 证据：`internal/backend/events.go`
- **Client**（source_file）：package client ⋮---- import "context" "encoding/json" "fmt" "io" "net" "net/http" "net/url" stdpath "path" "path/filepath" "time" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/proto" "github.com/charmbracelet/crush/internal/server" "github.com/google/uuid" ⋮---- "context" "encoding/json" "fmt" "io" "net" "net/http" "net/url" stdpath "path" "path/filepath" "time" ⋮---- "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/proto" "github.com/charmbracelet/crush/internal/server" "github.com/google/uuid" ⋮---- const DummyHost = "api.crush.localhost" ⋮---- type Client struct { h http.Client path string network string… 证据：`internal/client/client.go`
- **Config**（source_file）：package client ⋮---- import "context" "encoding/json" "fmt" "net/http" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/oauth" "github.com/charmbracelet/crush/internal/proto" ⋮---- "context" "encoding/json" "fmt" "net/http" ⋮---- "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/oauth" "github.com/charmbracelet/crush/internal/proto" ⋮---- func c Client SetConfigField ctx context.Context, id string, scope config.Scope, key string, value any error ⋮---- func c Client RemoveConfigField ctx context.Context, id string, scope config.Scope, key string error ⋮---- func c Client UpdatePreferredModel ctx context.Context,… 证据：`internal/client/config.go`
- **Proto**（source_file）：package client ⋮---- import "bufio" "bytes" "context" "encoding/json" "errors" "fmt" "io" "log/slog" "net/http" "net/url" "time" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/message" "github.com/charmbracelet/crush/internal/proto" "github.com/charmbracelet/crush/internal/pubsub" "github.com/charmbracelet/x/powernap/pkg/lsp/protocol" ⋮---- "bufio" "bytes" "context" "encoding/json" "errors" "fmt" "io" "log/slog" "net/http" "net/url" "time" ⋮---- "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/message" "github.com/charmbracelet/crush/internal/proto" "github.com/charmbracelet/crush/internal/pubsub" "github.co… 证据：`internal/client/proto.go`
- **Server**（source_file）：package cmd ⋮---- import "context" "errors" "fmt" "log/slog" "os" "os/signal" "path/filepath" "time" "github.com/charmbracelet/crush/internal/config" crushlog "github.com/charmbracelet/crush/internal/log" "github.com/charmbracelet/crush/internal/server" "github.com/charmbracelet/x/term" "github.com/spf13/cobra" ⋮---- "context" "errors" "fmt" "log/slog" "os" "os/signal" "path/filepath" "time" ⋮---- "github.com/charmbracelet/crush/internal/config" crushlog "github.com/charmbracelet/crush/internal/log" "github.com/charmbracelet/crush/internal/server" "github.com/charmbracelet/x/term" "github.com/spf13/cobra" ⋮---- var serverHost string ⋮---- func init ⋮---- var serverCmd = &cobra.Command{ Use:… 证据：`internal/cmd/server.go`
- **Config**（source_file）：package config ⋮---- import "cmp" "context" "errors" "fmt" "maps" "net/http" "net/url" "slices" "strings" "time" "charm.land/catwalk/pkg/catwalk" "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/oauth" "github.com/charmbracelet/crush/internal/oauth/copilot" "github.com/invopop/jsonschema" ⋮---- "cmp" "context" "errors" "fmt" "maps" "net/http" "net/url" "slices" "strings" "time" ⋮---- "charm.land/catwalk/pkg/catwalk" "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/oauth" "github.com/charmbracelet/crush/internal/oauth/copilot" "github.com/invopop/jsonschema" ⋮---- const appName = "crush" defaultDataDirectory = ".… 证据：`internal/config/config.go`
- **Docker Mcp**（source_file）：package config ⋮---- import "context" "fmt" "os/exec" "sync" "time" ⋮---- "context" "fmt" "os/exec" "sync" "time" ⋮---- var dockerMCPVersionRunner = func ctx context.Context error { ⋮---- const dockerMCPAvailabilityTTL = 10 time.Second ⋮---- var dockerMCPAvailabilityCache struct { mu sync.Mutex available bool checkedAt time.Time known bool } ⋮---- const DockerMCPName = "docker" ⋮---- func IsDockerMCPAvailable bool ⋮---- func DockerMCPAvailabilityCached available bool, known bool ⋮---- func RefreshDockerMCPAvailability bool ⋮---- func c Config IsDockerMCPEnabled bool ⋮---- func DockerMCPConfig MCPConfig ⋮---- func s ConfigStore PrepareDockerMCPConfig MCPConfig, error ⋮---- func s ConfigStore… 证据：`internal/config/docker_mcp.go`
- **Init**（source_file）：package config ⋮---- import "fmt" "os" "path/filepath" "slices" "strings" "github.com/charmbracelet/crush/internal/fsext" ⋮---- "fmt" "os" "path/filepath" "slices" "strings" ⋮---- "github.com/charmbracelet/crush/internal/fsext" ⋮---- const InitFlagFilename = "init" ⋮---- type ProjectInitFlag struct { Initialized bool json:"initialized" } ⋮---- func Init workingDir, dataDir string, debug bool ConfigStore, error ⋮---- func ProjectNeedsInitialization store ConfigStore bool, error ⋮---- func contextPathsExist dir string bool, error ⋮---- var files string ⋮---- func dirHasNoVisibleFiles dir string bool, error ⋮---- func MarkProjectInitialized store ConfigStore error ⋮---- func HasInitialDataConf… 证据：`internal/config/init.go`
- **Load**（source_file）：package config ⋮---- import "cmp" "context" "encoding/json" "fmt" "log/slog" "maps" "os" "os/exec" "path/filepath" "regexp" "runtime" "slices" "strconv" "strings" "testing" "charm.land/catwalk/pkg/catwalk" "github.com/charmbracelet/crush/internal/agent/hyper" "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/env" "github.com/charmbracelet/crush/internal/filepathext" "github.com/charmbracelet/crush/internal/fsext" "github.com/charmbracelet/crush/internal/home" powernapConfig "github.com/charmbracelet/x/powernap/pkg/config" "github.com/qjebbs/go-jsons" "github.com/tidwall/gjson" "github.com/tidwall/sjson" ⋮---- "cmp" "context" "encoding/json" "fmt" "log/… 证据：`internal/config/load.go`
- **Provider**（source_file）：package config ⋮---- import "cmp" "context" "encoding/json" "errors" "fmt" "log/slog" "os" "path/filepath" "runtime" "slices" "strings" "sync" "time" "charm.land/catwalk/pkg/catwalk" "charm.land/catwalk/pkg/embedded" "github.com/charmbracelet/crush/internal/agent/hyper" "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/home" "github.com/charmbracelet/x/etag" ⋮---- "cmp" "context" "encoding/json" "errors" "fmt" "log/slog" "os" "path/filepath" "runtime" "slices" "strings" "sync" "time" ⋮---- "charm.land/catwalk/pkg/catwalk" "charm.land/catwalk/pkg/embedded" "github.com/charmbracelet/crush/internal/agent/hyper" "github.com/charmbracelet/crush/internal/csy… 证据：`internal/config/provider.go`
- **Store**（source_file）：package config ⋮---- import "context" "encoding/json" "fmt" "log/slog" "os" "path/filepath" "slices" "charm.land/catwalk/pkg/catwalk" hyperp "github.com/charmbracelet/crush/internal/agent/hyper" "github.com/charmbracelet/crush/internal/env" "github.com/charmbracelet/crush/internal/oauth" "github.com/charmbracelet/crush/internal/oauth/copilot" "github.com/charmbracelet/crush/internal/oauth/hyper" "github.com/tidwall/gjson" "github.com/tidwall/sjson" ⋮---- "context" "encoding/json" "fmt" "log/slog" "os" "path/filepath" "slices" ⋮---- "charm.land/catwalk/pkg/catwalk" hyperp "github.com/charmbracelet/crush/internal/agent/hyper" "github.com/charmbracelet/crush/internal/env" "github.com/charmbrac… 证据：`internal/config/store.go`
- **Client**（source_file）：package lsp ⋮---- import "context" "encoding/json" "fmt" "log/slog" "os" "path/filepath" "slices" "sync" "sync/atomic" "time" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/fsext" "github.com/charmbracelet/crush/internal/home" powernap "github.com/charmbracelet/x/powernap/pkg/lsp" "github.com/charmbracelet/x/powernap/pkg/lsp/protocol" "github.com/charmbracelet/x/powernap/pkg/transport" ⋮---- "context" "encoding/json" "fmt" "log/slog" "os" "path/filepath" "slices" "sync" "sync/atomic" "time" ⋮---- "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/csync" "github.c… 证据：`internal/lsp/client.go`
- **Manager**（source_file）：package lsp ⋮---- import "cmp" "context" "errors" "io" "log/slog" "os/exec" "path/filepath" "strings" "sync" "time" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/fsext" powernapconfig "github.com/charmbracelet/x/powernap/pkg/config" powernap "github.com/charmbracelet/x/powernap/pkg/lsp" "github.com/sourcegraph/jsonrpc2" ⋮---- "cmp" "context" "errors" "io" "log/slog" "os/exec" "path/filepath" "strings" "sync" "time" ⋮---- "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/fsext" powernapconfig "github.com/charmbrace… 证据：`internal/lsp/manager.go`
- **Client**（source_file）：package copilot ⋮---- import "bytes" "fmt" "io" "log/slog" "net/http" "regexp" "github.com/charmbracelet/crush/internal/log" ⋮---- "bytes" "fmt" "io" "log/slog" "net/http" "regexp" ⋮---- "github.com/charmbracelet/crush/internal/log" ⋮---- var assistantRolePattern = regexp.MustCompile "role"\s :\s "assistant" ⋮---- func NewClient isSubAgent, debug bool http.Client ⋮---- type initiatorTransport struct { debug bool isSubAgent bool } ⋮---- func t initiatorTransport RoundTrip req http.Request http.Response, error ⋮---- const xInitiatorHeader = "X-Initiator" userInitiator = "user" agentInitiator = "agent" ⋮---- func t initiatorTransport roundTrip req http.Request http.Response, error 证据：`internal/oauth/copilot/client.go`
- **Proto**（source_file）：package proto ⋮---- import "encoding/json" "errors" "time" "charm.land/catwalk/pkg/catwalk" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/lsp" ⋮---- "encoding/json" "errors" "time" ⋮---- "charm.land/catwalk/pkg/catwalk" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/lsp" ⋮---- type Workspace struct { ID string json:"id" Path string json:"path" YOLO bool json:"yolo,omitempty" Debug bool json:"debug,omitempty" DataDir string json:"data dir,omitempty" Version string json:"version,omitempty" ClientID string json:"client id,omitempty" Config config.Config json:"config,omitempty" Env string json:"env,omitempty"… 证据：`internal/proto/proto.go`
- **Server**（source_file）：package proto ⋮---- type ServerControl struct { Command string json:"command" } 证据：`internal/proto/server.go`
- **Skills**（source_file）：package proto ⋮---- type SkillDiscoveryState int ⋮---- const SkillStateNormal SkillDiscoveryState = iota SkillStateError ⋮---- type SkillState struct { Name string json:"name" Path string json:"path" State SkillDiscoveryState json:"state" Error string json:"error,omitempty" } ⋮---- type SkillsEvent struct { States SkillState json:"states" } 证据：`internal/proto/skills.go`
- **Events**（source_file）：package pubsub ⋮---- import "context" "encoding/json" ⋮---- "context" "encoding/json" ⋮---- const CreatedEvent EventType = "created" UpdatedEvent EventType = "updated" DeletedEvent EventType = "deleted" ⋮---- const PayloadTypeLSPEvent PayloadType = "lsp event" PayloadTypeMCPEvent PayloadType = "mcp event" PayloadTypePermissionRequest PayloadType = "permission request" PayloadTypePermissionNotification PayloadType = "permission notification" PayloadTypeMessage PayloadType = "message" PayloadTypeSession PayloadType = "session" PayloadTypeFile PayloadType = "file" PayloadTypeAgentEvent PayloadType = "agent event" PayloadTypeConfigChanged PayloadType = "config changed" PayloadTypeSkillsEvent Pa… 证据：`internal/pubsub/events.go`
- **Config**（source_file）：package server ⋮---- import "encoding/json" "net/http" "github.com/charmbracelet/crush/internal/proto" ⋮---- "encoding/json" "net/http" ⋮---- "github.com/charmbracelet/crush/internal/proto" ⋮---- func c controllerV1 handlePostWorkspaceConfigSet w http.ResponseWriter, r http.Request ⋮---- var req proto.ConfigSetRequest ⋮---- func c controllerV1 handlePostWorkspaceConfigRemove w http.ResponseWriter, r http.Request ⋮---- var req proto.ConfigRemoveRequest ⋮---- func c controllerV1 handlePostWorkspaceConfigModel w http.ResponseWriter, r http.Request ⋮---- var req proto.ConfigModelRequest ⋮---- func c controllerV1 handlePostWorkspaceConfigCompact w http.ResponseWriter, r http.Request ⋮---- var re… 证据：`internal/server/config.go`
- **Events**（source_file）：package server ⋮---- import "encoding/json" "fmt" "log/slog" "github.com/charmbracelet/crush/internal/agent/notify" "github.com/charmbracelet/crush/internal/agent/tools/mcp" "github.com/charmbracelet/crush/internal/app" "github.com/charmbracelet/crush/internal/backend" "github.com/charmbracelet/crush/internal/history" "github.com/charmbracelet/crush/internal/message" "github.com/charmbracelet/crush/internal/permission" "github.com/charmbracelet/crush/internal/proto" "github.com/charmbracelet/crush/internal/pubsub" "github.com/charmbracelet/crush/internal/session" "github.com/charmbracelet/crush/internal/skills" ⋮---- "encoding/json" "fmt" "log/slog" ⋮---- "github.com/charmbracelet/crush/int… 证据：`internal/server/events.go`
- **Events Test**（source_file）：package server ⋮---- import "encoding/json" "errors" "testing" "github.com/charmbracelet/crush/internal/agent/notify" "github.com/charmbracelet/crush/internal/message" "github.com/charmbracelet/crush/internal/proto" "github.com/charmbracelet/crush/internal/pubsub" "github.com/charmbracelet/crush/internal/skills" "github.com/stretchr/testify/require" ⋮---- "encoding/json" "errors" "testing" ⋮---- "github.com/charmbracelet/crush/internal/agent/notify" "github.com/charmbracelet/crush/internal/message" "github.com/charmbracelet/crush/internal/proto" "github.com/charmbracelet/crush/internal/pubsub" "github.com/charmbracelet/crush/internal/skills" "github.com/stretchr/testify/require" ⋮---- func… 证据：`internal/server/events_test.go`
- **Proto**（source_file）：package server ⋮---- import "context" "encoding/json" "errors" "fmt" "net/http" "github.com/charmbracelet/crush/internal/backend" "github.com/charmbracelet/crush/internal/proto" "github.com/charmbracelet/crush/internal/session" "github.com/google/uuid" ⋮---- "context" "encoding/json" "errors" "fmt" "net/http" ⋮---- "github.com/charmbracelet/crush/internal/backend" "github.com/charmbracelet/crush/internal/proto" "github.com/charmbracelet/crush/internal/session" "github.com/google/uuid" ⋮---- type controllerV1 struct { backend backend.Backend server Server } ⋮---- func c controllerV1 handleGetHealth w http.ResponseWriter, http.Request ⋮---- func c controllerV1 handleGetVersion w http.Response… 证据：`internal/server/proto.go`
- **Server**（source_file）：package server ⋮---- import "context" "fmt" "log/slog" "net" "net/http" "net/url" "os/user" "runtime" "strings" "github.com/charmbracelet/crush/internal/backend" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/swagger" httpswagger "github.com/swaggo/http-swagger/v2" ⋮---- "context" "fmt" "log/slog" "net" "net/http" "net/url" "os/user" "runtime" "strings" ⋮---- "github.com/charmbracelet/crush/internal/backend" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/swagger" httpswagger "github.com/swaggo/http-swagger/v2" ⋮---- var ErrServerClosed = http.ErrServerClosed ⋮---- func ParseHostURL host string url.URL, err… 证据：`internal/server/server.go`
- **Catalog**（source_file）：package skills ⋮---- import "errors" "fmt" "os" "path/filepath" "strings" ⋮---- "errors" "fmt" "os" "path/filepath" "strings" ⋮---- type SourceType string ⋮---- const SourceSystem SourceType = "system" SourceUser SourceType = "user" SourceProject SourceType = "project" ⋮---- type CatalogEntry struct { ID string json:"id" Name string json:"name" Description string json:"description" Label string json:"label" Source SourceType json:"source" } ⋮---- type SkillReadResult struct { Name string json:"name" Description string json:"description" Source SourceType json:"source" Builtin bool json:"builtin" } ⋮---- var ErrSkillNotFound = errors.New "skill not found" ⋮---- func Catalog active Skill, ski… 证据：`internal/skills/catalog.go`
- **Embed**（source_file）：package skills ⋮---- import "embed" "io/fs" "log/slog" "path/filepath" ⋮---- "embed" "io/fs" "log/slog" "path/filepath" ⋮---- const BuiltinPrefix = "crush://skills/" ⋮---- //go:embed builtin 证据：`internal/skills/embed.go`
- **Manager**（source_file）：package skills ⋮---- import "context" "slices" "strings" "sync" "github.com/charmbracelet/crush/internal/home" "github.com/charmbracelet/crush/internal/pubsub" ⋮---- "context" "slices" "strings" "sync" ⋮---- "github.com/charmbracelet/crush/internal/home" "github.com/charmbracelet/crush/internal/pubsub" ⋮---- type Manager struct { mu sync.RWMutex allSkills Skill activeSkills Skill states SkillState resolvedPaths string workingDir string broker pubsub.Broker Event globalMirror bool } ⋮---- type ManagerOption func Manager ⋮---- func WithGlobalMirror ManagerOption ⋮---- func WithResolvedPaths paths string ManagerOption ⋮---- func WithWorkingDir dir string ManagerOption ⋮---- func NewManager all… 证据：`internal/skills/manager.go`
- **Skills**（source_file）：package skills ⋮---- import "context" "errors" "fmt" "log/slog" "os" "path/filepath" "regexp" "slices" "strings" "sync" "github.com/charlievieth/fastwalk" "github.com/charmbracelet/crush/internal/pubsub" "gopkg.in/yaml.v3" ⋮---- "context" "errors" "fmt" "log/slog" "os" "path/filepath" "regexp" "slices" "strings" "sync" ⋮---- "github.com/charlievieth/fastwalk" "github.com/charmbracelet/crush/internal/pubsub" "gopkg.in/yaml.v3" ⋮---- const SkillFileName = "SKILL.md" MaxNameLength = 64 MaxDescriptionLength = 1024 MaxCompatibilityLength = 500 ⋮---- var namePattern = regexp.MustCompile ^ a-zA-Z0-9 + - a-zA-Z0-9 + $ ⋮---- type Skill struct { Name string yaml:"name" json:"name" Description string… 证据：`internal/skills/skills.go`
- **Docker Mcp**（source_file）：package chat ⋮---- import "encoding/json" "fmt" "sort" "strings" "charm.land/lipgloss/v2" "charm.land/lipgloss/v2/table" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/message" "github.com/charmbracelet/crush/internal/stringext" "github.com/charmbracelet/crush/internal/ui/styles" ⋮---- "encoding/json" "fmt" "sort" "strings" ⋮---- "charm.land/lipgloss/v2" "charm.land/lipgloss/v2/table" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/message" "github.com/charmbracelet/crush/internal/stringext" "github.com/charmbracelet/crush/internal/ui/styles" ⋮---- type DockerMCPToolMessageItem struct { baseToolMessageItem… 证据：`internal/ui/chat/docker_mcp.go`
- **Taskfile**（source_file）：version: "3" tasks: test: desc: Run tests cmds: - go test ./... {{.CLI ARGS}} test:update: desc: Run tests and update golden files cmds: - go test ./... -update {{.CLI ARGS}} test:print: desc: Print golden files for debugging method: none sources: - ./testdata/TestDiffView/ / .golden cmds: - for: sources cmd: echo && echo "------- {{.ITEM}} -------" && echo && cat {{.ITEM}} silent: true test:print:width:unified: desc: Print golden files for debugging method: none sources: - ./testdata/TestDiffViewWidth/Unified/ .golden cmds: - for: sources cmd: echo && echo "------- {{.ITEM}} -------" && echo && cat {{.ITEM}} silent: true test:print:width:split: desc: Print golden files for debugging method… 证据：`internal/ui/diffview/Taskfile.yaml`
- **Skills**（source_file）：package model ⋮---- import "fmt" "path/filepath" "slices" "strings" "sync" "charm.land/lipgloss/v2" "github.com/charmbracelet/crush/internal/skills" "github.com/charmbracelet/crush/internal/ui/common" "github.com/charmbracelet/crush/internal/ui/styles" ⋮---- "fmt" "path/filepath" "slices" "strings" "sync" ⋮---- "charm.land/lipgloss/v2" "github.com/charmbracelet/crush/internal/skills" "github.com/charmbracelet/crush/internal/ui/common" "github.com/charmbracelet/crush/internal/ui/styles" ⋮---- type skillStatusItem struct { icon string name string title string description string } ⋮---- var builtinSkillsCache struct { once sync.Once skills skills.Skill } ⋮---- func cachedBuiltinSkills skills.S… 证据：`internal/ui/model/skills.go`
- **Contributor License Agreement**（documentation）：Thank you for your interest in the open source project s managed by Charmbracelet, Inc. "Company" . In order to clarify the intellectual property license granted with Contributions from any person or entity, Company 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 Company and its other contributors and users; it does not change your rights to use your own Contributions for any other purpose. By submitting a contribution to this repository e.g. opening a pull request or otherwise agreeing in writing, You accept and… 证据：`CLA.md`
- **Functional Source License, Version 1.1, MIT Future License**（documentation）：Functional Source License, Version 1.1, MIT Future License 证据：`LICENSE.md`
- **Testing**（source_file）：package app ⋮---- import "context" "sync" tea "charm.land/bubbletea/v2" "github.com/charmbracelet/crush/internal/agent/notify" "github.com/charmbracelet/crush/internal/permission" "github.com/charmbracelet/crush/internal/pubsub" ⋮---- "context" "sync" ⋮---- tea "charm.land/bubbletea/v2" "github.com/charmbracelet/crush/internal/agent/notify" "github.com/charmbracelet/crush/internal/permission" "github.com/charmbracelet/crush/internal/pubsub" ⋮---- func NewForTest ctx context.Context App ⋮---- func app App ShutdownForTest 证据：`internal/app/testing.go`
- **Testing**（source_file）：package backend ⋮---- func InsertWorkspaceForTest b Backend, ws Workspace ⋮---- func RegisterClientForTesting b Backend, ws Workspace, clientID string error ⋮---- func SetWorkspaceShutdownFnForTest ws Workspace, fn func ⋮---- func WorkspaceLiveStreamCountForTest ws Workspace int 证据：`internal/backend/testing.go`
- **Agent Tool**（documentation）：Launch a new agent that has access to the following tools: glob, grep, ls, view. When you are searching for a keyword or file and are not confident that you will find the right match on the first try, use the agent tool to perform the search for you. 证据：`internal/agent/templates/agent_tool.md`
- 其余 20 条证据见 `AI_CONTEXT_PACK.json` 或 `EVIDENCE_INDEX.json`。

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

- **把本资产当作开工前上下文，而不是运行环境。**：AI Context Pack 只包含证据化项目理解，不包含目标项目的可执行状态。 证据：`docs/hooks/README.md`, `README.md`, `.agents/skills/builtin-skills/SKILL.md`
- **回答用户时区分可预览内容与必须安装后才能验证的内容。**：安装前体验的消费者价值来自降低误装和误判，而不是伪装成真实运行。 证据：`docs/hooks/README.md`, `README.md`, `.agents/skills/builtin-skills/SKILL.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, go.mod, internal/version/version.go
- **安装与部署**：importance `high`
  - source_paths: goreleaser.yml, flake.nix, Taskfile.yaml
- **快速入门**：importance `high`
  - source_paths: internal/cmd/root.go, internal/cmd/login.go, internal/config/init.go
- **系统架构**：importance `high`
  - source_paths: internal/agent/agent.go, internal/backend/backend.go, internal/app/app.go, internal/server/server.go, internal/client/client.go
- **数据流与数据库**：importance `high`
  - source_paths: internal/db/db.go, internal/db/models.go, internal/db/querier.go, internal/db/sessions.sql.go, internal/db/messages.sql.go
- **Agent 系统**：importance `high`
  - source_paths: internal/agent/agent.go, internal/agent/coordinator.go, internal/agent/agent_tool.go, internal/agent/loop_detection.go, internal/permission/permission.go
- **工具系统**：importance `high`
  - source_paths: internal/agent/tools/tools.go, internal/agent/tools/bash.go, internal/agent/tools/edit.go, internal/agent/tools/write.go, internal/agent/tools/grep.go
- **技能系统**：importance `medium`
  - source_paths: internal/skills/skills.go, internal/skills/manager.go, internal/skills/catalog.go, internal/skills/embed.go, .agents/skills/builtin-skills/SKILL.md

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

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `cd592e80fd4758155f12b8a0fbf9930e44ea9024`
- inspected_files: `README.md`, `docs/hooks/FUTURE.md`, `docs/hooks/README.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: 失败模式：installation: Status line obscured by onboarding dialog

- Trigger: Developers should check this installation risk before relying on the project: Status line obscured by onboarding dialog
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: Status line obscured by onboarding dialog. Context: Observed when using macos
- Why it matters: Developers may fail before the first successful local run: Status line obscured by onboarding dialog
- Evidence: failure_mode_cluster:github_issue | fmev_a0f07b57c88e616e55f08e80117c394f | https://github.com/charmbracelet/crush/issues/3044 | Status line obscured by onboarding dialog
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 2: 来源证据：Status line obscured by onboarding dialog

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

### Constraint 3: 失败模式：configuration: Qwen 3.7 Max on OpenCode Go Unauthorized Error

- Trigger: Developers should check this configuration risk before relying on the project: Qwen 3.7 Max on OpenCode Go Unauthorized Error
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: Qwen 3.7 Max on OpenCode Go Unauthorized Error. Context: Observed when using linux
- Why it matters: Developers may misconfigure credentials, environment, or host setup: Qwen 3.7 Max on OpenCode Go Unauthorized Error
- Evidence: failure_mode_cluster:github_issue | fmev_9e6004420beb68218b1e13d4bcf43db6 | https://github.com/charmbracelet/crush/issues/3027 | Qwen 3.7 Max on OpenCode Go Unauthorized Error
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 4: 失败模式：configuration: v0.68.0

- Trigger: Developers should check this configuration risk before relying on the project: v0.68.0
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: v0.68.0. Context: Source discussion did not expose a precise runtime context.
- Why it matters: Upgrade or migration may change expected behavior: v0.68.0
- Evidence: failure_mode_cluster:github_release | fmev_bbaee295de66f70f36b7dc8593a9b7bd | https://github.com/charmbracelet/crush/releases/tag/v0.68.0 | v0.68.0
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 5: 失败模式：configuration: v0.70.0

- Trigger: Developers should check this configuration risk before relying on the project: v0.70.0
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: v0.70.0. Context: Source discussion did not expose a precise runtime context.
- Why it matters: Upgrade or migration may change expected behavior: v0.70.0
- Evidence: failure_mode_cluster:github_release | fmev_13d76ec440a4dbc5cec24de4d067e76e | https://github.com/charmbracelet/crush/releases/tag/v0.70.0 | v0.70.0
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 6: 失败模式：configuration: v0.71.0

- Trigger: Developers should check this configuration risk before relying on the project: v0.71.0
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: v0.71.0. Context: Observed when using python
- Why it matters: Upgrade or migration may change expected behavior: v0.71.0
- Evidence: failure_mode_cluster:github_release | fmev_8c04dff267efacde979bed34b0d877cd | https://github.com/charmbracelet/crush/releases/tag/v0.71.0 | v0.71.0
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 7: 失败模式：configuration: v0.74.0

- Trigger: Developers should check this configuration risk before relying on the project: v0.74.0
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: v0.74.0. Context: Observed when using windows
- Why it matters: Upgrade or migration may change expected behavior: v0.74.0
- Evidence: failure_mode_cluster:github_release | fmev_a06bc501b775f717bcff8195feac4cd4 | https://github.com/charmbracelet/crush/releases/tag/v0.74.0 | v0.74.0
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 8: 来源证据：Custom provider models are invisible in the TUI

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

### Constraint 9: 来源证据：Disabled models still appear in the TUI model picker

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

### Constraint 10: 来源证据：rate limited api requests (429) are not retried

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