mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-06 16:31:12 +08:00
feat: Add coordinator commands and role specifications for UI design team
- Implemented the 'monitor' command for coordinator role to handle monitoring events, task completion, and pipeline management. - Created role specifications for the coordinator, detailing responsibilities, command execution protocols, and session management. - Added role specifications for the analyst, discussant, explorer, and synthesizer in the ultra-analyze skill, defining their context loading, analysis, and synthesis processes.
This commit is contained in:
@@ -127,8 +127,8 @@ For callback/check/resume: load coordination logic and execute the appropriate h
|
||||
|
||||
```
|
||||
UDS-<slug>-<date>/
|
||||
├── team-session.json
|
||||
├── shared-memory.json
|
||||
├── .msg/messages.jsonl
|
||||
├── .msg/meta.json
|
||||
├── wisdom/
|
||||
│ ├── learnings.md
|
||||
│ ├── decisions.md
|
||||
@@ -144,17 +144,28 @@ UDS-<slug>-<date>/
|
||||
└── component-files/
|
||||
```
|
||||
|
||||
5. Initialize shared-memory.json with:
|
||||
- design_intelligence: {}
|
||||
- design_token_registry: { colors, typography, spacing, shadows, borders }
|
||||
- style_decisions: []
|
||||
- component_inventory: []
|
||||
- accessibility_patterns: []
|
||||
- audit_history: []
|
||||
- industry_context: { industry, config }
|
||||
- _metadata: { created_at, pipeline }
|
||||
5. Initialize cross-role state via team_msg(type='state_update'):
|
||||
|
||||
6. Write team-session.json with:
|
||||
```
|
||||
mcp__ccw-tools__team_msg({
|
||||
operation: "log",
|
||||
session_id: <session-id>,
|
||||
from: "coordinator",
|
||||
type: "state_update",
|
||||
data: {
|
||||
design_intelligence: {},
|
||||
design_token_registry: { colors: {}, typography: {}, spacing: {}, shadows: {}, borders: {} },
|
||||
style_decisions: [],
|
||||
component_inventory: [],
|
||||
accessibility_patterns: [],
|
||||
audit_history: [],
|
||||
industry_context: { industry: <industry>, config: <config> },
|
||||
_metadata: { created_at: <timestamp>, pipeline: <pipeline> }
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
6. Write meta.json with:
|
||||
- session_id, team_name, topic, pipeline, status
|
||||
- current_phase, completed_tasks, sync_points
|
||||
- gc_state: { round, max_rounds: 2, converged }
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
# Command: Dispatch
|
||||
|
||||
Create the UI design task chain with correct dependencies and structured task descriptions. Supports component, system, and full-system pipeline modes.
|
||||
|
||||
## Phase 2: Context Loading
|
||||
|
||||
| Input | Source | Required |
|
||||
|-------|--------|----------|
|
||||
| User requirement | From coordinator Phase 1 | Yes |
|
||||
| Session folder | From coordinator Phase 2 | Yes |
|
||||
| Pipeline mode | From session.json `pipeline` | Yes |
|
||||
| Industry config | From session.json `industry` | Yes |
|
||||
|
||||
1. Load user requirement and design scope from session.json
|
||||
2. Load pipeline stage definitions from SKILL.md Task Metadata Registry
|
||||
3. Read `pipeline` and `industry` from session.json
|
||||
|
||||
## Phase 3: Task Chain Creation (Mode-Branched)
|
||||
|
||||
### Task Description Template
|
||||
|
||||
Every task description uses structured format:
|
||||
|
||||
```
|
||||
TaskCreate({
|
||||
subject: "<TASK-ID>",
|
||||
owner: "<role>",
|
||||
description: "PURPOSE: <what this task achieves> | Success: <measurable completion criteria>
|
||||
TASK:
|
||||
- <step 1: specific action>
|
||||
- <step 2: specific action>
|
||||
- <step 3: specific action>
|
||||
CONTEXT:
|
||||
- Session: <session-folder>
|
||||
- Scope: <design-scope>
|
||||
- Industry: <industry>
|
||||
- Upstream artifacts: <artifact-1>, <artifact-2>
|
||||
- Shared memory: <session>/wisdom/.msg/meta.json
|
||||
EXPECTED: <deliverable path> + <quality criteria>
|
||||
CONSTRAINTS: <scope limits, focus areas>",
|
||||
blockedBy: [<dependency-list>],
|
||||
status: "pending"
|
||||
})
|
||||
```
|
||||
|
||||
### Mode Router
|
||||
|
||||
| Mode | Action |
|
||||
|------|--------|
|
||||
| `component` | Create 4 tasks: RESEARCH -> DESIGN -> AUDIT -> BUILD |
|
||||
| `system` | Create 7 tasks: dual-track with 2 sync points |
|
||||
| `full-system` | Create 8 tasks: dual-track with 3 sync points (final audit) |
|
||||
|
||||
---
|
||||
|
||||
### Component Pipeline Task Chain
|
||||
|
||||
**RESEARCH-001** (researcher):
|
||||
```
|
||||
TaskCreate({
|
||||
subject: "RESEARCH-001",
|
||||
description: "PURPOSE: Analyze existing design system, build component inventory, assess accessibility baseline | Success: 4 research artifacts produced with valid data
|
||||
TASK:
|
||||
- Analyze existing design tokens and styling patterns
|
||||
- Build component inventory with props and states
|
||||
- Assess accessibility baseline (WCAG level, ARIA coverage)
|
||||
- Retrieve design intelligence via ui-ux-pro-max
|
||||
CONTEXT:
|
||||
- Session: <session-folder>
|
||||
- Scope: <design-scope>
|
||||
- Industry: <industry>
|
||||
- Shared memory: <session>/wisdom/.msg/meta.json
|
||||
EXPECTED: <session>/research/*.json | All 4 research files with valid JSON
|
||||
CONSTRAINTS: Read-only analysis | Focus on <design-scope>",
|
||||
status: "pending"
|
||||
})
|
||||
```
|
||||
|
||||
**DESIGN-001** (designer):
|
||||
```
|
||||
TaskCreate({
|
||||
subject: "DESIGN-001",
|
||||
description: "PURPOSE: Define component design with tokens and specifications | Success: Design tokens + component spec with all states defined
|
||||
TASK:
|
||||
- Define design tokens consuming research findings
|
||||
- Create component specification with all 5 interactive states
|
||||
- Ensure accessibility spec (role, ARIA, keyboard, focus)
|
||||
- Reference design intelligence recommendations
|
||||
CONTEXT:
|
||||
- Session: <session-folder>
|
||||
- Scope: <design-scope>
|
||||
- Industry: <industry>
|
||||
- Upstream artifacts: research/*.json
|
||||
- Shared memory: <session>/wisdom/.msg/meta.json
|
||||
EXPECTED: <session>/design/design-tokens.json + component-specs/*.md | Complete token system + spec
|
||||
CONSTRAINTS: Follow W3C Design Tokens Format | All color tokens need light/dark",
|
||||
blockedBy: ["RESEARCH-001"],
|
||||
status: "pending"
|
||||
})
|
||||
```
|
||||
|
||||
**AUDIT-001** (reviewer):
|
||||
```
|
||||
TaskCreate({
|
||||
subject: "AUDIT-001",
|
||||
description: "PURPOSE: Audit design for consistency, accessibility, and quality | Success: Audit score >= 8 with 0 critical issues
|
||||
TASK:
|
||||
- Score 5 dimensions: consistency, accessibility, completeness, quality, industry compliance
|
||||
- Check token naming, theme completeness, contrast ratios
|
||||
- Verify component states and ARIA spec
|
||||
- Check against design intelligence anti-patterns
|
||||
CONTEXT:
|
||||
- Session: <session-folder>
|
||||
- Scope: <design-scope>
|
||||
- Industry: <industry>
|
||||
- Upstream artifacts: design/design-tokens.json, design/component-specs/*.md
|
||||
- Shared memory: <session>/wisdom/.msg/meta.json
|
||||
EXPECTED: <session>/audit/audit-001.md | 5-dimension scored report
|
||||
CONSTRAINTS: Read-only analysis | GC convergence: score >= 8 and 0 critical",
|
||||
blockedBy: ["DESIGN-001"],
|
||||
status: "pending"
|
||||
})
|
||||
```
|
||||
|
||||
**BUILD-001** (implementer):
|
||||
```
|
||||
TaskCreate({
|
||||
subject: "BUILD-001",
|
||||
description: "PURPOSE: Implement component code from design specs | Success: Production code with token consumption and accessibility
|
||||
TASK:
|
||||
- Generate CSS custom properties from design tokens
|
||||
- Implement component with all 5 states
|
||||
- Add ARIA attributes and keyboard navigation
|
||||
- Validate no hardcoded values
|
||||
CONTEXT:
|
||||
- Session: <session-folder>
|
||||
- Scope: <design-scope>
|
||||
- Industry: <industry>
|
||||
- Upstream artifacts: design/design-tokens.json, design/component-specs/*.md, audit/audit-001.md
|
||||
- Shared memory: <session>/wisdom/.msg/meta.json
|
||||
EXPECTED: <session>/build/**/* | Component + tokens CSS/TS + tests
|
||||
CONSTRAINTS: Use var(--token-name) only | Follow project patterns",
|
||||
blockedBy: ["AUDIT-001"],
|
||||
status: "pending"
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### System Pipeline Task Chain (Dual-Track)
|
||||
|
||||
Create tasks in dependency order:
|
||||
|
||||
| Task | Role | blockedBy | Description |
|
||||
|------|------|-----------|-------------|
|
||||
| RESEARCH-001 | researcher | (none) | Design system analysis |
|
||||
| DESIGN-001 | designer | RESEARCH-001 | Token system design |
|
||||
| AUDIT-001 | reviewer | DESIGN-001 | Token audit [Sync Point 1] |
|
||||
| DESIGN-002 | designer | AUDIT-001 | Component specification |
|
||||
| BUILD-001 | implementer | AUDIT-001 | Token code implementation |
|
||||
| AUDIT-002 | reviewer | DESIGN-002 | Component audit [Sync Point 2] |
|
||||
| BUILD-002 | implementer | AUDIT-002, BUILD-001 | Component code implementation |
|
||||
|
||||
Task descriptions follow same template as component pipeline, with subject-specific content for tokens vs components and appropriate upstream artifacts.
|
||||
|
||||
---
|
||||
|
||||
### Full-System Pipeline Task Chain
|
||||
|
||||
Same as System Pipeline, plus:
|
||||
|
||||
| Task | Role | blockedBy | Description |
|
||||
|------|------|-----------|-------------|
|
||||
| AUDIT-003 | reviewer | BUILD-002 | Final integrated audit (cross-cutting) |
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Validation
|
||||
|
||||
Verify task chain integrity:
|
||||
|
||||
| Check | Method | Expected |
|
||||
|-------|--------|----------|
|
||||
| Task count correct | TaskList count | component: 4, system: 7, full-system: 8 |
|
||||
| Dependencies correct | Trace dependency graph | Acyclic, correct blockedBy |
|
||||
| No circular dependencies | Trace dependency graph | Acyclic |
|
||||
| Task IDs use correct prefixes | Pattern check | RESEARCH/DESIGN/AUDIT/BUILD |
|
||||
| Structured descriptions complete | Each has PURPOSE/TASK/CONTEXT/EXPECTED/CONSTRAINTS | All present |
|
||||
|
||||
If validation fails, fix the specific task and re-validate.
|
||||
@@ -0,0 +1,203 @@
|
||||
# Command: Monitor
|
||||
|
||||
Handle all coordinator monitoring events: worker callbacks, status checks, pipeline advancement, and completion. Supports component, system, and full-system pipeline modes with sync point and Generator-Critic loop management.
|
||||
|
||||
## Phase 2: Context Loading
|
||||
|
||||
| Input | Source | Required |
|
||||
|-------|--------|----------|
|
||||
| Session state | <session>/session.json | Yes |
|
||||
| Task list | TaskList() | Yes |
|
||||
| Trigger event | From Entry Router detection | Yes |
|
||||
| Pipeline definition | From SKILL.md | Yes |
|
||||
|
||||
1. Load session.json for current state, `pipeline`, `gc_state`, `sync_points`
|
||||
2. Run TaskList() to get current task statuses
|
||||
3. Identify trigger event type from Entry Router
|
||||
|
||||
## Phase 3: Event Handlers
|
||||
|
||||
### handleCallback
|
||||
|
||||
Triggered when a worker sends completion message.
|
||||
|
||||
1. Parse message to identify role and task ID:
|
||||
|
||||
| Message Pattern | Role Detection |
|
||||
|----------------|---------------|
|
||||
| `[researcher]` or task ID `RESEARCH-*` | researcher |
|
||||
| `[designer]` or task ID `DESIGN-*` | designer |
|
||||
| `[reviewer]` or task ID `AUDIT-*` | reviewer |
|
||||
| `[implementer]` or task ID `BUILD-*` | implementer |
|
||||
|
||||
2. Mark task as completed:
|
||||
|
||||
```
|
||||
TaskUpdate({ taskId: "<task-id>", status: "completed" })
|
||||
```
|
||||
|
||||
3. Record completion in session state
|
||||
|
||||
4. Check if checkpoint feedback is configured for this stage:
|
||||
|
||||
| Completed Task | Checkpoint | Action |
|
||||
|---------------|------------|--------|
|
||||
| RESEARCH-001 | - | Notify user: research complete |
|
||||
| DESIGN-001 (tokens) | - | Proceed to AUDIT-001 |
|
||||
| AUDIT-001 | Sync Point 1 | Check audit signal -> GC loop or unblock parallel (see below) |
|
||||
| DESIGN-002 (components) | - | Proceed to AUDIT-002 |
|
||||
| AUDIT-002 | Sync Point 2 | Check audit signal -> GC loop or unblock BUILD-002 |
|
||||
| BUILD-001 (tokens) | - | Check if BUILD-002 ready |
|
||||
| BUILD-002 (components) | - | Check if AUDIT-003 exists (full-system) or handleComplete |
|
||||
| AUDIT-003 | Final | Notify user: final audit complete |
|
||||
|
||||
5. **Sync Point handling** (AUDIT task completed):
|
||||
- Read audit signal from message: `audit_passed`, `audit_result`, or `fix_required`
|
||||
- Route to GC loop control (see below)
|
||||
|
||||
6. Proceed to handleSpawnNext
|
||||
|
||||
### handleSpawnNext
|
||||
|
||||
Find and spawn the next ready tasks.
|
||||
|
||||
1. Scan task list for tasks where:
|
||||
- Status is "pending"
|
||||
- All blockedBy tasks have status "completed"
|
||||
|
||||
2. For each ready task, spawn team-worker:
|
||||
|
||||
```
|
||||
Task({
|
||||
subagent_type: "team-worker",
|
||||
description: "Spawn <role> worker for <task-id>",
|
||||
team_name: "uidesign",
|
||||
name: "<role>",
|
||||
run_in_background: true,
|
||||
prompt: `## Role Assignment
|
||||
role: <role>
|
||||
role_spec: .claude/skills/team-uidesign/role-specs/<role>.md
|
||||
session: <session-folder>
|
||||
session_id: <session-id>
|
||||
team_name: uidesign
|
||||
requirement: <task-description>
|
||||
inner_loop: false
|
||||
|
||||
Read role_spec file to load Phase 2-4 domain instructions.
|
||||
Execute built-in Phase 1 -> role-spec Phase 2-4 -> built-in Phase 5.`
|
||||
})
|
||||
```
|
||||
|
||||
3. **Parallel spawn rules by mode**:
|
||||
|
||||
| Mode | Scenario | Spawn Behavior |
|
||||
|------|----------|---------------|
|
||||
| Component | Sequential | One task at a time |
|
||||
| System | After Sync Point 1 | Spawn DESIGN-002 + BUILD-001 in parallel |
|
||||
| System | After Sync Point 2 | Spawn BUILD-002 |
|
||||
| Full-system | After Sync Point 1 | Spawn DESIGN-002 + BUILD-001 in parallel |
|
||||
| Full-system | After BUILD-002 | Spawn AUDIT-003 |
|
||||
|
||||
4. STOP after spawning -- wait for next callback
|
||||
|
||||
### Generator-Critic Loop Control
|
||||
|
||||
When AUDIT task completes, check signal:
|
||||
|
||||
| Signal | Condition | Action |
|
||||
|--------|-----------|--------|
|
||||
| `audit_passed` | Score >= 8, critical === 0 | GC converged -> record sync_point -> unblock downstream tasks |
|
||||
| `audit_result` | Score 6-7, critical === 0 | GC round < max -> create DESIGN-fix task |
|
||||
| `fix_required` | Score < 6 or critical > 0 | GC round < max -> create DESIGN-fix task (CRITICAL) |
|
||||
| Any | GC round >= max | Escalate to user |
|
||||
|
||||
**GC Fix Task Creation**:
|
||||
```
|
||||
TaskCreate({
|
||||
subject: "DESIGN-fix-<round>",
|
||||
description: "PURPOSE: Address audit feedback from AUDIT-<NNN> | Success: All critical/high issues resolved
|
||||
TASK:
|
||||
- Parse audit feedback for specific issues
|
||||
- Re-read affected design artifacts
|
||||
- Apply fixes: token adjustments, missing states, accessibility gaps
|
||||
- Re-write affected files
|
||||
CONTEXT:
|
||||
- Session: <session-folder>
|
||||
- Upstream artifacts: audit/audit-<NNN>.md
|
||||
- Shared memory: <session>/wisdom/.msg/meta.json
|
||||
EXPECTED: Updated design artifacts | All flagged issues addressed
|
||||
CONSTRAINTS: Targeted fixes only",
|
||||
blockedBy: [],
|
||||
status: "pending"
|
||||
})
|
||||
```
|
||||
|
||||
After fix completes, create new AUDIT task blocked by the fix task. Increment gc_state.round.
|
||||
|
||||
**GC Escalation Options**:
|
||||
1. Accept current design - Skip remaining review, continue implementation
|
||||
2. Try one more round - Extra GC loop opportunity
|
||||
3. Terminate - Stop and handle manually
|
||||
|
||||
### Dual-Track Sync Point Management
|
||||
|
||||
**When AUDIT at sync point passes (audit_passed)**:
|
||||
1. Record sync point in session.sync_points
|
||||
2. Unblock parallel tasks on both tracks
|
||||
3. team_msg log(sync_checkpoint)
|
||||
|
||||
**Dual-track failure fallback**:
|
||||
- Convert remaining parallel tasks to sequential
|
||||
- Remove parallel dependencies, add sequential blockedBy
|
||||
- team_msg log(error): "Dual-track sync failed, falling back to sequential"
|
||||
|
||||
### handleCheck
|
||||
|
||||
Output current pipeline status.
|
||||
|
||||
```
|
||||
Pipeline Status (<pipeline-mode>):
|
||||
[DONE] RESEARCH-001 (researcher) -> research/*.json
|
||||
[DONE] DESIGN-001 (designer) -> design-tokens.json
|
||||
[RUN] AUDIT-001 (reviewer) -> auditing tokens...
|
||||
[WAIT] BUILD-001 (implementer) -> blocked by AUDIT-001
|
||||
[WAIT] DESIGN-002 (designer) -> blocked by AUDIT-001
|
||||
|
||||
GC Rounds: 0/2
|
||||
Sync Points: 0/<expected>
|
||||
Session: <session-id>
|
||||
```
|
||||
|
||||
Output status -- do NOT advance pipeline.
|
||||
|
||||
### handleResume
|
||||
|
||||
Resume pipeline after user pause or interruption.
|
||||
|
||||
1. Audit task list for inconsistencies:
|
||||
- Tasks stuck in "in_progress" -> reset to "pending"
|
||||
- Tasks with completed blockers but still "pending" -> include in spawn list
|
||||
2. Proceed to handleSpawnNext
|
||||
|
||||
### handleComplete
|
||||
|
||||
Triggered when all pipeline tasks are completed.
|
||||
|
||||
**Completion check by mode**:
|
||||
|
||||
| Mode | Completion Condition |
|
||||
|------|---------------------|
|
||||
| Component | All 4 tasks (+ any fix/retry tasks) have status "completed" |
|
||||
| System | All 7 tasks (+ any fix/retry tasks) have status "completed" |
|
||||
| Full-system | All 8 tasks (+ any fix/retry tasks) have status "completed" |
|
||||
|
||||
If any tasks not completed, return to handleSpawnNext.
|
||||
If all completed, transition to coordinator Phase 5.
|
||||
|
||||
## Phase 4: State Persistence
|
||||
|
||||
After every handler execution:
|
||||
|
||||
1. Update session.json with current state (active tasks, gc_state, sync_points, last event)
|
||||
2. Verify task list consistency
|
||||
3. STOP and wait for next event
|
||||
278
.claude/skills/team-uidesign/roles/coordinator/role.md
Normal file
278
.claude/skills/team-uidesign/roles/coordinator/role.md
Normal file
@@ -0,0 +1,278 @@
|
||||
# Coordinator - UI Design Team
|
||||
|
||||
**Role**: coordinator
|
||||
**Type**: Orchestrator
|
||||
**Team**: uidesign
|
||||
|
||||
Orchestrates the UI design pipeline: manages dual-track task chains (design + implementation), spawns team-worker agents, handles Generator-Critic loops between designer and reviewer, manages sync points, and drives the pipeline to completion.
|
||||
|
||||
## Boundaries
|
||||
|
||||
### MUST
|
||||
|
||||
- Use `team-worker` agent type for all worker spawns (NOT `general-purpose`)
|
||||
- Follow Command Execution Protocol for dispatch and monitor commands
|
||||
- Respect pipeline stage dependencies (blockedBy)
|
||||
- Stop after spawning workers -- wait for callbacks
|
||||
- Handle Generator-Critic loops with max 2 iterations
|
||||
- Execute completion action in Phase 5
|
||||
|
||||
### MUST NOT
|
||||
|
||||
- Implement domain logic (researching, designing, auditing, building) -- workers handle this
|
||||
- Spawn workers without creating tasks first
|
||||
- Skip sync points when configured
|
||||
- Force-advance pipeline past failed audit
|
||||
- Modify source code or design artifacts directly -- delegate to workers
|
||||
|
||||
---
|
||||
|
||||
## Command Execution Protocol
|
||||
|
||||
When coordinator needs to execute a command (dispatch, monitor):
|
||||
|
||||
1. **Read the command file**: `roles/coordinator/commands/<command-name>.md`
|
||||
2. **Follow the workflow** defined in the command file (Phase 2-4 structure)
|
||||
3. **Commands are inline execution guides** -- NOT separate agents or subprocesses
|
||||
4. **Execute synchronously** -- complete the command workflow before proceeding
|
||||
|
||||
Example:
|
||||
```
|
||||
Phase 3 needs task dispatch
|
||||
-> Read roles/coordinator/commands/dispatch.md
|
||||
-> Execute Phase 2 (Context Loading)
|
||||
-> Execute Phase 3 (Task Chain Creation)
|
||||
-> Execute Phase 4 (Validation)
|
||||
-> Continue to Phase 4
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Entry Router
|
||||
|
||||
When coordinator is invoked, detect invocation type:
|
||||
|
||||
| Detection | Condition | Handler |
|
||||
|-----------|-----------|---------|
|
||||
| Worker callback | Message contains role tag [researcher], [designer], [reviewer], [implementer] | -> handleCallback |
|
||||
| Status check | Arguments contain "check" or "status" | -> handleCheck |
|
||||
| Manual resume | Arguments contain "resume" or "continue" | -> handleResume |
|
||||
| Pipeline complete | All tasks have status "completed" | -> handleComplete |
|
||||
| Interrupted session | Active/paused session exists | -> Phase 0 (Resume Check) |
|
||||
| New session | None of above | -> Phase 1 (Requirement Clarification) |
|
||||
|
||||
For callback/check/resume/complete: load `commands/monitor.md` and execute matched handler, then STOP.
|
||||
|
||||
### Router Implementation
|
||||
|
||||
1. **Load session context** (if exists):
|
||||
- Scan `.workflow/.team/UDS-*/.msg/meta.json` for active/paused sessions
|
||||
- If found, extract session folder path, status, and pipeline mode
|
||||
|
||||
2. **Parse $ARGUMENTS** for detection keywords:
|
||||
- Check for role name tags in message content
|
||||
- Check for "check", "status", "resume", "continue" keywords
|
||||
|
||||
3. **Route to handler**:
|
||||
- For monitor handlers: Read `commands/monitor.md`, execute matched handler, STOP
|
||||
- For Phase 0: Execute Session Resume Check below
|
||||
- For Phase 1: Execute Requirement Clarification below
|
||||
|
||||
---
|
||||
|
||||
## Phase 0: Session Resume Check
|
||||
|
||||
Triggered when an active/paused session is detected on coordinator entry.
|
||||
|
||||
1. Load session.json from detected session folder
|
||||
2. Audit task list:
|
||||
|
||||
```
|
||||
TaskList()
|
||||
```
|
||||
|
||||
3. Reconcile session state vs task status:
|
||||
|
||||
| Task Status | Session Expects | Action |
|
||||
|-------------|----------------|--------|
|
||||
| in_progress | Should be running | Reset to pending (worker was interrupted) |
|
||||
| completed | Already tracked | Skip |
|
||||
| pending + unblocked | Ready to run | Include in spawn list |
|
||||
|
||||
4. Rebuild team if not active:
|
||||
|
||||
```
|
||||
TeamCreate({ team_name: "uidesign" })
|
||||
```
|
||||
|
||||
5. Spawn workers for ready tasks -> Phase 4 coordination loop
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Requirement Clarification
|
||||
|
||||
1. Parse user task description from $ARGUMENTS
|
||||
2. Identify design scope:
|
||||
|
||||
| Signal | Target |
|
||||
|--------|--------|
|
||||
| Single component mentioned | Component pipeline |
|
||||
| Multiple components or "design system" | System pipeline |
|
||||
| Full redesign or "complete design system" | Full-system pipeline |
|
||||
|
||||
3. If scope is unclear, ask for clarification:
|
||||
|
||||
```
|
||||
AskUserQuestion({
|
||||
questions: [
|
||||
{ question: "UI design scope?", header: "Scope", options: [
|
||||
{ label: "Single component" },
|
||||
{ label: "Component system" },
|
||||
{ label: "Full design system" }
|
||||
]},
|
||||
{ question: "Product type/industry?", header: "Industry", options: [
|
||||
{ label: "SaaS/Tech" },
|
||||
{ label: "E-commerce" },
|
||||
{ label: "Healthcare/Finance" },
|
||||
{ label: "Education/Content" },
|
||||
{ label: "Other" }
|
||||
]}
|
||||
]
|
||||
})
|
||||
```
|
||||
|
||||
4. Map scope to pipeline: component / system / full-system
|
||||
5. Record requirement with scope, industry, and pipeline mode
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Session & Team Setup
|
||||
|
||||
1. Create session directory:
|
||||
|
||||
```
|
||||
Bash("mkdir -p .workflow/.team/UDS-<slug>-<date>/research .workflow/.team/UDS-<slug>-<date>/design/component-specs .workflow/.team/UDS-<slug>-<date>/design/layout-specs .workflow/.team/UDS-<slug>-<date>/audit .workflow/.team/UDS-<slug>-<date>/build/token-files .workflow/.team/UDS-<slug>-<date>/build/component-files .workflow/.team/UDS-<slug>-<date>/wisdom .workflow/.team/UDS-<slug>-<date>/.msg")
|
||||
```
|
||||
|
||||
2. Write session.json:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "active",
|
||||
"team_name": "uidesign",
|
||||
"requirement": "<requirement>",
|
||||
"timestamp": "<ISO-8601>",
|
||||
"pipeline": "<component|system|full-system>",
|
||||
"industry": "<industry>",
|
||||
"sync_points": [],
|
||||
"gc_state": { "round": 0, "max_rounds": 2, "converged": false },
|
||||
"fix_cycles": {}
|
||||
}
|
||||
```
|
||||
|
||||
3. Initialize .msg/meta.json:
|
||||
|
||||
```
|
||||
Write("<session>/wisdom/.msg/meta.json", { "session_id": "<session-id>", "requirement": "<requirement>", "pipeline": "<pipeline>" })
|
||||
```
|
||||
|
||||
4. Create team:
|
||||
|
||||
```
|
||||
TeamCreate({ team_name: "uidesign" })
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Task Chain Creation
|
||||
|
||||
Execute `commands/dispatch.md` inline (Command Execution Protocol):
|
||||
|
||||
1. Read `roles/coordinator/commands/dispatch.md`
|
||||
2. Follow dispatch Phase 2 (context loading) -> Phase 3 (task chain creation) -> Phase 4 (validation)
|
||||
3. Result: all pipeline tasks created with correct blockedBy dependencies
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Spawn & Coordination Loop
|
||||
|
||||
### Initial Spawn
|
||||
|
||||
Find first unblocked task and spawn its worker:
|
||||
|
||||
```
|
||||
Task({
|
||||
subagent_type: "team-worker",
|
||||
description: "Spawn researcher worker",
|
||||
team_name: "uidesign",
|
||||
name: "researcher",
|
||||
run_in_background: true,
|
||||
prompt: `## Role Assignment
|
||||
role: researcher
|
||||
role_spec: .claude/skills/team-uidesign/role-specs/researcher.md
|
||||
session: <session-folder>
|
||||
session_id: <session-id>
|
||||
team_name: uidesign
|
||||
requirement: <requirement>
|
||||
inner_loop: false
|
||||
|
||||
Read role_spec file to load Phase 2-4 domain instructions.
|
||||
Execute built-in Phase 1 -> role-spec Phase 2-4 -> built-in Phase 5.`
|
||||
})
|
||||
```
|
||||
|
||||
**STOP** after spawning. Wait for worker callback.
|
||||
|
||||
### Coordination (via monitor.md handlers)
|
||||
|
||||
All subsequent coordination is handled by `commands/monitor.md` handlers triggered by worker callbacks:
|
||||
|
||||
- handleCallback -> mark task done -> check pipeline -> handleSpawnNext
|
||||
- handleSpawnNext -> find ready tasks -> spawn team-worker agents -> STOP
|
||||
- handleComplete -> all done -> Phase 5
|
||||
|
||||
---
|
||||
|
||||
## Phase 5: Report + Completion Action
|
||||
|
||||
1. Load session state -> count completed tasks, calculate duration
|
||||
2. List deliverables:
|
||||
|
||||
| Deliverable | Path |
|
||||
|-------------|------|
|
||||
| Design System Analysis | <session>/research/design-system-analysis.json |
|
||||
| Component Inventory | <session>/research/component-inventory.json |
|
||||
| Accessibility Audit | <session>/research/accessibility-audit.json |
|
||||
| Design Intelligence | <session>/research/design-intelligence.json |
|
||||
| Design Tokens | <session>/design/design-tokens.json |
|
||||
| Component Specs | <session>/design/component-specs/*.md |
|
||||
| Audit Reports | <session>/audit/audit-*.md |
|
||||
| Token Files | <session>/build/token-files/* |
|
||||
| Component Files | <session>/build/component-files/* |
|
||||
|
||||
3. Output pipeline summary: task count, duration, GC rounds, sync points passed, final audit score
|
||||
|
||||
4. **Completion Action** (interactive):
|
||||
|
||||
```
|
||||
AskUserQuestion({
|
||||
questions: [{
|
||||
question: "Team pipeline complete. What would you like to do?",
|
||||
header: "Completion",
|
||||
multiSelect: false,
|
||||
options: [
|
||||
{ label: "Archive & Clean (Recommended)", 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" }
|
||||
]
|
||||
}]
|
||||
})
|
||||
```
|
||||
|
||||
5. Handle user choice:
|
||||
|
||||
| Choice | Steps |
|
||||
|--------|-------|
|
||||
| Archive & Clean | TaskList -> verify all completed -> update session status="completed" -> TeamDelete("uidesign") -> output final summary with artifact paths |
|
||||
| Keep Active | Update session status="paused" -> output: "Session paused. Resume with: Skill(skill='team-uidesign', args='resume')" |
|
||||
| Export Results | AskUserQuestion for target directory -> copy all artifacts -> Archive & Clean flow |
|
||||
@@ -59,21 +59,19 @@ Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
|
||||
```
|
||||
mcp__ccw-tools__team_msg({
|
||||
operation: "log",
|
||||
team: <session-id>,
|
||||
session_id: <session-id>,
|
||||
from: "designer",
|
||||
to: "coordinator",
|
||||
type: <message-type>,
|
||||
summary: "[designer] DESIGN complete: <task-subject>",
|
||||
ref: <artifact-path>
|
||||
})
|
||||
```
|
||||
|
||||
> **Note**: `team` must be session ID (e.g., `UDS-xxx-date`), NOT team name. Extract from `Session:` field in task description.
|
||||
> `to` and `summary` are auto-defaulted by the tool.
|
||||
|
||||
**CLI fallback** (when MCP unavailable):
|
||||
|
||||
```
|
||||
Bash("ccw team log --team <session-id> --from designer --to coordinator --type <message-type> --summary \"[designer] DESIGN complete\" --ref <artifact-path> --json")
|
||||
Bash("ccw team log --session-id <session-id> --from designer --type <message-type> --json")
|
||||
```
|
||||
|
||||
---
|
||||
@@ -99,7 +97,7 @@ Standard task discovery flow: TaskList -> filter by prefix `DESIGN-*` + owner ma
|
||||
**Loading steps**:
|
||||
|
||||
1. Extract session path from task description
|
||||
2. Read shared-memory.json
|
||||
2. Read role states via team_msg(operation="get_state")
|
||||
3. Read research findings:
|
||||
|
||||
| File | Content |
|
||||
|
||||
@@ -61,21 +61,19 @@ Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
|
||||
```
|
||||
mcp__ccw-tools__team_msg({
|
||||
operation: "log",
|
||||
team: <session-id>,
|
||||
session_id: <session-id>,
|
||||
from: "implementer",
|
||||
to: "coordinator",
|
||||
type: <message-type>,
|
||||
summary: "[implementer] BUILD complete: <task-subject>",
|
||||
ref: <artifact-path>
|
||||
})
|
||||
```
|
||||
|
||||
> **Note**: `team` must be session ID (e.g., `UDS-xxx-date`), NOT team name. Extract from `Session:` field in task description.
|
||||
> `to` and `summary` are auto-defaulted by the tool.
|
||||
|
||||
**CLI fallback** (when MCP unavailable):
|
||||
|
||||
```
|
||||
Bash("ccw team log --team <session-id> --from implementer --to coordinator --type <message-type> --summary \"[implementer] BUILD complete\" --ref <artifact-path> --json")
|
||||
Bash("ccw team log --session-id <session-id> --from implementer --type <message-type> --json")
|
||||
```
|
||||
|
||||
---
|
||||
@@ -100,7 +98,7 @@ Standard task discovery flow: TaskList -> filter by prefix `BUILD-*` + owner mat
|
||||
**Loading steps**:
|
||||
|
||||
1. Extract session path from task description
|
||||
2. Read shared-memory.json:
|
||||
2. Read role states via team_msg(operation="get_state"):
|
||||
|
||||
| Field | Usage |
|
||||
|-------|-------|
|
||||
|
||||
@@ -59,21 +59,19 @@ Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
|
||||
```
|
||||
mcp__ccw-tools__team_msg({
|
||||
operation: "log",
|
||||
team: <session-id>,
|
||||
session_id: <session-id>,
|
||||
from: "researcher",
|
||||
to: "coordinator",
|
||||
type: <message-type>,
|
||||
summary: "[researcher] RESEARCH complete: <task-subject>",
|
||||
ref: <artifact-path>
|
||||
})
|
||||
```
|
||||
|
||||
> **Note**: `team` must be session ID (e.g., `UDS-xxx-date`), NOT team name. Extract from `Session:` field in task description.
|
||||
> `to` and `summary` are auto-defaulted by the tool.
|
||||
|
||||
**CLI fallback** (when MCP unavailable):
|
||||
|
||||
```
|
||||
Bash("ccw team log --team <session-id> --from researcher --to coordinator --type <message-type> --summary \"[researcher] RESEARCH complete\" --ref <artifact-path> --json")
|
||||
Bash("ccw team log --session-id <session-id> --from researcher --type <message-type> --json")
|
||||
```
|
||||
|
||||
---
|
||||
@@ -91,7 +89,7 @@ Standard task discovery flow: TaskList -> filter by prefix `RESEARCH-*` + owner
|
||||
**Loading steps**:
|
||||
|
||||
1. Extract session path from task description (pattern: `Session: <path>`)
|
||||
2. Read shared-memory.json from session folder
|
||||
2. Read role states via team_msg(operation="get_state") from session
|
||||
3. Load existing component_inventory and accessibility_patterns if available
|
||||
|
||||
**Input Sources**:
|
||||
@@ -99,7 +97,7 @@ Standard task discovery flow: TaskList -> filter by prefix `RESEARCH-*` + owner
|
||||
| Input | Source | Required |
|
||||
|-------|--------|----------|
|
||||
| Session folder | Task description | Yes |
|
||||
| shared-memory.json | Session folder | Yes |
|
||||
| Role state | team_msg(operation="get_state", session_id=<session-id>) | Yes |
|
||||
| Wisdom files | Session/wisdom/ | No |
|
||||
|
||||
### Phase 3: Research Execution
|
||||
|
||||
@@ -58,21 +58,19 @@ Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
|
||||
```
|
||||
mcp__ccw-tools__team_msg({
|
||||
operation: "log",
|
||||
team: <session-id>,
|
||||
session_id: <session-id>,
|
||||
from: "reviewer",
|
||||
to: "coordinator",
|
||||
type: <message-type>,
|
||||
summary: "[reviewer] AUDIT complete: <task-subject>",
|
||||
ref: <artifact-path>
|
||||
})
|
||||
```
|
||||
|
||||
> **Note**: `team` must be session ID (e.g., `UDS-xxx-date`), NOT team name. Extract from `Session:` field in task description.
|
||||
> `to` and `summary` are auto-defaulted by the tool.
|
||||
|
||||
**CLI fallback** (when MCP unavailable):
|
||||
|
||||
```
|
||||
Bash("ccw team log --team <session-id> --from reviewer --to coordinator --type <message-type> --summary \"[reviewer] AUDIT complete\" --ref <artifact-path> --json")
|
||||
Bash("ccw team log --session-id <session-id> --from reviewer --type <message-type> --json")
|
||||
```
|
||||
|
||||
---
|
||||
@@ -99,7 +97,7 @@ Standard task discovery flow: TaskList -> filter by prefix `AUDIT-*` + owner mat
|
||||
**Loading steps**:
|
||||
|
||||
1. Extract session path from task description
|
||||
2. Read shared-memory.json:
|
||||
2. Read role states via team_msg(operation="get_state"):
|
||||
|
||||
| Field | Usage |
|
||||
|-------|-------|
|
||||
|
||||
Reference in New Issue
Block a user