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

@@ -11,23 +11,23 @@ Unified team skill: progressive test coverage through Generator-Critic loops (ge
## Architecture
```
┌───────────────────────────────────────────────────┐
Skill(skill="team-testing")
args="<task>" or args="--role=xxx"
└───────────────────┬───────────────────────────────┘
│ Role Router
┌──── --role present? ────┐
│ NO │ YES
↓ ↓
Orchestration Mode Role Dispatch
(auto → coordinator) (route to role.md)
┌────┴────┬───────────┬───────────┬───────────┐
↓ ↓ ↓
┌──────────┐┌──────────┐┌──────────┐┌──────────┐┌─────────┐
│coordinator││strategist││generator ││ executor ││ analyst │
│ ││STRATEGY-*││TESTGEN-* ││TESTRUN-* ││TESTANA-*│
└──────────┘└──────────┘└──────────┘└──────────┘└─────────┘
+---------------------------------------------------+
| Skill(skill="team-testing") |
| args="<task-description>" |
+-------------------+-------------------------------+
|
Orchestration Mode (auto -> coordinator)
|
Coordinator (inline)
Phase 0-5 orchestration
|
+-------+-------+-------+-------+
v v v v
[tw] [tw] [tw] [tw]
strate- genera- execu- analyst
gist tor tor
(tw) = team-worker agent
```
## Role Router
@@ -38,13 +38,13 @@ Parse `$ARGUMENTS` to extract `--role`. If absent → Orchestration Mode (auto r
### Role Registry
| Role | File | Task Prefix | Type | Compact |
|------|------|-------------|------|---------|
| coordinator | [roles/coordinator.md](roles/coordinator.md) | (none) | orchestrator | **⚠️ 压缩后必须重读** |
| strategist | [roles/strategist.md](roles/strategist.md) | STRATEGY-* | pipeline | 压缩后必须重读 |
| generator | [roles/generator.md](roles/generator.md) | TESTGEN-* | pipeline | 压缩后必须重读 |
| executor | [roles/executor.md](roles/executor.md) | TESTRUN-* | pipeline | 压缩后必须重读 |
| analyst | [roles/analyst.md](roles/analyst.md) | TESTANA-* | pipeline | 压缩后必须重读 |
| Role | Spec | Task Prefix | Inner Loop |
|------|------|-------------|------------|
| coordinator | [roles/coordinator/role.md](roles/coordinator/role.md) | (none) | - |
| strategist | [role-specs/strategist.md](role-specs/strategist.md) | STRATEGY-* | false |
| generator | [role-specs/generator.md](role-specs/generator.md) | TESTGEN-* | true |
| executor | [role-specs/executor.md](role-specs/executor.md) | TESTRUN-* | true |
| analyst | [role-specs/analyst.md](role-specs/analyst.md) | TESTANA-* | false |
> **⚠️ COMPACT PROTECTION**: 角色文件是执行文档,不是参考资料。当 context compression 发生后,角色指令仅剩摘要时,**必须立即 `Read` 对应 role.md 重新加载后再继续执行**。不得基于摘要执行任何 Phase。
@@ -101,8 +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="testing", from=<role>, to="coordinator", type=<message-type>, summary="[<role>] <summary>", ref=<artifact-path>
- **CLI fallback**: When MCP unavailable → `ccw team log --team <session-id> --from <role> --to coordinator --type <type> --summary "[<role>] ..." --json` // team must be session ID
- 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
@@ -129,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 tests directly, do not execute tests, do not analyze coverage, do not bypass workers.
@@ -142,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>"}
> **CRITICAL**: `team` must be session ID (e.g., TST-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**:
@@ -158,9 +159,9 @@ Every SendMessage **before**, must call `mcp__ccw-tools__team_msg` to log:
| executor | `tests_passed`, `tests_failed`, `coverage_report`, `error` |
| analyst | `analysis_ready`, `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 |
|------|-------|
@@ -175,7 +176,6 @@ All roles read in Phase 2 and write in Phase 5 to `shared-memory.json`:
|---------|-------|
| Team name | testing |
| Session directory | `.workflow/.team/TST-<slug>-<date>/` |
| Shared memory | `shared-memory.json` in session dir |
| Test layers | L1: Unit (80%), L2: Integration (60%), L3: E2E (40%) |
---
@@ -330,8 +330,8 @@ Session: <session-folder>
```
.workflow/.team/TST-<slug>-<YYYY-MM-DD>/
├── team-session.json # Session state
├── shared-memory.json # Defect patterns / effective test patterns / coverage history
├── .msg/messages.jsonl # Message bus log
├── .msg/meta.json # Session metadata
├── wisdom/ # Cross-task knowledge
│ ├── learnings.md
│ ├── decisions.md

View File

@@ -0,0 +1,94 @@
---
prefix: TESTANA
inner_loop: false
message_types:
success: analysis_ready
error: error
---
# Test Quality Analyst
Analyze defect patterns, identify coverage gaps, assess GC loop effectiveness, and generate a quality report with actionable recommendations.
## Phase 2: Context Loading
| Input | Source | Required |
|-------|--------|----------|
| Task description | From task subject/description | Yes |
| Session path | Extracted from task description | Yes |
| Execution results | <session>/results/run-*.json | Yes |
| Test strategy | <session>/strategy/test-strategy.md | Yes |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | Yes |
1. Extract session path from task description
2. Read .msg/meta.json for execution context (executor, generator namespaces)
3. Read all execution results:
```
Glob("<session>/results/run-*.json")
Read("<session>/results/run-001.json")
```
4. Read test strategy:
```
Read("<session>/strategy/test-strategy.md")
```
5. Read test files for pattern analysis:
```
Glob("<session>/tests/**/*")
```
## Phase 3: Quality Analysis
**Analysis dimensions**:
1. **Coverage Analysis** -- Aggregate coverage by layer:
| Layer | Coverage | Target | Status |
|-------|----------|--------|--------|
| L1 | X% | Y% | Met/Below |
2. **Defect Pattern Analysis** -- Frequency and severity:
| Pattern | Frequency | Severity |
|---------|-----------|----------|
| pattern | count | HIGH (>=3) / MEDIUM (>=2) / LOW (<2) |
3. **GC Loop Effectiveness**:
| Metric | Value | Assessment |
|--------|-------|------------|
| Rounds | N | - |
| Coverage Improvement | +/-X% | HIGH (>10%) / MEDIUM (>5%) / LOW (<=5%) |
4. **Coverage Gaps** -- per module/feature:
- Area, Current %, Gap %, Reason, Recommendation
5. **Quality Score**:
| Dimension | Score (1-10) | Weight |
|-----------|-------------|--------|
| Coverage Achievement | score | 30% |
| Test Effectiveness | score | 25% |
| Defect Detection | score | 25% |
| GC Loop Efficiency | score | 20% |
Write report to `<session>/analysis/quality-report.md`
## Phase 4: Trend Analysis & State Update
**Historical comparison** (if multiple sessions exist):
```
Glob(".workflow/.team/TST-*/.msg/meta.json")
```
- Track coverage trends over time
- Identify defect pattern evolution
- Compare GC loop effectiveness across sessions
Update `<session>/wisdom/.msg/meta.json` under `analyst` namespace:
- Merge `{ "analyst": { quality_score, coverage_gaps, top_defect_patterns, gc_effectiveness, recommendations } }`

View File

@@ -0,0 +1,92 @@
---
prefix: TESTRUN
inner_loop: true
message_types:
success: tests_passed
failure: tests_failed
coverage: coverage_report
error: error
---
# Test Executor
Execute tests, collect coverage, attempt auto-fix for failures. Acts as the Critic in the Generator-Critic loop. Reports pass rate and coverage for coordinator GC decisions.
## Phase 2: Context Loading
| Input | Source | Required |
|-------|--------|----------|
| Task description | From task subject/description | Yes |
| Session path | Extracted from task description | Yes |
| Test directory | Task description (Input: <path>) | Yes |
| Coverage target | Task description (default: 80%) | Yes |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | No |
1. Extract session path and test directory from task description
2. Extract coverage target (default: 80%)
3. Read .msg/meta.json for framework info (from strategist namespace)
4. Determine test framework:
| Framework | Run Command |
|-----------|-------------|
| Jest | `npx jest --coverage --json --outputFile=<session>/results/jest-output.json` |
| Pytest | `python -m pytest --cov --cov-report=json:<session>/results/coverage.json -v` |
| Vitest | `npx vitest run --coverage --reporter=json` |
5. Find test files to execute:
```
Glob("<session>/<test-dir>/**/*")
```
## Phase 3: Test Execution + Fix Cycle
**Iterative test-fix cycle** (max 3 iterations):
| Step | Action |
|------|--------|
| 1 | Run test command |
| 2 | Parse results: pass rate + coverage |
| 3 | pass_rate >= 0.95 AND coverage >= target -> success, exit |
| 4 | Extract failing test details |
| 5 | Delegate fix to code-developer subagent |
| 6 | Increment iteration; >= 3 -> exit with failures |
```
Bash("<test-command> 2>&1 || true")
```
**Auto-fix delegation** (on failure):
```
Task({
subagent_type: "code-developer",
run_in_background: false,
description: "Fix test failures (iteration <N>)",
prompt: "Fix these test failures:\n<test-output>\nOnly fix test files, not source code."
})
```
**Save results**: `<session>/results/run-<N>.json`
## Phase 4: Defect Pattern Extraction & State Update
**Extract defect patterns from failures**:
| Pattern Type | Detection Keywords |
|--------------|-------------------|
| Null reference | "null", "undefined", "Cannot read property" |
| Async timing | "timeout", "async", "await", "promise" |
| Import errors | "Cannot find module", "import" |
| Type mismatches | "type", "expected", "received" |
**Record effective test patterns** (if pass_rate > 0.8):
| Pattern | Detection |
|---------|-----------|
| Happy path | "should succeed", "valid input" |
| Edge cases | "edge", "boundary", "limit" |
| Error handling | "should fail", "error", "throw" |
Update `<session>/wisdom/.msg/meta.json` under `executor` namespace:
- Merge `{ "executor": { pass_rate, coverage, defect_patterns, effective_patterns, coverage_history_entry } }`

View File

@@ -0,0 +1,92 @@
---
prefix: TESTGEN
inner_loop: true
message_types:
success: tests_generated
revision: tests_revised
error: error
---
# Test Generator
Generate test code by layer (L1 unit / L2 integration / L3 E2E). Acts as the Generator in the Generator-Critic loop. Supports revision mode for GC loop iterations.
## Phase 2: Context Loading
| Input | Source | Required |
|-------|--------|----------|
| Task description | From task subject/description | Yes |
| Session path | Extracted from task description | Yes |
| Test strategy | <session>/strategy/test-strategy.md | Yes |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | No |
1. Extract session path and layer from task description
2. Read test strategy:
```
Read("<session>/strategy/test-strategy.md")
```
3. Read source files to test (from strategy priority_files, limit 20)
4. Read .msg/meta.json for framework and scope context
5. Detect revision mode:
| Condition | Mode |
|-----------|------|
| Task subject contains "fix" or "revised" | Revision -- load previous failures |
| Otherwise | Fresh generation |
For revision mode:
- Read latest result file for failure details
- Read effective test patterns from .msg/meta.json
6. Read wisdom files if available
## Phase 3: Test Generation
**Strategy selection by complexity**:
| File Count | Strategy |
|------------|----------|
| <= 3 files | Direct: inline Write/Edit |
| 3-5 files | Single code-developer agent |
| > 5 files | Batch: group by module, one agent per batch |
**Direct generation** (per source file):
1. Generate test path: `<session>/tests/<layer>/<test-file>`
2. Generate test code: happy path, edge cases, error handling
3. Write test file
**Agent delegation** (medium/high complexity):
```
Task({
subagent_type: "code-developer",
run_in_background: false,
description: "Generate <layer> tests",
prompt: "Generate <layer> tests using <framework>...
<file-list-with-content>
<if-revision: previous failures + effective patterns>
Write test files to: <session>/tests/<layer>/"
})
```
**Output verification**:
```
Glob("<session>/tests/<layer>/**/*")
```
## Phase 4: Self-Validation & State Update
**Validation checks**:
| Check | Method | Action on Fail |
|-------|--------|----------------|
| Syntax | `tsc --noEmit` or equivalent | Auto-fix imports/types |
| File count | Count generated files | Report issue |
| Import resolution | Check broken imports | Fix import paths |
Update `<session>/wisdom/.msg/meta.json` under `generator` namespace:
- Merge `{ "generator": { test_files, layer, round, is_revision } }`

View File

@@ -0,0 +1,82 @@
---
prefix: STRATEGY
inner_loop: false
message_types:
success: strategy_ready
error: error
---
# Test Strategist
Analyze git diff, determine test layers, define coverage targets, and formulate test strategy with prioritized execution order.
## 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 scope from task description
2. Get git diff for change analysis:
```
Bash("git diff HEAD~1 --name-only 2>/dev/null || git diff --cached --name-only")
Bash("git diff HEAD~1 -- <changed-files> 2>/dev/null || git diff --cached -- <changed-files>")
```
3. Detect test framework from project files:
| Signal File | Framework | Test Pattern |
|-------------|-----------|-------------|
| jest.config.js/ts | Jest | `**/*.test.{ts,tsx,js}` |
| vitest.config.ts/js | Vitest | `**/*.test.{ts,tsx}` |
| pytest.ini / pyproject.toml | Pytest | `**/test_*.py` |
| No detection | Default | Jest patterns |
4. Scan existing test patterns:
```
Glob("**/*.test.*")
Glob("**/*.spec.*")
```
5. Read .msg/meta.json if exists for session context
## Phase 3: Strategy Formulation
**Change analysis dimensions**:
| Change Type | Analysis | Priority |
|-------------|----------|----------|
| New files | Need new tests | High |
| Modified functions | Need updated tests | Medium |
| Deleted files | Need test cleanup | Low |
| Config changes | May need integration tests | Variable |
**Strategy output structure**:
1. **Change Analysis Table**: File, Change Type, Impact, Priority
2. **Test Layer Recommendations**:
- L1 Unit: Scope, Coverage Target, Priority Files, Patterns
- L2 Integration: Scope, Coverage Target, Integration Points
- L3 E2E: Scope, Coverage Target, User Scenarios
3. **Risk Assessment**: Risk, Probability, Impact, Mitigation
4. **Test Execution Order**: Prioritized sequence
Write strategy to `<session>/strategy/test-strategy.md`
**Self-validation**:
| Check | Criteria | Fallback |
|-------|----------|----------|
| Has L1 scope | L1 scope not empty | Default to all changed files |
| Has coverage targets | L1 target > 0 | Use defaults (80/60/40) |
| Has priority files | List not empty | Use all changed files |
## Phase 4: Wisdom & State Update
1. Write discoveries to `<session>/wisdom/conventions.md` (detected framework, patterns)
2. Update `<session>/wisdom/.msg/meta.json` under `strategist` namespace:
- Read existing -> merge `{ "strategist": { framework, layers, coverage_targets, priority_files, risks } }` -> write back

View File

@@ -16,8 +16,8 @@ Test quality analyst. Responsible for defect pattern analysis, coverage gap iden
- All output (SendMessage, team_msg, logs) must carry `[analyst]` identifier
- Only communicate with coordinator via SendMessage
- Work strictly within read-only analysis responsibility scope
- Phase 2: Read shared-memory.json (all historical data)
- Phase 5: Write analysis_report to shared-memory.json
- Phase 2: Read role states via team_msg(operation='get_state')
- Phase 5: Share analysis_report via team_msg(type='state_update')
### MUST NOT
@@ -35,7 +35,7 @@ Test quality analyst. Responsible for defect pattern analysis, coverage gap iden
| Tool | Type | Used By | Purpose |
|------|------|---------|---------|
| Read | Read | Phase 2 | Load shared-memory.json, strategy, results |
| Read | Read | Phase 2 | Load role states, strategy, results |
| Glob | Read | Phase 2 | Find result files, test files |
| Write | Write | Phase 3 | Create quality-report.md |
| TaskUpdate | Write | Phase 5 | Mark task completed |
@@ -57,19 +57,17 @@ Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
team: <session-id>, // MUST be session ID (e.g., TST-xxx-date), NOT team name. Extract from Session: field in task description.
session_id: <session-id>,
from: "analyst",
to: "coordinator",
type: <message-type>,
summary: "[analyst] TESTANA complete: <summary>",
ref: <artifact-path>
data: {ref: "<artifact-path>"}
})
```
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --team <session-id> --from analyst --to coordinator --type <message-type> --summary \"[analyst] ...\" --ref <artifact-path> --json")
Bash("ccw team log --session-id <session-id> --from analyst --type <message-type> --json")
```
---
@@ -89,7 +87,7 @@ Standard task discovery flow: TaskList -> filter by prefix `TESTANA-*` + owner m
| Input | Source | Required |
|-------|--------|----------|
| Session path | Task description (Session: <path>) | Yes |
| Shared memory | <session-folder>/shared-memory.json | Yes |
| Role state | team_msg(operation="get_state", session_id=<session-id>) | Yes |
| Execution results | <session-folder>/results/run-*.json | Yes |
| Test strategy | <session-folder>/strategy/test-strategy.md | Yes |
| Test files | <session-folder>/tests/**/* | Yes |
@@ -98,10 +96,10 @@ Standard task discovery flow: TaskList -> filter by prefix `TESTANA-*` + owner m
1. Extract session path from task description (look for `Session: <path>`)
2. Read shared memory:
2. Read role states:
```
Read("<session-folder>/shared-memory.json")
mcp__ccw-tools__team_msg({ operation: "get_state", session_id: <session-id> })
```
3. Read all execution results:
@@ -186,7 +184,7 @@ Write("<session-folder>/analysis/quality-report.md", <report-content>)
**Historical comparison**:
```
Glob({ pattern: ".workflow/.team/TST-*/shared-memory.json" })
Glob({ pattern: ".workflow/.team/TST-*/.msg/meta.json" })
```
If multiple sessions exist:
@@ -198,27 +196,31 @@ If multiple sessions exist:
> See SKILL.md Shared Infrastructure -> Worker Phase 5: Report
1. **Update shared memory**:
1. **Share analysis report via team_msg(type='state_update')**:
```
sharedMemory.analysis_report = {
quality_score: <total-score>,
coverage_gaps: <gap-list>,
top_defect_patterns: <patterns>.slice(0, 5),
gc_effectiveness: <improvement>,
recommendations: <immediate-actions>
}
Write("<session-folder>/shared-memory.json", <updated-json>)
mcp__ccw-tools__team_msg({
operation: "log", session_id: <session-id>, from: "analyst",
type: "state_update",
data: {
analysis_report: {
quality_score: <total-score>,
coverage_gaps: <gap-list>,
top_defect_patterns: <patterns>.slice(0, 5),
gc_effectiveness: <improvement>,
recommendations: <immediate-actions>
}
}
})
```
2. **Log via team_msg**:
```
mcp__ccw-tools__team_msg({
operation: "log", team: <session-id> // MUST be session ID, NOT team name, from: "analyst", to: "coordinator",
operation: "log", session_id: <session-id>, from: "analyst",
type: "analysis_ready",
summary: "[analyst] Quality report: score <score>/10, <pattern-count> defect patterns, <gap-count> coverage gaps",
ref: "<session-folder>/analysis/quality-report.md"
data: {ref: "<session-folder>/analysis/quality-report.md"}
})
```

View File

@@ -134,27 +134,44 @@ Extract changed files and modules for pipeline selection.
3. Call TeamCreate with team name
4. Initialize wisdom directory (learnings.md, decisions.md, conventions.md, issues.md)
5. Initialize shared memory:
5. Initialize shared state via `team_msg(type='state_update')` and write `meta.json`:
```
Write("<session-folder>/shared-memory.json", {
task: <description>,
pipeline: <selected-pipeline>,
changed_files: [...],
changed_modules: [...],
coverage_targets: {...},
gc_round: 0,
max_gc_rounds: 3,
test_strategy: null,
generated_tests: [],
execution_results: [],
defect_patterns: [],
effective_test_patterns: [],
coverage_history: []
Write("<session-folder>/.msg/meta.json", {
session_id: <session-id>,
mode: <selected-mode>,
scope: <scope>,
status: "active"
})
```
6. Write session file with: session_id, mode, scope, status="active"
6. Initialize cross-role state via team_msg(type='state_update'):
```
mcp__ccw-tools__team_msg({
operation: "log",
session_id: <session-id>,
from: "coordinator",
type: "state_update",
data: {
task: <description>,
pipeline: <selected-pipeline>,
changed_files: [...],
changed_modules: [...],
coverage_targets: {...},
gc_round: 0,
max_gc_rounds: 3,
test_strategy: null,
generated_tests: [],
execution_results: [],
defect_patterns: [],
effective_test_patterns: [],
coverage_history: []
}
})
```
7. Write session state with: session_id, mode, scope, status="active"
**Success**: Team created, session file written, wisdom initialized.
@@ -238,10 +255,10 @@ When receiving `tests_failed` or `coverage_report`:
```
mcp__ccw-tools__team_msg({
operation: "log",
team: <session-id>, // MUST be session ID (e.g., TST-xxx-date), NOT team name. Extract from Session: field in task description.
from: "coordinator", to: "generator",
session_id: <session-id>,
from: "coordinator",
type: "gc_loop_trigger",
summary: "[coordinator] GC round <N>: coverage <X>% < target <Y>%, revise tests"
data: {ref: "<session-folder>"}
})
```

View File

@@ -0,0 +1,156 @@
# Command: Dispatch
Create the testing task chain with correct dependencies and structured task descriptions. Supports targeted, standard, and comprehensive pipelines.
## 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 |
| Coverage targets | From session.json `coverage_targets` | Yes |
1. Load user requirement and scope from session.json
2. Load pipeline definition from SKILL.md Pipeline Definitions
3. Read `pipeline` mode and `coverage_targets` 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 criteria>
TASK:
- <step 1: specific action>
- <step 2: specific action>
CONTEXT:
- Session: <session-folder>
- Scope: <scope>
- Layer: <L1-unit|L2-integration|L3-e2e>
- Upstream artifacts: <artifact-1>, <artifact-2>
- Shared memory: <session>/wisdom/.msg/meta.json
EXPECTED: <deliverable path> + <quality criteria>
CONSTRAINTS: <scope limits, focus areas>
---
InnerLoop: <true|false>",
blockedBy: [<dependency-list>],
status: "pending"
})
```
### Mode Router
| Mode | Action |
|------|--------|
| `targeted` | Create 3 tasks: STRATEGY -> TESTGEN(L1) -> TESTRUN(L1) |
| `standard` | Create 6 tasks: STRATEGY -> TESTGEN(L1) -> TESTRUN(L1) -> TESTGEN(L2) -> TESTRUN(L2) -> TESTANA |
| `comprehensive` | Create 8 tasks with parallel groups |
---
### Targeted Pipeline
**STRATEGY-001** (strategist):
```
TaskCreate({
subject: "STRATEGY-001",
description: "PURPOSE: Analyze change scope, define test strategy | Success: Strategy doc with layer recommendations
TASK:
- Analyze git diff for changed files and modules
- Detect test framework and existing patterns
- Define L1 unit test scope and coverage targets
CONTEXT:
- Session: <session-folder>
- Scope: <scope>
EXPECTED: <session>/strategy/test-strategy.md
CONSTRAINTS: Read-only analysis
---
InnerLoop: false",
blockedBy: [],
status: "pending"
})
```
**TESTGEN-001** (generator, L1):
```
TaskCreate({
subject: "TESTGEN-001",
description: "PURPOSE: Generate L1 unit tests | Success: Executable test files covering priority files
TASK:
- Read test strategy for priority files and patterns
- Generate unit tests: happy path, edge cases, error handling
- Validate syntax
CONTEXT:
- Session: <session-folder>
- Layer: L1-unit
- Upstream artifacts: strategy/test-strategy.md
EXPECTED: <session>/tests/L1-unit/
CONSTRAINTS: Only generate test code, do not modify source
---
InnerLoop: true",
blockedBy: ["STRATEGY-001"],
status: "pending"
})
```
**TESTRUN-001** (executor, L1):
```
TaskCreate({
subject: "TESTRUN-001",
description: "PURPOSE: Execute L1 unit tests, collect coverage | Success: pass_rate >= 0.95 AND coverage >= target
TASK:
- Run tests with coverage collection
- Parse pass rate and coverage metrics
- Auto-fix failures (max 3 iterations)
CONTEXT:
- Session: <session-folder>
- Input: tests/L1-unit
- Coverage target: <L1-target>%
EXPECTED: <session>/results/run-001.json
CONSTRAINTS: Only fix test files, not source code
---
InnerLoop: true",
blockedBy: ["TESTGEN-001"],
status: "pending"
})
```
### Standard Pipeline
Adds to targeted:
**TESTGEN-002** (generator, L2): blockedBy ["TESTRUN-001"], Layer: L2-integration
**TESTRUN-002** (executor, L2): blockedBy ["TESTGEN-002"], Input: tests/L2-integration
**TESTANA-001** (analyst): blockedBy ["TESTRUN-002"]
### Comprehensive Pipeline
**Parallel groups**:
- TESTGEN-001 + TESTGEN-002 both blockedBy ["STRATEGY-001"] (parallel generation)
- TESTRUN-001 blockedBy ["TESTGEN-001"], TESTRUN-002 blockedBy ["TESTGEN-002"] (parallel execution)
- TESTGEN-003 blockedBy ["TESTRUN-001", "TESTRUN-002"], Layer: L3-e2e
- TESTRUN-003 blockedBy ["TESTGEN-003"]
- TESTANA-001 blockedBy ["TESTRUN-003"]
## Phase 4: Validation
1. Verify all tasks created with correct subjects and dependencies
2. Check no circular dependencies
3. Verify blockedBy references exist
4. Log task chain to team_msg:
```
mcp__ccw-tools__team_msg({
operation: "log",
session_id: <session-id>,
from: "coordinator",
type: "pipeline_selected",
data: { pipeline: "<mode>", task_count: <N> }
})
```

View File

@@ -0,0 +1,188 @@
# Command: Monitor
Handle all coordinator monitoring events: worker callbacks, status checks, pipeline advancement, Generator-Critic loop control, and completion.
## 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 mode, gc_rounds, coverage_targets
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, task ID:
| Message Pattern | Role Detection |
|----------------|---------------|
| `[strategist]` or task ID `STRATEGY-*` | strategist |
| `[generator]` or task ID `TESTGEN-*` | generator |
| `[executor]` or task ID `TESTRUN-*` | executor |
| `[analyst]` or task ID `TESTANA-*` | analyst |
2. Mark task as completed:
```
TaskUpdate({ taskId: "<task-id>", status: "completed" })
```
3. Record completion in session state
4. **Generator-Critic check** (executor callbacks only):
- If completed task is TESTRUN-* AND message indicates tests_failed or coverage below target:
- Read gc_rounds for this layer from session.json
- Execute **GC Loop Decision** (see below)
5. Checkpoints:
| Completed Task | Checkpoint | Action |
|---------------|------------|--------|
| STRATEGY-001 | CP-1 | Notify user: test strategy ready for review |
| Last TESTRUN-* | CP-2 | Check coverage, decide GC loop or next layer |
| TESTANA-001 | CP-3 | Pipeline complete |
6. Proceed to handleSpawnNext
### GC Loop Decision
When executor reports test results:
| Condition | Action |
|-----------|--------|
| passRate >= 0.95 AND coverage >= target | Log success, proceed to next stage |
| (passRate < 0.95 OR coverage < target) AND gcRound < maxRounds | Create TESTGEN-fix task, increment gc_round |
| gcRound >= maxRounds | Accept current coverage with warning, proceed |
**TESTGEN-fix task creation**:
```
TaskCreate({
subject: "TESTGEN-<layer>-fix-<round>",
owner: "generator",
description: "PURPOSE: Revise tests to fix failures and improve coverage
TASK:
- Read previous test results and failure details
- Revise tests to address failures
- Improve coverage for uncovered areas
CONTEXT:
- Session: <session-folder>
- Layer: <layer>
- Previous results: <session>/results/run-<N>.json
EXPECTED: Revised test files in <session>/tests/<layer>/
---
InnerLoop: true",
blockedBy: [],
status: "pending"
})
```
Create TESTRUN-fix blocked on TESTGEN-fix.
### 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, determine role from task subject prefix:
| Prefix | Role | Inner Loop |
|--------|------|------------|
| STRATEGY-* | strategist | false |
| TESTGEN-* | generator | true |
| TESTRUN-* | executor | true |
| TESTANA-* | analyst | false |
3. Spawn team-worker:
```
Task({
subagent_type: "team-worker",
description: "Spawn <role> worker for <task-id>",
team_name: "testing",
name: "<role>",
run_in_background: true,
prompt: `## Role Assignment
role: <role>
role_spec: .claude/skills/team-testing/role-specs/<role>.md
session: <session-folder>
session_id: <session-id>
team_name: testing
requirement: <task-description>
inner_loop: <true|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.`
})
```
4. **Parallel spawn** (comprehensive pipeline):
| Scenario | Spawn Behavior |
|----------|---------------|
| TESTGEN-001 + TESTGEN-002 both unblocked | Spawn both in parallel |
| TESTRUN-001 + TESTRUN-002 both unblocked | Spawn both in parallel |
5. STOP after spawning -- wait for next callback
### handleCheck
Output current pipeline status.
```
Pipeline Status (<pipeline-mode>):
[DONE] STRATEGY-001 (strategist) -> test-strategy.md
[RUN] TESTGEN-001 (generator) -> generating L1...
[WAIT] TESTRUN-001 (executor) -> blocked by TESTGEN-001
[WAIT] TESTGEN-002 (generator) -> blocked by TESTRUN-001
...
GC Rounds: L1: 0/3, L2: 0/3
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 and no GC cycles remain.
**Completion check**:
| Pipeline | Completion Condition |
|----------|---------------------|
| targeted | STRATEGY-001 + TESTGEN-001 + TESTRUN-001 (+ any fix tasks) completed |
| standard | All 6 tasks (+ any fix tasks) completed |
| comprehensive | All 8 tasks (+ any fix tasks) completed |
1. If any tasks not completed, return to handleSpawnNext
2. 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_rounds per layer, last event)
2. Verify task list consistency
3. STOP and wait for next event

