Add quality gates, role library, and templates for team lifecycle v3

- Introduced quality gates documentation outlining scoring dimensions and per-phase criteria.
- Created a dynamic role library with definitions for core and specialist roles, including data engineer, devops engineer, ml engineer, orchestrator, performance optimizer, and security expert.
- Added templates for architecture documents, epics and stories, product briefs, and requirements PRD to standardize outputs across phases.
This commit is contained in:
catlog22
2026-03-05 10:20:42 +08:00
parent bbdd1840de
commit bf057a927b
65 changed files with 5023 additions and 50 deletions

View File

@@ -0,0 +1,217 @@
# Command: dispatch (v3 Enhanced)
Create task chains based on execution mode with conditional routing, dynamic role injection, and priority assignment.
## Phase 2: Context Loading
| Input | Source | Required |
|-------|--------|----------|
| Mode | Phase 1 requirements | Yes |
| Session folder | Phase 2 session init | Yes |
| Scope | User requirements | Yes |
| Injected roles | Phase 1 keyword analysis | No |
| Complexity | Phase 1 assessment | No |
## Phase 3: Task Chain Creation
### Spec Pipeline (6 tasks, 3 discuss)
| # | Subject | Owner | BlockedBy | Description | Validation | Priority |
|---|---------|-------|-----------|-------------|------------|----------|
| 1 | RESEARCH-001 | analyst | (none) | Seed analysis and context gathering | DISCUSS-001 | P0 |
| 2 | DRAFT-001 | writer | RESEARCH-001 | Generate Product Brief | self-validate | P0 |
| 3 | DRAFT-002 | writer | DRAFT-001 | Generate Requirements/PRD | DISCUSS-002 | P0 |
| 4 | DRAFT-003 | writer | DRAFT-002 | Generate Architecture Document | self-validate | P0 |
| 5 | DRAFT-004 | writer | DRAFT-003 | Generate Epics & Stories | self-validate | P0 |
| 6 | QUALITY-001 | reviewer | DRAFT-004 | 5-dimension spec quality + sign-off | DISCUSS-003 | P0 |
### Impl Pipeline - Conditional Routing (v3 NEW)
#### Low Complexity (1-2 modules, shallow deps)
| # | Subject | Owner | BlockedBy | Description | Priority |
|---|---------|-------|-----------|-------------|----------|
| 1 | PLAN-001 | planner | (none) | Planning with complexity assessment | P0 |
| 2 | IMPL-001 | executor | PLAN-001 | Code implementation | P0 |
| 3 | TEST-001 | tester | IMPL-001 | Test-fix cycles | P1 |
| 4 | REVIEW-001 | reviewer | IMPL-001 | 4-dimension code review | P1 |
#### Medium Complexity (3-4 modules, moderate deps)
| # | Subject | Owner | BlockedBy | Description | Priority |
|---|---------|-------|-----------|-------------|----------|
| 1 | PLAN-001 | planner | (none) | Planning with complexity assessment | P0 |
| 2 | ORCH-001 | orchestrator | PLAN-001 | Task decomposition & coordination | P0 |
| 3 | IMPL-001 | executor | ORCH-001 | Backend implementation | P0 |
| 4 | IMPL-002 | executor | ORCH-001 | Module 2 implementation | P0 |
| 5 | TEST-001 | tester | IMPL-001, IMPL-002 | Test-fix cycles | P1 |
| 6 | REVIEW-001 | reviewer | IMPL-001, IMPL-002 | 4-dimension code review | P1 |
#### High Complexity (5+ modules, deep deps)
| # | Subject | Owner | BlockedBy | Description | Priority |
|---|---------|-------|-----------|-------------|----------|
| 1 | PLAN-001 | planner | (none) | Planning with complexity assessment | P0 |
| 2 | ARCH-001 | architect | PLAN-001 | Architecture design | P0 |
| 3 | ORCH-001 | orchestrator | ARCH-001 | Task decomposition & coordination | P0 |
| 4 | IMPL-001 | executor | ORCH-001 | Backend implementation | P0 |
| 5 | IMPL-002 | executor | ORCH-001 | Module 2 implementation | P0 |
| 6 | IMPL-003 | executor | ORCH-001 | Module 3 implementation | P0 |
| 7 | TEST-001 | tester | IMPL-001, IMPL-002, IMPL-003 | Test-fix cycles | P1 |
| 8 | REVIEW-001 | reviewer | IMPL-001, IMPL-002, IMPL-003 | 4-dimension code review | P1 |
### FE Pipeline (3 tasks)
| # | Subject | Owner | BlockedBy | Description | Priority |
|---|---------|-------|-----------|-------------|----------|
| 1 | PLAN-001 | planner | (none) | Planning (frontend focus) | P0 |
| 2 | DEV-FE-001 | fe-developer | PLAN-001 | Frontend implementation | P0 |
| 3 | QA-FE-001 | fe-qa | DEV-FE-001 | 5-dimension frontend QA | P1 |
### Fullstack Pipeline (6 tasks, parallel execution)
| # | Subject | Owner | BlockedBy | Description | Priority |
|---|---------|-------|-----------|-------------|----------|
| 1 | PLAN-001 | planner | (none) | Fullstack planning | P0 |
| 2 | IMPL-001 | executor | PLAN-001 | Backend implementation | P0 |
| 3 | DEV-FE-001 | fe-developer | PLAN-001 | Frontend implementation (parallel) | P0 |
| 4 | TEST-001 | tester | IMPL-001 | Backend test-fix | P1 |
| 5 | QA-FE-001 | fe-qa | DEV-FE-001 | Frontend QA (parallel) | P1 |
| 6 | REVIEW-001 | reviewer | TEST-001, QA-FE-001 | Full code review | P1 |
### Dynamic Role Injection (v3 NEW)
When specialist roles are injected, add corresponding tasks:
| Injected Role | Task ID | Owner | BlockedBy | Description | Priority |
|---------------|---------|-------|-----------|-------------|----------|
| security-expert | SECURITY-001 | security-expert | IMPL-001 | Security audit (OWASP Top 10) | P0 |
| performance-optimizer | PERF-001 | performance-optimizer | IMPL-001 | Performance profiling & optimization | P1 |
| data-engineer | DATA-001 | data-engineer | PLAN-001 | Data pipeline implementation (parallel) | P0 |
| devops-engineer | DEVOPS-001 | devops-engineer | IMPL-001 | CI/CD & infrastructure setup | P1 |
| ml-engineer | ML-001 | ml-engineer | PLAN-001 | ML pipeline implementation (parallel) | P0 |
**Injection Rules**:
- Security tasks: P0 priority, block REVIEW-001
- Performance tasks: P1 priority, parallel with TEST-001
- Data/ML tasks: P0 priority, parallel with IMPL-001
- DevOps tasks: P1 priority, after IMPL-001
### Composite Modes
| Mode | Construction | PLAN-001 BlockedBy |
|------|-------------|-------------------|
| full-lifecycle | Spec (6) + Impl (conditional) | QUALITY-001 |
| full-lifecycle-fe | Spec (6) + Fullstack (6) | QUALITY-001 |
### Task Description Template
```
TaskCreate({
subject: "<TASK-ID>",
description: "PURPOSE: <what> | Success: <criteria>
TASK:
- <step 1>
- <step 2>
- <step 3>
CONTEXT:
- Session: <session-folder>
- Scope: <scope>
- Upstream: <artifacts>
- Priority: <P0|P1|P2>
EXPECTED: <deliverable> + <quality>
CONSTRAINTS: <scope limits>
---
Validation: <DISCUSS-NNN or self-validate>
InnerLoop: <true|false>
Priority: <P0|P1|P2>",
addBlockedBy: [<deps>]
})
```
### Complexity Assessment Logic (v3 NEW)
PLAN-001 task description includes complexity assessment instructions:
```
PURPOSE: Create implementation plan with complexity assessment | Success: Actionable plan with module breakdown and complexity rating
TASK:
- Analyze requirements and scope
- Identify modules and dependencies
- Assess complexity (Low/Medium/High)
- Generate implementation plan
- Write complexity assessment to plan.json
CONTEXT:
- Session: <session-folder>
- Spec artifacts: <paths>
- Complexity criteria:
* Low: 1-2 modules, shallow deps, single tech stack
* Medium: 3-4 modules, moderate deps, 2 tech stacks
* High: 5+ modules, deep deps, multiple tech stacks
EXPECTED: plan.json with complexity field + implementation plan document
Priority: P0
```
### Revision Task Template
```
TaskCreate({
subject: "<ORIGINAL-ID>-R1",
owner: "<same-role>",
description: "PURPOSE: Revision of <ORIGINAL-ID> | Success: Address feedback
TASK:
- Review original + feedback
- Apply fixes
- Validate
CONTEXT:
- Session: <session-folder>
- Original: <artifact-path>
- Feedback: <text>
- Priority: <inherit-from-original>
EXPECTED: Updated artifact + summary
---
Validation: <same-as-original>
InnerLoop: <same-as-original>
Priority: <inherit-from-original>",
addBlockedBy: []
})
```
## Phase 4: Artifact Manifest Generation
For each task, include artifact manifest generation instructions in task description:
```
---
Artifact Contract:
Generate artifact-manifest.json in Phase 4:
{
"artifact_id": "<role>-<type>-<timestamp>",
"creator_role": "<role>",
"artifact_type": "<type>",
"version": "1.0.0",
"path": "<relative-path>",
"dependencies": [<upstream-artifact-ids>],
"validation_status": "pending|passed|failed",
"validation_summary": "<summary>",
"metadata": {
"created_at": "<ISO8601>",
"task_id": "<task-id>",
"priority": "<P0|P1|P2>"
}
}
```
## Error Handling
| Error | Resolution |
|-------|------------|
| Invalid mode | Reject, ask to clarify |
| Complexity assessment missing | Default to Low complexity |
| Injected role not found | Log warning, skip injection |
| Priority conflict | P0 > P1 > P2, FIFO within same priority |
| Circular dependency | Detect, report, halt |

