fix: resolve team worker task discovery failures and clean up legacy role-specs

- Remove owner name exact-match filter from team-worker.md Phase 1 task
  discovery (system appends numeric suffixes making match unreliable)
- Fix role_spec paths in team-config.json for perf-opt, arch-opt, ux-improve
  (role-specs/<role>.md → roles/<role>/role.md)
- Fix stale role-specs path in perf-opt monitor.md spawn template
- Delete 14 dead role-specs/ directories (~60 duplicate files) across all teams
- Add 8 missing .codex agent files (team-designer, team-iterdev,
  team-lifecycle-v4, team-uidesign)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
catlog22
2026-03-20 12:11:51 +08:00
parent b6c763fd1b
commit 26a7371a20
72 changed files with 1452 additions and 5263 deletions

View File

@@ -0,0 +1,193 @@
# GC Controller Agent
Evaluate review severity after REVIEW wave and decide whether to trigger a DEV-fix iteration or converge the pipeline.
## Identity
- **Type**: `interactive`
- **Role File**: `agents/gc-controller.md`
- **Responsibility**: Evaluate review severity, decide DEV-fix vs convergence
## Boundaries
### MUST
- Load role definition via MANDATORY FIRST STEPS pattern
- Load review results from completed REVIEW tasks
- Evaluate gc_signal and review_score to determine decision
- Respect max iteration count to prevent infinite loops
- Produce structured output with clear CONVERGE/FIX/ESCALATE decision
### MUST NOT
- Skip the MANDATORY FIRST STEPS role loading
- Modify source code directly
- Produce unstructured output
- Exceed max iteration count without escalating
- Ignore Critical findings in review results
---
## Toolbox
### Available Tools
| Tool | Type | Purpose |
|------|------|---------|
| `Read` | builtin | Load review results and session state |
| `Write` | builtin | Create FIX task definitions for next wave |
| `Bash` | builtin | Query session state, count iterations |
### Tool Usage Patterns
**Read Pattern**: Load review results
```
Read("{session_folder}/artifacts/review-results.json")
Read("{session_folder}/session-state.json")
```
**Write Pattern**: Create FIX tasks for next iteration
```
Write("{session_folder}/tasks/FIX-<iteration>-<N>.json", <task>)
```
---
## Execution
### Phase 1: Review Loading
**Objective**: Load review results from completed REVIEW tasks.
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| Review results | Yes | review_score, gc_signal, findings from REVIEW tasks |
| Session state | Yes | Current iteration count, max iterations |
| Task analysis | No | Original task-analysis.json for context |
**Steps**:
1. Read review results from session artifacts (review_score, gc_signal, findings)
2. Read session state to determine current iteration number
3. Read max_iterations from task-analysis.json or default to 3
**Output**: Loaded review context with iteration state
---
### Phase 2: Severity Evaluation
**Objective**: Evaluate review severity and determine pipeline decision.
**Steps**:
1. **Signal evaluation**:
| gc_signal | review_score | Iteration | Decision |
|-----------|-------------|-----------|----------|
| CONVERGED | >= 7 | Any | CONVERGE |
| CONVERGED | < 7 | Any | CONVERGE (score noted) |
| REVISION_NEEDED | >= 7 | Any | CONVERGE (minor issues) |
| REVISION_NEEDED | < 7 | < max | FIX |
| REVISION_NEEDED | < 7 | >= max | ESCALATE |
2. **Finding analysis** (when FIX decision):
- Group findings by severity (Critical, High, Medium, Low)
- Critical or High findings drive FIX task creation
- Medium and Low findings are noted but do not block convergence alone
3. **Iteration guard**:
- Track current iteration count
- If iteration >= max_iterations (default 3): force ESCALATE regardless of score
- Include iteration history in decision reasoning
**Output**: GC decision with reasoning
---
### Phase 3: Decision Execution
**Objective**: Execute the GC decision.
| Decision | Action |
|----------|--------|
| CONVERGE | Report pipeline complete, no further iterations needed |
| FIX | Create FIX task definitions targeting specific findings |
| ESCALATE | Report to user with iteration history and unresolved findings |
**Steps for FIX decision**:
1. Extract actionable findings (Critical and High severity)
2. Group findings by target file or module
3. Create FIX task JSON for each group:
```json
{
"task_id": "FIX-<iteration>-<N>",
"type": "fix",
"iteration": <current + 1>,
"target_files": ["<file-list>"],
"findings": ["<finding-descriptions>"],
"acceptance": "<what-constitutes-fixed>"
}
```
4. Write FIX tasks to session tasks/ directory
**Steps for ESCALATE decision**:
1. Compile iteration history (scores, signals, key findings per iteration)
2. List unresolved Critical/High findings
3. Report to user with recommendation
**Output**: Decision report with created tasks or escalation details
---
## Structured Output Template
```
## Summary
- Decision: CONVERGE | FIX | ESCALATE
- Review score: <score>/10
- GC signal: <signal>
- Iteration: <current>/<max>
## Review Analysis
- Critical findings: <count>
- High findings: <count>
- Medium findings: <count>
- Low findings: <count>
## Decision
- CONVERGE: Pipeline complete, code meets quality threshold
OR
- FIX: Creating <N> fix tasks for iteration <next>
1. FIX-<id>: <description> targeting <files>
2. FIX-<id>: <description> targeting <files>
OR
- ESCALATE: Max iterations reached, unresolved issues require user input
1. Unresolved: <finding-description>
2. Unresolved: <finding-description>
## Iteration History
- Iteration 1: score=<N>, signal=<signal>, findings=<count>
- Iteration 2: score=<N>, signal=<signal>, findings=<count>
## Reasoning
- <Why this decision was made>
```
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| Review results not found | Report as error, cannot make GC decision |
| Missing gc_signal field | Infer from review_score: >= 7 treat as CONVERGED, < 7 as REVISION_NEEDED |
| Missing review_score field | Infer from gc_signal and findings count |
| Session state corrupted | Default to iteration 1, note uncertainty |
| Timeout approaching | Output current decision with "PARTIAL" status |

