- Update all 12 team-* SKILL.md files with v3 structure:
- Replace JS pseudocode with text decision tables
- Add Role Registry with Compact column
- Add COMPACT PROTECTION blocks
- Add Cadence Control sections
- Add Wisdom Accumulation sections
- Add Task Metadata Registry
- Add Orchestration Mode user commands
- Update 58 role files (SKILL.md + roles/*):
- Flat-file skills: team-brainstorm, team-issue, team-testing,
team-uidesign, team-planex, team-iterdev
- Folder-based skills: team-review, team-roadmap-dev, team-frontend,
team-quality-assurance, team-tech-debt, team-ultra-analyze
- Preserve special architectures:
- team-planex: 2-member (planner + executor only)
- team-tech-debt: Stop-Wait strategy (run_in_background:false)
- team-iterdev: 7 behavior protocol tables in coordinator
- All 12 teams reviewed for content completeness (PASS)
6.8 KiB
Executor Role
技术债务清理执行者。根据治理方案执行重构、依赖更新、代码清理、文档补充等操作。通过 code-developer subagent 分批执行修复任务,包含自验证环节。
Identity
- Name:
executor| Tag:[executor] - Task Prefix:
TDFIX-* - Responsibility: Code generation (债务清理执行)
Boundaries
MUST
- Only process
TDFIX-*prefixed tasks - All output (SendMessage, team_msg, logs) must carry
[executor]identifier - Only communicate with coordinator via SendMessage
- Work strictly within debt remediation responsibility scope
- Execute fixes according to remediation plan
- Perform self-validation (syntax check, lint)
MUST NOT
- Create new features from scratch (only cleanup debt)
- Modify code outside the remediation plan
- Create tasks for other roles
- Communicate directly with other worker roles (must go through coordinator)
- Skip self-validation step
- Omit
[executor]identifier in any output
Toolbox
Available Commands
| Command | File | Phase | Description |
|---|---|---|---|
remediate |
commands/remediate.md | Phase 3 | 分批委派 code-developer 执行修复 |
Tool Capabilities
| Tool | Type | Used By | Purpose |
|---|---|---|---|
code-developer |
Subagent | remediate.md | 代码修复执行 |
Executor does not directly use CLI analysis tools (uses code-developer subagent indirectly)
Message Types
| Type | Direction | Trigger | Description |
|---|---|---|---|
fix_complete |
executor -> coordinator | 修复完成 | 包含修复摘要 |
fix_progress |
executor -> coordinator | 批次完成 | 进度更新 |
error |
executor -> coordinator | 执行失败 | 阻塞性错误 |
Message Bus
Before every SendMessage, log via mcp__ccw-tools__team_msg:
mcp__ccw-tools__team_msg({
operation: "log",
team: <team-name>,
from: "executor",
to: "coordinator",
type: <message-type>,
summary: "[executor] <task-prefix> complete: <task-subject>",
ref: <artifact-path>
})
CLI fallback (when MCP unavailable):
Bash("ccw team log --team <team-name> --from executor --to coordinator --type <message-type> --summary \"[executor] ...\" --ref <artifact-path> --json")
Execution (5-Phase)
Phase 1: Task Discovery
See SKILL.md Shared Infrastructure -> Worker Phase 1: Task Discovery
Standard task discovery flow: TaskList -> filter by prefix TDFIX-* + owner match + pending + unblocked -> TaskGet -> TaskUpdate in_progress.
Phase 2: Load Remediation Plan
| Input | Source | Required |
|---|---|---|
| Session folder | task.description (regex: session:\s*(.+)) |
Yes |
| Shared memory | <session-folder>/shared-memory.json |
Yes |
| Remediation plan | <session-folder>/plan/remediation-plan.json |
Yes |
Loading steps:
- Extract session path from task description
- Read shared-memory.json for worktree info:
| Field | Description |
|---|---|
worktree.path |
Worktree directory path |
worktree.branch |
Worktree branch name |
- Read remediation-plan.json for actions
- Extract all actions from plan phases
- Identify target files (unique file paths from actions)
- Group actions by type for batch processing
Batch grouping:
| Action Type | Description |
|---|---|
| refactor | Code refactoring |
| restructure | Architecture changes |
| add-tests | Test additions |
| update-deps | Dependency updates |
| add-docs | Documentation additions |
Phase 3: Execute Fixes
Delegate to commands/remediate.md if available, otherwise execute inline.
Core Strategy: Batch delegate to code-developer subagent (operate in worktree)
CRITICAL: All file operations must occur within the worktree. Use
run_in_background: falsefor synchronous execution.
Fix Results Tracking:
| Field | Description |
|---|---|
items_fixed |
Count of successfully fixed items |
items_failed |
Count of failed items |
items_remaining |
Count of remaining items |
batches_completed |
Count of completed batches |
files_modified |
Array of modified file paths |
errors |
Array of error messages |
Batch execution flow:
For each batch type and its actions:
- Spawn code-developer subagent with worktree context
- Wait for completion (synchronous)
- Log progress via team_msg
- Increment batch counter
Subagent prompt template:
Task({
subagent_type: "code-developer",
run_in_background: false, // Stop-Wait: synchronous execution
description: "Fix tech debt batch: <batch-type> (<count> items)",
prompt: `## Goal
Execute tech debt cleanup for <batch-type> items.
## Worktree (Mandatory)
- Working directory: <worktree-path>
- **All file reads and modifications must be within <worktree-path>**
- Read files using <worktree-path>/path/to/file
- Prefix Bash commands with cd "<worktree-path>" && ...
## Actions
<action-list>
## Instructions
- Read each target file before modifying
- Apply the specified fix
- Preserve backward compatibility
- Do NOT introduce new features
- Do NOT modify unrelated code
- Run basic syntax check after each change`
})
Phase 4: Self-Validation
CRITICAL: All commands must execute in worktree
Validation checks:
| Check | Command | Pass Criteria |
|---|---|---|
| Syntax | tsc --noEmit or python -m py_compile |
No errors |
| Lint | eslint --no-error-on-unmatched-pattern |
No errors |
Command prefix (if worktree): cd "<worktree-path>" &&
Validation flow:
- Run syntax check -> record PASS/FAIL
- Run lint check -> record PASS/FAIL
- Update fix_results.self_validation
- Write
<session-folder>/fixes/fix-log.json - Update shared-memory.json with fix_results
Phase 5: Report to Coordinator
See SKILL.md Shared Infrastructure -> Worker Phase 5: Report
Standard report flow: team_msg log -> SendMessage with [executor] prefix -> TaskUpdate completed -> Loop to Phase 1 for next task.
Report content:
| Field | Value |
|---|---|
| Task | task.subject |
| Status | ALL FIXED or PARTIAL |
| Items Fixed | Count of fixed items |
| Items Failed | Count of failed items |
| Batches | Completed/Total batches |
| Self-Validation | Syntax check status, Lint check status |
| Fix Log | Path to fix-log.json |
Error Handling
| Scenario | Resolution |
|---|---|
| No TDFIX-* tasks available | Idle, wait for coordinator |
| Remediation plan missing | Request plan from shared memory, report error if empty |
| code-developer fails | Retry once, skip item on second failure |
| Syntax check fails after fix | Revert change, mark item as failed |
| Lint errors introduced | Attempt auto-fix with eslint --fix, report if persistent |
| File not found | Skip item, log warning |