View File

@@ -0,0 +1,263 @@
# Command: monitor (v3 Enhanced)
Monitor team progress, handle callbacks, manage artifact registry, spawn next workers with priority scheduling.
## Handlers
| Handler | Trigger | Purpose |
|---------|---------|---------|
| handleCallback | Worker completion message | Process completion, validate artifacts, spawn next |
| handleCheck | User "check" command | Display current status |
| handleResume | User "resume" command | Advance pipeline |
| handleSpawnNext | Internal | Find ready tasks, priority sort, spawn workers |
| handleComplete | All tasks done | Trigger completion action |
---
## handleCallback
### Input
- Worker completion message via SendMessage
- Message contains: role, task_id, status, artifact_path
### Steps
1. **Parse Message**
- Extract role, task_id, status from message
- Load task via TaskGet
2. **Update Task Status**
- TaskUpdate(status="completed")
- Log completion to message bus
3. **Artifact Validation (v3 NEW)**
- Check if artifact-manifest.json exists
- If exists:
- Read manifest
- Check validation_status
- Register artifact in artifact-registry.json
- If validation_status == "failed":
- Block downstream spawn
- Create fix task
- STOP
- If validation_status == "pending":
- Prompt user for manual validation
- STOP
- If not exists (backward compatible):
- Continue without validation gating
4. **Checkpoint Detection**
- If task_id == "QUALITY-001":
- Display checkpoint output (see SKILL.md)
- Pause for user command
- STOP
- If task_id == "PLAN-001" (v3 NEW):
- Read plan.json for complexity assessment
- Display routing decision
- Apply conditional routing
- Continue
5. **Spawn Next**
- Call handleSpawnNext
- STOP
---
## handleSpawnNext (v3 Enhanced)
### Steps
1. **Find Ready Tasks**
- TaskList -> filter status="pending"
- For each pending task:
- Check blockedBy dependencies
- All blockedBy tasks completed? -> ready
2. **Priority Sorting (v3 NEW)**
- Sort ready tasks by priority:
- P0 tasks first
- P1 tasks second
- P2 tasks last
- Within same priority: FIFO (creation order)
3. **Parallel Grouping (v3 NEW)**
- Group tasks by stage (same blockedBy set)
- Tasks in same group can spawn in parallel
- Example: IMPL-001 and DEV-FE-001 both blocked by PLAN-001 -> parallel group
4. **Artifact Discovery (v3 NEW)**
- For each ready task:
- Query artifact registry for upstream artifacts
- Generate context-artifacts.json with artifact paths
- Write to session folder for worker Phase 2 consumption
5. **Spawn Workers**
- For each ready task (or parallel group):
- Spawn team-worker agent with role-spec
- Include priority in prompt
- Include context-artifacts.json path
- Log spawn to message bus
6. **Output Summary**
- List spawned tasks with priorities
- Show remaining pending count
- STOP
### Spawn Template (v3 Enhanced)
```
Agent({
subagent_type: "team-worker",
description: "Spawn <role> worker",
team_name: <team-name>,
name: "<role>",
run_in_background: true,
prompt: `## Role Assignment
role: <role>
role_spec: .claude/skills/team-lifecycle-v3/role-specs/<role>.md
session: <session-folder>
session_id: <session-id>
team_name: <team-name>
requirement: <task-description>
inner_loop: <true|false>
priority: <P0|P1|P2>
context_artifacts: <session-folder>/context-artifacts.json
Read role_spec file to load Phase 2-4 domain instructions.
Read context_artifacts for upstream artifact paths (automatic discovery).
Execute built-in Phase 1 (task discovery) -> role-spec Phase 2-4 -> built-in Phase 5 (report).`
})
```
---
## handleCheck
### Steps
1. **Load Session State**
- Read team-session.json
- TaskList -> count by status
2. **Display Status**
- Session ID
- Mode
- Task counts: completed / in_progress / pending
- Current running workers
- Artifact registry summary (v3 NEW)
- Priority queue status (v3 NEW)
3. **STOP** (no advancement)
---
## handleResume
### Steps
1. **Reconcile State**
- TaskList -> find in_progress tasks
- Check if workers still running
- If worker missing:
- Reset task to pending
- Log orphan detection
2. **Fast-Advance Orphan Detection**
- Check message bus for fast_advance logs
- If fast_advance spawned wrong task:
- Reconcile task chain
- Respawn correct task
3. **Spawn Next**
- Call handleSpawnNext
- STOP
---
## handleComplete (v3 NEW)
### Trigger
- All tasks have status="completed"
- No tasks with status="pending" or "in_progress"
### Steps
1. **Generate Summary**
- Count total tasks, duration
- List deliverables with artifact paths
- Generate artifact registry summary
- Calculate quality metrics (discuss verdicts, review scores)
2. **Completion Action**
- Read completion_action from team-config.json
- If "interactive":
- AskUserQuestion (see coordinator role.md Phase 5)
- Execute user choice
- If "auto_archive":
- Update session status="completed"
- TeamDelete
- Archive artifacts
- If "auto_keep":
- Update session status="paused"
- Output resume instructions
3. **Cleanup**
- Write final session state
- Log completion to message bus
- STOP
---
## Artifact Registry Operations (v3 NEW)
### Register Artifact
```javascript
// Read existing registry
const registry = JSON.parse(Read("<session>/artifact-registry.json"))
// Add new artifact
registry.artifacts[artifact_id] = {
manifest: <artifact-manifest>,
discovered_at: new Date().toISOString(),
consumed_by: []
}
// Write back
Write("<session>/artifact-registry.json", JSON.stringify(registry))
```
### Generate Context Artifacts
```javascript
// Query registry for upstream artifacts
const upstreamArtifacts = []
for (const dep of task.blockedBy) {
const depTask = TaskGet(dep)
const artifactId = findArtifactByTaskId(registry, depTask.id)
if (artifactId) {
upstreamArtifacts.push(registry.artifacts[artifactId].manifest)
}
}
// Write context-artifacts.json for worker consumption
Write("<session>/context-artifacts.json", JSON.stringify({
task_id: task.id,
upstream_artifacts: upstreamArtifacts,
generated_at: new Date().toISOString()
}))
```
---
## Error Handling
| Error | Resolution |
|-------|------------|
| Worker timeout | Mark task failed, ask user to retry |
| Artifact validation fails | Block downstream, create fix task |
| Artifact manifest missing | Continue without validation (backward compatible) |
| Priority conflict | P0 > P1 > P2, FIFO within same priority |
| Parallel spawn fails | Log error, spawn sequentially |
| Registry corruption | Rebuild from task artifacts |
| Completion action fails | Fallback to manual cleanup |

