refactor: replace Task tool with Agent tool and fix schema compliance

## Task -> Agent Replacement
- Replace all Task({}) calls with Agent({}) across .claude/ directory
- Update allowed-tools declarations from Task to Agent
- Update documentation references from "Task tool" to "Agent tool"

## Schema Compliance Fixes

### Agent Schema
- Add missing required `description` parameter in 6 files
- Add missing `run_in_background: false` for subagent calls
- Add missing `subagent_type` parameter

### AskUserQuestion Schema
- Fix issue-manage/SKILL.md: reduce options from 5 to 4 (max allowed)

### SendMessage Schema
- Fix team-worker.md: use correct params (type, content, summary)
- Remove invalid `team_name` parameter

### TaskCreate/TaskUpdate Schema
- Remove invalid `blockedBy`, `owner`, `status` from TaskCreate calls
- Use separate TaskUpdate calls for dependencies and ownership
- Fix TaskUpdate syntax to use object parameter

### TeamDelete Schema
- Remove parameters from TeamDelete() calls (should be no params)

### TaskOutput Schema
- Fix Python-style syntax to JavaScript object syntax

## Files Changed
- 146 files updated across commands/, skills/, skills_lib/, agents/
This commit is contained in:
catlog22
2026-03-04 22:40:39 +08:00
parent 64e772f9b8
commit 16bbfcd12a
146 changed files with 505 additions and 516 deletions

View File

@@ -83,7 +83,7 @@
| 内容类型 | 保留要求 | 示例 |
|---------|---------|------|
| **Bash命令** | 完整命令,包含所有参数、管道、重定向 | `find . -name "*.json" \| head -1` |
| **Agent Prompt** | 全文保留包含OBJECTIVE、TASK、EXPECTED等所有节 | 完整的Task({prompt: "..."}) |
| **Agent Prompt** | 全文保留包含OBJECTIVE、TASK、EXPECTED等所有节 | 完整的Agent({prompt: "..."}) |
| **代码函数** | 完整函数体所有if/else分支 | `analyzeTaskComplexity()` 全部代码 |
| **参数表格** | 所有行列,不省略任何参数 | Session Types表格 |
| **JSON Schema** | 所有字段、类型、required定义 | context-package.json schema |
@@ -95,7 +95,7 @@
1. **将代码替换为描述**
- ❌ 错误:`Execute context gathering agent`
- ✅ 正确:完整的 `Task({ subagent_type: "context-search-agent", prompt: "...[完整200行prompt]..." })`
- ✅ 正确:完整的 `Agent({ subagent_type: "context-search-agent", prompt: "...[完整200行prompt]..." })`
2. **省略Prompt内容**
- ❌ 错误:`Agent prompt for context gathering (see original file)`
@@ -277,7 +277,7 @@ commands/ skills/
---
name: {skill-name}
description: {简短描述}. Triggers on "{trigger-phrase}".
allowed-tools: Task, AskUserQuestion, TodoWrite, Read, Write, Edit, Bash, Glob, Grep
allowed-tools: Agent, AskUserQuestion, TodoWrite, Read, Write, Edit, Bash, Glob, Grep
---
```
@@ -440,7 +440,7 @@ Complete: IMPL_PLAN.md + Task JSONs
|--------|---------|---------|
| **代码块数量** | 计数 ` ```bash `` ```javascript ` | 与原文件相等 |
| **表格数量** | 计数 ` \| ` 开头的行 | 与原文件相等 |
| **Agent Prompt** | 搜索 `Task({` | 完整的prompt参数内容 |
| **Agent Prompt** | 搜索 `Agent({` | 完整的prompt参数内容 |
| **步骤编号** | 检查 `### Step` | 编号序列与原文件一致 |
| **文件行数** | `wc -l` | ±20%以内 |
| **关键函数** | 搜索函数名 | 所有函数完整保留 |
@@ -492,10 +492,10 @@ Execute the context-search-agent to gather project context.
### Step 2: Run context gathering
```javascript
Task({
Agent({
subagent_type: "context-search-agent",
prompt: `
## Context Search Task
## Context Search Agent
### OBJECTIVE
Gather comprehensive context for planning session ${sessionId}
@@ -535,7 +535,7 @@ Gather comprehensive context for planning session ${sessionId}
│ └─→ 数量应相等 │
│ │
│ Step 3: 关键内容抽查 │
│ - 搜索 Task({ → Agent Prompt 完整性 │
│ - 搜索 Agent({ → Agent Prompt 完整性 │
│ - 搜索函数名 → 函数体完整性 │
│ - 搜索表格标记 → 表格完整性 │
│ │
@@ -562,8 +562,8 @@ grep -c '^|' commands/workflow/tools/context-gather.md
grep -c '^|' skills/workflow-plan/phases/02-context-gathering.md
# 4. Agent Prompt检查
grep -c 'Task({' commands/workflow/tools/context-gather.md
grep -c 'Task({' skills/workflow-plan/phases/02-context-gathering.md
grep -c 'Agent({' commands/workflow/tools/context-gather.md
grep -c 'Agent({' skills/workflow-plan/phases/02-context-gathering.md
# 5. 函数定义检查
grep -E '^(function|const.*=.*=>|async function)' commands/workflow/tools/context-gather.md

View File

@@ -140,7 +140,7 @@ graph TD
---
name: {skill-name}
description: {一句话描述}. {触发关键词}. Triggers on "{关键词1}", "{关键词2}".
allowed-tools: Task, AskUserQuestion, Read, Bash, Glob, Grep, Write, {其他MCP工具}
allowed-tools: Agent, AskUserQuestion, Read, Bash, Glob, Grep, Write, {其他MCP工具}
---
# {Skill 标题}
@@ -192,7 +192,7 @@ description: | # 必需:描述 + 触发词
Generate XXX documents.
Triggers on "keyword1", "keyword2".
allowed-tools: | # 必需:允许使用的工具
Task, AskUserQuestion, Read, Bash,
Agent, AskUserQuestion, Read, Bash,
Glob, Grep, Write, mcp__chrome__*
---
```
@@ -641,7 +641,7 @@ touch my-skill/templates/agent-base.md
---
name: my-skill
description: Generate XXX. Triggers on "keyword1", "keyword2".
allowed-tools: Task, AskUserQuestion, Read, Bash, Glob, Grep, Write
allowed-tools: Agent, AskUserQuestion, Read, Bash, Glob, Grep, Write
---
# My Skill
@@ -680,7 +680,7 @@ Generate XXX through multi-phase analysis.
| 工具 | 用途 | 适用 Skill |
|------|------|------------|
| `Task` | 启动子 Agent | 所有 |
| `Agent` | 启动子 Agent | 所有 |
| `AskUserQuestion` | 用户交互 | 所有 |
| `Read/Write/Glob/Grep` | 文件操作 | 所有 |
| `Bash` | 脚本执行 | 需要自动化 |