# cowagent - Doramagic AI Context Pack

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

## 充分原则

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

## 给宿主 AI 的使用方式

你正在读取 Doramagic 为 cowagent 编译的 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 文档。 证据：`skills/image-generation/SKILL.md`, `skills/knowledge-wiki/SKILL.md`, `skills/skill-creator/SKILL.md` Claim：`clm_0004` supported 0.86

## 它能做什么

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

## 怎么开始

- `curl -O https://cdn.link-ai.tech/code/cow/docker-compose.yml` 证据：`README.md` Claim：`clm_0005` 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 或项目证据支撑，但仍不等于真实安装效果。 证据：`skills/image-generation/SKILL.md`, `skills/knowledge-wiki/SKILL.md`, `skills/skill-creator/SKILL.md` Claim：`clm_0004` supported 0.86
- **能力存在：AI Skill / Agent 指令资产库**（supported）：可以相信项目包含这类能力线索；是否适合你的具体任务仍要试用或安装后验证。 证据：`skills/image-generation/SKILL.md`, `skills/knowledge-wiki/SKILL.md`, `skills/skill-creator/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）：Prompt Preview 只能展示引导方式，不能证明真实项目中的结果质量。
- **宿主 AI 版本兼容性不能在安装前相信。**（unverified）：Claude、Cursor、Codex、Gemini 等宿主加载规则和版本差异必须在真实环境验证。
- **不会污染现有宿主 AI 行为，不能直接相信。**（inferred）：Skill、plugin、AGENTS/CLAUDE/GEMINI 指令可能改变宿主 AI 的默认行为。 证据：`skills/image-generation/SKILL.md`, `skills/knowledge-wiki/SKILL.md`, `skills/skill-creator/SKILL.md`
- **可安全回滚不能默认相信。**（unverified）：除非项目明确提供卸载和恢复说明，否则必须先在隔离环境验证。
- **真实安装后是否与用户当前宿主 AI 版本兼容？**（unverified）：兼容性只能通过实际宿主环境验证。
- **项目输出质量是否满足用户具体任务？**（unverified）：安装前预览只能展示流程和边界，不能替代真实评测。
- **安装命令是否需要网络、权限或全局写入？**（unverified）：这影响企业环境和个人环境的安装风险。 证据：`README.md`

### 继续会触碰什么

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

### 最小安全下一步

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

### 退出方式

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

## 哪些只能预览

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

## 哪些必须安装后验证

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

## 边界与风险判断卡

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

## 开工前工作上下文

### 加载顺序

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

### 任务路由

- **AI Skill / Agent 指令资产库**：先基于 role_skill_index / evidence_index 帮用户挑选可用角色、Skill 或工作流。 边界：可做安装前 Prompt 体验。 证据：`skills/image-generation/SKILL.md`, `skills/knowledge-wiki/SKILL.md`, `skills/skill-creator/SKILL.md` Claim：`clm_0001` supported 0.86
- **命令行启动或安装流程**：先说明这是安装后验证能力，再给出安装前检查清单。 边界：必须真实安装或运行后验证。 证据：`README.md` Claim：`clm_0002` supported 0.86

### 上下文规模

- 文件总数：617
- 重要文件覆盖：40/617
- 证据索引条目：72
- 角色 / Skill 条目：3

### 证据不足时的处理

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

## Prompt Recipes

### 适配判断

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

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

### 安装前体验

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

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

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

## 角色 / Skill 索引

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

- **image-generation**（skill）：Generate or edit images from text prompts. Use when the user asks to create, draw, design, or edit an image, illustration, photo, icon, poster, or any visual content. 激活提示：当用户任务与“image-generation”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`skills/image-generation/SKILL.md`
- **knowledge-wiki**（skill）：Manage the personal knowledge wiki. Use when the user shares articles, documents, or asks to organize knowledge; when a conversation produces insights worth preserving as structured knowledge; or when the user asks about the knowledge base. 激活提示：当用户任务与“knowledge-wiki”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`skills/knowledge-wiki/SKILL.md`
- **skill-creator**（skill）：Create, install, or update skills in the workspace. Use when 1 installing a skill from a URL or remote source, 2 creating a new skill from scratch, 3 updating or restructuring existing skills. Always use this skill for any skill installation or creation task. 激活提示：当用户任务与“skill-creator”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`skills/skill-creator/SKILL.md`

## 证据索引

- 共索引 72 条证据。

- **Documentation**（documentation）：This directory contains the Mintlify documentation site for the project. 证据：`docs/README.md`
- **🌟 主な機能**（documentation）：CowAgent は、自律的にタスクを計画し、コンピュータや外部リソースを操作し、Skill を作成・実行し、パーソナルナレッジベースと長期記憶を構築し、自己進化によってユーザーとともに成長するオープンソースのスーパー AI アシスタントです。エンドツーエンドの Agent Harness のリファレンス実装の一つでもあります。 证据：`docs/ja/README.md`
- **🌟 核心能力**（documentation）：CowAgent 是一个开源的超级 AI 助理，能够主动思考和规划任务、操作计算机和外部资源、创造和执行 Skills、构建知识库与长期记忆、通过自主进化与你一同成长，是 Agent Harness 工程的最佳实践之一。 证据：`docs/zh/README.md`
- **🌟 Highlights**（documentation）：CowAgent is an open-source super AI assistant that proactively plans tasks, controls your computer and external services, creates and runs Skills, builds a personal knowledge base and long-term memory, and grows alongside you through self-evolution — a reference implementation of Agent Harness engineering. 证据：`README.md`
- **CowAgent Desktop**（documentation）：Cross-platform desktop client for CowAgent, built with Electron + React + TypeScript. 证据：`desktop/README.md`
- **Skills**（documentation）：Skills are reusable instruction sets that extend the agent's capabilities. Each skill is a SKILL.md file in its own directory, providing specialized knowledge, workflows, and tool integrations for specific tasks. 证据：`skills/README.md`
- **定时任务工具 Scheduler Tool**（documentation）：- ⏰ 定时提醒 : 在指定时间发送消息 - 🔄 周期性任务 : 按固定间隔或 cron 表达式重复执行 - 🔧 动态工具调用 : 定时执行其他工具并发送结果（如搜索新闻、查询天气等） - 📋 任务管理 : 查询、启用、禁用、删除任务 证据：`agent/tools/scheduler/README.md`
- **飞书Channel使用说明**（documentation）：模式 适用场景 优点 缺点 ------ --------- ------ ------ webhook 生产环境 稳定可靠，官方推荐 需要公网IP或域名 websocket 本地开发 无需公网IP，开发便捷 需要额外依赖 证据：`channel/feishu/README.md`
- **Web Channel**（documentation）：提供了一个默认的AI对话页面，可展示文本、图片等消息交互，支持markdown语法渲染，兼容插件执行。 证据：`channel/web/README.md`
- **Vendor assets**（documentation）：Third-party frontend assets bundled locally so the Web Console can run in fully offline / air-gapped environments no requests to cloudflare, jsdelivr, googleapis, gstatic, etc. . 证据：`channel/web/static/vendor/README.md`
- **微信客服（WeChat Customer Service）通道**（documentation）：与 channel/wechatcom/ （企微自建应用）是两个 独立的 CoW 通道 ： - 自建应用： 面向企业内部成员 （员工通过企业微信 App 与机器人对话）。 - 微信客服： 面向外部微信用户 （普通微信用户通过链接/二维码进入对话）。 但底层都基于"企微自建应用"——本通道是 通过把一个企微自建应用绑定到微信客服账号 来实现 AI 接管对外咨询，详见 LinkAI 微信客服接入文档 https://docs.link-ai.tech/platform/link-app/wechat-customer-service 。 证据：`channel/wechat_kf/README.md`
- **企业微信应用号channel**（documentation）：企业微信官方提供了客服、应用等API，本channel使用的是企业微信的自建应用API的能力。 证据：`channel/wechatcom/README.md`
- **微信公众号channel**（documentation）：微信公众号channel，提供稳定的服务。 目前支持订阅号和服务号两种类型的公众号，它们都支持文本交互，语音和图片输入。其中个人主体的微信订阅号由于无法通过微信认证，存在回复时间限制，每天的图片和声音回复次数也有限制。 证据：`channel/wechatmp/README.md`
- **说明**（documentation）：说明 百度语音识别与合成参数说明 百度语音依赖，经常会出现问题，可能就是缺少依赖： pip install baidu-aip pip install pydub pip install pysilk 还有ffmpeg，不同系统安装方式不同 证据：`voice/baidu/README.md`
- **Package**（package_manifest）：{ "name": "cowagent-desktop", "version": "2.1.3", "description": "CowAgent Desktop Client - AI Agent on your desktop", "main": "dist/main/index.js", "author": "CowAgent", "license": "MIT", "scripts": { "dev": "npm run build && electron .", "dev:hot": "concurrently \"npm run dev:renderer\" \"sleep 2 && npm run dev:main\"", "dev:main": "tsc -p tsconfig.main.json && electron .", "dev:renderer": "vite", "build": "npm run build:renderer && npm run build:main", "build:main": "tsc -p tsconfig.main.json", "build:renderer": "vite build", "dist": "npm run build && electron-builder", "dist:mac": "npm run build && electron-builder --mac", "dist:win": "npm run build && electron-builder --win" }, "depend… 证据：`desktop/package.json`
- **Contributing to CowAgent**（documentation）：Thanks for taking the time to contribute! 🎉 CowAgent is built by a global community, and contributions of all sizes are welcome — from typo fixes to new features. 证据：`CONTRIBUTING.md`
- **Image Generation**（skill_instruction）：Generate and edit images using AI models. The script automatically picks a backend based on which API keys are configured — you don't need to specify a model unless the user explicitly names one . 证据：`skills/image-generation/SKILL.md`
- **Knowledge Wiki**（skill_instruction）：Maintain a persistent, structured knowledge base in the knowledge/ directory. 证据：`skills/knowledge-wiki/SKILL.md`
- **Skill Creator**（skill_instruction）：This skill provides guidance for creating effective skills using the existing tool system. 证据：`skills/skill-creator/SKILL.md`
- **License**（source_file）：Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files the "Software" , to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 证据：`LICENSE`
- **Pop under lock, then stop outside lock to avoid deadlock**（source_file）：channel mgr = None ⋮---- DESKTOP MODE = os.environ.get "COW DESKTOP" == "1" ⋮---- def get channel manager ⋮---- def parse channel type raw - list ⋮---- class ChannelManager ⋮---- def init self ⋮---- @property def channel self ⋮---- def get channel self, channel name: str ⋮---- def start self, channel names: list, first start: bool = False ⋮---- channels = ⋮---- ch = channel factory.create channel name ⋮---- web entry = None other entries = ⋮---- web entry = entry ⋮---- ordered = web entry if web entry else + other entries ⋮---- t = threading.Thread target=self. run channel, args= name, ch , daemon=True ⋮---- def run channel self, name: str, channel ⋮---- def stop self, channel name: str = N… 证据：`app.py`
- **Use tool-enabled streaming call if available**（source_file）：def add openai compatible support bot instance ⋮---- class EnhancedBot bot instance. class , OpenAICompatibleBot ⋮---- def get api config self ⋮---- class AgentLLMModel LLMModel ⋮---- MODEL BOT TYPE MAP = { MODEL PREFIX MAP = ⋮---- def init self, bridge: Bridge, bot type: str = "chat" ⋮---- @property def model self ⋮---- @model.setter def model self, value ⋮---- def resolve bot type self, model name: str - str ⋮---- configured bot type = conf .get "bot type" ⋮---- lowered model = model name.lower ⋮---- @property def bot self ⋮---- cur model = self.model cur bot type = self. resolve bot type cur model ⋮---- def call self, request: LLMRequest ⋮---- kwargs = { ⋮---- system prompt = getattr req… 证据：`bridge/agent_bridge.py`
- **Bridge**（source_file）：@singleton class Bridge object ⋮---- def init self ⋮---- bot type = conf .get "bot type" ⋮---- model type = conf .get "model" or const.GPT 41 MINI ⋮---- model type = str model type ⋮---- lowered model type = model type.lower ⋮---- def refresh voice self ⋮---- new v2t = conf .get "voice to text" or self. auto pick voice to text new t2v = conf .get "text to voice", "google" ⋮---- new v2t = const.LINKAI ⋮---- new t2v = const.LINKAI ⋮---- @staticmethod def auto pick voice to text - str ⋮---- query: User query context: Context object on event: Event callback for streaming clear history: Whether to clear conversation history ⋮---- Returns: 证据：`bridge/bridge.py`
- **Channel Factory**（source_file）：def create channel channel type - Channel ⋮---- ch = Channel ⋮---- ch = TerminalChannel ⋮---- ch = WebChannel ⋮---- ch = WechatMPChannel passive reply=True ⋮---- ch = WechatMPChannel passive reply=False ⋮---- ch = WechatComAppChannel ⋮---- ch = WechatKfChannel ⋮---- ch = FeiShuChanel ⋮---- ch = DingTalkChanel ⋮---- ch = WecomBotChannel ⋮---- ch = QQChannel ⋮---- ch = TelegramChannel ⋮---- ch = SlackChannel ⋮---- ch = DiscordChannel ⋮---- ch = WeixinChannel channel type = const.WEIXIN 证据：`channel/channel_factory.py`
- **Init**（source_file）：def read version ⋮---- version file = os.path.join os.path.dirname os.path.abspath file , "VERSION" ⋮---- version = read version 证据：`cli/__init__.py`
- **openai api base; when use azure chatgpt is true, set the matching api base**（source_file）：available setting = { ⋮---- "open ai api key": "", openai api key openai api base; when use azure chatgpt is true, set the matching api base ⋮---- "custom api key": "", custom OpenAI-compatible provider api key used when bot type is "custom" ; legacy single-provider field "custom api base": "", custom OpenAI-compatible provider api base used when bot type is "custom" ; legacy single-provider field ⋮---- "proxy": "", proxy used by openai chatgpt model; when use azure chatgpt is true, this is the Azure model deployment name ⋮---- "bot type": "", optional; for OpenAI-compatible third-party services set "openai" or "custom" in custom mode switching model won't auto-switch bot type . See common/… 证据：`config.py`
- **Pyproject**（source_file）：build-system requires = "setuptools =45.0" build-backend = "setuptools.build meta" 证据：`pyproject.toml`
- **wechatcom & wechatmp**（source_file）：numpy =1.21 aiohttp =3.8.6, =2.28.2 chardet =5.1.0 Pillow python-dotenv =1.0.0 PyYAML =6.0 croniter =2.0.0 click =8.0 qrcode json-repair 证据：`requirements.txt`
- **A terminal we can read from. When the script runs via curl bash , stdin is**（source_file）：set -e RED='\033 0;31m' GREEN='\033 0;32m' YELLOW='\033 0;33m' CYAN='\033 0;36m' BOLD='\033 1m' NC='\033 0m' EMOJI ROCKET="🚀" EMOJI COW="🐄" EMOJI CHECK="✅" EMOJI CROSS="❌" EMOJI WARN="⚠️" EMOJI STOP="🛑" EMOJI WRENCH="🔧" if -z "$BASH VERSION" ; then echo -e "${RED}❌ Please run this script with Bash.${NC}" exit 1 fi UI LANG="" A terminal we can read from. When the script runs via curl bash , stdin is the script pipe EOF on read , so interactive prompts must read from the tty. TTY DEV="/dev/tty" HAS TTY=false if -r /dev/tty && -w /dev/tty ; then HAS TTY=true fi detect ui lang { local loc="" macOS: prefer AppleLocale, which reflects the real UI language if "$ uname " = "Darwin" && command -v de… 证据：`run.sh`
- **Requires -Version 5.1**（source_file）：param Parameter Position = 0 string $Command = "" 证据：`scripts/run.ps1`
- **Shutdown**（source_file）：cd dirname $0 /.. export BASE DIR= pwd pid= ps ax grep -i app.py grep "${BASE DIR}" grep python3 grep -v grep awk '{print $1}' if -z "$pid" ; then echo "No chatgpt-on-wechat running." exit -1; fi echo "The chatgpt-on-wechat ${pid} is running..." kill ${pid} echo "Send shutdown request to chatgpt-on-wechat ${pid} OK" 证据：`scripts/shutdown.sh`
- **Start**（source_file）：cd dirname $0 /.. export BASE DIR= pwd echo $BASE DIR if ! -f "${BASE DIR}/nohup.out" ; then touch "${BASE DIR}/nohup.out" echo "create file ${BASE DIR}/nohup.out" fi nohup python3 "${BASE DIR}/app.py" & tail -f "${BASE DIR}/nohup.out" echo "Chat on webchat is starting，you can check the ${BASE DIR}/nohup.out" 证据：`scripts/start.sh`
- **Tout**（source_file）：cd dirname $0 /.. export BASE DIR= pwd echo $BASE DIR if ! -f "${BASE DIR}/nohup.out" ; then echo "No file ${BASE DIR}/nohup.out" exit -1; fi tail -f "${BASE DIR}/nohup.out" 证据：`scripts/tout.sh`
- **Init**（source_file）：all = "ChatService" 证据：`agent/chat/__init__.py`
- **Init**（source_file）：all = 证据：`agent/evolution/__init__.py`
- **Config**（source_file）：DEFAULT ENABLED = False DEFAULT IDLE MINUTES = 10 DEFAULT MIN TURNS = 6 ⋮---- DEFAULT MAX STEPS = 12 ⋮---- @dataclass class EvolutionConfig ⋮---- enabled: bool = DEFAULT ENABLED idle minutes: int = DEFAULT IDLE MINUTES min turns: int = DEFAULT MIN TURNS max steps: int = DEFAULT MAX STEPS ⋮---- @property def idle seconds self - int ⋮---- def as bool value: Any, fallback: bool - bool ⋮---- v = value.strip .lower ⋮---- def as pos int value: Any, fallback: int - int ⋮---- n = int value ⋮---- def get evolution config - EvolutionConfig ⋮---- c = conf ⋮---- c = {} ⋮---- def get key, default 证据：`agent/evolution/config.py`
- **Init**（source_file）：all = 证据：`agent/memory/__init__.py`
- **Config**（source_file）：def default workspace ⋮---- @dataclass class MemoryConfig ⋮---- workspace root: str = field default factory= default workspace ⋮---- embedding provider: str = "openai" embedding model: str = "text-embedding-3-small" embedding dim: int = 1536 ⋮---- chunk max tokens: int = 500 chunk overlap tokens: int = 50 ⋮---- max results: int = 10 min score: float = 0.1 ⋮---- vector weight: float = 0.7 keyword weight: float = 0.3 ⋮---- sources: List str = field default factory=lambda: "memory", "session" ⋮---- enable auto sync: bool = True sync on search: bool = True ⋮---- def get workspace self - Path ⋮---- def get memory dir self - Path ⋮---- def get db path self - Path ⋮---- index dir = self.get memory… 证据：`agent/memory/config.py`
- **Init**（source_file）：all = 证据：`agent/memory/embedding/__init__.py`
- **Init**（source_file）：all = 证据：`agent/prompt/__init__.py`
- **Init**（source_file）：all = 证据：`agent/protocol/__init__.py`
- **If tool is already an instance, use it directly**（source_file）：class Agent ⋮---- custom dir = os.path.join workspace dir, "skills" if workspace dir else None ⋮---- def add tool self, tool: BaseTool ⋮---- """ Add a tool to the agent. :param tool: The tool to add either a tool instance or a tool name """ If tool is already an instance, use it directly ⋮---- def get skills prompt self, skill filter=None - str ⋮---- """ Get the skills prompt to append to system prompt. :param skill filter: Optional list of skill names to include :return: Formatted skills prompt or empty string """ ⋮---- def get full system prompt self, skill filter=None - str ⋮---- """ Build the complete system prompt from scratch every time. Re-reads AGENT.md / USER.md / RULE.md from disk… 证据：`agent/protocol/agent.py`
- **Convert tools list to dict**（source_file）：HAS JSON REPAIR = True ⋮---- HAS JSON REPAIR = False ⋮---- MAX STORED REASONING CHARS = 4 1024 ⋮---- REASONING TRUNCATE MARKER = "\n\n... reasoning truncated, {omitted} chars omitted ...\n\n" ⋮---- def truncate reasoning for storage text: str - str ⋮---- half = MAX STORED REASONING CHARS // 2 head = text :half tail = text -half: omitted = len text - len head - len tail ⋮---- def parse tool args args str: str, finish reason: Optional str - Tuple dict, Optional str ⋮---- repaired = repair json args str, return objects=True ⋮---- class AgentStreamExecutor ⋮---- """ Agent Stream Executor Handles multi-turn reasoning loop based on tool-call: 1. LLM generates response may include tool calls 2. Ex… 证据：`agent/protocol/agent_stream.py`
- **Init**（source_file）：all = 证据：`agent/skills/__init__.py`
- **Config**（source_file）：def resolve runtime platform - str ⋮---- def has binary bin name: str - bool ⋮---- def has any binary bin names: List str - bool ⋮---- def has env var env name: str - bool ⋮---- def get skill config config: Optional Dict , skill name: str - Optional Dict ⋮---- skills config = config.get 'skills', {} ⋮---- entries = skills config.get 'entries', {} ⋮---- metadata = entry.metadata ⋮---- platform name = current platform or resolve runtime platform ⋮---- platform map = { normalized platform = platform map.get platform name, platform name ⋮---- required bins = metadata.requires.get 'bins', ⋮---- any bins = metadata.requires.get 'anyBins', ⋮---- required env = metadata.requires.get 'env', ⋮---- an… 证据：`agent/skills/config.py`
- **Scheduler Tool requires croniter**（source_file）：def import optional tools ⋮---- tools = {} ⋮---- Scheduler Tool requires croniter ⋮---- WebSearch Tool conditionally loaded based on API key availability at init time ⋮---- WebFetch Tool ⋮---- Vision Tool conditionally loaded based on API key availability ⋮---- Load optional tools optional tools = import optional tools EnvConfig = optional tools.get 'EnvConfig' SchedulerTool = optional tools.get 'SchedulerTool' WebSearch = optional tools.get 'WebSearch' WebFetch = optional tools.get 'WebFetch' Vision = optional tools.get 'Vision' GoogleSearch = optional tools.get 'GoogleSearch' FileSave = optional tools.get 'FileSave' Terminal = optional tools.get 'Terminal' ⋮---- BrowserTool requires playw… 证据：`agent/tools/__init__.py`
- **Base Tool**（source_file）：class ToolStage Enum ⋮---- PRE PROCESS = "pre process" POST PROCESS = "post process" ⋮---- class ToolResult ⋮---- def init self, status: str = None, result: Any = None, ext data: Any = None ⋮---- @staticmethod def success result, ext data: Any = None ⋮---- @staticmethod def fail result, ext data: Any = None ⋮---- class BaseTool ⋮---- stage = ToolStage.PRE PROCESS ⋮---- name: str = "base tool" description: str = "Base tool" params: dict = {} model: Optional Any = None progress callback = None ⋮---- def report progress self, message: str ⋮---- callback = getattr self, "progress callback", None ⋮---- @classmethod def get json schema cls - dict ⋮---- """Get the standard description of the tool"… 证据：`agent/tools/base_tool.py`
- **Init**（source_file）：all = 'Bash' 证据：`agent/tools/bash/__init__.py`
- **Prepare environment with .env file variables**（source_file）：class Bash BaseTool ⋮---- IS WIN = sys.platform == "win32" PROGRESS MAX BYTES = 4 1024 PROGRESS INTERVAL = 0.5 ⋮---- WIN CMD SAFE LEN = 7000 ⋮---- name: str = "bash" description: str = f"""Execute a bash command in the current working directory. Returns stdout and stderr. Output is truncated to last {DEFAULT MAX LINES} lines or {DEFAULT MAX BYTES // 1024}KB whichever is hit first . If truncated, full output is saved to a temp file. ⋮---- params: dict = { ⋮---- def init self, config: dict = None ⋮---- def execute self, args: Dict str, Any - ToolResult ⋮---- command = args.get "command", "" .strip timeout = args.get "timeout", self.default timeout ⋮---- warning = self. get safety warning comm… 证据：`agent/tools/bash/bash.py`
- **Init**（source_file）：all = "BrowserTool" 证据：`agent/tools/browser/__init__.py`
- **Init**（source_file）：all = 'Edit' 证据：`agent/tools/edit/__init__.py`
- **Init**（source_file）：all = 'EnvConfig' 证据：`agent/tools/env_config/__init__.py`
- **Skip empty lines and comments**（source_file）：API KEY REGISTRY = { ⋮---- class EnvConfig BaseTool ⋮---- name: str = "env config" description: str = ⋮---- params: dict = { ⋮---- def init self, config: dict = None ⋮---- def ensure env file self ⋮---- def mask value self, value: str - str ⋮---- """Mask sensitive parts of a value for logging""" ⋮---- def read env file self - Dict str, str ⋮---- """Read all key-value pairs from .env file""" env vars = {} ⋮---- line = line.strip Skip empty lines and comments ⋮---- Parse KEY=VALUE match = re.match r'^ ^= + = . $', line ⋮---- def write env file self, env vars: Dict str, str ⋮---- """Write all key-value pairs to .env file""" ⋮---- f.write " Auto-managed by env config tool\n\n" ⋮---- def reload… 证据：`agent/tools/env_config/env_config.py`
- **Init**（source_file）：all = "EvolutionUndoTool" 证据：`agent/tools/evolution_undo/__init__.py`
- **Init**（source_file）：all = 'Ls' 证据：`agent/tools/ls/__init__.py`
- **Init**（source_file）：all = "McpClient", "McpClientRegistry", "McpTool" 证据：`agent/tools/mcp/__init__.py`
- **Best-effort streamable-http session termination**（source_file）：STREAMABLE HTTP ALIASES = {"streamable-http", "streamable http", "streamablehttp", "http"} ⋮---- class McpClient ⋮---- def init self, config: dict ⋮---- raw transport: str = config.get "type", "stdio" ⋮---- def initialize self - bool ⋮---- def list tools self - list ⋮---- """Return the tool list from this server. Each item is a dict: {"name": str, "description": str, "inputSchema": dict} Call a tool and return the result as a string.""" ⋮---- resp = self. send request "tools/call", {"name": name, "arguments": arguments} content = resp.get "result", {} .get "content", parts = item.get "text", "" for item in content if item.get "type" == "text" ⋮---- def shutdown self ⋮---- """Close the conne… 证据：`agent/tools/mcp/mcp_client.py`
- **Mcp Tool**（source_file）：class McpTool BaseTool ⋮---- def init self, client, tool schema: dict, server name: str ⋮---- def execute self, params: dict - ToolResult ⋮---- result = self.client.call tool self.name, params 证据：`agent/tools/mcp/mcp_tool.py`
- **Init**（source_file）：all = 'MemorySearchTool', 'MemoryGetTool' 证据：`agent/tools/memory/__init__.py`
- **Init**（source_file）：all = 'Read' 证据：`agent/tools/read/__init__.py`
- 其余 12 条证据见 `AI_CONTEXT_PACK.json` 或 `EVIDENCE_INDEX.json`。

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

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

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

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

## 验收标准

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

---

## Doramagic Context Augmentation

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

## Human Manual 骨架

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

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

- **CowAgent 简介与系统架构**：importance `high`
  - source_paths: README.md, app.py, bridge/bridge.py, bridge/agent_bridge.py, channel/channel_factory.py
- **Agent 核心：协议、工具、记忆、知识、演化**：importance `high`
  - source_paths: agent/protocol/agent_stream.py, agent/protocol/agent.py, agent/tools/tool_manager.py, agent/tools/base_tool.py, agent/tools/bash/bash.py
- **外部集成：Channels、Models、MCP、Skills、Plugins**：importance `high`
  - source_paths: channel/web/web_channel.py, channel/telegram/telegram_channel.py, channel/slack/slack_channel.py, channel/discord/discord_channel.py, channel/weixin/weixin_channel.py
- **部署、CLI、桌面端与安全运维**：importance `high`
  - source_paths: run.sh, scripts/start.sh, scripts/shutdown.sh, scripts/run.ps1, scripts/tout.sh

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

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `2e742958074a754daf6dfd7391b42b3cb1e6168d`
- inspected_files: `Dockerfile`, `README.md`, `pyproject.toml`, `requirements.txt`, `docs/README.md`, `docs/channels/dingtalk.mdx`, `docs/channels/discord.mdx`, `docs/channels/feishu.mdx`, `docs/channels/index.mdx`, `docs/channels/qq.mdx`, `docs/channels/slack.mdx`, `docs/channels/telegram.mdx`, `docs/channels/web.mdx`, `docs/channels/wechat-kf.mdx`, `docs/channels/wechatmp.mdx`, `docs/channels/wecom-bot.mdx`, `docs/channels/wecom.mdx`, `docs/channels/weixin.mdx`, `docs/cli/general.mdx`, `docs/cli/index.mdx`

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

## Doramagic Pitfall Constraints / 踩坑约束

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

### Constraint 1: 来源证据：[Bug] pyproject.toml requires-python=">=3.7" contradicts actual deps and README (Python 3.13)

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：[Bug] pyproject.toml requires-python=">=3.7" contradicts actual deps and README (Python 3.13)
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/zhayujie/CowAgent/issues/2930 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 2: 失败模式：security_permissions: [Security] Read tool credential-bypass via `/proc/self/environ` environment alias

- Trigger: Developers should check this security_permissions risk before relying on the project: [Security] Read tool credential-bypass via `/proc/self/environ` environment alias
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: [Security] Read tool credential-bypass via `/proc/self/environ` environment alias. Context: Observed when using python, docker, linux
- Why it matters: Developers may expose sensitive permissions or credentials: [Security] Read tool credential-bypass via `/proc/self/environ` environment alias
- Evidence: failure_mode_cluster:github_issue | https://github.com/zhayujie/CowAgent/issues/2913 | [Security] Read tool credential-bypass via `/proc/self/environ` environment alias
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 3: 来源证据：[Feature] MCP 大工具集按需向量检索，避免全量 schema 注入

- Trigger: GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：[Feature] MCP 大工具集按需向量检索，避免全量 schema 注入
- Why it matters: 可能影响授权、密钥配置或安全边界。
- Evidence: community_evidence:github | https://github.com/zhayujie/CowAgent/issues/2937 | 来源类型 github_issue 暴露的待验证使用条件。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 4: 失败模式：installation: 2.0.5

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

### Constraint 5: 失败模式：installation: 2.0.9

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

### Constraint 6: 失败模式：installation: 2.1.0

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

### Constraint 7: 失败模式：installation: 2.1.1

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

### Constraint 8: 失败模式：installation: 2.1.2

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

### Constraint 9: 失败模式：installation: [Bug] pyproject.toml requires-python=">=3.7" contradicts actual deps and README (Python 3.13)

- Trigger: Developers should check this installation risk before relying on the project: [Bug] pyproject.toml requires-python=">=3.7" contradicts actual deps and README (Python 3.13)
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: [Bug] pyproject.toml requires-python=">=3.7" contradicts actual deps and README (Python 3.13). Context: Observed when using python, docker
- Why it matters: Developers may fail before the first successful local run: [Bug] pyproject.toml requires-python=">=3.7" contradicts actual deps and README (Python 3.13)
- Evidence: failure_mode_cluster:github_issue | https://github.com/zhayujie/CowAgent/issues/2930 | [Bug] pyproject.toml requires-python=">=3.7" contradicts actual deps and README (Python 3.13)
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 10: 来源证据：[Feature] 腾讯Agent Mail支持~

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：[Feature] 腾讯Agent Mail支持~
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/zhayujie/CowAgent/issues/2938 | 来源讨论提到 node 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。