View File

@@ -0,0 +1,276 @@
# Coordinator - Testing Team
**Role**: coordinator
**Type**: Orchestrator
**Team**: testing
Orchestrates the testing pipeline: manages task chains, spawns team-worker agents, handles Generator-Critic loops, quality gates, 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 cycles with max 3 iterations per layer
- Execute completion action in Phase 5
### MUST NOT
- Implement domain logic (test generation, execution, analysis) -- workers handle this
- Spawn workers without creating tasks first
- Skip quality gates when coverage is below target
- Modify test files or source code directly -- delegate to workers
- Force-advance pipeline past failed GC loops
---
## 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 [strategist], [generator], [executor], [analyst] | -> 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 (Change Scope Analysis) |
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/TST-*/.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 Change Scope Analysis 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: "testing" })
```
5. Spawn workers for ready tasks -> Phase 4 coordination loop
---
## Phase 1: Change Scope Analysis
1. Parse user task description from $ARGUMENTS
2. Analyze change scope:
```
Bash("git diff --name-only HEAD~1 2>/dev/null || git diff --name-only --cached")
```
Extract changed files and modules for pipeline selection.
3. Select pipeline:
| Condition | Pipeline |
|-----------|----------|
| fileCount <= 3 AND moduleCount <= 1 | targeted |
| fileCount <= 10 AND moduleCount <= 3 | standard |
| Otherwise | comprehensive |
4. Ask for missing parameters via AskUserQuestion if scope is unclear
5. Record requirements: mode, scope, focus, constraints
---
## Phase 2: Session & Team Setup
1. Create session directory:
```
Bash("mkdir -p .workflow/.team/TST-<slug>-<date>/strategy .workflow/.team/TST-<slug>-<date>/tests/L1-unit .workflow/.team/TST-<slug>-<date>/tests/L2-integration .workflow/.team/TST-<slug>-<date>/tests/L3-e2e .workflow/.team/TST-<slug>-<date>/results .workflow/.team/TST-<slug>-<date>/analysis .workflow/.team/TST-<slug>-<date>/wisdom")
```
2. Write session.json:
```json
{
"status": "active",
"team_name": "testing",
"requirement": "<requirement>",
"timestamp": "<ISO-8601>",
"pipeline": "<targeted|standard|comprehensive>",
"coverage_targets": { "L1": 80, "L2": 60, "L3": 40 },
"gc_rounds": {},
"max_gc_rounds": 3
}
```
3. Initialize .msg/meta.json:
```
Write("<session>/wisdom/.msg/meta.json", { "session_id": "<session-id>", "requirement": "<requirement>", "pipeline": "<mode>" })
```
4. Create team:
```
TeamCreate({ team_name: "testing" })
```
5. Initialize wisdom directory (learnings.md, decisions.md, conventions.md, issues.md)
---
## 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 strategist worker",
team_name: "testing",
name: "strategist",
run_in_background: true,
prompt: `## Role Assignment
role: strategist
role_spec: .claude/skills/team-testing/role-specs/strategist.md
session: <session-folder>
session_id: <session-id>
team_name: testing
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 |
|-------------|------|
| Test Strategy | <session>/strategy/test-strategy.md |
| Test Files | <session>/tests/<layer>/ |
| Execution Results | <session>/results/run-*.json |
| Quality Report | <session>/analysis/quality-report.md |
3. Output pipeline summary: task count, GC rounds, coverage metrics
4. **Completion Action** (interactive):
```
AskUserQuestion({
questions: [{
question: "Testing 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: "Deepen Coverage", description: "Add more test layers or increase coverage targets" }
]
}]
})
```
5. Handle user choice:
| Choice | Steps |
|--------|-------|
| Archive & Clean | TaskList -> verify all completed -> update session status="completed" -> TeamDelete("testing") -> output final summary |
| Keep Active | Update session status="paused" -> output: "Session paused. Resume with: Skill(skill='team-testing', args='resume')" |
| Deepen Coverage | Create additional TESTGEN+TESTRUN tasks for next layer -> Phase 4 |
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| Teammate no response | Send tracking message, 2 times -> respawn worker |
| GC loop exceeded (3 rounds) | Accept current coverage, log to wisdom, proceed |
| Test environment failure | Report to user, suggest manual fix |
| All tests fail | Check test framework config, notify analyst |
| Coverage tool unavailable | Degrade to pass rate judgment |
| Worker crash | Respawn worker, reassign task |
| Dependency cycle | Detect, report to user, halt |

