[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7786TZTX2HS9BGKRXK6X2C9":3,"skill-same:01M7786TZTX2HS9BGKRXK6X2C9":56},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":34,"commitSha":35,"skillDirectory":36,"forksCount":37,"repositoryHtmlUrl":38,"repositoryHomepageUrl":39,"ownerHtmlUrl":40,"ownerBlogUrl":6,"ownerDescription":41,"updatedAt":42,"install":43,"resources":55},"01M7786TZTX2HS9BGKRXK6X2C9","comind",null,"CoMind 人机协作平台 AI 成员操作手册。定义任务执行、Markdown 同步、对话协作、状态面板等全部工作流程。当 AI 成员接收到 CoMind 平台的任务推送、对话请求、定时调度或巡检指令时，应使用此 Skill 执行标准化操作。","Lord1Egypt\u002Fawesome-skill-forge","Lord1Egypt","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99746359?v=4","01M7592YDNT0XK9WJ0T2MQVPDN","Mohamed Mounir Ali AL Keshita","01M75GRFNHC8VZNWEB8DKDE433",3,"MIT","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fclawhub\u002Fc\u002Fcomind\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: comind\ndescription: CoMind 人机协作平台 AI 成员操作手册。定义任务执行、Markdown 同步、对话协作、状态面板等全部工作流程。当 AI 成员接收到 CoMind 平台的任务推送、对话请求、定时调度或巡检指令时，应使用此 Skill 执行标准化操作。\ncomind_version: \"2.2.4\"\nmetadata: { \"openclaw\": { \"always\": true, \"emoji\": \"🧠\", \"homepage\": \"https:\u002F\u002Fgithub.com\u002Fcomind\", \"requires\": { \"env\": [\"COMIND_BASE_URL\", \"COMIND_API_TOKEN\"] } } }\n---\n\n# CoMind AI 成员操作手册\n\n> **版本**: v2.2.4\n\n作为 CoMind 协作平台的 AI 成员，按照本文档定义的流程执行所有操作。\n\n## 环境变量\n\n| 变量 | 说明 |\n|------|------|\n| `COMIND_BASE_URL` | CoMind 实例地址（如 `http:\u002F\u002Flocalhost:3000`） |\n| `COMIND_API_TOKEN` | MCP External API 鉴权 Token |\n\n### 配置获取方式\n\n#### 方式一：WebSocket 主动请求（推荐）\n\n当 CoMind 已与 OpenClaw Gateway 建立 WebSocket 连接时，Gateway 可主动请求 MCP 配置：\n\n```javascript\n\u002F\u002F Gateway 发送事件请求配置\n{ type: 'event', event: 'comind.config.request', id: 'req-xxx' }\n\n\u002F\u002F CoMind 响应\n{ type: 'res', id: 'req-xxx', ok: true, payload: { baseUrl: 'http:\u002F\u002Flocalhost:3000', apiToken: 'xxx' } }\n```\n\n#### 方式二：手动配置\n\n在 OpenClaw 的 systemd 服务文件或环境变量中配置：\n\n```bash\n# \u002Fetc\u002Fsystemd\u002Fsystem\u002Fopenclaw.service 或 .env\nCOMIND_BASE_URL=http:\u002F\u002Flocalhost:3000\nCOMIND_API_TOKEN=your_api_token_here\n```\n\n#### 获取 API Token\n\n1. 登录 CoMind 平台\n2. 进入「成员管理」页面\n3. 找到对应的 AI 成员，点击编辑\n4. 复制或生成 `openclawApiToken`\n\n或通过 API 查询：\n```bash\n# 查询 AI 成员列表（需要管理员权限）\ncurl http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fmembers | jq '.[] | select(.type==\"ai\")'\n\n# 为成员生成 Token\ncurl -X PUT http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fmembers\u002F{member_id} \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"openclawApiToken\": \"your-new-token\"}'\n```\n\n---\n\n## 🚨 关键：三种交互通道架构\n\nCoMind 提供三种与 Agent 交互的通道，**MCP API 是核心通道和兜底保障**：\n\n```\n┌─────────────────────────────────────────────────────────────────────┐\n│                    CoMind Agent 交互通道架构                         │\n├─────────────────────────────────────────────────────────────────────┤\n│                                                                     │\n│   ┌──────────────┐     ┌──────────────┐     ┌──────────────┐       │\n│   │  对话信道    │     │   MCP API    │     │  文档同步    │       │\n│   │  (高效)      │     │  (可靠)      │     │  (便捷)      │       │\n│   └──────┬───────┘     └──────┬───────┘     └──────┬───────┘       │\n│          │                    │                    │                │\n│          │     ┌──────────────┴──────────────┐     │                │\n│          │     │         能力边界             │     │                │\n│          │     │  • 依赖 WebSocket 连接       │     │                │\n│          │     │  • 解析失败静默丢弃          │     │  • Front Matter 格式要求    │\n│          │     │  • 无显式错误反馈            │     │  • 同步失败仅日志           │\n│          │     │  • 能力子集                  │     │  • 无即时验证               │\n│          └─────┴─────────────────────────────┴─────┘                │\n│                              │                                      │\n│                              ▼                                      │\n│                    ┌─────────────────┐                              │\n│                    │   MCP API 兜底   │ ← 最可靠的验证通道           │\n│                    │   • 显式错误返回 │                              │\n│                    │   • 审计日志    │                              │\n│                    │   • 限流保护    │                              │\n│                    │   • 独立 HTTP   │                              │\n│                    └─────────────────┘                              │\n└─────────────────────────────────────────────────────────────────────┘\n```\n\n---\n\n### 通道一：对话信道 Actions（高效，但有边界）\n\n**触发方式**：AI 在对话回复末尾嵌入 `{\"actions\": [...]}` JSON 块\n\n**执行链路**：\n```\nAI 回复 → Gateway 推送 chat 事件 → CoMind 解析 Actions → 执行 → SSE 广播结果\n```\n\n**可靠性机制**：\n- ✅ 幂等性：`idempotencyKey` 防止重复执行\n- ✅ 批量执行：多个 action 顺序执行，失败不影响后续\n- ✅ 结果回传：执行结果自动回传给 AI（通过对话）\n\n**能力边界**（重要！）：\n- ❌ **依赖 WebSocket 连接**：Gateway 断连时 Actions 无法执行\n- ❌ **解析失败静默丢弃**：JSON 格式错误时无显式错误反馈\n- ❌ **操作子集**：仅支持写入操作，不支持查询\n- ❌ **无验证机制**：无法确认操作是否真正成功\n\n**适用场景**：\n- 对话中更新任务状态、添加评论\n- 与用户交互时即时反馈\n- **不适合**：关键操作、需要确认的操作\n\n---\n\n### 通道二：MCP API（核心通道，可靠兜底）\n\n**触发方式**：HTTP POST `\u002Fapi\u002Fmcp\u002Fexternal`，Bearer Token 鉴权\n\n**执行链路**：\n```\nAI 请求 → 鉴权 → 审计日志 → 执行 → 返回结果\n```\n\n**可靠性机制**（与其他通道的关键差异）：\n- ✅ **显式错误返回**：`{ success: false, error: \"具体错误原因\" }`\n- ✅ **审计日志**：所有调用记录到数据库，可追溯\n- ✅ **限流保护**：防止滥用，自动降级\n- ✅ **独立 HTTP 协议**：不依赖 WebSocket 连接状态\n- ✅ **完整操作集**：支持所有查询和写入操作\n- ✅ **身份自动注入**：`member_id` 自动填充，防止伪造\n\n**为什么 MCP 是兜底通道**：\n\n| 场景 | 其他通道问题 | MCP 兜底方案 |\n|------|-------------|-------------|\n| 文档同步创建任务后 | 无即时验证，不知道是否成功 | `get_task(task_id)` 确认存在 |\n| Actions 执行后 | 无错误反馈，可能静默失败 | `get_task(task_id)` 验证状态 |\n| 关键状态变更 | 可能因断连丢失 | MCP 独立请求，确保送达 |\n| 批量操作验证 | 同步失败仅日志 | `list_my_tasks` 验证结果 |\n\n---\n\n### 通道三：文档自动扫描同步（便捷，需验证）\n\n**触发方式**：创建\u002F更新包含特殊 Front Matter 的 Markdown 文档\n\n**执行链路**：\n```\nAI 创建文档 → API 保存 → syncMarkdownToDatabase() → 解析 Front Matter → 写入数据库\n```\n\n**支持的同步类型**：\n\n| Front Matter type | 同步目标 | 说明 |\n|-------------------|---------|------|\n| `comind:tasks` \u002F `task_list` | tasks 表 | 批量创建\u002F更新任务 |\n| `comind:schedules` | schedules 表 | 创建定时任务 |\n| `delivery_status: pending` | deliveries 表 | 创建交付记录 |\n\n**可靠性机制**：\n- ✅ 防循环同步：标记正在同步的文档 ID\n- ✅ 成员名自动匹配：`@成员名` → `memberId`\n- ✅ 项目名自动匹配：项目名 → `projectId`\n\n**能力边界**：\n- ❌ **Front Matter 格式要求严格**：解析失败无反馈\n- ❌ **同步失败仅记录日志**：AI 无法获知失败原因\n- ❌ **无即时验证**：无法在创建时确认结果\n\n**适用场景**：\n- 批量创建任务（≥2 条）\n- 批量提交交付物\n- **必须配合 MCP 验证**：同步后调用 MCP 确认结果\n\n---\n\n### 三通道协同模式：便捷 + 验证\n\n**模式一：文档同步 + MCP 验证**\n\n```bash\n# 1. 通过文档同步创建任务（便捷）\ncreate_document({\n  title: \"任务看板\",\n  content: \"---\ntype: comind:tasks\nproject: 项目名\n---\n- [ ] 任务1 @AI成员\n- [ ] 任务2 @AI成员\"\n})\n\n# 2. 通过 MCP 验证创建结果（可靠）\nlist_my_tasks(status: \"todo\") → 确认任务数量正确\nget_task(task_id: \"xxx\") → 确认任务详情正确\n```\n\n**模式二：对话 Actions + MCP 验证**\n\n```bash\n# 1. 通过对话 Actions 更新状态（高效）\n{\"actions\": [{\"type\": \"update_task_status\", \"task_id\": \"xxx\", \"status\": \"in_progress\"}]}\n\n# 2. 通过 MCP 验证更新结果（可靠）\nget_task(task_id: \"xxx\") → 确认 status 已变为 in_progress\n```\n\n**模式三：交付提交 + MCP 验证**\n\n```bash\n# 1. 通过 Front Matter 提交交付（便捷）\ncreate_document({\n  title: \"技术方案\",\n  content: \"---\ndelivery_status: pending\ndelivery_assignee: AI成员名\nrelated_tasks: [task_xxx]\n---\n# 技术方案内容...\"\n})\n\n# 2. 通过 MCP 验证交付记录（可靠）\nget_delivery(delivery_id: \"xxx\") → 确认交付记录已创建\nlist_my_deliveries(status: \"pending\") → 确认在待审核队列中\n```\n\n---\n\n### 方法选择决策树\n\n```\n需要执行操作\n│\n├─ 是否需要 100% 确认结果？\n│   └─ YES → 使用 MCP API（唯一可靠通道）\n│\n├─ 是否在对话中回复用户？\n│   ├─ YES → 操作是否支持对话信道 Actions？\n│   │         ├─ YES → 使用 Actions（便捷）+ MCP 验证（可靠）\n│   │         └─ NO  → 使用 MCP API\n│   │\n│   └─ NO → 是否批量写入 ≥2 条记录？\n│             ├─ YES → Markdown 同步 + MCP 验证\n│             └─ NO  → MCP API 单条操作\n```\n\n---\n\n### ⚠️ 能力限制对比表\n\n**对话信道 Actions 支持的操作**：\n- ✅ `update_task_status` — 更新任务状态\n- ✅ `add_comment` — 添加任务评论\n- ✅ `create_check_item` — 创建检查项\n- ✅ `complete_check_item` — 完成检查项\n- ✅ `create_document` — 创建文档\n- ✅ `update_document` — 更新文档\n- ✅ `deliver_document` — 提交文档交付\n- ✅ `update_status` — 更新 AI 状态\n- ✅ `set_queue` — 设置任务队列\n- ✅ `sync_identity` — 同步身份信息到 IDENTITY.md\n- ✅ `get_mcp_token` — 获取 MCP API Token\n\n**对话信道 Actions 不支持的操作**（必须用 MCP API）：\n- ❌ `set_do_not_disturb` — 免打扰模式\n- ❌ `create_schedule` \u002F `update_schedule` \u002F `delete_schedule` — 定时任务管理\n- ❌ `review_delivery` — 审核交付（人类操作）\n- ❌ `get_task` \u002F `get_document` \u002F `search_documents` — 查询操作\n- ❌ `get_project` \u002F `list_my_tasks` — 查询操作\n- ❌ `register_member` — 成员注册\n\n**对话信道 Actions 支持的操作**：\n- ✅ `update_task_status` — 更新任务状态\n- ✅ `add_comment` — 添加任务评论\n- ✅ `create_check_item` — 创建检查项\n- ✅ `complete_check_item` — 完成检查项\n- ✅ `create_document` — 创建文档\n- ✅ `update_document` — 更新文档\n- ✅ `deliver_document` — 提交文档交付\n- ✅ `update_status` — 更新 AI 状态\n- ✅ `set_queue` — 设置任务队列\n- ✅ `sync_identity` — 同步身份信息到 IDENTITY.md\n- ✅ `get_mcp_token` — 获取 MCP API Token\n\n**对话信道 Actions 不支持的操作**（必须用 MCP API）：\n- ❌ `set_do_not_disturb` — 免打扰模式\n- ❌ `create_schedule` \u002F `update_schedule` \u002F `delete_schedule` — 定时任务管理\n- ❌ `review_delivery` — 审核交付（人类操作）\n- ❌ `get_task` \u002F `get_document` \u002F `search_documents` — 查询操作\n- ❌ `get_project` \u002F `list_my_tasks` — 查询操作\n- ❌ `register_member` — 成员注册\n- ❌ `list_my_deliveries` \u002F `get_delivery` — 交付查询\n\n---\n\n## 内置 MCP 调用脚本\n\n为提高 Agent 调用 MCP API 的效率和可靠性，Skill 内置以下调用脚本模板：\n\n### 基础调用模板\n\n```bash\n# 环境变量（由 Agent 自动注入）\nCOMIND_BASE_URL=\"${COMIND_BASE_URL:-http:\u002F\u002Flocalhost:3000}\"\nCOMIND_API_TOKEN=\"${COMIND_API_TOKEN}\"\n\n# 通用调用函数\nmcp_call() {\n  local tool=\"$1\"\n  local params=\"$2\"\n  \n  curl -s -X POST \"${COMIND_BASE_URL}\u002Fapi\u002Fmcp\u002Fexternal\" \\\n    -H \"Authorization: Bearer ${COMIND_API_TOKEN}\" \\\n    -H \"Content-Type: application\u002Fjson\" \\\n    -d \"{\\\"tool\\\": \\\"${tool}\\\", \\\"parameters\\\": ${params}}\"\n}\n```\n\n### 高频操作脚本\n\n#### 验证任务创建\u002F更新\n\n```bash\n# 文档同步创建任务后验证\nverify_task() {\n  local task_id=\"$1\"\n  local expected_status=\"${2:-todo}\"\n  \n  result=$(mcp_call \"get_task\" \"{\\\"task_id\\\": \\\"${task_id}\\\"}\")\n  \n  if echo \"$result\" | jq -e '.success == true' > \u002Fdev\u002Fnull; then\n    actual_status=$(echo \"$result\" | jq -r '.data.status')\n    if [ \"$actual_status\" = \"$expected_status\" ]; then\n      echo \"✅ 任务验证成功: $task_id 状态为 $actual_status\"\n      return 0\n    else\n      echo \"⚠️ 任务状态不符: 期望 $expected_status，实际 $actual_status\"\n      return 1\n    fi\n  else\n    echo \"❌ 任务验证失败: $(echo \"$result\" | jq -r '.error')\"\n    return 1\n  fi\n}\n```\n\n#### 验证交付记录创建\n\n```bash\n# Front Matter 提交交付后验证\nverify_delivery() {\n  local document_id=\"$1\"\n  \n  # 先查询该文档关联的交付记录\n  result=$(mcp_call \"list_my_deliveries\" \"{\\\"status\\\": \\\"all\\\"}\")\n  \n  delivery_id=$(echo \"$result\" | jq -r \".data.deliveries[] | select(.document_id == \\\"${document_id}\\\") | .id\")\n  \n  if [ -n \"$delivery_id\" ]; then\n    echo \"✅ 交付记录已创建: $delivery_id\"\n    \n    # 获取详情确认\n    detail=$(mcp_call \"get_delivery\" \"{\\\"delivery_id\\\": \\\"${delivery_id}\\\"}\")\n    echo \"交付状态: $(echo \"$detail\" | jq -r '.data.status')\"\n    return 0\n  else\n    echo \"❌ 未找到关联的交付记录\"\n    return 1\n  fi\n}\n```\n\n#### 批量操作验证\n\n```bash\n# 文档同步批量创建任务后验证\nverify_bulk_tasks() {\n  local expected_count=\"$1\"\n  local project_id=\"$2\"\n  \n  result=$(mcp_call \"list_my_tasks\" \"{\\\"status\\\": \\\"todo\\\"}\")\n  actual_count=$(echo \"$result\" | jq '.data.tasks | length')\n  \n  if [ \"$actual_count\" -ge \"$expected_count\" ]; then\n    echo \"✅ 批量任务验证成功: 创建了 $actual_count 个任务\"\n    return 0\n  else\n    echo \"⚠️ 任务数量不足: 期望 $expected_count，实际 $actual_count\"\n    return 1\n  fi\n}\n```\n\n#### 状态更新验证\n\n```bash\n# Actions 更新状态后验证\nverify_status_update() {\n  local task_id=\"$1\"\n  local expected_status=\"$2\"\n  local max_retries=3\n  local retry=0\n  \n  while [ $retry -lt $max_retries ]; do\n    result=$(mcp_call \"get_task\" \"{\\\"task_id\\\": \\\"${task_id}\\\"}\")\n    actual_status=$(echo \"$result\" | jq -r '.data.status \u002F\u002F empty')\n    \n    if [ \"$actual_status\" = \"$expected_status\" ]; then\n      echo \"✅ 状态验证成功: $task_id → $actual_status\"\n      return 0\n    fi\n    \n    retry=$((retry + 1))\n    sleep 1\n  done\n  \n  echo \"❌ 状态验证失败: 期望 $expected_status，实际 $actual_status\"\n  return 1\n}\n```\n\n### 错误处理模板\n\n```bash\n# 带重试的 MCP 调用\nmcp_call_with_retry() {\n  local tool=\"$1\"\n  local params=\"$2\"\n  local max_retries=\"${3:-3}\"\n  local retry=0\n  \n  while [ $retry -lt $max_retries ]; do\n    result=$(mcp_call \"$tool\" \"$params\")\n    \n    if echo \"$result\" | jq -e '.success == true' > \u002Fdev\u002Fnull; then\n      echo \"$result\"\n      return 0\n    fi\n    \n    error=$(echo \"$result\" | jq -r '.error')\n    \n    # 限流错误，等待重试\n    if echo \"$error\" | grep -q \"rate limit\"; then\n      sleep $((2 ** retry))\n      retry=$((retry + 1))\n      continue\n    fi\n    \n    # 其他错误，直接返回\n    echo \"$result\"\n    return 1\n  done\n  \n  echo '{\"success\": false, \"error\": \"Max retries exceeded\"}'\n  return 1\n}\n```\n\n---\n\n## 验证场景清单\n\n以下场景**必须**使用 MCP 验证：\n\n### 场景 1：文档同步创建任务\n\n```yaml\n操作: create_document({ type: \"comind:tasks\", ... })\n验证: list_my_tasks() → 确认任务数量和内容\n原因: Front Matter 解析失败静默，需显式验证\n```\n\n### 场景 2：文档同步创建交付\n\n```yaml\n操作: create_document({ delivery_status: \"pending\", ... })\n验证: list_my_deliveries(status: \"pending\") → 确认交付记录存在\n原因: 交付记录关联复杂，需确认 memberId、documentId 正确\n```\n\n### 场景 3：对话 Actions 更新状态\n\n```yaml\n操作: {\"actions\": [{\"type\": \"update_task_status\", ...}]}\n验证: get_task(task_id) → 确认状态已变更\n原因: WebSocket 断连时 Actions 可能丢失\n```\n\n### 场景 4：批量操作\n\n```yaml\n操作: 文档同步批量创建 N 条记录\n验证: list_my_tasks() \u002F list_my_deliveries() → 确认数量\n原因: 部分记录可能因解析失败被跳过\n```\n\n### 场景 5：关键状态变更\n\n```yaml\n操作: 任务完成 \u002F 交付提交 \u002F 状态切换\n验证: get_task() \u002F get_delivery() → 确认状态\n原因: 关键操作需 100% 确认成功\n```\n\n### 场景 6：跨系统同步\n\n```yaml\n操作: 外部文档系统同步到 CoMind\n验证: search_documents(query) → 确认文档已同步\n原因: 外部系统可能延迟或失败\n```\n\n---\n\n## 决策流程图（更新版）\n\n### 场景与方法映射\n\n| 场景 | 推荐方法 | 原因 |\n|------|---------|------|\n| 用户对话中更新任务状态 | 对话信道 Actions | 一次回复完成，无需额外请求 |\n| 任务推送后更新状态 | 对话信道 Actions | 回复即执行，用户可见进度 |\n| 用户对话中查询任务 | MCP API | 查询操作不支持 Actions |\n| 批量创建任务 | Markdown 同步 | 一次调用创建多条记录 |\n| 定时任务管理 | MCP API | Actions 不支持定时任务 |\n| 获取待办任务列表 | MCP API (`list_my_tasks`) | 查询操作不支持 Actions |\n\n---\n\n## 决策树\n\n```\n收到指令\n├─ task-push 模板 → 场景A: 执行任务（必须在对话中汇报进展）\n├─ chat-* 模板   → 场景E: 对话协作\n├─ 需要全局上下文 → 读取 references\u002Fsystem-info.md 模板格式，调 API 获取数据\n└─ 自主巡检      → 场景D: 任务巡检\n\n执行中:\n├─ 批量写操作(≥2条) → Markdown 同步\n├─ 单字段更新       → 对话信道 Actions 或 MCP API\n├─ 状态面板         → 对话信道 Actions 或 MCP API\n├─ 查询数据         → MCP API\n├─ 关键进展         → 在对话中主动汇报\n└─ 完成             → 在对话中汇报总结 + update_task_status(completed) + update_status(idle)\n```\n\n---\n\n## 实体映射\n\nMarkdown 文档与 CoMind 数据库的自动映射规则：\n\n| Markdown 元素 | CoMind 表 | 映射规则 |\n|--------------|----------|---------|\n| 文档 | documents | title 从 Front Matter 或 H1 解析 |\n| 任务行 | tasks | 按标题匹配，自动创建\u002F更新 |\n| `@成员名` | members | 按名称模糊匹配，转 ID 存入 assignees |\n| `[[文档名]]` | documents | 按标题匹配，建立关联关系 |\n| `#task_xxx` | tasks | 精确 ID 引用或标题模糊匹配 |\n| Front Matter | 各表字段 | 自动解析填充 |\n\n### Front Matter 字段映射\n\n```yaml\n# 必填字段\ntitle: 文档标题          # → documents.title\ntype: report            # → documents.docType\nproject: comind-v2      # → documents.projectId（按项目名匹配）\ncreated: 2026-02-18     # → documents.createdAt\nupdated: 2026-02-18     # → documents.updatedAt\n\n# 可选字段\ntags: [标签]            # → documents.tags\nrelated_tasks: [task_id] # → 关联任务\ncontains_tasks: true    # → 触发任务解析\ntask_assignees: [成员]   # → 任务默认分配\n\n# 交付字段（有 delivery_status 即自动创建交付记录）\ndelivery_status: pending      # → deliveries.status（pending | approved | rejected | revision_needed）\ndelivery_assignee: AI成员名   # → deliveries.memberId（按成员名匹配）\ndelivery_platform: local      # → deliveries.platform（local | tencent-doc | feishu | notion | other）\ndelivery_version: 1           # → deliveries.version\ndelivery_reviewer: 人类成员名 # → deliveries.reviewerId（审核人填写）\ndelivery_comment: 审核意见    # → deliveries.reviewComment（审核人填写）\n```\n\n> **交付说明**：文档 Front Matter 中存在 `delivery_status` 字段时，系统自动创建\u002F更新交付记录。\n> - `pending`：进入交付中心待审核队列\n> - `approved`：已通过审核\n> - `rejected`：已驳回\n> - `revision_needed`：需要修改\n\n### 任务状态映射\n\n| 语法 | 状态 | 优先级 |\n|------|------|--------|\n| `- [ ]` | todo | medium |\n| `- [!]` | todo | high |\n| `- [-]` | todo | low |\n| `- [~]` | in_progress | - |\n| `- [?]` | reviewing | - |\n| `- [x]` | completed | - |\n\n---\n\n## 场景A: 执行任务\n\n**触发**：收到 task-push 推送（含 task_id、title、description、项目上下文）\n\n> ⚠️ **关键警告**\n> - 开始执行前**必须**先更新状态为 `in_progress`\n> - 完成工作后**必须**更新状态为 `completed` 或 `reviewing`\n> - 仅创建笔记\u002F文档 ≠ 完成任务，必须更新状态才能结束！\n> - **必须在对话中主动汇报工作进展，不能默默执行！**\n> - **关键操作后必须用 MCP 验证结果！**\n\n### 汇报规范\n\n| 阶段 | 要求 |\n|------|------|\n| 收到任务 | 在对话中确认收到，简述执行计划 |\n| 执行过程 | 遇到关键节点或重要发现时，主动在对话中汇报 |\n| 完成时 | 在对话中发送完成总结：做了什么、产出了什么 |\n| 遇到问题 | 立即在对话中说明问题和处理方案 |\n\n**回复风格**：简洁明了，像同事沟通，重要信息加粗。\n\n**流程**：\n\n### 1. 【必须】确认收到 + 接受任务 + 验证\n\n先在对话中简短确认收到任务、说明执行计划，然后执行 Actions：\n\n```json\n{\"actions\": [\n  {\"type\": \"update_task_status\", \"task_id\": \"xxx\", \"status\": \"in_progress\"},\n  {\"type\": \"update_status\", \"status\": \"working\", \"current_action\": \"开始执行\", \"task_id\": \"xxx\"}\n]}\n```\n\n**验证**（使用 MCP API 确认状态变更）：\n```json\n{\"tool\": \"get_task\", \"parameters\": {\"task_id\": \"xxx\"}}\n\u002F\u002F 确认返回的 status 为 \"in_progress\"\n```\n\n### 2. 获取上下文（可选）\n\n**必须使用 MCP API**（查询操作不支持 Actions）\n\n```json\n{\"tool\": \"get_task\", \"parameters\": {\"task_id\": \"xxx\"}}\n{\"tool\": \"get_project\", \"parameters\": {\"project_id\": \"xxx\"}}\n```\n\n### 3. 分解子任务 + 验证\n\n- **≥2项**：Markdown 同步（`create_document` + `comind:tasks` frontmatter）**+ MCP 验证**\n- **≤2项**：MCP API 或 Actions（`create_check_item`）\n\n**批量创建任务后验证**：\n```json\n{\"tool\": \"list_my_tasks\", \"parameters\": {\"status\": \"todo\"}}\n\u002F\u002F 确认任务数量和内容正确\n```\n\n### 4. 执行 + 汇报\n\n执行过程中如有重要进展，**在对话中主动汇报**，同时通过 Actions 记录：\n\n```json\n{\"actions\": [\n  {\"type\": \"add_comment\", \"task_id\": \"xxx\", \"content\": \"进展：正在分析需求...\"},\n  {\"type\": \"update_status\", \"status\": \"working\", \"progress\": 30}\n]}\n```\n\n### 5. 产出交付物 + 验证\n\n- **Markdown 同步**：`create_document` 写内容 + `comind:deliveries` 批量提交\n- **单个交付**：Actions 或 MCP API `deliver_document`\n\n**创建交付物后验证**：\n```json\n{\"tool\": \"list_my_deliveries\", \"parameters\": {\"status\": \"pending\"}}\n\u002F\u002F 确认交付记录已创建，document_id 正确关联\n```\n\n### 6. 【必须】完成任务 + 汇报结果 + 验证\n\n**情况A：无需用户决策**\n\n在对话中汇报完成总结，然后执行：\n\n```json\n{\"actions\": [\n  {\"type\": \"update_task_status\", \"task_id\": \"xxx\", \"status\": \"completed\"},\n  {\"type\": \"add_comment\", \"task_id\": \"xxx\", \"content\": \"✅ 任务已完成！\"},\n  {\"type\": \"update_status\", \"status\": \"idle\"}\n]}\n```\n\n**验证**：\n```json\n{\"tool\": \"get_task\", \"parameters\": {\"task_id\": \"xxx\"}}\n\u002F\u002F 确认 status 为 \"completed\"\n```\n\n**情况B：需要用户审核**（文档交付场景）\n\n在对话中说明已提交交付、等待审核，然后执行：\n\n```json\n{\"actions\": [\n  {\"type\": \"deliver_document\", \"title\": \"技术方案\", \"platform\": \"local\", \"document_id\": \"doc_xxx\", \"task_id\": \"xxx\"},\n  {\"type\": \"update_task_status\", \"task_id\": \"xxx\", \"status\": \"reviewing\"},\n  {\"type\": \"add_comment\", \"task_id\": \"xxx\", \"content\": \"📄 已提交交付中心，等待审核\"}\n]}\n```\n\n**验证**：\n```json\n{\"tool\": \"get_task\", \"parameters\": {\"task_id\": \"xxx\"}}\n\u002F\u002F 确认 status 为 \"reviewing\"\n\n{\"tool\": \"list_my_deliveries\", \"parameters\": {\"status\": \"pending\"}}\n\u002F\u002F 确认交付记录已创建\n```\n\n> ⚠️ **重要**：提交交付后状态必须设为 `reviewing`，不能设为 `completed`！\n\n**完成标准检查清单**：\n- [ ] 已在对话中确认收到任务\n- [ ] 状态已更新为 `completed` 或 `reviewing`\n- [ ] **已通过 MCP 验证状态变更成功**\n- [ ] 交付物已提交（如有产出）\n- [ ] **已通过 MCP 验证交付记录创建成功**\n- [ ] 已在对话中汇报完成总结\n\n---\n\n## 场景A2: 文档交付\n\n**何时需要提交文档交付？**\n\n| 文档类型 | 说明 | 必须提交 |\n|---------|------|---------|\n| 决策文档 | 技术选型、架构方案 | ✅ 是 |\n| 审核文档 | 预算报告、合同草案 | ✅ 是 |\n| 外部发布 | 公众号文章、产品公告 | ✅ 是 |\n| 临时笔记 | 学习笔记、过程记录 | ❌ 否 |\n| 工作日志 | 过程记录、信息整理 | ❌ 否 |\n\n### 创建交付物的方式 + 验证\n\n**方式一：文档 Front Matter（推荐）+ MCP 验证**\n\n在创建文档时添加 `delivery_status` 字段，系统自动创建交付记录：\n\n```yaml\n---\ntitle: 技术方案\ntype: decision\nproject: 项目名\ncreated: 2026-02-24T10:00:00Z\nupdated: 2026-02-24T10:00:00Z\n\n# 交付字段\ndelivery_status: pending\ndelivery_assignee: 你的名字\ndelivery_platform: local\ndelivery_version: 1\nrelated_tasks: [task_xxx]\n---\n\n# 技术方案内容...\n```\n\n**创建后验证**（必须）：\n```json\n\u002F\u002F 验证交付记录已创建\n{\"tool\": \"list_my_deliveries\", \"parameters\": {\"status\": \"pending\"}}\n\n\u002F\u002F 验证文档关联正确\n{\"tool\": \"get_delivery\", \"parameters\": {\"delivery_id\": \"从上面返回的 ID\"}}\n\u002F\u002F 确认 document_id、task_id 关联正确\n```\n\n**方式二：对话信道 Actions + MCP 验证**\n\n```json\n{\"actions\": [\n  {\"type\": \"deliver_document\", \"title\": \"技术方案\", \"platform\": \"local\", \"document_id\": \"doc_xxx\", \"task_id\": \"xxx\"}\n]}\n```\n\n**创建后验证**（必须）：\n```json\n{\"tool\": \"list_my_deliveries\", \"parameters\": {\"status\": \"pending\"}}\n\u002F\u002F 确认交付记录存在，document_id 正确\n```\n\n**方式三：MCP API（自带验证）**\n\n```json\n{\"tool\": \"deliver_document\", \"parameters\": {\n  \"title\": \"技术方案\",\n  \"platform\": \"local\",\n  \"document_id\": \"doc_xxx\",\n  \"task_id\": \"xxx\"\n}}\n\n\u002F\u002F 返回结果包含 delivery_id，可确认创建成功\n```\n\n### 用户审核\n\n用户在交付中心审核后，系统自动更新文档 Front Matter 中的 `delivery_status`、`delivery_reviewer`、`delivery_comment` 字段。\n\n**交付状态流转**：\n\n```\npending → approved (用户批准) → 任务可 completed\n        → rejected (用户拒绝)\n        → revision_needed (需要修改)\n```\n\n**AI 感知审核结果**：心跳巡检时通过 MCP 查询交付状态：\n\n```json\n{\"tool\": \"list_my_deliveries\", \"parameters\": {\"status\": \"revision_needed\"}}\n{\"tool\": \"get_delivery\", \"parameters\": {\"delivery_id\": \"xxx\"}}\n\u002F\u002F 获取 review_comment 了解审核意见\n```\n\n---\n\n## 场景B: Markdown 同步 + MCP 验证\n\n涉及 ≥2 条记录的写操作时，**必须**使用 Markdown 同步，**并使用 MCP 验证结果。\n\n**模板文件位于 `references\u002F` 目录**：\n\n| 模板 | 用途 | 验证方式 |\n|------|------|---------|\n| `task-board.md` | 批量创建\u002F更新任务 | `list_my_tasks` 确认数量 |\n| `schedules.md` | 管理定时调度 | `list_schedules` 确认创建 |\n| `deliveries.md` | 批量提交交付物 | `list_my_deliveries` 确认 |\n\n**语法**：\n- `@成员名` — 分配任务\n- `[[文档名]]` — 关联文档\n- `#task_xxx` — 引用任务\n\n**同步后验证流程**：\n\n```bash\n# 1. 执行文档同步\ncreate_document({ type: \"comind:tasks\", content: \"...\" })\n\n# 2. 验证同步结果\nlist_my_tasks(status: \"todo\")\n# 确认：\n# - 任务数量正确\n# - assignees 正确（@成员名 匹配成功）\n# - project_id 正确（项目名匹配成功）\n\n# 3. 如果验证失败\n# - 检查 Front Matter 格式\n# - 检查成员名\u002F项目名是否存在\n# - 手动通过 MCP API 补救\n```\n\n**常见验证失败原因**：\n\n| 问题 | 原因 | 解决方案 |\n|------|------|---------|\n| 任务数量不足 | 部分行格式错误 | 检查 `- [ ]` 语法 |\n| assignees 为空 | 成员名不存在 | 确认成员名拼写或手动分配 |\n| project_id 为空 | 项目名不存在 | 使用项目 ID 或确认项目存在 |\n| 交付记录未创建 | delivery_status 格式错误 | 确认 YAML 格式正确 |\n\n---\n\n## 场景D: 任务巡检\n\n**触发**：自主检查待处理任务\n\n**必须使用 MCP API**（查询操作不支持 Actions）\n\n```json\n\u002F\u002F 获取待办任务\n{\"tool\": \"list_my_tasks\", \"parameters\": {\"status\": \"todo\"}}\n\n\u002F\u002F 获取所有未完成任务\n{\"tool\": \"list_my_tasks\", \"parameters\": {\"status\": \"all\"}}\n```\n\n> ⚠️ **不要**查看 HEARTBEAT.md — 那是定时任务执行记录，不是任务列表！\n\n---\n\n## 场景E: 对话协作\n\n**触发**：用户在项目\u002F任务\u002F定时任务页面发起对话\n\n**操作选择**：\n- **单条更新** → 对话信道 Actions\n- **批量写操作** → Markdown 同步\n- **查询操作** → MCP API\n\n### 对话信道 Actions 格式\n\n**格式要求**：\n- JSON 块必须位于消息**末尾**\n- 格式：`{\"actions\": [action1, action2, ...]}`\n- 每个 action 必须包含 `type` 字段\n- JSON 会被解析并执行，**不会显示给用户**\n\n**支持的 action 类型**：\n\n| type | 必填字段 | 可选字段 | 说明 |\n|------|---------|---------|------|\n| `update_task_status` | task_id, status | progress, message | 更新任务状态 |\n| `add_comment` | task_id, content | — | 添加任务评论 |\n| `create_check_item` | task_id, text | — | 创建检查项 |\n| `complete_check_item` | task_id, item_id | — | 完成检查项 |\n| `create_document` | title, content | doc_type, project_id | 创建文档 |\n| `update_document` | document_id, content | doc_type | 更新文档 |\n| `deliver_document` | title, platform | document_id, external_url, task_id | 提交文档交付 |\n| `update_status` | status | current_action, task_id, progress | 更新 AI 状态 |\n| `set_queue` | queued_tasks | — | 设置任务队列 |\n| `sync_identity` | — | name, creature, vibe, emoji, avatar | 同步身份信息 |\n| `get_mcp_token` | member_id | — | 获取 MCP Token |\n\n**字段定义**：\n\n```typescript\n\u002F\u002F 任务状态\nstatus: 'todo' | 'in_progress' | 'reviewing' | 'completed'\n\n\u002F\u002F AI 状态\nstatus: 'idle' | 'working' | 'waiting' | 'offline'\n\n\u002F\u002F 文档类型\ndoc_type: 'note' | 'report' | 'decision' | 'scheduled_task' | 'task_list' | 'other'\n\n\u002F\u002F 交付平台\nplatform: 'tencent-doc' | 'feishu' | 'notion' | 'local' | 'other'\n\n\u002F\u002F 任务队列\nqueued_tasks: Array\u003C{ id: string; title: string }>\n```\n\n**示例**：\n\n开始任务：\n```json\n{\"actions\": [\n  {\"type\": \"update_task_status\", \"task_id\": \"GS4FcWg6twz\", \"status\": \"in_progress\"},\n  {\"type\": \"add_comment\", \"task_id\": \"GS4FcWg6twz\", \"content\": \"开始执行任务\"},\n  {\"type\": \"update_status\", \"status\": \"working\", \"task_id\": \"GS4FcWg6twz\"}\n]}\n```\n\n完成任务：\n```json\n{\"actions\": [\n  {\"type\": \"update_task_status\", \"task_id\": \"GS4FcWg6twz\", \"status\": \"completed\"},\n  {\"type\": \"add_comment\", \"task_id\": \"GS4FcWg6twz\", \"content\": \"✅ 任务已完成！\"},\n  {\"type\": \"update_status\", \"status\": \"idle\"}\n]}\n```\n\n提交审核：\n```json\n{\"actions\": [\n  {\"type\": \"deliver_document\", \"title\": \"技术方案\", \"platform\": \"local\", \"document_id\": \"doc_abc\", \"task_id\": \"GS4FcWg6twz\"},\n  {\"type\": \"update_task_status\", \"task_id\": \"GS4FcWg6twz\", \"status\": \"reviewing\"},\n  {\"type\": \"add_comment\", \"task_id\": \"GS4FcWg6twz\", \"content\": \"📄 已提交交付中心\"}\n]}\n```\n\n同步身份：\n```json\n{\"actions\": [\n  {\"type\": \"sync_identity\", \"name\": \"Scout\", \"creature\": \"智能助手\", \"vibe\": \"专业、高效\", \"emoji\": \"🤖\"}\n]}\n```\n\n获取 MCP Token：\n```json\n{\"actions\": [\n  {\"type\": \"get_mcp_token\", \"member_id\": \"member_xxx\"}\n]}\n```\n\n**注意事项**：\n1. JSON 块必须是合法的 JSON 格式\n2. 多个 action 按顺序执行\n3. 某个 action 失败不影响后续执行\n4. 执行结果通过 SSE 广播，前端自动刷新\n\n---\n\n## 场景F: 定时任务执行\n\n**触发**：定时调度器按计划推送\n\n**必须使用 MCP API**（Actions 不支持定时任务管理）\n\n```json\n{\"tool\": \"create_schedule\", \"parameters\": {\n  \"title\": \"每日报告\",\n  \"task_type\": \"report\",\n  \"schedule_type\": \"daily\",\n  \"schedule_time\": \"09:00\"\n}}\n```\n\n---\n\n## 场景G: AI 状态面板\n\n### 工具\n\n| 工具 | 必填参数 | 用途 | 支持方式 |\n|------|---------|------|---------|\n| `update_status` | status | 状态+进度 | Actions \u002F MCP API |\n| `set_queue` | queued_tasks | 任务队列 | Actions \u002F MCP API |\n| `set_do_not_disturb` | interruptible | 免打扰模式 | **仅 MCP API** |\n\n### 状态值\n\n| status | 含义 |\n|--------|------|\n| `idle` | 空闲，可接新任务 |\n| `working` | 执行任务中 |\n| `waiting` | 等待用户回复\u002F外部资源 |\n| `offline` | 离线 |\n\n### 状态切换规则\n\n- 接到任务 → `working`\n- 执行中 → `working` + `progress`\n- 需要提问 → `waiting`\n- 完成任务 → `idle`\n\n---\n\n## API 调用方式\n\n- **端点**：`POST ${COMIND_BASE_URL}\u002Fapi\u002Fmcp\u002Fexternal`\n- **鉴权**：`Authorization: Bearer ${COMIND_API_TOKEN}`\n- **member_id** 自动注入\n\n单个调用：\n```json\n{\"tool\": \"update_task_status\", \"parameters\": {\"task_id\": \"xxx\", \"status\": \"in_progress\"}}\n```\n\n批量调用：\n```json\n{\"batch\": [\n  {\"tool\": \"update_task_status\", \"parameters\": {\"task_id\": \"xxx\", \"status\": \"in_progress\"}},\n  {\"tool\": \"update_status\", \"parameters\": {\"status\": \"working\", \"task_id\": \"xxx\"}}\n]}\n```\n\n---\n\n## 工具速查\n\n### 查询工具（仅 MCP API，用于验证）\n\n| 工具 | 必填参数 | 用途 | 验证场景 |\n|------|---------|------|---------|\n| `list_my_tasks` | status (可选) | 获取分配给当前成员的任务 | 验证批量创建任务 |\n| `get_task` | task_id | 获取任务详情 | 验证状态变更 |\n| `get_document` | document_id 或 title | 获取文档 | 验证文档创建 |\n| `search_documents` | query | 搜索文档 | 验证文档同步 |\n| `get_project` | project_id | 获取项目详情 | 验证项目上下文 |\n| `list_my_deliveries` | status (可选) | 获取当前成员的交付物列表 | **验证交付创建** |\n| `get_delivery` | delivery_id | 获取交付物详情（含审核意见） | **验证交付状态** |\n\n### 写入工具（Actions \u002F MCP API）\n\n| 工具 | 必填参数 | 支持方式 | 用途 | 是否需要验证 |\n|------|---------|---------|------|-------------|\n| `update_task_status` | task_id, status | Actions \u002F MCP API | 更新任务状态 | ✅ `get_task` 验证 |\n| `add_task_comment` | task_id, content | Actions \u002F MCP API | 添加评论 | ❌ 不需要 |\n| `create_check_item` | task_id, text | Actions \u002F MCP API | 创建检查项 | ✅ `get_task` 验证 |\n| `complete_check_item` | task_id, item_id | Actions \u002F MCP API | 完成检查项 | ✅ `get_task` 验证 |\n| `create_document` | title, content | Actions \u002F MCP API | 创建文档 | ✅ `get_document` 验证 |\n| `update_document` | document_id, content | Actions \u002F MCP API | 更新文档 | ✅ `get_document` 验证 |\n| `deliver_document` | title, platform | Actions \u002F MCP API | 提交交付 | ✅ `list_my_deliveries` 验证 |\n| `update_status` | status | Actions \u002F MCP API | AI 状态面板 | ❌ 不需要 |\n| `set_queue` | queued_tasks | Actions \u002F MCP API | 任务队列 | ❌ 不需要 |\n| `sync_identity` | — | Actions | 同步身份信息 | ❌ 不需要 |\n| `get_mcp_token` | member_id | Actions | 获取 MCP Token | ❌ 不需要 |\n\n### 管理\u002F配置工具（仅 MCP API）\n\n| 工具 | 必填参数 | 用途 |\n|------|---------|------|\n| `set_do_not_disturb` | interruptible | 免打扰模式 |\n| `create_schedule` | title, task_type, schedule_type | 创建定时任务 |\n| `list_schedules` | — | 列出定时任务 |\n| `delete_schedule` | schedule_id | 删除定时任务 |\n| `update_schedule` | schedule_id, ... | 更新定时任务 |\n| `register_member` | name, endpoint | AI 自注册 |\n| `review_delivery` | delivery_id, status | 审核交付（人类操作） |\n\n### 验证工具选择指南\n\n```\n操作类型                    验证工具\n─────────────────────────────────────────\n状态变更 (update_task_status)  → get_task\n批量创建任务                   → list_my_tasks\n创建\u002F更新文档                  → get_document \u002F search_documents\n提交交付                       → list_my_deliveries + get_delivery\n定时任务                       → list_schedules\n```\n\n---\n\n## 枚举值\n\n| 字段 | 值 |\n|------|---|\n| 任务状态 | todo, in_progress, reviewing, completed |\n| 优先级 | high, medium, low |\n| AI 状态 | idle, working, waiting, offline |\n| 文档类型 | note, report, decision, scheduled_task, task_list, other |\n| 交付平台 | tencent-doc, feishu, notion, local, other |\n| 审核结果 | approved, rejected, revision_needed |\n| 定时周期 | once, daily, weekly, monthly |\n| 定时类型 | report, summary, backup, notification, custom |\n","# CoMind AI 成员操作手册\n\n> **版本**: v2.2.4\n\n作为 CoMind 协作平台的 AI 成员，按照本文档定义的流程执行所有操作。\n\n## 环境变量\n\n| 变量 | 说明 |\n|------|------|\n| `COMIND_BASE_URL` | CoMind 实例地址（如 `http:\u002F\u002Flocalhost:3000`） |\n| `COMIND_API_TOKEN` | MCP External API 鉴权 Token |\n\n### 配置获取方式\n\n#### 方式一：WebSocket 主动请求（推荐）\n\n当 CoMind 已与 OpenClaw Gateway 建立 WebSocket 连接时，Gateway 可主动请求 MCP 配置：\n\n```javascript\n\u002F\u002F Gateway 发送事件请求配置\n{ type: 'event', event: 'comind.config.request', id: 'req-xxx' }\n\n\u002F\u002F CoMind 响应\n{ type: 'res', id: 'req-xxx', ok: true, payload: { baseUrl: 'http:\u002F\u002Flocalhost:3000', apiToken: 'xxx' } }\n```\n\n#### 方式二：手动配置\n\n在 OpenClaw 的 systemd 服务文件或环境变量中配置：\n\n```bash\n# \u002Fetc\u002Fsystemd\u002Fsystem\u002Fopenclaw.service 或 .env\nCOMIND_BASE_URL=http:\u002F\u002Flocalhost:3000\nCOMIND_API_TOKEN=your_api_token_here\n```\n\n#### 获取 API Token\n\n1. 登录 CoMind 平台\n2. 进入「成员管理」页面\n3. 找到对应的 AI 成员，点击编辑\n4. 复制或生成 `openclawApiToken`\n\n或通过 API 查询：\n```bash\n# 查询 AI 成员列表（需要管理员权限）\ncurl http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fmembers | jq '.[] | select(.type==\"ai\")'\n\n# 为成员生成 Token\ncurl -X PUT http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fmembers\u002F{member_id} \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"openclawApiToken\": \"your-new-token\"}'\n```\n\n---\n\n## 🚨 关键：三种交互通道架构\n\nCoMind 提供三种与 Agent 交互的通道，**MCP API 是核心通道和兜底保障**：\n\n```\n┌─────────────────────────────────────────────────────────────────────┐\n│                    CoMind Agent 交互通道架构                         │\n├─────────────────────────────────────────────────────────────────────┤\n│                                                                     │\n│   ┌──────────────┐     ┌──────────────┐     ┌──────────────┐       │\n│   │  对话信道    │     │   MCP API    │     │  文档同步    │       │\n│   │  (高效)      │     │  (可靠)      │     │  (便捷)      │       │\n│   └──────┬───────┘     └──────┬───────┘     └──────┬───────┘       │\n│          │                    │                    │                │\n│          │     ┌──────────────┴──────────────┐     │                │\n│          │     │         能力边界             │     │                │\n│          │     │  • 依赖 WebSocket 连接       │     │                │\n│          │     │  • 解析失败静默丢弃          │     │  • Front Matter 格式要求    │\n│          │     │  • 无显式错误反馈            │     │  • 同步失败仅日志           │\n│          │     │  • 能力子集                  │     │  • 无即时验证               │\n│          └─────┴─────────────────────────────┴─────┘                │\n│                              │                                      │\n│                              ▼                                      │\n│                    ┌─────────────────┐                              │\n│                    │   MCP API 兜底   │ ← 最可靠的验证通道           │\n│                    │   • 显式错误返回 │                              │\n│                    │   • 审计日志    │                              │\n│                    │   • 限流保护    │                              │\n│                    │   • 独立 HTTP   │                              │\n│                    └─────────────────┘                              │\n└─────────────────────────────────────────────────────────────────────┘\n```\n\n---\n\n### 通道一：对话信道 Actions（高效，但有边界）\n\n**触发方式**：AI 在对话回复末尾嵌入 `{\"actions\": [...]}` JSON 块\n\n**执行链路**：\n```\nAI 回复 → Gateway 推送 chat 事件 → CoMind 解析 Actions → 执行 → SSE 广播结果\n```\n\n**可靠性机制**：\n- ✅ 幂等性：`idempotencyKey` 防止重复执行\n- ✅ 批量执行：多个 action 顺序执行，失败不影响后续\n- ✅ 结果回传：执行结果自动回传给 AI（通过对话）\n\n**能力边界**（重要！）：\n- ❌ **依赖 WebSocket 连接**：Gateway 断连时 Actions 无法执行\n- ❌ **解析失败静默丢弃**：JSON 格式错误时无显式错误反馈\n- ❌ **操作子集**：仅支持写入操作，不支持查询\n- ❌ **无验证机制**：无法确认操作是否真正成功\n\n**适用场景**：\n- 对话中更新任务状态、添加评论\n- 与用户交互时即时反馈\n- **不适合**：关键操作、需要确认的操作\n\n---\n\n### 通道二：MCP API（核心通道，可靠兜底）\n\n**触发方式**：HTTP POST `\u002Fapi\u002Fmcp\u002Fexternal`，Bearer Token 鉴权\n\n**执行链路**：\n```\nAI 请求 → 鉴权 → 审计日志 → 执行 → 返回结果\n```\n\n**可靠性机制**（与其他通道的关键差异）：\n- ✅ **显式错误返回**：`{ success: false, error: \"具体错误原因\" }`\n- ✅ **审计日志**：所有调用记录到数据库，可追溯\n- ✅ **限流保护**：防止滥用，自动降级\n- ✅ **独立 HTTP 协议**：不依赖 WebSocket 连接状态\n- ✅ **完整操作集**：支持所有查询和写入操作\n- ✅ **身份自动注入**：`member_id` 自动填充，防止伪造\n\n**为什么 MCP 是兜底通道**：\n\n| 场景 | 其他通道问题 | MCP 兜底方案 |\n|------|-------------|-------------|\n| 文档同步创建任务后 | 无即时验证，不知道是否成功 | `get_task(task_id)` 确认存在 |\n| Actions 执行后 | 无错误反馈，可能静默失败 | `get_task(task_id)` 验证状态 |\n| 关键状态变更 | 可能因断连丢失 | MCP 独立请求，确保送达 |\n| 批量操作验证 | 同步失败仅日志 | `list_my_tasks` 验证结果 |\n\n---\n\n### 通道三：文档自动扫描同步（便捷，需验证）\n\n**触发方式**：创建\u002F更新包含特殊 Front Matter 的 Markdown 文档\n\n**执行链路**：\n```\nAI 创建文档 → API 保存 → syncMarkdownToDatabase() → 解析 Front Matter → 写入数据库\n```\n\n**支持的同步类型**：\n\n| Front Matter type | 同步目标 | 说明 |\n|-------------------|---------|------|\n| `comind:tasks` \u002F `task_list` | tasks 表 | 批量创建\u002F更新任务 |\n| `comind:schedules` | schedules 表 | 创建定时任务 |\n| `delivery_status: pending` | deliveries 表 | 创建交付记录 |\n\n**可靠性机制**：\n- ✅ 防循环同步：标记正在同步的文档 ID\n- ✅ 成员名自动匹配：`@成员名` → `memberId`\n- ✅ 项目名自动匹配：项目名 → `projectId`\n\n**能力边界**：\n- ❌ **Front Matter 格式要求严格**：解析失败无反馈\n- ❌ **同步失败仅记录日志**：AI 无法获知失败原因\n- ❌ **无即时验证**：无法在创建时确认结果\n\n**适用场景**：\n- 批量创建任务（≥2 条）\n- 批量提交交付物\n- **必须配合 MCP 验证**：同步后调用 MCP 确认结果\n\n---\n\n### 三通道协同模式：便捷 + 验证\n\n**模式一：文档同步 + MCP 验证**\n\n```bash\n# 1. 通过文档同步创建任务（便捷）\ncreate_document({\n  title: \"任务看板\",\n  content: \"---\ntype: comind:tasks\nproject: 项目名\n---\n- [ ] 任务1 @AI成员\n- [ ] 任务2 @AI成员\"\n})\n\n# 2. 通过 MCP 验证创建结果（可靠）\nlist_my_tasks(status: \"todo\") → 确认任务数量正确\nget_task(task_id: \"xxx\") → 确认任务详情正确\n```\n\n**模式二：对话 Actions + MCP 验证**\n\n```bash\n# 1. 通过对话 Actions 更新状态（高效）\n{\"actions\": [{\"type\": \"update_task_status\", \"task_id\": \"xxx\", \"status\": \"in_progress\"}]}\n\n# 2. 通过 MCP 验证更新结果（可靠）\nget_task(task_id: \"xxx\") → 确认 status 已变为 in_progress\n```\n\n**模式三：交付提交 + MCP 验证**\n\n```bash\n# 1. 通过 Front Matter 提交交付（便捷）\ncreate_document({\n  title: \"技术方案\",\n  content: \"---\ndelivery_status: pending\ndelivery_assignee: AI成员名\nrelated_tasks: [task_xxx]\n---\n# 技术方案内容...\"\n})\n\n# 2. 通过 MCP 验证交付记录（可靠）\nget_delivery(delivery_id: \"xxx\") → 确认交付记录已创建\nlist_my_deliveries(status: \"pending\") → 确认在待审核队列中\n```\n\n---\n\n### 方法选择决策树\n\n```\n需要执行操作\n│\n├─ 是否需要 100% 确认结果？\n│   └─ YES → 使用 MCP API（唯一可靠通道）\n│\n├─ 是否在对话中回复用户？\n│   ├─ YES → 操作是否支持对话信道 Actions？\n│   │         ├─ YES → 使用 Actions（便捷）+ MCP 验证（可靠）\n│   │         └─ NO  → 使用 MCP API\n│   │\n│   └─ NO → 是否批量写入 ≥2 条记录？\n│             ├─ YES → Markdown 同步 + MCP 验证\n│             └─ NO  → MCP API 单条操作\n```\n\n---\n\n### ⚠️ 能力限制对比表\n\n**对话信道 Actions 支持的操作**：\n- ✅ `update_task_status` — 更新任务状态\n- ✅ `add_comment` — 添加任务评论\n- ✅ `create_check_item` — 创建检查项\n- ✅ `complete_check_item` — 完成检查项\n- ✅ `create_document` — 创建文档\n- ✅ `update_document` — 更新文档\n- ✅ `deliver_document` — 提交文档交付\n- ✅ `update_status` — 更新 AI 状态\n- ✅ `set_queue` — 设置任务队列\n- ✅ `sync_identity` — 同步身份信息到 IDENTITY.md\n- ✅ `get_mcp_token` — 获取 MCP API Token\n\n**对话信道 Actions 不支持的操作**（必须用 MCP API）：\n- ❌ `set_do_not_disturb` — 免打扰模式\n- ❌ `create_schedule` \u002F `update_schedule` \u002F `delete_schedule` — 定时任务管理\n- ❌ `review_delivery` — 审核交付（人类操作）\n- ❌ `get_task` \u002F `get_document` \u002F `search_documents` — 查询操作\n- ❌ `get_project` \u002F `list_my_tasks` — 查询操作\n- ❌ `register_member` — 成员注册\n\n**对话信道 Actions 支持的操作**：\n- ✅ `update_task_status` — 更新任务状态\n- ✅ `add_comment` — 添加任务评论\n- ✅ `create_check_item` — 创建检查项\n- ✅ `complete_check_item` — 完成检查项\n- ✅ `create_document` — 创建文档\n- ✅ `update_document` — 更新文档\n- ✅ `deliver_document` — 提交文档交付\n- ✅ `update_status` — 更新 AI 状态\n- ✅ `set_queue` — 设置任务队列\n- ✅ `sync_identity` — 同步身份信息到 IDENTITY.md\n- ✅ `get_mcp_token` — 获取 MCP API Token\n\n**对话信道 Actions 不支持的操作**（必须用 MCP API）：\n- ❌ `set_do_not_disturb` — 免打扰模式\n- ❌ `create_schedule` \u002F `update_schedule` \u002F `delete_schedule` — 定时任务管理\n- ❌ `review_delivery` — 审核交付（人类操作）\n- ❌ `get_task` \u002F `get_document` \u002F `search_documents` — 查询操作\n- ❌ `get_project` \u002F `list_my_tasks` — 查询操作\n- ❌ `register_member` — 成员注册\n- ❌ `list_my_deliveries` \u002F `get_delivery` — 交付查询\n\n---\n\n## 内置 MCP 调用脚本\n\n为提高 Agent 调用 MCP API 的效率和可靠性，Skill 内置以下调用脚本模板：\n\n### 基础调用模板\n\n```bash\n# 环境变量（由 Agent 自动注入）\nCOMIND_BASE_URL=\"${COMIND_BASE_URL:-http:\u002F\u002Flocalhost:3000}\"\nCOMIND_API_TOKEN=\"${COMIND_API_TOKEN}\"\n\n# 通用调用函数\nmcp_call() {\n  local tool=\"$1\"\n  local params=\"$2\"\n  \n  curl -s -X POST \"${COMIND_BASE_URL}\u002Fapi\u002Fmcp\u002Fexternal\" \\\n    -H \"Authorization: Bearer ${COMIND_API_TOKEN}\" \\\n    -H \"Content-Type: application\u002Fjson\" \\\n    -d \"{\\\"tool\\\": \\\"${tool}\\\", \\\"parameters\\\": ${params}}\"\n}\n```\n\n### 高频操作脚本\n\n#### 验证任务创建\u002F更新\n\n```bash\n# 文档同步创建任务后验证\nverify_task() {\n  local task_id=\"$1\"\n  local expected_status=\"${2:-todo}\"\n  \n  result=$(mcp_call \"get_task\" \"{\\\"task_id\\\": \\\"${task_id}\\\"}\")\n  \n  if echo \"$result\" | jq -e '.success == true' > \u002Fdev\u002Fnull; then\n    actual_status=$(echo \"$result\" | jq -r '.data.status')\n    if [ \"$actual_status\" = \"$expected_status\" ]; then\n      echo \"✅ 任务验证成功: $task_id 状态为 $actual_status\"\n      return 0\n    else\n      echo \"⚠️ 任务状态不符: 期望 $expected_status，实际 $actual_status\"\n      return 1\n    fi\n  else\n    echo \"❌ 任务验证失败: $(echo \"$result\" | jq -r '.error')\"\n    return 1\n  fi\n}\n```\n\n#### 验证交付记录创建\n\n```bash\n# Front Matter 提交交付后验证\nverify_delivery() {\n  local document_id=\"$1\"\n  \n  # 先查询该文档关联的交付记录\n  result=$(mcp_call \"list_my_deliveries\" \"{\\\"status\\\": \\\"all\\\"}\")\n  \n  delivery_id=$(echo \"$result\" | jq -r \".data.deliveries[] | select(.document_id == \\\"${document_id}\\\") | .id\")\n  \n  if [ -n \"$delivery_id\" ]; then\n    echo \"✅ 交付记录已创建: $delivery_id\"\n    \n    # 获取详情确认\n    detail=$(mcp_call \"get_delivery\" \"{\\\"delivery_id\\\": \\\"${delivery_id}\\\"}\")\n    echo \"交付状态: $(echo \"$detail\" | jq -r '.data.status')\"\n    return 0\n  else\n    echo \"❌ 未找到关联的交付记录\"\n    return 1\n  fi\n}\n```\n\n#### 批量操作验证\n\n```bash\n# 文档同步批量创建任务后验证\nverify_bulk_tasks() {\n  local expected_count=\"$1\"\n  local project_id=\"$2\"\n  \n  result=$(mcp_call \"list_my_tasks\" \"{\\\"status\\\": \\\"todo\\\"}\")\n  actual_count=$(echo \"$result\" | jq '.data.tasks | length')\n  \n  if [ \"$actual_count\" -ge \"$expected_count\" ]; then\n    echo \"✅ 批量任务验证成功: 创建了 $actual_count 个任务\"\n    return 0\n  else\n    echo \"⚠️ 任务数量不足: 期望 $expected_count，实际 $actual_count\"\n    return 1\n  fi\n}\n```\n\n#### 状态更新验证\n\n```bash\n# Actions 更新状态后验证\nverify_status_update() {\n  local task_id=\"$1\"\n  local expected_status=\"$2\"\n  local max_retries=3\n  local retry=0\n  \n  while [ $retry -lt $max_retries ]; do\n    result=$(mcp_call \"get_task\" \"{\\\"task_id\\\": \\\"${task_id}\\\"}\")\n    actual_status=$(echo \"$result\" | jq -r '.data.status \u002F\u002F empty')\n    \n    if [ \"$actual_status\" = \"$expected_status\" ]; then\n      echo \"✅ 状态验证成功: $task_id → $actual_status\"\n      return 0\n    fi\n    \n    retry=$((retry + 1))\n    sleep 1\n  done\n  \n  echo \"❌ 状态验证失败: 期望 $expected_status，实际 $actual_status\"\n  return 1\n}\n```\n\n### 错误处理模板\n\n```bash\n# 带重试的 MCP 调用\nmcp_call_with_retry() {\n  local tool=\"$1\"\n  local params=\"$2\"\n  local max_retries=\"${3:-3}\"\n  local retry=0\n  \n  while [ $retry -lt $max_retries ]; do\n    result=$(mcp_call \"$tool\" \"$params\")\n    \n    if echo \"$result\" | jq -e '.success == true' > \u002Fdev\u002Fnull; then\n      echo \"$result\"\n      return 0\n    fi\n    \n    error=$(echo \"$result\" | jq -r '.error')\n    \n    # 限流错误，等待重试\n    if echo \"$error\" | grep -q \"rate limit\"; then\n      sleep $((2 ** retry))\n      retry=$((retry + 1))\n      continue\n    fi\n    \n    # 其他错误，直接返回\n    echo \"$result\"\n    return 1\n  done\n  \n  echo '{\"success\": false, \"error\": \"Max retries exceeded\"}'\n  return 1\n}\n```\n\n---\n\n## 验证场景清单\n\n以下场景**必须**使用 MCP 验证：\n\n### 场景 1：文档同步创建任务\n\n```yaml\n操作: create_document({ type: \"comind:tasks\", ... })\n验证: list_my_tasks() → 确认任务数量和内容\n原因: Front Matter 解析失败静默，需显式验证\n```\n\n### 场景 2：文档同步创建交付\n\n```yaml\n操作: create_document({ delivery_status: \"pending\", ... })\n验证: list_my_deliveries(status: \"pending\") → 确认交付记录存在\n原因: 交付记录关联复杂，需确认 memberId、documentId 正确\n```\n\n### 场景 3：对话 Actions 更新状态\n\n```yaml\n操作: {\"actions\": [{\"type\": \"update_task_status\", ...}]}\n验证: get_task(task_id) → 确认状态已变更\n原因: WebSocket 断连时 Actions 可能丢失\n```\n\n### 场景 4：批量操作\n\n```yaml\n操作: 文档同步批量创建 N 条记录\n验证: list_my_tasks() \u002F list_my_deliveries() → 确认数量\n原因: 部分记录可能因解析失败被跳过\n```\n\n### 场景 5：关键状态变更\n\n```yaml\n操作: 任务完成 \u002F 交付提交 \u002F 状态切换\n验证: get_task() \u002F get_delivery() → 确认状态\n原因: 关键操作需 100% 确认成功\n```\n\n### 场景 6：跨系统同步\n\n```yaml\n操作: 外部文档系统同步到 CoMind\n验证: search_documents(query) → 确认文档已同步\n原因: 外部系统可能延迟或失败\n```\n\n---\n\n## 决策流程图（更新版）\n\n### 场景与方法映射\n\n| 场景 | 推荐方法 | 原因 |\n|------|---------|------|\n| 用户对话中更新任务状态 | 对话信道 Actions | 一次回复完成，无需额外请求 |\n| 任务推送后更新状态 | 对话信道 Actions | 回复即执行，用户可见进度 |\n| 用户对话中查询任务 | MCP API | 查询操作不支持 Actions |\n| 批量创建任务 | Markdown 同步 | 一次调用创建多条记录 |\n| 定时任务管理 | MCP API | Actions 不支持定时任务 |\n| 获取待办任务列表 | MCP API (`list_my_tasks`) | 查询操作不支持 Actions |\n\n---\n\n## 决策树\n\n```\n收到指令\n├─ task-push 模板 → 场景A: 执行任务（必须在对话中汇报进展）\n├─ chat-* 模板   → 场景E: 对话协作\n├─ 需要全局上下文 → 读取 references\u002Fsystem-info.md 模板格式，调 API 获取数据\n└─ 自主巡检      → 场景D: 任务巡检\n\n执行中:\n├─ 批量写操作(≥2条) → Markdown 同步\n├─ 单字段更新       → 对话信道 Actions 或 MCP API\n├─ 状态面板         → 对话信道 Actions 或 MCP API\n├─ 查询数据         → MCP API\n├─ 关键进展         → 在对话中主动汇报\n└─ 完成             → 在对话中汇报总结 + update_task_status(completed) + update_status(idle)\n```\n\n---\n\n## 实体映射\n\nMarkdown 文档与 CoMind 数据库的自动映射规则：\n\n| Markdown 元素 | CoMind 表 | 映射规则 |\n|--------------|----------|---------|\n| 文档 | documents | title 从 Front Matter 或 H1 解析 |\n| 任务行 | tasks | 按标题匹配，自动创建\u002F更新 |\n| `@成员名` | members | 按名称模糊匹配，转 ID 存入 assignees |\n| `[[文档名]]` | documents | 按标题匹配，建立关联关系 |\n| `#task_xxx` | tasks | 精确 ID 引用或标题模糊匹配 |\n| Front Matter | 各表字段 | 自动解析填充 |\n\n### Front Matter 字段映射\n\n```yaml\n# 必填字段\ntitle: 文档标题          # → documents.title\ntype: report            # → documents.docType\nproject: comind-v2      # → documents.projectId（按项目名匹配）\ncreated: 2026-02-18     # → documents.createdAt\nupdated: 2026-02-18     # → documents.updatedAt\n\n# 可选字段\ntags: [标签]            # → documents.tags\nrelated_tasks: [task_id] # → 关联任务\ncontains_tasks: true    # → 触发任务解析\ntask_assignees: [成员]   # → 任务默认分配\n\n# 交付字段（有 delivery_status 即自动创建交付记录）\ndelivery_status: pending      # → deliveries.status（pending | approved | rejected | revision_needed）\ndelivery_assignee: AI成员名   # → deliveries.memberId（按成员名匹配）\ndelivery_platform: local      # → deliveries.platform（local | tencent-doc | feishu | notion | other）\ndelivery_version: 1           # → deliveries.version\ndelivery_reviewer: 人类成员名 # → deliveries.reviewerId（审核人填写）\ndelivery_comment: 审核意见    # → deliveries.reviewComment（审核人填写）\n```\n\n> **交付说明**：文档 Front Matter 中存在 `delivery_status` 字段时，系统自动创建\u002F更新交付记录。\n> - `pending`：进入交付中心待审核队列\n> - `approved`：已通过审核\n> - `rejected`：已驳回\n> - `revision_needed`：需要修改\n\n### 任务状态映射\n\n| 语法 | 状态 | 优先级 |\n|------|------|--------|\n| `- [ ]` | todo | medium |\n| `- [!]` | todo | high |\n| `- [-]` | todo | low |\n| `- [~]` | in_progress | - |\n| `- [?]` | reviewing | - |\n| `- [x]` | completed | - |\n\n---\n\n## 场景A: 执行任务\n\n**触发**：收到 task-push 推送（含 task_id、title、description、项目上下文）\n\n> ⚠️ **关键警告**\n> - 开始执行前**必须**先更新状态为 `in_progress`\n> - 完成工作后**必须**更新状态为 `completed` 或 `reviewing`\n> - 仅创建笔记\u002F文档 ≠ 完成任务，必须更新状态才能结束！\n> - **必须在对话中主动汇报工作进展，不能默默执行！**\n> - **关键操作后必须用 MCP 验证结果！**\n\n### 汇报规范\n\n| 阶段 | 要求 |\n|------|------|\n| 收到任务 | 在对话中确认收到，简述执行计划 |\n| 执行过程 | 遇到关键节点或重要发现时，主动在对话中汇报 |\n| 完成时 | 在对话中发送完成总结：做了什么、产出了什么 |\n| 遇到问题 | 立即在对话中说明问题和处理方案 |\n\n**回复风格**：简洁明了，像同事沟通，重要信息加粗。\n\n**流程**：\n\n### 1. 【必须】确认收到 + 接受任务 + 验证\n\n先在对话中简短确认收到任务、说明执行计划，然后执行 Actions：\n\n```json\n{\"actions\": [\n  {\"type\": \"update_task_status\", \"task_id\": \"xxx\", \"status\": \"in_progress\"},\n  {\"type\": \"update_status\", \"status\": \"working\", \"current_action\": \"开始执行\", \"task_id\": \"xxx\"}\n]}\n```\n\n**验证**（使用 MCP API 确认状态变更）：\n```json\n{\"tool\": \"get_task\", \"parameters\": {\"task_id\": \"xxx\"}}\n\u002F\u002F 确认返回的 status 为 \"in_progress\"\n```\n\n### 2. 获取上下文（可选）\n\n**必须使用 MCP API**（查询操作不支持 Actions）\n\n```json\n{\"tool\": \"get_task\", \"parameters\": {\"task_id\": \"xxx\"}}\n{\"tool\": \"get_project\", \"parameters\": {\"project_id\": \"xxx\"}}\n```\n\n### 3. 分解子任务 + 验证\n\n- **≥2项**：Markdown 同步（`create_document` + `comind:tasks` frontmatter）**+ MCP 验证**\n- **≤2项**：MCP API 或 Actions（`create_check_item`）\n\n**批量创建任务后验证**：\n```json\n{\"tool\": \"list_my_tasks\", \"parameters\": {\"status\": \"todo\"}}\n\u002F\u002F 确认任务数量和内容正确\n```\n\n### 4. 执行 + 汇报\n\n执行过程中如有重要进展，**在对话中主动汇报**，同时通过 Actions 记录：\n\n```json\n{\"actions\": [\n  {\"type\": \"add_comment\", \"task_id\": \"xxx\", \"content\": \"进展：正在分析需求...\"},\n  {\"type\": \"update_status\", \"status\": \"working\", \"progress\": 30}\n]}\n```\n\n### 5. 产出交付物 + 验证\n\n- **Markdown 同步**：`create_document` 写内容 + `comind:deliveries` 批量提交\n- **单个交付**：Actions 或 MCP API `deliver_document`\n\n**创建交付物后验证**：\n```json\n{\"tool\": \"list_my_deliveries\", \"parameters\": {\"status\": \"pending\"}}\n\u002F\u002F 确认交付记录已创建，document_id 正确关联\n```\n\n### 6. 【必须】完成任务 + 汇报结果 + 验证\n\n**情况A：无需用户决策**\n\n在对话中汇报完成总结，然后执行：\n\n```json\n{\"actions\": [\n  {\"type\": \"update_task_status\", \"task_id\": \"xxx\", \"status\": \"completed\"},\n  {\"type\": \"add_comment\", \"task_id\": \"xxx\", \"content\": \"✅ 任务已完成！\"},\n  {\"type\": \"update_status\", \"status\": \"idle\"}\n]}\n```\n\n**验证**：\n```json\n{\"tool\": \"get_task\", \"parameters\": {\"task_id\": \"xxx\"}}\n\u002F\u002F 确认 status 为 \"completed\"\n```\n\n**情况B：需要用户审核**（文档交付场景）\n\n在对话中说明已提交交付、等待审核，然后执行：\n\n```json\n{\"actions\": [\n  {\"type\": \"deliver_document\", \"title\": \"技术方案\", \"platform\": \"local\", \"document_id\": \"doc_xxx\", \"task_id\": \"xxx\"},\n  {\"type\": \"update_task_status\", \"task_id\": \"xxx\", \"status\": \"reviewing\"},\n  {\"type\": \"add_comment\", \"task_id\": \"xxx\", \"content\": \"📄 已提交交付中心，等待审核\"}\n]}\n```\n\n**验证**：\n```json\n{\"tool\": \"get_task\", \"parameters\": {\"task_id\": \"xxx\"}}\n\u002F\u002F 确认 status 为 \"reviewing\"\n\n{\"tool\": \"list_my_deliveries\", \"parameters\": {\"status\": \"pending\"}}\n\u002F\u002F 确认交付记录已创建\n```\n\n> ⚠️ **重要**：提交交付后状态必须设为 `reviewing`，不能设为 `completed`！\n\n**完成标准检查清单**：\n- [ ] 已在对话中确认收到任务\n- [ ] 状态已更新为 `completed` 或 `reviewing`\n- [ ] **已通过 MCP 验证状态变更成功**\n- [ ] 交付物已提交（如有产出）\n- [ ] **已通过 MCP 验证交付记录创建成功**\n- [ ] 已在对话中汇报完成总结\n\n---\n\n## 场景A2: 文档交付\n\n**何时需要提交文档交付？**\n\n| 文档类型 | 说明 | 必须提交 |\n|---------|------|---------|\n| 决策文档 | 技术选型、架构方案 | ✅ 是 |\n| 审核文档 | 预算报告、合同草案 | ✅ 是 |\n| 外部发布 | 公众号文章、产品公告 | ✅ 是 |\n| 临时笔记 | 学习笔记、过程记录 | ❌ 否 |\n| 工作日志 | 过程记录、信息整理 | ❌ 否 |\n\n### 创建交付物的方式 + 验证\n\n**方式一：文档 Front Matter（推荐）+ MCP 验证**\n\n在创建文档时添加 `delivery_status` 字段，系统自动创建交付记录：\n\n```yaml\n---\ntitle: 技术方案\ntype: decision\nproject: 项目名\ncreated: 2026-02-24T10:00:00Z\nupdated: 2026-02-24T10:00:00Z\n\n# 交付字段\ndelivery_status: pending\ndelivery_assignee: 你的名字\ndelivery_platform: local\ndelivery_version: 1\nrelated_tasks: [task_xxx]\n---\n\n# 技术方案内容...\n```\n\n**创建后验证**（必须）：\n```json\n\u002F\u002F 验证交付记录已创建\n{\"tool\": \"list_my_deliveries\", \"parameters\": {\"status\": \"pending\"}}\n\n\u002F\u002F 验证文档关联正确\n{\"tool\": \"get_delivery\", \"parameters\": {\"delivery_id\": \"从上面返回的 ID\"}}\n\u002F\u002F 确认 document_id、task_id 关联正确\n```\n\n**方式二：对话信道 Actions + MCP 验证**\n\n```json\n{\"actions\": [\n  {\"type\": \"deliver_document\", \"title\": \"技术方案\", \"platform\": \"local\", \"document_id\": \"doc_xxx\", \"task_id\": \"xxx\"}\n]}\n```\n\n**创建后验证**（必须）：\n```json\n{\"tool\": \"list_my_deliveries\", \"parameters\": {\"status\": \"pending\"}}\n\u002F\u002F 确认交付记录存在，document_id 正确\n```\n\n**方式三：MCP API（自带验证）**\n\n```json\n{\"tool\": \"deliver_document\", \"parameters\": {\n  \"title\": \"技术方案\",\n  \"platform\": \"local\",\n  \"document_id\": \"doc_xxx\",\n  \"task_id\": \"xxx\"\n}}\n\n\u002F\u002F 返回结果包含 delivery_id，可确认创建成功\n```\n\n### 用户审核\n\n用户在交付中心审核后，系统自动更新文档 Front Matter 中的 `delivery_status`、`delivery_reviewer`、`delivery_comment` 字段。\n\n**交付状态流转**：\n\n```\npending → approved (用户批准) → 任务可 completed\n        → rejected (用户拒绝)\n        → revision_needed (需要修改)\n```\n\n**AI 感知审核结果**：心跳巡检时通过 MCP 查询交付状态：\n\n```json\n{\"tool\": \"list_my_deliveries\", \"parameters\": {\"status\": \"revision_needed\"}}\n{\"tool\": \"get_delivery\", \"parameters\": {\"delivery_id\": \"xxx\"}}\n\u002F\u002F 获取 review_comment 了解审核意见\n```\n\n---\n\n## 场景B: Markdown 同步 + MCP 验证\n\n涉及 ≥2 条记录的写操作时，**必须**使用 Markdown 同步，**并使用 MCP 验证结果。\n\n**模板文件位于 `references\u002F` 目录**：\n\n| 模板 | 用途 | 验证方式 |\n|------|------|---------|\n| `task-board.md` | 批量创建\u002F更新任务 | `list_my_tasks` 确认数量 |\n| `schedules.md` | 管理定时调度 | `list_schedules` 确认创建 |\n| `deliveries.md` | 批量提交交付物 | `list_my_deliveries` 确认 |\n\n**语法**：\n- `@成员名` — 分配任务\n- `[[文档名]]` — 关联文档\n- `#task_xxx` — 引用任务\n\n**同步后验证流程**：\n\n```bash\n# 1. 执行文档同步\ncreate_document({ type: \"comind:tasks\", content: \"...\" })\n\n# 2. 验证同步结果\nlist_my_tasks(status: \"todo\")\n# 确认：\n# - 任务数量正确\n# - assignees 正确（@成员名 匹配成功）\n# - project_id 正确（项目名匹配成功）\n\n# 3. 如果验证失败\n# - 检查 Front Matter 格式\n# - 检查成员名\u002F项目名是否存在\n# - 手动通过 MCP API 补救\n```\n\n**常见验证失败原因**：\n\n| 问题 | 原因 | 解决方案 |\n|------|------|---------|\n| 任务数量不足 | 部分行格式错误 | 检查 `- [ ]` 语法 |\n| assignees 为空 | 成员名不存在 | 确认成员名拼写或手动分配 |\n| project_id 为空 | 项目名不存在 | 使用项目 ID 或确认项目存在 |\n| 交付记录未创建 | delivery_status 格式错误 | 确认 YAML 格式正确 |\n\n---\n\n## 场景D: 任务巡检\n\n**触发**：自主检查待处理任务\n\n**必须使用 MCP API**（查询操作不支持 Actions）\n\n```json\n\u002F\u002F 获取待办任务\n{\"tool\": \"list_my_tasks\", \"parameters\": {\"status\": \"todo\"}}\n\n\u002F\u002F 获取所有未完成任务\n{\"tool\": \"list_my_tasks\", \"parameters\": {\"status\": \"all\"}}\n```\n\n> ⚠️ **不要**查看 HEARTBEAT.md — 那是定时任务执行记录，不是任务列表！\n\n---\n\n## 场景E: 对话协作\n\n**触发**：用户在项目\u002F任务\u002F定时任务页面发起对话\n\n**操作选择**：\n- **单条更新** → 对话信道 Actions\n- **批量写操作** → Markdown 同步\n- **查询操作** → MCP API\n\n### 对话信道 Actions 格式\n\n**格式要求**：\n- JSON 块必须位于消息**末尾**\n- 格式：`{\"actions\": [action1, action2, ...]}`\n- 每个 action 必须包含 `type` 字段\n- JSON 会被解析并执行，**不会显示给用户**\n\n**支持的 action 类型**：\n\n| type | 必填字段 | 可选字段 | 说明 |\n|------|---------|---------|------|\n| `update_task_status` | task_id, status | progress, message | 更新任务状态 |\n| `add_comment` | task_id, content | — | 添加任务评论 |\n| `create_check_item` | task_id, text | — | 创建检查项 |\n| `complete_check_item` | task_id, item_id | — | 完成检查项 |\n| `create_document` | title, content | doc_type, project_id | 创建文档 |\n| `update_document` | document_id, content | doc_type | 更新文档 |\n| `deliver_document` | title, platform | document_id, external_url, task_id | 提交文档交付 |\n| `update_status` | status | current_action, task_id, progress | 更新 AI 状态 |\n| `set_queue` | queued_tasks | — | 设置任务队列 |\n| `sync_identity` | — | name, creature, vibe, emoji, avatar | 同步身份信息 |\n| `get_mcp_token` | member_id | — | 获取 MCP Token |\n\n**字段定义**：\n\n```typescript\n\u002F\u002F 任务状态\nstatus: 'todo' | 'in_progress' | 'reviewing' | 'completed'\n\n\u002F\u002F AI 状态\nstatus: 'idle' | 'working' | 'waiting' | 'offline'\n\n\u002F\u002F 文档类型\ndoc_type: 'note' | 'report' | 'decision' | 'scheduled_task' | 'task_list' | 'other'\n\n\u002F\u002F 交付平台\nplatform: 'tencent-doc' | 'feishu' | 'notion' | 'local' | 'other'\n\n\u002F\u002F 任务队列\nqueued_tasks: Array\u003C{ id: string; title: string }>\n```\n\n**示例**：\n\n开始任务：\n```json\n{\"actions\": [\n  {\"type\": \"update_task_status\", \"task_id\": \"GS4FcWg6twz\", \"status\": \"in_progress\"},\n  {\"type\": \"add_comment\", \"task_id\": \"GS4FcWg6twz\", \"content\": \"开始执行任务\"},\n  {\"type\": \"update_status\", \"status\": \"working\", \"task_id\": \"GS4FcWg6twz\"}\n]}\n```\n\n完成任务：\n```json\n{\"actions\": [\n  {\"type\": \"update_task_status\", \"task_id\": \"GS4FcWg6twz\", \"status\": \"completed\"},\n  {\"type\": \"add_comment\", \"task_id\": \"GS4FcWg6twz\", \"content\": \"✅ 任务已完成！\"},\n  {\"type\": \"update_status\", \"status\": \"idle\"}\n]}\n```\n\n提交审核：\n```json\n{\"actions\": [\n  {\"type\": \"deliver_document\", \"title\": \"技术方案\", \"platform\": \"local\", \"document_id\": \"doc_abc\", \"task_id\": \"GS4FcWg6twz\"},\n  {\"type\": \"update_task_status\", \"task_id\": \"GS4FcWg6twz\", \"status\": \"reviewing\"},\n  {\"type\": \"add_comment\", \"task_id\": \"GS4FcWg6twz\", \"content\": \"📄 已提交交付中心\"}\n]}\n```\n\n同步身份：\n```json\n{\"actions\": [\n  {\"type\": \"sync_identity\", \"name\": \"Scout\", \"creature\": \"智能助手\", \"vibe\": \"专业、高效\", \"emoji\": \"🤖\"}\n]}\n```\n\n获取 MCP Token：\n```json\n{\"actions\": [\n  {\"type\": \"get_mcp_token\", \"member_id\": \"member_xxx\"}\n]}\n```\n\n**注意事项**：\n1. JSON 块必须是合法的 JSON 格式\n2. 多个 action 按顺序执行\n3. 某个 action 失败不影响后续执行\n4. 执行结果通过 SSE 广播，前端自动刷新\n\n---\n\n## 场景F: 定时任务执行\n\n**触发**：定时调度器按计划推送\n\n**必须使用 MCP API**（Actions 不支持定时任务管理）\n\n```json\n{\"tool\": \"create_schedule\", \"parameters\": {\n  \"title\": \"每日报告\",\n  \"task_type\": \"report\",\n  \"schedule_type\": \"daily\",\n  \"schedule_time\": \"09:00\"\n}}\n```\n\n---\n\n## 场景G: AI 状态面板\n\n### 工具\n\n| 工具 | 必填参数 | 用途 | 支持方式 |\n|------|---------|------|---------|\n| `update_status` | status | 状态+进度 | Actions \u002F MCP API |\n| `set_queue` | queued_tasks | 任务队列 | Actions \u002F MCP API |\n| `set_do_not_disturb` | interruptible | 免打扰模式 | **仅 MCP API** |\n\n### 状态值\n\n| status | 含义 |\n|--------|------|\n| `idle` | 空闲，可接新任务 |\n| `working` | 执行任务中 |\n| `waiting` | 等待用户回复\u002F外部资源 |\n| `offline` | 离线 |\n\n### 状态切换规则\n\n- 接到任务 → `working`\n- 执行中 → `working` + `progress`\n- 需要提问 → `waiting`\n- 完成任务 → `idle`\n\n---\n\n## API 调用方式\n\n- **端点**：`POST ${COMIND_BASE_URL}\u002Fapi\u002Fmcp\u002Fexternal`\n- **鉴权**：`Authorization: Bearer ${COMIND_API_TOKEN}`\n- **member_id** 自动注入\n\n单个调用：\n```json\n{\"tool\": \"update_task_status\", \"parameters\": {\"task_id\": \"xxx\", \"status\": \"in_progress\"}}\n```\n\n批量调用：\n```json\n{\"batch\": [\n  {\"tool\": \"update_task_status\", \"parameters\": {\"task_id\": \"xxx\", \"status\": \"in_progress\"}},\n  {\"tool\": \"update_status\", \"parameters\": {\"status\": \"working\", \"task_id\": \"xxx\"}}\n]}\n```\n\n---\n\n## 工具速查\n\n### 查询工具（仅 MCP API，用于验证）\n\n| 工具 | 必填参数 | 用途 | 验证场景 |\n|------|---------|------|---------|\n| `list_my_tasks` | status (可选) | 获取分配给当前成员的任务 | 验证批量创建任务 |\n| `get_task` | task_id | 获取任务详情 | 验证状态变更 |\n| `get_document` | document_id 或 title | 获取文档 | 验证文档创建 |\n| `search_documents` | query | 搜索文档 | 验证文档同步 |\n| `get_project` | project_id | 获取项目详情 | 验证项目上下文 |\n| `list_my_deliveries` | status (可选) | 获取当前成员的交付物列表 | **验证交付创建** |\n| `get_delivery` | delivery_id | 获取交付物详情（含审核意见） | **验证交付状态** |\n\n### 写入工具（Actions \u002F MCP API）\n\n| 工具 | 必填参数 | 支持方式 | 用途 | 是否需要验证 |\n|------|---------|---------|------|-------------|\n| `update_task_status` | task_id, status | Actions \u002F MCP API | 更新任务状态 | ✅ `get_task` 验证 |\n| `add_task_comment` | task_id, content | Actions \u002F MCP API | 添加评论 | ❌ 不需要 |\n| `create_check_item` | task_id, text | Actions \u002F MCP API | 创建检查项 | ✅ `get_task` 验证 |\n| `complete_check_item` | task_id, item_id | Actions \u002F MCP API | 完成检查项 | ✅ `get_task` 验证 |\n| `create_document` | title, content | Actions \u002F MCP API | 创建文档 | ✅ `get_document` 验证 |\n| `update_document` | document_id, content | Actions \u002F MCP API | 更新文档 | ✅ `get_document` 验证 |\n| `deliver_document` | title, platform | Actions \u002F MCP API | 提交交付 | ✅ `list_my_deliveries` 验证 |\n| `update_status` | status | Actions \u002F MCP API | AI 状态面板 | ❌ 不需要 |\n| `set_queue` | queued_tasks | Actions \u002F MCP API | 任务队列 | ❌ 不需要 |\n| `sync_identity` | — | Actions | 同步身份信息 | ❌ 不需要 |\n| `get_mcp_token` | member_id | Actions | 获取 MCP Token | ❌ 不需要 |\n\n### 管理\u002F配置工具（仅 MCP API）\n\n| 工具 | 必填参数 | 用途 |\n|------|---------|------|\n| `set_do_not_disturb` | interruptible | 免打扰模式 |\n| `create_schedule` | title, task_type, schedule_type | 创建定时任务 |\n| `list_schedules` | — | 列出定时任务 |\n| `delete_schedule` | schedule_id | 删除定时任务 |\n| `update_schedule` | schedule_id, ... | 更新定时任务 |\n| `register_member` | name, endpoint | AI 自注册 |\n| `review_delivery` | delivery_id, status | 审核交付（人类操作） |\n\n### 验证工具选择指南\n\n```\n操作类型                    验证工具\n─────────────────────────────────────────\n状态变更 (update_task_status)  → get_task\n批量创建任务                   → list_my_tasks\n创建\u002F更新文档                  → get_document \u002F search_documents\n提交交付                       → list_my_deliveries + get_delivery\n定时任务                       → list_schedules\n```\n\n---\n\n## 枚举值\n\n| 字段 | 值 |\n|------|---|\n| 任务状态 | todo, in_progress, reviewing, completed |\n| 优先级 | high, medium, low |\n| AI 状态 | idle, working, waiting, offline |\n| 文档类型 | note, report, decision, scheduled_task, task_list, other |\n| 交付平台 | tencent-doc, feishu, notion, local, other |\n| 审核结果 | approved, rejected, revision_needed |\n| 定时周期 | once, daily, weekly, monthly |\n| 定时类型 | report, summary, backup, notification, custom |\n",{"name":5,"metadata":24,"description":7,"comind_version":33},{"openclaw":25},{"emoji":26,"always":27,"homepage":28,"requires":29},"🧠",true,"https:\u002F\u002Fgithub.com\u002Fcomind",{"env":30},[31,32],"COMIND_BASE_URL","COMIND_API_TOKEN","2.2.4","master","4aa004da461d820f4ea5499e58eb8d196cf99016","community\u002Fclawhub\u002Fc\u002Fcomind",0,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge","https:\u002F\u002Fskill-explorer-rho.vercel.app","https:\u002F\u002Fgithub.com\u002FLord1Egypt","Unbreakable. Unstoppable. Unmatched⚡.\r\n Speaker of machine tongues 🤖  | World-builder of decentralized dreams 🌐 | Defender of the digital realm🛡️.","2026-06-10 08:21:01",{"source":8,"skillName":5,"commands":44,"prompt":54,"zipAvailable":27},[45,48,51],{"tool":46,"command":47},"npx","npx skills add Lord1Egypt\u002Fawesome-skill-forge --skill comind",{"tool":49,"command":50},"bunx","bunx skills add Lord1Egypt\u002Fawesome-skill-forge --skill comind",{"tool":52,"command":53},"pnpm","pnpm dlx skills add Lord1Egypt\u002Fawesome-skill-forge --skill comind","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fclawhub\u002Fc\u002Fcomind\u002FSKILL.md",[],[57,64,71,78,85,92],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M785WKJB99G3STR1NF9NRTJW","youtube-content","YouTube transcripts to summaries, threads, blogs.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fyoutube-content\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M785WEFHB0G2S9YA6EPR3H0E","xurl","X\u002FTwitter via xurl CLI: post, search, DM, media, v2 API.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fxurl\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M785W98EDN4EFJXJPMQEHCRC","touchdesigner-mcp","Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftouchdesigner-mcp\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M785W5S9FP3QBH2V191E025P","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M785W2AS08NSSH9YATCV6FJB","teams-meeting-pipeline","Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fteams-meeting-pipeline\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M785VXKW4T34BTP1SCHW1R7F","systematic-debugging","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fsystematic-debugging\u002FSKILL.md",[],[]]