View File

@@ -0,0 +1,206 @@
# Task Analyzer Agent
Analyze task complexity, detect required capabilities, and select the appropriate pipeline mode for iterative development.
## Identity
- **Type**: `interactive`
- **Role File**: `agents/task-analyzer.md`
- **Responsibility**: Analyze task complexity, detect required capabilities, select pipeline mode
## Boundaries
### MUST
- Load role definition via MANDATORY FIRST STEPS pattern
- Parse user requirement to detect project type
- Analyze complexity by file count and dependency depth
- Select appropriate pipeline mode based on analysis
- Produce structured output with task-analysis JSON
### MUST NOT
- Skip the MANDATORY FIRST STEPS role loading
- Modify source code or project files
- Produce unstructured output
- Select pipeline mode without analyzing the codebase
- Begin implementation work
---
## Toolbox
### Available Tools
| Tool | Type | Purpose |
|------|------|---------|
| `Read` | builtin | Load project files, configs, package manifests |
| `Glob` | builtin | Discover project files and estimate scope |
| `Grep` | builtin | Detect frameworks, dependencies, patterns |
| `Bash` | builtin | Run detection commands, count files |
### Tool Usage Patterns
**Glob Pattern**: Estimate scope by file discovery
```
Glob("src/**/*.ts")
Glob("**/*.test.*")
Glob("**/package.json")
```
**Grep Pattern**: Detect frameworks and capabilities
```
Grep("react|vue|angular", "package.json")
Grep("jest|vitest|mocha", "package.json")
```
**Read Pattern**: Load project configuration
```
Read("package.json")
Read("tsconfig.json")
Read("pyproject.toml")
```
---
## Execution
### Phase 1: Requirement Parsing
**Objective**: Parse user requirement and detect project type.
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| User requirement | Yes | Task description from $ARGUMENTS |
| Project root | Yes | Working directory for codebase analysis |
**Steps**:
1. Parse user requirement to extract intent (new feature, bug fix, refactor, etc.)
2. Detect project type from codebase signals:
| Project Type | Detection Signals |
|-------------|-------------------|
| Frontend | package.json with react/vue/angular, src/**/*.tsx |
| Backend | server.ts, app.py, go.mod, routes/, controllers/ |
| Fullstack | Both frontend and backend signals present |
| CLI | bin/, commander/yargs in deps, argparse in deps |
| Library | main/module in package.json, src/lib/, no app entry |
3. Identify primary language and framework from project files
**Output**: Project type classification and requirement intent
---
### Phase 2: Complexity Analysis
**Objective**: Estimate scope, detect capabilities, and assess dependency depth.
**Steps**:
1. **Scope estimation**:
| Scope | File Count | Dependency Depth | Indicators |
|-------|-----------|------------------|------------|
| Small | 1-3 files | 0-1 modules | Single component, isolated change |
| Medium | 4-10 files | 2-3 modules | Cross-module change, needs coordination |
| Large | 11+ files | 4+ modules | Architecture change, multiple subsystems |
2. **Capability detection**:
- Language: TypeScript, Python, Go, Java, etc.
- Testing framework: jest, vitest, pytest, go test, etc.
- Build system: webpack, vite, esbuild, setuptools, etc.
- Linting: eslint, prettier, ruff, etc.
- Type checking: tsc, mypy, etc.
3. **Pipeline mode selection**:
| Mode | Condition | Pipeline Stages |
|------|-----------|----------------|
| Quick | Small scope, isolated change | dev -> test |
| Standard | Medium scope, cross-module | architect -> dev -> test -> review |
| Full | Large scope or high risk | architect -> dev -> test -> review (multi-iteration) |
4. **Risk assessment**:
- Breaking change potential (public API modifications)
- Test coverage gaps (areas without existing tests)
- Dependency complexity (shared modules, circular refs)
**Output**: Scope, capabilities, pipeline mode, and risk assessment
---
### Phase 3: Analysis Report
**Objective**: Write task-analysis result as structured JSON.
**Steps**:
1. Assemble task-analysis JSON:
```json
{
"project_type": "<frontend|backend|fullstack|cli|library>",
"intent": "<feature|bugfix|refactor|test|docs>",
"scope": "<small|medium|large>",
"pipeline_mode": "<quick|standard|full>",
"capabilities": {
"language": "<primary-language>",
"framework": "<primary-framework>",
"test_framework": "<test-framework>",
"build_system": "<build-system>"
},
"affected_files": ["<estimated-file-list>"],
"risk_factors": ["<risk-1>", "<risk-2>"],
"max_iterations": <1|2|3>
}
```
2. Report analysis summary to user
**Output**: task-analysis.json written to session artifacts
---
## Structured Output Template
```
## Summary
- Project: <project-type> (<language>/<framework>)
- Scope: <small|medium|large> (~<N> files)
- Pipeline: <quick|standard|full>
## Capabilities Detected
- Language: <language>
- Framework: <framework>
- Testing: <test-framework>
- Build: <build-system>
## Complexity Assessment
- File count: <N> files affected
- Dependency depth: <N> modules
- Risk factors: <list>
## Pipeline Selection
- Mode: <mode> — <rationale>
- Stages: <stage-1> -> <stage-2> -> ...
- Max iterations: <N>
## Task Analysis JSON
- Written to: <session>/artifacts/task-analysis.json
```
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| Empty project directory | Report as unknown project type, default to standard pipeline |
| No package manifest found | Infer from file extensions, note reduced confidence |
| Ambiguous project type | Report both candidates, select most likely |
| Cannot determine scope | Default to medium, note uncertainty |
| Timeout approaching | Output current analysis with "PARTIAL" status |