View File

@@ -16,8 +16,8 @@ Test executor. Executes tests, collects coverage, attempts auto-fix for failures
- All output (SendMessage, team_msg, logs) must carry `[executor]` identifier
- Only communicate with coordinator via SendMessage
- Work strictly within validation responsibility scope
- Phase 2: Read shared-memory.json
- Phase 5: Write execution_results + defect_patterns to shared-memory.json
- Phase 2: Read role states via team_msg(operation='get_state')
- Phase 5: Share execution_results + defect_patterns via team_msg(type='state_update')
- Report coverage and pass rate for coordinator's GC decision
### MUST NOT
@@ -36,7 +36,7 @@ Test executor. Executes tests, collects coverage, attempts auto-fix for failures
| Tool | Type | Used By | Purpose |
|------|------|---------|---------|
| Read | Read | Phase 2 | Load shared-memory.json |
| Read | Read | Phase 2 | Load role states |
| Glob | Read | Phase 2 | Find test files to execute |
| Bash | Execute | Phase 3 | Run test commands |
| Write | Write | Phase 3 | Save test results |
@@ -62,19 +62,17 @@ Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
team: <session-id>, // MUST be session ID (e.g., TST-xxx-date), NOT team name. Extract from Session: field in task description.
session_id: <session-id>,
from: "executor",
to: "coordinator",
type: <message-type>,
summary: "[executor] TESTRUN complete: <summary>",
ref: <artifact-path>
data: {ref: "<artifact-path>"}
})
```
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --team <session-id> --from executor --to coordinator --type <message-type> --summary \"[executor] ...\" --ref <artifact-path> --json")
Bash("ccw team log --session-id <session-id> --from executor --type <message-type> --json")
```
---
@@ -94,7 +92,7 @@ Standard task discovery flow: TaskList -> filter by prefix `TESTRUN-*` + owner m
| Input | Source | Required |
|-------|--------|----------|
| Session path | Task description (Session: <path>) | Yes |
| Shared memory | <session-folder>/shared-memory.json | Yes |
| Role state | team_msg(operation="get_state", session_id=<session-id>) | Yes |
| Test directory | Task description (Input: <path>) | Yes |
| Coverage target | Task description | Yes |
@@ -105,7 +103,7 @@ Standard task discovery flow: TaskList -> filter by prefix `TESTRUN-*` + owner m
3. Extract coverage target from task description (default: 80%)
```
Read("<session-folder>/shared-memory.json")
mcp__ccw-tools__team_msg({ operation: "get_state", session_id: <session-id> })
```
4. Determine test framework from shared memory:
@@ -219,39 +217,39 @@ Write("<session-folder>/results/run-<N>.json", <result-json>)
> See SKILL.md Shared Infrastructure -> Worker Phase 5: Report
1. **Update shared memory**:
1. **Share execution results via team_msg(type='state_update')**:
```
sharedMemory.execution_results.push(<result-data>)
if (<result-data>.defect_patterns) {
sharedMemory.defect_patterns = [
...sharedMemory.defect_patterns,
...<result-data>.defect_patterns
]
}
if (<result-data>.effective_patterns) {
sharedMemory.effective_test_patterns = [
...new Set([...sharedMemory.effective_test_patterns, ...<result-data>.effective_patterns])
]
}
sharedMemory.coverage_history.push({
layer: <test-dir>,
coverage: <coverage>,
target: <target>,
pass_rate: <pass_rate>,
timestamp: <ISO-date>
mcp__ccw-tools__team_msg({
operation: "log", session_id: <session-id>, from: "executor",
type: "state_update",
data: {
execution_results: [...sharedMemory.execution_results, <result-data>],
defect_patterns: [
...sharedMemory.defect_patterns,
...(<result-data>.defect_patterns || [])
],
effective_test_patterns: [
...new Set([...sharedMemory.effective_test_patterns, ...(<result-data>.effective_patterns || [])])
],
coverage_history: [...sharedMemory.coverage_history, {
layer: <test-dir>,
coverage: <coverage>,
target: <target>,
pass_rate: <pass_rate>,
timestamp: <ISO-date>
}]
}
})
Write("<session-folder>/shared-memory.json", <updated-json>)
```
2. **Log via team_msg**:
```
mcp__ccw-tools__team_msg({
operation: "log", team: <session-id> // MUST be session ID, NOT team name, from: "executor", to: "coordinator",
operation: "log", session_id: <session-id>, from: "executor",
type: <passed ? "tests_passed" : "tests_failed">,
summary: "[executor] <passed|failed>: pass=<pass_rate>%, coverage=<coverage>% (target: <target>%), iterations=<N>",
ref: "<session-folder>/results/run-<N>.json"
data: {ref: "<session-folder>/results/run-<N>.json"}
})
```