View File

@@ -0,0 +1,270 @@
# Coordinator Role (v3 Enhanced)
Orchestrate team-lifecycle-v3: team creation, task dispatching with priority scheduling, dynamic role injection, artifact registry management, progress monitoring. Uses **team-worker agent** for all worker spawns.
## Identity
- **Name**: `coordinator` | **Tag**: `[coordinator]`
- **Responsibility**: Parse requirements -> Inject roles -> Create team -> Dispatch tasks -> Monitor progress -> Manage artifacts -> Report
## v3 Enhancements
| Feature | Description |
|---------|-------------|
| Dynamic Role Injection | Analyze task keywords to inject specialist roles at runtime |
| Priority Scheduling | P0/P1/P2 task prioritization with critical path optimization |
| Artifact Registry | Maintain in-memory registry for automatic artifact discovery |
| Conditional Routing | Route based on complexity assessment from PLAN-001 |
| Parallel Orchestration | Spawn multiple workers in parallel stages |
## Boundaries
### MUST
- Parse user requirements and clarify via AskUserQuestion
- Analyze task description for specialist role injection
- Create team and spawn workers using **team-worker** agent type
- Dispatch tasks with proper dependency chains and priority levels
- Monitor progress via callbacks and route messages
- Maintain artifact registry for validation gating
- Maintain session state (team-session.json)
### MUST NOT
- Execute spec/impl/research work directly
- Modify task outputs
- Skip dependency validation
- Skip artifact validation gating
---
## Entry Router
| Detection | Condition | Handler |
|-----------|-----------|---------|
| Worker callback | Message contains `[role-name]` tag | -> handleCallback |
| Status check | "check" or "status" | -> handleCheck |
| Manual resume | "resume" or "continue" | -> handleResume |
| Interrupted session | Active/paused session in `.workflow/.team/TLS-*` | -> Phase 0 |
| New session | None of above | -> Phase 1 |
For callback/check/resume: load `commands/monitor.md`, execute handler, STOP.
---
## Phase 0: Session Resume Check
1. Scan `.workflow/.team/TLS-*/team-session.json` for active/paused
2. No sessions -> Phase 1
3. Single session -> resume (reconciliation)
4. Multiple -> AskUserQuestion
**Session Reconciliation**:
1. Audit TaskList, reconcile with session state
2. Reset in_progress -> pending (interrupted tasks)
3. Rebuild team if disbanded
4. Restore artifact registry from session
5. Create missing tasks with correct blockedBy
6. Kick first executable -> Phase 4
---
## Phase 1: Requirement Clarification
1. Parse arguments for mode, scope, focus
2. Ask missing parameters via AskUserQuestion:
- Mode: spec-only / impl-only / full-lifecycle / fe-only / fullstack / full-lifecycle-fe
- Scope: project description
3. Frontend auto-detection (keyword + package.json scanning)
4. **v3 NEW**: Keyword analysis for specialist role injection
5. Store requirements
### Keyword Analysis (v3 NEW)
Scan task description for specialist role triggers:
| Keywords | Injected Role | Injection Point |
|----------|---------------|-----------------|
| security, vulnerability, OWASP, audit | security-expert | After PLAN-001 |
| performance, optimization, bottleneck, latency | performance-optimizer | After IMPL-* |
| data, pipeline, ETL, schema, migration | data-engineer | Parallel with IMPL-* |
| devops, CI/CD, deployment, docker, kubernetes | devops-engineer | After IMPL-* |
| ML, model, training, inference, neural | ml-engineer | Parallel with IMPL-* |
| orchestrate, complex, multi-module | orchestrator | Replace IMPL-* with ORCH-* |
---
## Phase 2: Create Team + Initialize Session
1. Generate session ID: `TLS-<slug>-<date>`
2. Create session folder: `.workflow/.team/<session-id>/`
3. **v3 NEW**: Create artifact registry: `<session-id>/artifact-registry.json`
4. TeamCreate
5. Initialize directories (spec/, discussions/, plan/, explorations/, artifacts/)
6. Write team-session.json with injected roles
7. Initialize meta.json via team_msg state_update:
```
mcp__ccw-tools__team_msg({
operation: "log",
session_id: "<session-id>",
from: "coordinator",
type: "state_update",
summary: "Session initialized",
data: {
pipeline_mode: "<mode>",
pipeline_stages: [<role-list>],
roles: [<all-roles>],
injected_roles: [<specialist-roles>],
team_name: "lifecycle-v3",
artifact_registry_enabled: true,
priority_scheduling_enabled: true
}
})
```
---
## Phase 3: Create Task Chain
Delegate to `commands/dispatch.md`:
1. Read Task Metadata Registry for task definitions
2. **v3 NEW**: Assess complexity from requirements (Low/Medium/High)
3. **v3 NEW**: Apply conditional routing based on complexity
4. **v3 NEW**: Inject specialist role tasks based on keywords
5. Create tasks via TaskCreate with correct blockedBy and priority
6. Include `Session: <session-folder>` in every task
7. Mark discuss rounds (DISCUSS-001, DISCUSS-002, DISCUSS-003) or "self-validate"
### Complexity Assessment (v3 NEW)
| Complexity | Indicators | Route |
|------------|-----------|-------|
| Low | 1-2 modules, shallow deps, single tech stack | Direct IMPL-001 |
| Medium | 3-4 modules, moderate deps, 2 tech stacks | ORCH-001 -> parallel IMPL-* |
| High | 5+ modules, deep deps, multiple tech stacks | ARCH-001 -> ORCH-001 -> parallel IMPL-* |
### Priority Assignment (v3 NEW)
| Task Type | Priority | Rationale |
|-----------|----------|-----------|
| Spec pipeline | P0 | Blocking all downstream |
| PLAN-001, ARCH-001 | P0 | Critical path |
| ORCH-001, parallel IMPL-* | P0 | Critical path |
| TEST-*, QA-* | P1 | Validation phase |
| REVIEW-*, specialist analysis | P1 | Quality gate |
| IMPROVE-*, optimization | P2 | Enhancement |
---
## Phase 4: Spawn-and-Stop
1. Load `commands/monitor.md`
2. Find ready tasks (pending + blockedBy resolved)
3. **v3 NEW**: Sort by priority (P0 > P1 > P2), FIFO within same priority
4. **v3 NEW**: Identify parallel groups (same stage, no mutual blockedBy)
5. Spawn team-worker for each ready task (parallel spawn for same group)
6. Output summary with priority levels
7. STOP
### Checkpoint Gate (QUALITY-001)
When QUALITY-001 completes:
1. Read readiness-report.md
2. Parse quality gate and dimension scores
3. Output Checkpoint Template (see SKILL.md)
4. Pause for user command
### Complexity Routing Gate (PLAN-001, v3 NEW)
When PLAN-001 completes:
1. Read plan.json for complexity assessment
2. Apply conditional routing:
- Low: spawn IMPL-001 directly
- Medium: spawn ORCH-001 first
- High: spawn ARCH-001 first
3. Output routing decision
4. Continue
---
## Phase 5: Report + Completion Action
1. Count completed tasks, duration
2. List deliverables with artifact paths
3. **v3 NEW**: Generate artifact registry summary
4. Update session status -> "completed"
5. **v3 NEW**: Trigger completion action (interactive/auto-archive/auto-keep)
### Completion Action (v3 NEW)
```
AskUserQuestion({
questions: [{
question: "Team pipeline complete. What would you like to do?",
header: "Completion",
multiSelect: false,
options: [
{ label: "Archive & Clean", description: "Archive session, clean up tasks and team resources" },
{ label: "Keep Active", description: "Keep session active for follow-up work or inspection" },
{ label: "Export Results", description: "Export deliverables to a specified location, then clean" }
]
}]
})
```
| Choice | Action |
|--------|--------|
| Archive & Clean | Update session status="completed", TeamDelete, archive artifacts |
| Keep Active | Update session status="paused", output resume instructions |
| Export Results | Copy deliverables to user-specified path, then Archive & Clean |
---
## Artifact Registry Management (v3 NEW)
### Registry Structure
```json
{
"artifacts": {
"<artifact-id>": {
"manifest": { ... },
"discovered_at": "timestamp",
"consumed_by": ["<role-name>"]
}
}
}
```
### Registry Operations
| Operation | When | Action |
|-----------|------|--------|
| Register | Worker Phase 5 callback | Add artifact manifest to registry |
| Validate | Before spawning downstream | Check validation_status |
| Discover | Worker Phase 2 request | Generate context-artifacts.json |
| Update | Worker consumes artifact | Add to consumed_by list |
### Validation Gating
Before spawning downstream worker:
1. Read artifact manifest from registry
2. Check validation_status:
- `passed`: spawn next worker
- `failed`: block spawn, trigger fix loop
- `pending`: wait or prompt manual validation
---
## Error Handling
| Error | Resolution |
|-------|------------|
| Task timeout | Log, mark failed, ask user |
| Worker crash | Respawn worker, reassign task |
| Dependency cycle | Detect, report, halt |
| Invalid mode | Reject, ask to clarify |
| Session corruption | Attempt recovery |
| Artifact validation fails | Block downstream, create fix task |
| Role injection fails | Log warning, continue with core roles |
| Priority conflict | P0 > P1 > P2, FIFO within same priority |
| Parallel merge timeout | Report stall, prompt user intervention |