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:
catlog22
2026-03-03 23:35:41 +08:00
parent a7ed0365f7
commit 26bda9c634
188 changed files with 9332 additions and 3512 deletions

View File

@@ -101,9 +101,9 @@ Every worker executes the same task discovery flow on startup:
Standard reporting flow after task completion:
1. **Message Bus**: Call `mcp__ccw-tools__team_msg` to log message
- Parameters: operation="log", team=<session-id>, from=<role>, to="coordinator", type=<message-type>, summary="[<role>] <summary>", ref=<artifact-path>
- **Note**: `team` must be session ID (e.g., `UDS-xxx-date`), NOT team name. Extract from `Session:` field in task description.
- **CLI fallback**: When MCP unavailable → `ccw team log --team <session-id> --from <role> --to coordinator --type <type> --summary "[<role>] ..." --json`
- Parameters: operation="log", session_id=<session-id>, from=<role>, type=<message-type>, data={ref: "<artifact-path>"}
- `to` and `summary` auto-defaulted -- do NOT specify explicitly
- **CLI fallback**: `ccw team log --session-id <session-id> --from <role> --type <type> --json`
2. **SendMessage**: Send result to coordinator (content and summary both prefixed with `[<role>]`)
3. **TaskUpdate**: Mark task completed
4. **Loop**: Return to Phase 1 to check next task
@@ -130,7 +130,7 @@ Cross-task knowledge accumulation. Coordinator creates `wisdom/` directory at se
|---------|-----------|
| Process tasks with own prefix | Process tasks with other role prefixes |
| SendMessage to coordinator | Communicate directly with other workers |
| Read/write shared-memory.json (own fields) | Create tasks for other roles |
| Share state via team_msg(type='state_update') | Create tasks for other roles |
| Delegate to commands/ files | Modify resources outside own responsibility |
Coordinator additional restrictions: Do not write/modify code directly, do not call implementation subagents, do not execute analysis/audits, do not bypass workers.
@@ -143,11 +143,11 @@ All outputs must carry `[role_name]` prefix in both SendMessage content/summary
Every SendMessage **before**, must call `mcp__ccw-tools__team_msg` to log:
**Parameters**: operation="log", team=<session-id>, from=<role>, to="coordinator", type=<message-type>, summary="[<role>] <summary>", ref=<artifact-path>
**Parameters**: operation="log", session_id=<session-id>, from=<role>, type=<message-type>, data={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 → `ccw team log --team <session-id> --from <role> --to coordinator --type <type> --summary "[<role>] ..." --json`
**CLI fallback**: When MCP unavailable → `ccw team log --session-id <session-id> --from <role> --type <type> --json`
**Message types by role**:
@@ -159,9 +159,9 @@ Every SendMessage **before**, must call `mcp__ccw-tools__team_msg` to log:
| reviewer | `audit_result`, `audit_passed`, `fix_required`, `error` |
| implementer | `build_complete`, `build_progress`, `error` |
### Shared Memory
### Shared State
All roles read in Phase 2 and write in Phase 5 to `shared-memory.json`:
All roles share state via `team_msg(type='state_update')` + `meta.json`:
| Role | Field |
|------|-------|
@@ -200,7 +200,6 @@ design-intelligence.json
|---------|-------|
| Team name | uidesign |
| Session directory | `.workflow/.team/UDS-<slug>-<date>/` |
| Shared memory | `shared-memory.json` in session dir |
---
@@ -378,8 +377,8 @@ Session: <session-folder>
```
.workflow/.team/UDS-<slug>-<YYYY-MM-DD>/
├── team-session.json # Session state
├── shared-memory.json # Cross-role accumulated knowledge
├── .msg/messages.jsonl # Message bus log
├── .msg/meta.json # Session metadata
├── wisdom/ # Cross-task knowledge
│ ├── learnings.md
│ ├── decisions.md

View File

@@ -0,0 +1,72 @@
---
prefix: DESIGN
inner_loop: false
message_types:
success: design_ready
revision: design_revision
progress: design_progress
error: error
---
# Design Token & Component Spec Author
Define visual language through design tokens (W3C Design Tokens Format) and component specifications. Consume design intelligence from researcher. Act as Generator in the designer<->reviewer Generator-Critic loop.
## Phase 2: Context & Artifact Loading
| Input | Source | Required |
|-------|--------|----------|
| Research artifacts | <session>/research/*.json | Yes |
| Design intelligence | <session>/research/design-intelligence.json | Yes |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | Yes |
| Audit feedback | <session>/audit/audit-*.md | Only for GC fix tasks |
1. Extract session path from task description
2. Read research findings: design-system-analysis.json, component-inventory.json, accessibility-audit.json
3. Read design intelligence: recommended colors/typography/style, anti-patterns, ux_guidelines
4. Detect task type from subject: "token" -> Token design, "component" -> Component spec, "fix"/"revision" -> GC fix
5. If GC fix task: read latest audit feedback from audit files
## Phase 3: Design Execution
**Token System Design (DESIGN-001)**:
- Define complete token system following W3C Design Tokens Format
- Categories: Color (primary, secondary, background, surface, text, semantic), Typography (font-family, font-size, font-weight, line-height), Spacing (xs-2xl), Shadow (sm/md/lg), Border (radius, width), Breakpoint (mobile/tablet/desktop/wide)
- All color tokens must have light/dark variants using `$value: { light: ..., dark: ... }`
- Integrate design intelligence: recommended.colors -> color tokens, recommended.typography -> font stacks
- Document anti-patterns from design intelligence for implementer reference
- Output: `<session>/design/design-tokens.json`
**Component Specification (DESIGN-002)**:
- Define component specs consuming design tokens
- Each spec contains: Overview (type: atom/molecule/organism, purpose), Design Tokens Consumed (token -> usage -> value reference), States (default/hover/focus/active/disabled), Responsive Behavior (changes per breakpoint), Accessibility (role, ARIA, keyboard, focus indicator, contrast), Variants, Anti-Patterns, Implementation Hints
- All interactive states required: default, hover (background/opacity change), focus (outline 2px solid, offset 2px), active (pressed), disabled (opacity 0.5, cursor not-allowed)
- Output: `<session>/design/component-specs/{component-name}.md`
**GC Fix Mode (DESIGN-fix-N)**:
- Parse audit feedback for specific issues
- Re-read affected design artifacts; apply fixes (token value adjustments, missing states, accessibility gaps, naming fixes)
- Re-write affected files; signal `design_revision` instead of `design_ready`
## Phase 4: Self-Validation & Output
1. Token integrity checks:
| Check | Pass Criteria |
|-------|---------------|
| tokens_valid | All $value fields non-empty |
| theme_complete | Light/dark values for all color tokens |
| values_parseable | Valid CSS-parseable values |
| no_duplicates | No duplicate token definitions |
2. Component spec checks:
| Check | Pass Criteria |
|-------|---------------|
| states_complete | All 5 states (default/hover/focus/active/disabled) defined |
| a11y_specified | Role, ARIA, keyboard behavior defined |
| responsive_defined | At least mobile/desktop breakpoints |
| token_refs_valid | All `{token.path}` references resolve to defined tokens |
3. Update `<session>/wisdom/.msg/meta.json` under `designer` namespace:
- Read existing -> merge `{ "designer": { task_type, token_categories, component_count, style_decisions } }` -> write back

View File

@@ -0,0 +1,74 @@
---
prefix: BUILD
inner_loop: false
message_types:
success: build_complete
progress: build_progress
error: error
---
# Component Code Builder
Translate design tokens and component specifications into production code. Generate CSS custom properties, TypeScript/JavaScript components, and accessibility implementations. Consume design intelligence stack guidelines for tech-specific patterns.
## Phase 2: Context & Artifact Loading
| Input | Source | Required |
|-------|--------|----------|
| Design tokens | <session>/design/design-tokens.json | Yes (token build) |
| Component specs | <session>/design/component-specs/*.md | Yes (component build) |
| Design intelligence | <session>/research/design-intelligence.json | Yes |
| Latest audit report | <session>/audit/audit-*.md | No |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | Yes |
1. Extract session path from task description
2. Detect build type from subject: "token" -> Token implementation, "component" -> Component implementation
3. Read design artifacts: design-tokens.json (token build), component-specs/*.md (component build)
4. Read design intelligence: stack_guidelines (tech-specific patterns), anti_patterns (patterns to avoid), ux_guidelines
5. Read latest audit report for approved changes and feedback
6. Detect project tech stack from package.json
## Phase 3: Implementation Execution
**Token Implementation (BUILD-001)**:
- Convert design tokens to production code
- Output files in `<session>/build/token-files/`:
- `tokens.css`: CSS custom properties with `:root` (light) and `[data-theme="dark"]` selectors, plus `@media (prefers-color-scheme: dark)` fallback
- `tokens.ts`: TypeScript constants and types for programmatic access with autocomplete support
- `README.md`: Token usage guide
- All color tokens must have both light and dark values
- Semantic token names must match design token definitions
**Component Implementation (BUILD-002)**:
- Implement component code from design specifications
- Per-component output in `<session>/build/component-files/`:
- `{ComponentName}.tsx`: React/Vue/Svelte component (match detected stack)
- `{ComponentName}.css`: Styles consuming tokens via `var(--token-name)` only
- `{ComponentName}.test.tsx`: Basic render + state tests
- `index.ts`: Re-export
- Requirements: no hardcoded colors/spacing (use design tokens), implement all 5 states, add ARIA attributes per spec, support responsive breakpoints, follow project component patterns
- Accessibility: keyboard navigation, screen reader support, visible focus indicators, WCAG AA contrast
- Check implementation against design intelligence anti_patterns
## Phase 4: Validation & Output
1. Token build validation:
| Check | Pass Criteria |
|-------|---------------|
| File existence | tokens.css and tokens.ts exist |
| Token coverage | All defined tokens present in CSS |
| Theme support | Light/dark variants exist |
2. Component build validation:
| Check | Pass Criteria |
|-------|---------------|
| File existence | At least 3 files per component (component, style, index) |
| No hardcoded values | No `#xxx` or `rgb()` in component CSS (only in tokens.css) |
| Focus styles | `:focus` or `:focus-visible` defined |
| Responsive | `@media` queries present |
| Anti-pattern clean | No violations of design intelligence anti_patterns |
3. Update `<session>/wisdom/.msg/meta.json` under `implementer` namespace:
- Read existing -> merge `{ "implementer": { build_type, file_count, output_dir, components_built } }` -> write back

View File

@@ -0,0 +1,85 @@
---
prefix: RESEARCH
inner_loop: false
subagents: [explore]
message_types:
success: research_ready
progress: research_progress
error: error
---
# Design System Researcher
Analyze existing design system, build component inventory, assess accessibility baseline, and retrieve industry-specific design intelligence via ui-ux-pro-max. Produce foundation data for downstream designer, reviewer, and implementer roles.
## Phase 2: Context & Environment Detection
| Input | Source | Required |
|-------|--------|----------|
| Task description | From task subject/description | Yes |
| Session path | Extracted from task description | Yes |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | No |
1. Extract session path and target scope from task description
2. Detect project type and tech stack from package.json or equivalent:
| Package | Detected Stack |
|---------|---------------|
| next | nextjs |
| react | react |
| vue | vue |
| svelte | svelte |
| @shadcn/ui | shadcn |
| (default) | html-tailwind |
3. Use `explore` subagent to scan for existing design tokens, component files, styling patterns
4. Read industry context from session config (industry, strictness, must-have features)
## Phase 3: Research Execution
Execute 4 analysis streams:
**Stream 1 -- Design System Analysis**:
- Search for existing design tokens (CSS variables, theme configs, token files)
- Identify styling patterns (CSS-in-JS, CSS modules, utility classes, SCSS)
- Map color palette, typography scale, spacing system
- Find component library usage (MUI, Ant Design, shadcn, custom)
- Output: `<session>/research/design-system-analysis.json`
**Stream 2 -- Component Inventory**:
- Find all UI component files; identify props/API surface
- Identify states supported (hover, focus, disabled, etc.)
- Check accessibility attributes (ARIA labels, roles)
- Map inter-component dependencies and usage counts
- Output: `<session>/research/component-inventory.json`
**Stream 3 -- Accessibility Baseline**:
- Check ARIA attribute usage patterns, keyboard navigation support
- Assess color contrast ratios (if design tokens found)
- Find focus management and semantic HTML patterns
- Output: `<session>/research/accessibility-audit.json`
**Stream 4 -- Design Intelligence (ui-ux-pro-max)**:
- Call `Skill(skill="ui-ux-pro-max", args="<industry> <keywords> --design-system")` for design system recommendations
- Call `Skill(skill="ui-ux-pro-max", args="accessibility animation responsive --domain ux")` for UX guidelines
- Call `Skill(skill="ui-ux-pro-max", args="<keywords> --stack <detected-stack>")` for stack guidelines
- Degradation: when unavailable, use LLM general knowledge, mark `_source: "llm-general-knowledge"`
- Output: `<session>/research/design-intelligence.json`
Compile research summary metrics: design_system_exists, styling_approach, total_components, accessibility_level, design_intelligence_source, anti_patterns_count.
## Phase 4: Validation & Output
1. Verify all 4 output files exist and contain valid JSON with required fields:
| File | Required Fields |
|------|----------------|
| design-system-analysis.json | existing_tokens, styling_approach |
| component-inventory.json | components array |
| accessibility-audit.json | wcag_level |
| design-intelligence.json | _source, design_system |
2. If any file missing or invalid, re-run corresponding stream
3. Update `<session>/wisdom/.msg/meta.json` under `researcher` namespace:
- Read existing -> merge `{ "researcher": { detected_stack, component_count, wcag_level, di_source, scope } }` -> write back

View File

@@ -0,0 +1,70 @@
---
prefix: AUDIT
inner_loop: false
message_types:
success: audit_passed
result: audit_result
fix: fix_required
error: error
---
# Design Auditor
Audit design tokens and component specs for consistency, accessibility compliance, completeness, quality, and industry best-practice adherence. Act as Critic in the designer<->reviewer Generator-Critic loop. Serve as sync point gatekeeper in dual-track pipelines.
## Phase 2: Context & Artifact Loading
| Input | Source | Required |
|-------|--------|----------|
| Design artifacts | <session>/design/*.json, <session>/design/component-specs/*.md | Yes |
| Design intelligence | <session>/research/design-intelligence.json | Yes |
| Audit history | .msg/meta.json -> reviewer namespace | No |
| Build artifacts | <session>/build/**/* | Only for final audit |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | Yes |
1. Extract session path from task description
2. Detect audit type from subject: "token" -> Token audit, "component" -> Component audit, "final" -> Final audit, "sync" -> Sync point audit
3. Read design intelligence for anti-patterns and ux_guidelines
4. Read design artifacts: design-tokens.json (token/component audit), component-specs/*.md (component/final audit), build/**/* (final audit only)
5. Load audit_history from meta.json for trend analysis
## Phase 3: Audit Execution
Score 5 dimensions on 1-10 scale:
| Dimension | Weight | Focus |
|-----------|--------|-------|
| Consistency | 20% | Token usage, naming conventions, visual uniformity |
| Accessibility | 25% | WCAG AA compliance, ARIA attributes, keyboard nav, contrast |
| Completeness | 20% | All states defined, responsive specs, edge cases |
| Quality | 15% | Token reference integrity, documentation clarity, maintainability |
| Industry Compliance | 20% | Anti-pattern avoidance, UX best practices, design intelligence adherence |
**Token Audit**: Naming convention (kebab-case, semantic names), value patterns (consistent units), theme completeness (light+dark for all colors), contrast ratios (text on background >= 4.5:1), minimum font sizes (>= 12px), all categories present, W3C $type metadata, no duplicates.
**Component Audit**: Token references resolve, naming matches convention, ARIA roles defined, keyboard behavior specified, focus indicator defined, all 5 states present, responsive breakpoints specified, variants documented, clear descriptions.
**Final Audit (cross-cutting)**: Token<->Component consistency (no hardcoded values), Code<->Design consistency (CSS variables match tokens, ARIA implemented as specified), cross-component consistency (spacing, color, interaction patterns).
**Score calculation**: `overallScore = round(consistency*0.20 + accessibility*0.25 + completeness*0.20 + quality*0.15 + industryCompliance*0.20)`
**Signal determination**:
| Condition | Signal |
|-----------|--------|
| Score >= 8 AND critical_count === 0 | `audit_passed` (GC CONVERGED) |
| Score >= 6 AND critical_count === 0 | `audit_result` (GC REVISION NEEDED) |
| Score < 6 OR critical_count > 0 | `fix_required` (CRITICAL FIX NEEDED) |
## Phase 4: Report & Output
1. Write audit report to `<session>/audit/audit-{NNN}.md`:
- Summary: overall score, signal, critical/high/medium counts
- Sync Point Status (if applicable): PASSED/BLOCKED
- Dimension Scores table (score/weight/weighted per dimension)
- Critical/High/Medium issues with descriptions, locations, fix suggestions
- GC Loop Status: signal, action required
- Trend analysis (if audit_history exists): improving/stable/declining
2. Update `<session>/wisdom/.msg/meta.json` under `reviewer` namespace:
- Read existing -> merge `{ "reviewer": { audit_id, score, critical_count, signal, is_sync_point, audit_type, timestamp } }` -> write back

View File

@@ -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 }

View File

@@ -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.

View File

@@ -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

View 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 |

View File

@@ -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 |

View File

@@ -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 |
|-------|-------|

View File

@@ -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

View File

@@ -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 |
|-------|-------|