View File

@@ -16,8 +16,8 @@ Test case generator. Generates test code by layer (L1 unit / L2 integration / L3
- All output (SendMessage, team_msg, logs) must carry `[generator]` identifier
- Only communicate with coordinator via SendMessage
- Work strictly within code generation responsibility scope
- Phase 2: Read shared-memory.json + test strategy
- Phase 5: Write generated_tests to shared-memory.json
- Phase 2: Read role states via team_msg(operation='get_state') + test strategy
- Phase 5: Share generated_tests via team_msg(type='state_update')
- Generate executable test code
### MUST NOT
@@ -36,7 +36,7 @@ Test case generator. Generates test code by layer (L1 unit / L2 integration / L3
| Tool | Type | Used By | Purpose |
|------|------|---------|---------|
| Read | Read | Phase 2 | Load shared-memory.json, strategy, source files |
| Read | Read | Phase 2 | Load role states, strategy, source files |
| Glob | Read | Phase 2 | Find test files, source files |
| Write | Write | Phase 3 | Create test files |
| Edit | Write | Phase 3 | Modify existing test files |
@@ -62,19 +62,17 @@ Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
team: <session-id>, // MUST be session ID (e.g., TST-xxx-date), NOT team name. Extract from Session: field in task description.
session_id: <session-id>,
from: "generator",
to: "coordinator",
type: <message-type>,
summary: "[generator] TESTGEN complete: <summary>",
ref: <artifact-path>
data: {ref: "<artifact-path>"}
})
```
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --team <session-id> --from generator --to coordinator --type <message-type> --summary \"[generator] ...\" --ref <artifact-path> --json")
Bash("ccw team log --session-id <session-id> --from generator --type <message-type> --json")
```
---
@@ -94,7 +92,7 @@ Standard task discovery flow: TaskList -> filter by prefix `TESTGEN-*` + owner m
| Input | Source | Required |
|-------|--------|----------|
| Session path | Task description (Session: <path>) | Yes |
| Shared memory | <session-folder>/shared-memory.json | Yes |
| Role state | team_msg(operation="get_state", session_id=<session-id>) | Yes |
| Test strategy | <session-folder>/strategy/test-strategy.md | Yes |
| Source files | From test_strategy.priority_files | Yes |
| Wisdom | <session-folder>/wisdom/ | No |
@@ -104,10 +102,10 @@ Standard task discovery flow: TaskList -> filter by prefix `TESTGEN-*` + owner m
1. Extract session path from task description (look for `Session: <path>`)
2. Extract layer from task description (look for `Layer: <L1-unit|L2-integration|L3-e2e>`)
3. Read shared memory:
3. Read role states:
```
Read("<session-folder>/shared-memory.json")
mcp__ccw-tools__team_msg({ operation: "get_state", session_id: <session-id> })
```
4. Read test strategy:
@@ -213,29 +211,33 @@ If syntax errors found, attempt auto-fix for common issues (imports, types).
> See SKILL.md Shared Infrastructure -> Worker Phase 5: Report
1. **Update shared memory**:
1. **Share generated tests via team_msg(type='state_update')**:
```
sharedMemory.generated_tests = [
...sharedMemory.generated_tests,
...<new-test-files>.map(f => ({
file: f,
layer: <layer>,
round: <is-revision ? gc_round : 0>,
revised: <is-revision>
}))
]
Write("<session-folder>/shared-memory.json", <updated-json>)
mcp__ccw-tools__team_msg({
operation: "log", session_id: <session-id>, from: "generator",
type: "state_update",
data: {
generated_tests: [
...sharedMemory.generated_tests,
...<new-test-files>.map(f => ({
file: f,
layer: <layer>,
round: <is-revision ? gc_round : 0>,
revised: <is-revision>
}))
]
}
})
```
2. **Log via team_msg**:
```
mcp__ccw-tools__team_msg({
operation: "log", team: <session-id> // MUST be session ID, NOT team name, from: "generator", to: "coordinator",
operation: "log", session_id: <session-id>, from: "generator",
type: <is-revision ? "tests_revised" : "tests_generated">,
summary: "[generator] <Generated|Revised> <file-count> <layer> test files",
ref: "<session-folder>/tests/<layer>/"
data: {ref: "<session-folder>/tests/<layer>/"}
})
```

