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

@@ -1,7 +1,7 @@
---
name: team-arch-opt
description: Unified team skill for architecture optimization. Uses team-worker agent architecture with role-spec files for domain logic. Coordinator orchestrates pipeline, workers are team-worker agents. Triggers on "team arch-opt".
allowed-tools: Task, TaskCreate, TaskList, TaskGet, TaskUpdate, TeamCreate, TeamDelete, SendMessage, AskUserQuestion, Read, Write, Edit, Bash, Glob, Grep, mcp__ace-tool__search_context
allowed-tools: Agent, TaskCreate, TaskList, TaskGet, TaskUpdate, TeamCreate, TeamDelete, SendMessage, AskUserQuestion, Read, Write, Edit, Bash, Glob, Grep, mcp__ace-tool__search_context
---
# Team Architecture Optimization
@@ -137,7 +137,7 @@ Phase 3 needs task dispatch
When coordinator spawns workers, use `team-worker` agent with role-spec path:
```
Task({
Agent({
subagent_type: "team-worker",
description: "Spawn <role> worker",
team_name: <team-name>,
@@ -361,7 +361,7 @@ AskUserQuestion({
| Choice | Action |
|--------|--------|
| Archive & Clean | Update session status="completed" -> TeamDelete(arch-opt) -> output final summary |
| Archive & Clean | Update session status="completed" -> TeamDelete() -> output final summary |
| Keep Active | Update session status="paused" -> output resume instructions: `Skill(skill="team-arch-opt", args="resume")` |
| Export Results | AskUserQuestion for target path -> copy deliverables -> Archive & Clean |

View File

@@ -27,7 +27,6 @@ Every task description uses structured format for clarity:
```
TaskCreate({
subject: "<TASK-ID>",
owner: "<role>",
description: "PURPOSE: <what this task achieves> | Success: <measurable completion criteria>
TASK:
- <step 1: specific action>
@@ -43,10 +42,9 @@ EXPECTED: <deliverable path> + <quality criteria>
CONSTRAINTS: <scope limits, focus areas>
---
InnerLoop: <true|false>
BranchId: <B01|A|none>",
blockedBy: [<dependency-list>],
status: "pending"
BranchId: <B01|A|none>"
})
TaskUpdate({ taskId: "<TASK-ID>", addBlockedBy: [<dependency-list>], owner: "<role>" })
```
### Mode Router
@@ -81,9 +79,9 @@ CONTEXT:
EXPECTED: <session>/artifacts/architecture-baseline.json + <session>/artifacts/architecture-report.md | Quantified metrics with evidence
CONSTRAINTS: Focus on <refactoring-scope> | Analyze before any changes
---
InnerLoop: false",
status: "pending"
InnerLoop: false"
})
TaskUpdate({ taskId: "ANALYZE-001", owner: "analyzer" })
```
**DESIGN-001** (designer, Stage 2):
@@ -105,10 +103,9 @@ CONTEXT:
EXPECTED: <session>/artifacts/refactoring-plan.md | Priority-ordered with structural improvement targets, discrete REFACTOR-IDs
CONSTRAINTS: Focus on highest-impact refactorings | Risk assessment required | Non-overlapping file targets per REFACTOR-ID
---
InnerLoop: false",
blockedBy: ["ANALYZE-001"],
status: "pending"
InnerLoop: false"
})
TaskUpdate({ taskId: "DESIGN-001", addBlockedBy: ["ANALYZE-001"], owner: "designer" })
```
**REFACTOR-001** (refactorer, Stage 3):
@@ -130,10 +127,9 @@ CONTEXT:
EXPECTED: Modified source files + validation passing | Refactorings applied without regressions
CONSTRAINTS: Preserve existing behavior | Update all references | Follow code conventions
---
InnerLoop: true",
blockedBy: ["DESIGN-001"],
status: "pending"
InnerLoop: true"
})
TaskUpdate({ taskId: "REFACTOR-001", addBlockedBy: ["DESIGN-001"], owner: "refactorer" })
```
**VALIDATE-001** (validator, Stage 4 - parallel):
@@ -156,10 +152,9 @@ CONTEXT:
EXPECTED: <session>/artifacts/validation-results.json | Per-dimension validation with verdicts
CONSTRAINTS: Must compare against baseline | Flag any regressions or broken imports
---
InnerLoop: false",
blockedBy: ["REFACTOR-001"],
status: "pending"
InnerLoop: false"
})
TaskUpdate({ taskId: "VALIDATE-001", addBlockedBy: ["REFACTOR-001"], owner: "validator" })
```
**REVIEW-001** (reviewer, Stage 4 - parallel):
@@ -180,10 +175,9 @@ CONTEXT:
EXPECTED: <session>/artifacts/review-report.md | Per-dimension findings with severity
CONSTRAINTS: Focus on refactoring changes only | Provide specific file:line references
---
InnerLoop: false",
blockedBy: ["REFACTOR-001"],
status: "pending"
InnerLoop: false"
})
TaskUpdate({ taskId: "REVIEW-001", addBlockedBy: ["REFACTOR-001"], owner: "reviewer" })
```
---
@@ -210,11 +204,15 @@ For each target index `i` (0-based), with prefix char `P = pipeline_prefix_chars
// Create session subdirectory for this pipeline
Bash("mkdir -p <session>/artifacts/pipelines/<P>")
TaskCreate({ subject: "ANALYZE-<P>01", ... }) // blockedBy: []
TaskCreate({ subject: "DESIGN-<P>01", ... }) // blockedBy: ["ANALYZE-<P>01"]
TaskCreate({ subject: "REFACTOR-<P>01", ... }) // blockedBy: ["DESIGN-<P>01"]
TaskCreate({ subject: "VALIDATE-<P>01", ... }) // blockedBy: ["REFACTOR-<P>01"]
TaskCreate({ subject: "REVIEW-<P>01", ... }) // blockedBy: ["REFACTOR-<P>01"]
TaskCreate({ subject: "ANALYZE-<P>01", ... })
TaskCreate({ subject: "DESIGN-<P>01", ... })
TaskUpdate({ taskId: "DESIGN-<P>01", addBlockedBy: ["ANALYZE-<P>01"] })
TaskCreate({ subject: "REFACTOR-<P>01", ... })
TaskUpdate({ taskId: "REFACTOR-<P>01", addBlockedBy: ["DESIGN-<P>01"] })
TaskCreate({ subject: "VALIDATE-<P>01", ... })
TaskUpdate({ taskId: "VALIDATE-<P>01", addBlockedBy: ["REFACTOR-<P>01"] })
TaskCreate({ subject: "REVIEW-<P>01", ... })
TaskUpdate({ taskId: "REVIEW-<P>01", addBlockedBy: ["REFACTOR-<P>01"] })
```
Task descriptions follow same template as single mode, with additions:
@@ -241,9 +239,9 @@ EXPECTED: <session>/artifacts/pipelines/A/architecture-baseline.json + architect
CONSTRAINTS: Focus on auth module scope
---
InnerLoop: false
PipelineId: A",
status: "pending"
PipelineId: A"
})
TaskUpdate({ taskId: "ANALYZE-A01", owner: "analyzer" })
```
---
@@ -298,10 +296,9 @@ EXPECTED: Modified source files for REFACTOR-{NNN} only
CONSTRAINTS: Only implement this branch's refactoring | Do not touch files outside REFACTOR-{NNN} scope
---
InnerLoop: false
BranchId: B{NN}",
blockedBy: ["DESIGN-001"],
status: "pending"
BranchId: B{NN}"
})
TaskUpdate({ taskId: "REFACTOR-B{NN}", addBlockedBy: ["DESIGN-001"], owner: "refactorer" })
TaskCreate({
subject: "VALIDATE-B{NN}",
@@ -319,10 +316,9 @@ EXPECTED: <session>/artifacts/branches/B{NN}/validation-results.json
CONSTRAINTS: Only validate this branch's changes
---
InnerLoop: false
BranchId: B{NN}",
blockedBy: ["REFACTOR-B{NN}"],
status: "pending"
BranchId: B{NN}"
})
TaskUpdate({ taskId: "VALIDATE-B{NN}", addBlockedBy: ["REFACTOR-B{NN}"], owner: "validator" })
TaskCreate({
subject: "REVIEW-B{NN}",
@@ -340,10 +336,9 @@ EXPECTED: <session>/artifacts/branches/B{NN}/review-report.md
CONSTRAINTS: Only review this branch's changes
---
InnerLoop: false
BranchId: B{NN}",
blockedBy: ["REFACTOR-B{NN}"],
status: "pending"
BranchId: B{NN}"
})
TaskUpdate({ taskId: "REVIEW-B{NN}", addBlockedBy: ["REFACTOR-B{NN}"], owner: "reviewer" })
```
7. Update session.json:

