# 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`
- **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`
- **Bash**（source_file）：package tools ⋮---- import "bytes" "cmp" "context" "embed" "fmt" "html/template" "path/filepath" "runtime" "strings" "time" "charm.land/fantasy" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/fsext" "github.com/charmbracelet/crush/internal/permission" "github.com/charmbracelet/crush/internal/shell" ⋮---- "bytes" "cmp" "context" "embed" "fmt" "html/template" "path/filepath" "runtime" "strings" "time" ⋮---- "charm.land/fantasy" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/fsext" "github.com/charmbracelet/crush/internal/permission" "github.com/charmbracelet/crush/internal/shell" ⋮---- type BashParams struct… 证据：`internal/agent/tools/bash.go`
- **Crush Logs**（source_file）：package tools ⋮---- import "context" "embed" "encoding/json" "fmt" "html/template" "io" "os" "path/filepath" "sort" "strconv" "strings" "time" "charm.land/fantasy" ⋮---- "context" "embed" "encoding/json" "fmt" "html/template" "io" "os" "path/filepath" "sort" "strconv" "strings" "time" ⋮---- "charm.land/fantasy" ⋮---- const CrushLogsToolName = "crush logs" ⋮---- //go:embed crush logs.md.tpl var crushLogsDescriptionTmpl byte ⋮---- var crushLogsDescriptionTpl = template.Must template.New "crushLogsDescription" . ⋮---- type crushLogsDescriptionData struct { DefaultLines int MaxLines int } ⋮---- func crushLogsDescription string ⋮---- const maxLogLineSize = 1024 1024 ⋮---- const defaultLogLines =… 证据：`internal/agent/tools/crush_logs.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`
- **Edit**（source_file）：package tools ⋮---- import "context" "embed" "fmt" "log/slog" "os" "path/filepath" "strings" "time" "charm.land/fantasy" "github.com/charmbracelet/crush/internal/diff" "github.com/charmbracelet/crush/internal/filepathext" "github.com/charmbracelet/crush/internal/filetracker" "github.com/charmbracelet/crush/internal/fsext" "github.com/charmbracelet/crush/internal/history" "github.com/charmbracelet/crush/internal/lsp" "github.com/charmbracelet/crush/internal/permission" ⋮---- "context" "embed" "fmt" "log/slog" "os" "path/filepath" "strings" "time" ⋮---- "charm.land/fantasy" "github.com/charmbracelet/crush/internal/diff" "github.com/charmbracelet/crush/internal/filepathext" "github.com/charmbr… 证据：`internal/agent/tools/edit.go`
- **Fetch**（source_file）：package tools ⋮---- import "context" "embed" "fmt" "html/template" "io" "net/http" "strings" "time" "unicode/utf8" "charm.land/fantasy" md "github.com/JohannesKaufmann/html-to-markdown" "github.com/PuerkitoBio/goquery" "github.com/charmbracelet/crush/internal/permission" ⋮---- "context" "embed" "fmt" "html/template" "io" "net/http" "strings" "time" "unicode/utf8" ⋮---- "charm.land/fantasy" md "github.com/JohannesKaufmann/html-to-markdown" "github.com/PuerkitoBio/goquery" "github.com/charmbracelet/crush/internal/permission" ⋮---- const FetchToolName = "fetch" MaxFetchSize = 100 1024 ⋮---- //go:embed fetch.md.tpl var fetchDescriptionTmpl byte ⋮---- var fetchDescriptionTpl = template.Must temp… 证据：`internal/agent/tools/fetch.go`
- **Glob**（source_file）：package tools ⋮---- import "bytes" "cmp" "context" "embed" "fmt" "html/template" "log/slog" "os/exec" "path/filepath" "sort" "strings" "charm.land/fantasy" "github.com/charmbracelet/crush/internal/filepathext" "github.com/charmbracelet/crush/internal/fsext" ⋮---- "bytes" "cmp" "context" "embed" "fmt" "html/template" "log/slog" "os/exec" "path/filepath" "sort" "strings" ⋮---- "charm.land/fantasy" "github.com/charmbracelet/crush/internal/filepathext" "github.com/charmbracelet/crush/internal/fsext" ⋮---- const GlobToolName = "glob" ⋮---- //go:embed glob.md.tpl var globDescriptionTmpl byte ⋮---- var globDescriptionTpl = template.Must template.New "globDescription" . ⋮---- type globDescriptionDa… 证据：`internal/agent/tools/glob.go`
- **Grep**（source_file）：package tools ⋮---- import "bufio" "bytes" "cmp" "context" "embed" "encoding/json" "fmt" "html/template" "io" "net/http" "os" "os/exec" "path/filepath" "regexp" "sort" "strings" "time" "charm.land/fantasy" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/fsext" ⋮---- "bufio" "bytes" "cmp" "context" "embed" "encoding/json" "fmt" "html/template" "io" "net/http" "os" "os/exec" "path/filepath" "regexp" "sort" "strings" "time" ⋮---- "charm.land/fantasy" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/fsext" ⋮---- type r… 证据：`internal/agent/tools/grep.go`
- **Mcp Tools**（source_file）：package tools ⋮---- import "context" "fmt" "slices" "charm.land/fantasy" "github.com/charmbracelet/crush/internal/agent/tools/mcp" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/permission" ⋮---- "context" "fmt" "slices" ⋮---- "charm.land/fantasy" "github.com/charmbracelet/crush/internal/agent/tools/mcp" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/permission" ⋮---- var whitelistDockerTools = string{ "mcp docker mcp-find", "mcp docker mcp-add", "mcp docker mcp-remove", "mcp docker mcp-config-set", "mcp docker code-mode", } ⋮---- func GetMCPTools permissions permission.Service, cfg config.ConfigStore, wd… 证据：`internal/agent/tools/mcp-tools.go`
- **Tools**（source_file）：package mcp ⋮---- import "context" "encoding/base64" "encoding/json" "fmt" "iter" "log/slog" "slices" "strings" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/csync" "github.com/modelcontextprotocol/go-sdk/mcp" ⋮---- "context" "encoding/base64" "encoding/json" "fmt" "iter" "log/slog" "slices" "strings" ⋮---- "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/csync" "github.com/modelcontextprotocol/go-sdk/mcp" ⋮---- type ToolResult struct { Type string Content string Data byte MediaType string } ⋮---- var allTools = csync.NewMap string, Tool ⋮---- func Tools iter.Seq2 string, Tool ⋮---- func RunTool ctx context… 证据：`internal/agent/tools/mcp/tools.go`
- **Multiedit**（source_file）：package tools ⋮---- import "context" "embed" "fmt" "log/slog" "os" "path/filepath" "strings" "time" "charm.land/fantasy" "github.com/charmbracelet/crush/internal/diff" "github.com/charmbracelet/crush/internal/filepathext" "github.com/charmbracelet/crush/internal/filetracker" "github.com/charmbracelet/crush/internal/fsext" "github.com/charmbracelet/crush/internal/history" "github.com/charmbracelet/crush/internal/lsp" "github.com/charmbracelet/crush/internal/permission" ⋮---- "context" "embed" "fmt" "log/slog" "os" "path/filepath" "strings" "time" ⋮---- "charm.land/fantasy" "github.com/charmbracelet/crush/internal/diff" "github.com/charmbracelet/crush/internal/filepathext" "github.com/charmbr… 证据：`internal/agent/tools/multiedit.go`
- **Tools**（source_file）：package tools ⋮---- import "bytes" "context" "html/template" "os/exec" "testing" "charm.land/fantasy" ⋮---- "bytes" "context" "html/template" "os/exec" "testing" ⋮---- "charm.land/fantasy" ⋮---- sessionIDContextKey string messageIDContextKey string supportsImagesKey string modelNameKey string ⋮---- const SessionIDContextKey sessionIDContextKey = "session id" MessageIDContextKey messageIDContextKey = "message id" SupportsImagesContextKey supportsImagesKey = "supports images" ModelNameContextKey modelNameKey = "model name" ⋮---- func getContextValue T any ctx context.Context, key any, defaultValue T T ⋮---- func GetSessionFromContext ctx context.Context string ⋮---- // GetMessageFromContext r… 证据：`internal/agent/tools/tools.go`
- **View**（source_file）：package tools ⋮---- import "bufio" "context" "embed" "errors" "fmt" "html/template" "io" "io/fs" "net/http" "os" "path/filepath" "strings" "time" "unicode/utf8" "charm.land/fantasy" "github.com/charmbracelet/crush/internal/filepathext" "github.com/charmbracelet/crush/internal/filetracker" "github.com/charmbracelet/crush/internal/lsp" "github.com/charmbracelet/crush/internal/permission" "github.com/charmbracelet/crush/internal/skills" ⋮---- "bufio" "context" "embed" "errors" "fmt" "html/template" "io" "io/fs" "net/http" "os" "path/filepath" "strings" "time" "unicode/utf8" ⋮---- "charm.land/fantasy" "github.com/charmbracelet/crush/internal/filepathext" "github.com/charmbracelet/crush/internal… 证据：`internal/agent/tools/view.go`
- **Web Fetch**（source_file）：package tools ⋮---- import "context" "embed" "fmt" "html/template" "net/http" "os" "strings" "time" "charm.land/fantasy" ⋮---- "context" "embed" "fmt" "html/template" "net/http" "os" "strings" "time" ⋮---- "charm.land/fantasy" ⋮---- //go:embed web fetch.md.tpl var webFetchDescriptionTmpl byte ⋮---- var webFetchDescriptionTpl = template.Must template.New "webFetchDescription" . ⋮---- func NewWebFetchTool workingDir string, client http.Client fantasy.AgentTool ⋮---- var result strings.Builder 证据：`internal/agent/tools/web_fetch.go`
- **Write**（source_file）：package tools ⋮---- import "context" "embed" "fmt" "log/slog" "os" "path/filepath" "strings" "time" "charm.land/fantasy" "github.com/charmbracelet/crush/internal/diff" "github.com/charmbracelet/crush/internal/filepathext" "github.com/charmbracelet/crush/internal/filetracker" "github.com/charmbracelet/crush/internal/fsext" "github.com/charmbracelet/crush/internal/history" "github.com/charmbracelet/crush/internal/lsp" "github.com/charmbracelet/crush/internal/permission" ⋮---- "context" "embed" "fmt" "log/slog" "os" "path/filepath" "strings" "time" ⋮---- "charm.land/fantasy" "github.com/charmbracelet/crush/internal/diff" "github.com/charmbracelet/crush/internal/filepathext" "github.com/charmbr… 证据：`internal/agent/tools/write.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`
- **Provider Test**（source_file）：package app ⋮---- import "testing" "charm.land/catwalk/pkg/catwalk" "github.com/charmbracelet/crush/internal/config" "github.com/stretchr/testify/require" ⋮---- "testing" ⋮---- "charm.land/catwalk/pkg/catwalk" "github.com/charmbracelet/crush/internal/config" "github.com/stretchr/testify/require" ⋮---- func TestParseModelStr t testing.T ⋮---- func setupMockProviders map string config.ProviderConfig ⋮---- func setupMockProvidersWithSlashes map string config.ProviderConfig ⋮---- func TestFindModels t testing.T ⋮---- // Validate the matches. 证据：`internal/app/provider_test.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`
- **Permission**（source_file）：package backend ⋮---- import "github.com/charmbracelet/crush/internal/permission" "github.com/charmbracelet/crush/internal/proto" ⋮---- "github.com/charmbracelet/crush/internal/permission" "github.com/charmbracelet/crush/internal/proto" ⋮---- func b Backend GrantPermission workspaceID string, req proto.PermissionGrant bool, error ⋮---- func b Backend SetPermissionsSkip workspaceID string, skip bool error ⋮---- func b Backend GetPermissionsSkip workspaceID string bool, error 证据：`internal/backend/permission.go`
- **Session**（source_file）：package backend ⋮---- import "context" "github.com/charmbracelet/crush/internal/message" "github.com/charmbracelet/crush/internal/proto" "github.com/charmbracelet/crush/internal/session" ⋮---- "context" ⋮---- "github.com/charmbracelet/crush/internal/message" "github.com/charmbracelet/crush/internal/proto" "github.com/charmbracelet/crush/internal/session" ⋮---- func b Backend CreateSession ctx context.Context, workspaceID, title string session.Session, error ⋮---- func b Backend GetSession ctx context.Context, workspaceID, sessionID string session.Session, error ⋮---- func b Backend ListSessions ctx context.Context, workspaceID string session.Session, error ⋮---- func b Backend GetAgentSessi… 证据：`internal/backend/session.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`
- **Logs**（source_file）：package cmd ⋮---- import "context" "encoding/json" "fmt" "io" "os" "path/filepath" "slices" "time" "charm.land/log/v2" "github.com/charmbracelet/colorprofile" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/x/term" "github.com/nxadm/tail" "github.com/spf13/cobra" ⋮---- "context" "encoding/json" "fmt" "io" "os" "path/filepath" "slices" "time" ⋮---- "charm.land/log/v2" "github.com/charmbracelet/colorprofile" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/x/term" "github.com/nxadm/tail" "github.com/spf13/cobra" ⋮---- const defaultTailLines = 1000 ⋮---- var logsCmd = &cobra.Command{ Use: "logs", Short: "View crush logs", Long: View the logs… 证据：`internal/cmd/logs.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`
- **Session**（source_file）：package cmd ⋮---- import "context" "encoding/json" "errors" "fmt" "io" "os" "os/exec" "runtime" "sort" "strings" "syscall" "time" "charm.land/lipgloss/v2" "github.com/charmbracelet/colorprofile" "github.com/charmbracelet/crush/internal/agent/tools" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/db" "github.com/charmbracelet/crush/internal/event" "github.com/charmbracelet/crush/internal/message" "github.com/charmbracelet/crush/internal/session" "github.com/charmbracelet/crush/internal/ui/chat" "github.com/charmbracelet/crush/internal/ui/styles" "github.com/charmbracelet/x/ansi" "github.com/charmbracelet/x/exp/charmtone" "github.com/charmbracelet/x/t… 证据：`internal/cmd/session.go`
- **Commands**（source_file）：package commands ⋮---- import "context" "io/fs" "os" "path/filepath" "regexp" "strings" "time" "github.com/charmbracelet/crush/internal/agent/tools/mcp" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/home" "github.com/charmbracelet/crush/internal/skills" ⋮---- "context" "io/fs" "os" "path/filepath" "regexp" "strings" "time" ⋮---- "github.com/charmbracelet/crush/internal/agent/tools/mcp" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/home" "github.com/charmbracelet/crush/internal/skills" ⋮---- var namedArgPattern = regexp.MustCompile \$ A-Z A-Z0-9 ⋮---- const userCommandPrefix = "user:" projectCommandPrefix… 证据：`internal/commands/commands.go`
- **Atomicwrite**（source_file）：package config ⋮---- import "os" "path/filepath" ⋮---- "os" "path/filepath" ⋮---- func atomicWriteFile path string, data byte, perm os.FileMode error 证据：`internal/config/atomicwrite.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`
- **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`
- **Provider Test**（source_file）：package config ⋮---- import "encoding/json" "os" "path/filepath" "sync" "testing" "charm.land/catwalk/pkg/catwalk" "github.com/stretchr/testify/require" ⋮---- "encoding/json" "os" "path/filepath" "sync" "testing" ⋮---- "charm.land/catwalk/pkg/catwalk" "github.com/stretchr/testify/require" ⋮---- func resetProviderState ⋮---- func TestProviders Integration AutoUpdateDisabled t testing.T ⋮---- func TestProviders Integration WithMockClients t testing.T ⋮---- func TestProviders Integration WithCachedData t testing.T ⋮---- func TestProviders Integration CatwalkFailsHyperSucceeds t testing.T ⋮---- func TestProviders Integration BothFail t testing.T ⋮---- func TestCache StoreAndGet t testing.T ⋮---… 证据：`internal/config/provider_test.go`
- **Connect**（source_file）：package db ⋮---- import "context" "database/sql" "embed" "fmt" "log/slog" "os" "path/filepath" "sync" "testing" "github.com/pressly/goose/v3" ⋮---- "context" "database/sql" "embed" "fmt" "log/slog" "os" "path/filepath" "sync" "testing" ⋮---- "github.com/pressly/goose/v3" ⋮---- var pragmas = map string string{ "foreign keys": "ON", "journal mode": "WAL", "page size": "4096", "temp store": "MEMORY", "cache size": "-8000", "synchronous": "NORMAL", "secure delete": "ON", "busy timeout": "30000", } gooseInitOnce sync.Once gooseInitErr error ⋮---- //go:embed migrations 证据：`internal/db/connect.go`
- **Db**（source_file）：package db ⋮---- import "context" "database/sql" "fmt" ⋮---- "context" "database/sql" "fmt" ⋮---- type DBTX interface { ExecContext context.Context, string, ...any sql.Result, error PrepareContext context.Context, string sql.Stmt, error QueryContext context.Context, string, ...any sql.Rows, error QueryRowContext context.Context, string, ...any sql.Row } ⋮---- func New db DBTX Queries ⋮---- func Prepare ctx context.Context, db DBTX Queries, error ⋮---- var err error ⋮---- func q Queries Close error ⋮---- func q Queries exec ctx context.Context, stmt sql.Stmt, query string, args ...interface ⋮---- func q Queries query ctx context.Context, stmt sql.Stmt, query string, args ...interface ⋮---- f… 证据：`internal/db/db.go`
- **All**（source_file）：package event ⋮---- import "time" ⋮---- "time" ⋮---- var appStartTime time.Time ⋮---- func AppInitialized ⋮---- func AppExited ⋮---- func SessionCreated ⋮---- func SessionDeleted ⋮---- func SessionSwitched ⋮---- func FilePickerOpened ⋮---- func PromptSent props ...any ⋮---- func PromptResponded props ...any ⋮---- func TokensUsed props ...any ⋮---- func StatsViewed ⋮---- func SessionListed json bool ⋮---- func SessionShown json bool ⋮---- func SessionLastShown json bool ⋮---- func SessionDeletedCommand json bool ⋮---- func SessionRenamed json bool 证据：`internal/event/all.go`
- **Log**（source_file）：package log ⋮---- import "fmt" "io" "log/slog" "os" "runtime/debug" "sync" "sync/atomic" "time" "github.com/charmbracelet/crush/internal/event" "github.com/charmbracelet/x/term" "gopkg.in/natefinch/lumberjack.v2" ⋮---- "fmt" "io" "log/slog" "os" "runtime/debug" "sync" "sync/atomic" "time" ⋮---- "github.com/charmbracelet/crush/internal/event" "github.com/charmbracelet/x/term" "gopkg.in/natefinch/lumberjack.v2" ⋮---- var initOnce sync.Once initialized atomic.Bool ⋮---- func Setup logFile string, debug bool, ws ...io.Writer ⋮---- var handlers slog.Handler ⋮---- func Initialized bool ⋮---- func RecoverPanic name string, cleanup func 证据：`internal/log/log.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`
- **Edit**（source_file）：package util ⋮---- import "bytes" "fmt" "os" "sort" "strings" powernap "github.com/charmbracelet/x/powernap/pkg/lsp" "github.com/charmbracelet/x/powernap/pkg/lsp/protocol" ⋮---- "bytes" "fmt" "os" "sort" "strings" ⋮---- powernap "github.com/charmbracelet/x/powernap/pkg/lsp" "github.com/charmbracelet/x/powernap/pkg/lsp/protocol" ⋮---- func applyTextEdits uri protocol.DocumentURI, edits protocol.TextEdit, encoding powernap.OffsetEncoding error ⋮---- var lineEnding string ⋮---- var newContent strings.Builder ⋮---- func applyTextEdit lines string, edit protocol.TextEdit, encoding powernap.OffsetEncoding string, error ⋮---- var startChar, endChar int ⋮---- // Split new text into lines, being car… 证据：`internal/lsp/util/edit.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`
- **Device**（source_file）：package hyper ⋮---- import "bytes" "context" "encoding/json" "errors" "fmt" "io" "net/http" "os" "strings" "time" "github.com/charmbracelet/crush/internal/agent/hyper" "github.com/charmbracelet/crush/internal/event" "github.com/charmbracelet/crush/internal/oauth" ⋮---- "bytes" "context" "encoding/json" "errors" "fmt" "io" "net/http" "os" "strings" "time" ⋮---- "github.com/charmbracelet/crush/internal/agent/hyper" "github.com/charmbracelet/crush/internal/event" "github.com/charmbracelet/crush/internal/oauth" ⋮---- type DeviceAuthResponse struct { DeviceCode string json:"device code" UserCode string json:"user code" VerificationURL string json:"verification url" ExpiresIn int json:"expires in… 证据：`internal/oauth/hyper/device.go`
- **Permission**（source_file）：package permission ⋮---- import "context" "os" "path/filepath" "slices" "sync" "sync/atomic" "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/pubsub" "github.com/google/uuid" ⋮---- "context" "os" "path/filepath" "slices" "sync" "sync/atomic" ⋮---- "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/pubsub" "github.com/google/uuid" ⋮---- type hookApprovalKey struct{} ⋮---- func WithHookApproval ctx context.Context, toolCallID string context.Context ⋮---- func hookApproved ctx context.Context, toolCallID string bool ⋮---- type CreatePermissionRequest struct { SessionID string json:"session id" ToolCallID string json:… 证据：`internal/permission/permission.go`
- **Permission**（source_file）：package proto ⋮---- import "encoding/json" ⋮---- "encoding/json" ⋮---- type CreatePermissionRequest struct { SessionID string json:"session id" ToolCallID string json:"tool call id" ToolName string json:"tool name" Description string json:"description" Action string json:"action" Params any json:"params" Path string json:"path" } ⋮---- type PermissionNotification struct { ToolCallID string json:"tool call id" Granted bool json:"granted" Denied bool json:"denied" } ⋮---- type PermissionRequest struct { ID string json:"id" SessionID string json:"session id" ToolCallID string json:"tool call id" ToolName string json:"tool name" Description string json:"description" Action string json:"action"… 证据：`internal/proto/permission.go`
- 其余 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。

- **Getting Started with Crush**：importance `high`
  - source_paths: README.md, internal/cmd/root.go, crush.json, go.mod
- **Project Structure**：importance `medium`
  - source_paths: internal/agent/agent.go, internal/app/app.go, internal/backend/backend.go, internal/db/db.go, main.go
- **Configuration Guide**：importance `high`
  - source_paths: internal/config/config.go, internal/config/load.go, internal/lsp/manager.go, internal/hooks/hooks.go, internal/permission/permission.go
- **LLM Provider Setup**：importance `high`
  - source_paths: internal/config/provider.go, internal/config/catwalk.go, internal/cmd/update_providers.go, internal/oauth/copilot/oauth.go, internal/oauth/hyper/device.go
- **Built-in Tools**：importance `high`
  - source_paths: internal/agent/tools/tools.go, internal/agent/tools/bash.go, internal/agent/tools/read.go, internal/agent/tools/write.go, internal/agent/tools/edit.go
- **Permission System**：importance `high`
  - source_paths: internal/permission/permission.go, internal/backend/permission.go, internal/agent/tools/safe.go, internal/proto/permission.go
- **MCP Integration**：importance `high`
  - source_paths: internal/agent/tools/mcp/init.go, internal/agent/tools/mcp/tools.go, internal/agent/tools/mcp/resources.go, internal/config/docker_mcp.go, internal/agent/tools/mcp-tools.go
- **Skills System**：importance `medium`
  - source_paths: internal/skills/manager.go, internal/skills/catalog.go, internal/skills/skills.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: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。