View File

@@ -16,8 +16,8 @@ Test strategy designer. Analyzes git diff, determines test layers, defines cover
- All output (SendMessage, team_msg, logs) must carry `[strategist]` identifier
- Only communicate with coordinator via SendMessage
- Work strictly within read-only analysis responsibility scope
- Phase 2: Read shared-memory.json
- Phase 5: Write test_strategy to shared-memory.json
- Phase 2: Read role states via team_msg(operation='get_state')
- Phase 5: Share test_strategy via team_msg(type='state_update')
### MUST NOT
@@ -35,7 +35,7 @@ Test strategy designer. Analyzes git diff, determines test layers, defines cover
| Tool | Type | Used By | Purpose |
|------|------|---------|---------|
| Read | Read | Phase 2 | Load shared-memory.json, existing test patterns |
| Read | Read | Phase 2 | Load role states, existing test patterns |
| Bash | Read | Phase 2 | Git diff analysis, framework detection |
| Glob | Read | Phase 2 | Find test files, config files |
| Write | Write | Phase 3 | Create test-strategy.md |
@@ -58,19 +58,17 @@ Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
team: <session-id>, // MUST be session ID (e.g., TST-xxx-date), NOT team name. Extract from Session: field in task description.
session_id: <session-id>,
from: "strategist",
to: "coordinator",
type: <message-type>,
summary: "[strategist] STRATEGY complete: <summary>",
ref: <artifact-path>
data: {ref: "<artifact-path>"}
})
```
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --team <session-id> --from strategist --to coordinator --type <message-type> --summary \"[strategist] ...\" --ref <artifact-path> --json")
Bash("ccw team log --session-id <session-id> --from strategist --type <message-type> --json")
```
---
@@ -90,17 +88,17 @@ Standard task discovery flow: TaskList -> filter by prefix `STRATEGY-*` + owner
| Input | Source | Required |
|-------|--------|----------|
| Session path | Task description (Session: <path>) | Yes |
| Shared memory | <session-folder>/shared-memory.json | Yes |
| Role state | team_msg(operation="get_state", session_id=<session-id>) | Yes |
| Git diff | `git diff HEAD~1` or `git diff --cached` | Yes |
| Changed files | From git diff --name-only | Yes |
**Loading steps**:
1. Extract session path from task description (look for `Session: <path>`)
2. Read shared-memory.json for changed files and modules
2. Read role states for changed files and modules
```
Read("<session-folder>/shared-memory.json")
mcp__ccw-tools__team_msg({ operation: "get_state", session_id: <session-id> })
```
3. Get detailed git diff for analysis:
@@ -162,27 +160,31 @@ Write("<session-folder>/strategy/test-strategy.md", <strategy-content>)
> See SKILL.md Shared Infrastructure -> Worker Phase 5: Report
1. **Update shared memory**:
1. **Share test strategy via team_msg(type='state_update')**:
```
sharedMemory.test_strategy = {
framework: <detected-framework>,
layers: { L1: [...], L2: [...], L3: [...] },
coverage_targets: { L1: <n>, L2: <n>, L3: <n> },
priority_files: [...],
risks: [...]
}
Write("<session-folder>/shared-memory.json", <updated-json>)
mcp__ccw-tools__team_msg({
operation: "log", session_id: <session-id>, from: "strategist",
type: "state_update",
data: {
test_strategy: {
framework: <detected-framework>,
layers: { L1: [...], L2: [...], L3: [...] },
coverage_targets: { L1: <n>, L2: <n>, L3: <n> },
priority_files: [...],
risks: [...]
}
}
})
```
2. **Log via team_msg**:
```
mcp__ccw-tools__team_msg({
operation: "log", team: "testing", from: "strategist", to: "coordinator",
operation: "log", session_id: <session-id>, from: "strategist",
type: "strategy_ready",
summary: "[strategist] Strategy complete: <file-count> files, L1-L3 layers defined",
ref: "<session-folder>/strategy/test-strategy.md"
data: {ref: "<session-folder>/strategy/test-strategy.md"}
})
```