View File

@@ -65,7 +65,7 @@ Find and spawn the next ready tasks.
2. For each ready task, spawn team-worker:
```
Task({
Agent({
subagent_type: "team-worker",
description: "Spawn <role> worker for <task-id>",
team_name: "arch-opt",
@@ -171,10 +171,9 @@ EXPECTED: Fixed source files for B{NN} only
CONSTRAINTS: Targeted fixes only | Do not touch other branches
---
InnerLoop: false
BranchId: B{NN}",
blockedBy: [],
status: "pending"
BranchId: B{NN}"
})
TaskUpdate({ taskId: "FIX-B{NN}-{cycle}", owner: "refactorer" })
```
Create new VALIDATE and REVIEW with retry suffix:
@@ -186,9 +185,8 @@ Create new VALIDATE and REVIEW with retry suffix:
TaskCreate({
subject: "FIX-{P}01-{cycle}",
...same pattern with pipeline prefix...
blockedBy: [],
status: "pending"
})
TaskUpdate({ taskId: "FIX-{P}01-{cycle}", owner: "refactorer" })
```
Create `VALIDATE-{P}01-R{cycle}` and `REVIEW-{P}01-R{cycle}`.

View File

@@ -229,7 +229,7 @@ Execute `commands/dispatch.md` inline (Command Execution Protocol):
Find first unblocked task and spawn its worker:
```
Task({
Agent({
subagent_type: "team-worker",
description: "Spawn analyzer worker",
team_name: "arch-opt",
@@ -298,6 +298,6 @@ AskUserQuestion({
| Choice | Steps |
|--------|-------|
| Archive & Clean | TaskList -> verify all completed -> update session status="completed" -> TeamDelete("arch-opt") -> output final summary with artifact paths |
| Archive & Clean | TaskList -> verify all completed -> update session status="completed" -> TeamDelete() -> output final summary with artifact paths |
| Keep Active | Update session status="paused" -> output: "Session paused. Resume with: Skill(skill='team-arch-opt', args='resume')" |
| Export Results | AskUserQuestion for target directory -> copy all artifacts -> Archive & Clean flow |

View File

@@ -11,7 +11,7 @@ Complex refactoring decisions (e.g., choosing between dependency inversion vs me
Called by designer, reviewer after their primary analysis when complexity warrants multi-perspective evaluation:
```
Task({
Agent({
subagent_type: "cli-discuss-agent",
run_in_background: false,
description: "Discuss <round-id>: <topic> for architecture optimization",

View File

@@ -11,7 +11,7 @@ Codebase exploration is a read-only operation shared between analyzer (mapping s
Called by analyzer, refactorer after needing codebase context for architecture analysis or implementation:
```
Task({
Agent({
subagent_type: "cli-explore-agent",
run_in_background: false,
description: "Explore codebase for architecture-critical structures in <target-scope>",