claude-code-workflow 7.2.25 → 7.2.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/.claude/CLAUDE.md +20 -0
  2. package/.claude/agents/action-planning-agent.md +6 -0
  3. package/.claude/agents/cli-explore-agent.md +63 -77
  4. package/.claude/agents/cli-lite-planning-agent.md +10 -11
  5. package/.claude/agents/issue-plan-agent.md +7 -2
  6. package/.claude/commands/workflow/spec/setup.md +1 -1
  7. package/.claude/skills/review-cycle/phases/review-module.md +4 -4
  8. package/.claude/skills/review-cycle/phases/review-session.md +4 -4
  9. package/.claude/skills/team-arch-opt/SKILL.md +1 -1
  10. package/.claude/skills/team-arch-opt/roles/coordinator/commands/monitor.md +3 -1
  11. package/.claude/skills/team-arch-opt/roles/refactorer/role.md +3 -1
  12. package/.claude/skills/team-arch-opt/specs/team-config.json +2 -2
  13. package/.claude/skills/team-coordinate/SKILL.md +4 -3
  14. package/.claude/skills/team-coordinate/roles/coordinator/commands/analyze-task.md +1 -1
  15. package/.claude/skills/team-coordinate/roles/coordinator/commands/dispatch.md +3 -2
  16. package/.claude/skills/team-coordinate/roles/coordinator/commands/monitor.md +3 -2
  17. package/.claude/skills/team-coordinate/roles/coordinator/role.md +16 -15
  18. package/.claude/skills/team-coordinate/specs/pipelines.md +7 -4
  19. package/.claude/skills/team-coordinate/specs/role-spec-template.md +1 -0
  20. package/.claude/skills/team-lifecycle-v4/SKILL.md +1 -1
  21. package/.claude/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +14 -2
  22. package/.claude/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +24 -2
  23. package/.claude/skills/team-lifecycle-v4/roles/executor/role.md +3 -1
  24. package/.claude/skills/team-perf-opt/SKILL.md +1 -1
  25. package/.claude/skills/team-perf-opt/roles/optimizer/role.md +3 -1
  26. package/.claude/skills/team-perf-opt/specs/team-config.json +2 -2
  27. package/.claude/skills/team-quality-assurance/SKILL.md +1 -1
  28. package/.claude/skills/team-quality-assurance/roles/coordinator/commands/dispatch.md +4 -2
  29. package/.claude/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +4 -2
  30. package/.claude/skills/team-quality-assurance/roles/executor/role.md +3 -1
  31. package/.claude/skills/team-testing/SKILL.md +1 -1
  32. package/.claude/skills/team-testing/roles/coordinator/commands/dispatch.md +5 -2
  33. package/.claude/skills/team-testing/roles/coordinator/commands/monitor.md +4 -2
  34. package/.claude/skills/team-testing/roles/executor/role.md +3 -1
  35. package/.claude/skills/workflow-multi-cli-plan/SKILL.md +2 -2
  36. package/.claude/skills/workflow-plan/phases/03-conflict-resolution.md +2 -2
  37. package/.claude/skills/workflow-plan/phases/05-plan-verify.md +2 -2
  38. package/.claude/skills/workflow-tdd-plan/phases/02-context-gathering.md +3 -3
  39. package/.claude/skills/workflow-tdd-plan/phases/04-conflict-resolution.md +2 -2
  40. package/.claude/skills/workflow-test-fix/phases/02-test-context-gather.md +2 -2
  41. package/.codex/AGENTS.md +16 -0
  42. package/ccw/dist/tools/index.d.ts.map +1 -1
  43. package/ccw/dist/tools/index.js +2 -0
  44. package/ccw/dist/tools/index.js.map +1 -1
  45. package/ccw/dist/tools/json-builder.d.ts +17 -0
  46. package/ccw/dist/tools/json-builder.d.ts.map +1 -0
  47. package/ccw/dist/tools/json-builder.js +746 -0
  48. package/ccw/dist/tools/json-builder.js.map +1 -0
  49. package/ccw/dist/tools/schema-registry.d.ts +71 -0
  50. package/ccw/dist/tools/schema-registry.d.ts.map +1 -0
  51. package/ccw/dist/tools/schema-registry.js +136 -0
  52. package/ccw/dist/tools/schema-registry.js.map +1 -0
  53. package/package.json +1 -1
  54. package/.codex/prompts/prep-cycle.md +0 -416
  55. package/.codex/prompts/prep-plan.md +0 -371
package/.claude/CLAUDE.md CHANGED
@@ -36,6 +36,26 @@ Available CLI endpoints are dynamically defined by the config file
36
36
  - **Key scenarios**: Self-repair fails, ambiguous requirements, architecture decisions, pattern uncertainty, critical code paths
37
37
  - **Principles**: Default `--mode analysis`, no confirmation needed, wait for completion, flexible rule selection
38
38
 
39
+ ## Workflow Session Awareness
40
+
41
+ ### Artifact Locations
42
+
43
+ | Workflow | Directory | Summary File |
44
+ |----------|-----------|-------------|
45
+ | `workflow-plan` | `.workflow/active/WFS-*/` | `workflow-session.json` |
46
+ | `workflow-lite-plan` | `.workflow/.lite-plan/{slug}-{date}/` | `plan.json` |
47
+ | `analyze-with-file` | `.workflow/.analysis/ANL-*/` | `conclusions.json` |
48
+ | `multi-cli-plan` | `.workflow/.multi-cli-plan/*/` | `session-state.json` |
49
+ | `lite-fix` | `.workflow/.lite-fix/*/` | `fix-plan.json` |
50
+ | Other | `.workflow/.debug/`, `.workflow/.scratchpad/`, `.workflow/archives/` | — |
51
+
52
+ ### Pre-Task Discovery
53
+
54
+ Before starting any workflow skill, scan recent sessions (7 days) to avoid conflicts and reuse prior work:
55
+ - If overlapping file scope found: warn user, suggest `--continue` or reference prior session
56
+ - If complementary: feed prior findings into new session context
57
+ - `memory/MEMORY.md` for cross-session knowledge; `.workflow/` for session-specific artifacts — reference session IDs, don't duplicate
58
+
39
59
  ## Code Diagnostics
40
60
 
41
61
  - **Prefer `mcp__ide__getDiagnostics`** for code error checking over shell-based TypeScript compilation
@@ -829,6 +829,12 @@ Generate at `.workflow/active/{session_id}/plan.json` following `plan-overview-b
829
829
 
830
830
  **Generation Timing**: After all `.task/IMPL-*.json` files are generated, aggregate into plan.json.
831
831
 
832
+ **Validation**: After writing plan.json and task files, validate with json_builder:
833
+ ```bash
834
+ ccw tool exec json_builder '{"cmd":"validate","target":"<session>/plan.json","schema":"plan"}'
835
+ ccw tool exec json_builder '{"cmd":"validate","target":"<session>/.task/IMPL-001.json","schema":"task"}'
836
+ ```
837
+
832
838
  ### 2.3 IMPL_PLAN.md Structure
833
839
 
834
840
  **Template-Based Generation**:
@@ -5,6 +5,7 @@ description: |
5
5
  Orchestrates 4-phase workflow: Task Understanding → Analysis Execution → Schema Validation → Output Generation.
6
6
  Spawned by /explore command orchestrator.
7
7
  tools: Read, Bash, Glob, Grep
8
+ # json_builder available via: ccw tool exec json_builder '{"cmd":"..."}' (Bash)
8
9
  color: yellow
9
10
  ---
10
11
 
@@ -66,9 +67,9 @@ Phase 4: Output Generation
66
67
  Store result as `project_structure` for module-aware file discovery in Phase 2.
67
68
 
68
69
  2. **Output Schema Loading** (if output file path specified in prompt):
69
- - Exploration output `cat ~/.ccw/workflows/cli-templates/schemas/explore-json-schema.json`
70
- - Other schemas as specified in prompt
71
- Read and memorize schema requirements BEFORE any analysis begins (feeds Phase 3 validation).
70
+ - Get schema summary: `ccw tool exec json_builder '{"cmd":"info","schema":"explore"}'` (or "diagnosis" for bug analysis)
71
+ - Initialize output file: `ccw tool exec json_builder '{"cmd":"init","schema":"explore","output":"<output_path>"}'`
72
+ - The tool returns requiredFields, arrayFields, and enumFields memorize these for Phase 2.
72
73
 
73
74
  3. **Project Context Loading** (from spec system):
74
75
  - Load exploration specs using: `ccw spec load --category exploration`
@@ -150,55 +151,56 @@ RULES: {from prompt, if template specified} | analysis=READ-ONLY
150
151
  ---
151
152
 
152
153
  <schema_validation>
153
- ## Phase 3: Schema Validation
154
+ ## Phase 3: Incremental Build & Validation (via json_builder)
154
155
 
155
- ### CRITICAL: Schema Compliance Protocol
156
+ **This phase replaces manual JSON writing + self-validation with tool-assisted construction.**
156
157
 
157
- **This phase is MANDATORY when schema file is specified in prompt.**
158
+ **Step 1: Set text fields** (discovered during Phase 2 analysis)
159
+ ```bash
160
+ ccw tool exec json_builder '{"cmd":"set","target":"<output_path>","ops":[
161
+ {"path":"project_structure","value":"..."},
162
+ {"path":"patterns","value":"..."},
163
+ {"path":"dependencies","value":"..."},
164
+ {"path":"integration_points","value":"..."},
165
+ {"path":"constraints","value":"..."}
166
+ ]}'
167
+ ```
168
+
169
+ **Step 2: Append file entries** (as discovered — one `set` per batch)
170
+ ```bash
171
+ ccw tool exec json_builder '{"cmd":"set","target":"<output_path>","ops":[
172
+ {"path":"relevant_files[+]","value":{"path":"src/auth.ts","relevance":0.9,"rationale":"Contains AuthService.login() entry point for JWT generation","role":"modify_target","discovery_source":"bash-scan","key_code":[{"symbol":"login()","location":"L45-78","description":"JWT token generation with bcrypt verification"}],"topic_relation":"Security target — JWT generation lacks token rotation"}},
173
+ {"path":"relevant_files[+]","value":{...}}
174
+ ]}'
175
+ ```
158
176
 
159
- **Step 1: Read Schema FIRST**
177
+ The tool **automatically validates** each operation:
178
+ - enum values (role, discovery_source) → rejects invalid
179
+ - minLength (rationale >= 10) → rejects too short
180
+ - type checking → rejects wrong types
181
+
182
+ **Step 3: Set metadata**
183
+ ```bash
184
+ ccw tool exec json_builder '{"cmd":"set","target":"<output_path>","ops":[
185
+ {"path":"_metadata.timestamp","value":"auto"},
186
+ {"path":"_metadata.task_description","value":"..."},
187
+ {"path":"_metadata.source","value":"cli-explore-agent"},
188
+ {"path":"_metadata.exploration_angle","value":"..."},
189
+ {"path":"_metadata.exploration_index","value":1},
190
+ {"path":"_metadata.total_explorations","value":2}
191
+ ]}'
160
192
  ```
161
- Read(schema_file_path)
193
+
194
+ **Step 4: Final validation**
195
+ ```bash
196
+ ccw tool exec json_builder '{"cmd":"validate","target":"<output_path>"}'
162
197
  ```
198
+ Returns `{valid, errors, warnings, stats}`. If errors exist → fix with `set` → re-validate.
163
199
 
164
- **Step 2: Extract Schema Requirements**
165
-
166
- Parse and memorize:
167
- 1. **Root structure** - Is it array `[...]` or object `{...}`?
168
- 2. **Required fields** - List all `"required": [...]` arrays
169
- 3. **Field names EXACTLY** - Copy character-by-character (case-sensitive)
170
- 4. **Enum values** - Copy exact strings (e.g., `"critical"` not `"Critical"`)
171
- 5. **Nested structures** - Note flat vs nested requirements
172
-
173
- **Step 3: File Rationale Validation** (MANDATORY for relevant_files / affected_files)
174
-
175
- Every file entry MUST have:
176
- - `rationale` (required, minLength 10): Specific reason tied to the exploration topic, NOT generic
177
- - GOOD: "Contains AuthService.login() which is the entry point for JWT token generation"
178
- - BAD: "Related to auth" or "Relevant file"
179
- - `role` (required, enum): Structural classification of why it was selected
180
- - `discovery_source` (optional but recommended): How the file was found
181
- - `key_code` (strongly recommended for relevance >= 0.7): Array of {symbol, location?, description}
182
- - GOOD: [{"symbol": "AuthService.login()", "location": "L45-L78", "description": "JWT token generation with bcrypt verification, returns token pair"}]
183
- - BAD: [{"symbol": "login", "description": "login function"}]
184
- - `topic_relation` (strongly recommended for relevance >= 0.7): Connection from exploration angle perspective
185
- - GOOD: "Security exploration targets this file because JWT generation lacks token rotation"
186
- - BAD: "Related to security"
187
-
188
- **Step 4: Pre-Output Validation Checklist**
189
-
190
- Before writing ANY JSON output, verify:
191
-
192
- - [ ] Root structure matches schema (array vs object)
193
- - [ ] ALL required fields present at each level
194
- - [ ] Field names EXACTLY match schema (character-by-character)
195
- - [ ] Enum values EXACTLY match schema (case-sensitive)
196
- - [ ] Nested structures follow schema pattern (flat vs nested)
197
- - [ ] Data types correct (string, integer, array, object)
198
- - [ ] Every file in relevant_files has: path + relevance + rationale + role
199
- - [ ] Every rationale is specific (>10 chars, not generic)
200
- - [ ] Files with relevance >= 0.7 have key_code with symbol + description (minLength 10)
201
- - [ ] Files with relevance >= 0.7 have topic_relation explaining connection to angle (minLength 15)
200
+ **Quality reminders** (enforced by tool, but be aware):
201
+ - `rationale`: Must be specific, not generic ("Related to auth" → rejected by semantic check)
202
+ - `key_code`: Strongly recommended for relevance >= 0.7 (warnings if missing)
203
+ - `topic_relation`: Strongly recommended for relevance >= 0.7 (warnings if missing)
202
204
  </schema_validation>
203
205
 
204
206
  ---
@@ -212,16 +214,12 @@ Brief summary:
212
214
  - Task completion status
213
215
  - Key findings summary
214
216
  - Generated file paths (if any)
217
+ - Validation result (from Phase 3 Step 4)
215
218
 
216
- ### File Output (as specified in prompt)
217
-
218
- **MANDATORY WORKFLOW**:
219
+ ### File Output
219
220
 
220
- 1. `Read()` schema file BEFORE generating output
221
- 2. Extract ALL field names from schema
222
- 3. Build JSON using ONLY schema field names
223
- 4. Validate against checklist before writing
224
- 5. Write file with validated content
221
+ File is already written by json_builder during Phase 3 (init + set operations).
222
+ Phase 4 only verifies the final validation passed and returns the summary.
225
223
  </output_generation>
226
224
 
227
225
  ---
@@ -243,28 +241,19 @@ Brief summary:
243
241
 
244
242
  **ALWAYS**:
245
243
  1. **Search Tool Priority**: ACE (`mcp__ace-tool__search_context`) → CCW (`mcp__ccw-tools__smart_search`) / Built-in (`Grep`, `Glob`, `Read`)
246
- 2. Read schema file FIRST before generating any output (if schema specified)
247
- 3. Copy field names EXACTLY from schema (case-sensitive)
248
- 4. Verify root structure matches schema (array vs object)
249
- 5. Match nested/flat structures as schema requires
250
- 6. Use exact enum values from schema (case-sensitive)
251
- 7. Include ALL required fields at every level
252
- 8. Include file:line references in findings
253
- 9. **Every file MUST have rationale**: Specific selection basis tied to the topic (not generic)
254
- 10. **Every file MUST have role**: Classify as modify_target/dependency/pattern_reference/test_target/type_definition/integration_point/config/context_only
255
- 11. **Track discovery source**: Record how each file was found (bash-scan/cli-analysis/ace-search/dependency-trace/manual)
256
- 12. **Populate key_code for high-relevance files**: relevance >= 0.7 → key_code array with symbol, location, description
257
- 13. **Populate topic_relation for high-relevance files**: relevance >= 0.7 → topic_relation explaining file-to-angle connection
244
+ 2. **Use json_builder** for all JSON output: `init` `set` (incremental) `validate`
245
+ 3. Include file:line references in findings
246
+ 4. **Every file MUST have rationale + role** (enforced by json_builder set validation)
247
+ 5. **Track discovery source**: Record how each file was found (bash-scan/cli-analysis/ace-search/dependency-trace/manual)
248
+ 6. **Populate key_code + topic_relation for high-relevance files** (relevance >= 0.7; json_builder warns if missing)
258
249
 
259
250
  **Bash Tool**:
260
251
  - Use `run_in_background=false` for all Bash/CLI calls to ensure foreground execution
261
252
 
262
253
  **NEVER**:
263
- 1. Modify any files (read-only agent)
264
- 2. Skip schema reading step when schema is specified
265
- 3. Guess field names - ALWAYS copy from schema
266
- 4. Assume structure - ALWAYS verify against schema
267
- 5. Omit required fields
254
+ 1. Modify any source code files (read-only agent — json_builder writes only output JSON)
255
+ 2. Hand-write JSON output always use json_builder
256
+ 3. Skip the `validate` step before returning
268
257
  </operational_rules>
269
258
 
270
259
  <output_contract>
@@ -282,11 +271,8 @@ When exploration is complete, return one of:
282
271
 
283
272
  Before returning, verify:
284
273
  - [ ] All 4 phases were executed (or skipped with justification)
285
- - [ ] Schema was read BEFORE output generation (if schema specified)
286
- - [ ] All field names match schema exactly (case-sensitive)
287
- - [ ] Every file entry has rationale (specific, >10 chars) and role
288
- - [ ] High-relevance files (>= 0.7) have key_code and topic_relation
274
+ - [ ] json_builder `init` was called at start
275
+ - [ ] json_builder `validate` returned `valid: true` (or all errors were fixed)
289
276
  - [ ] Discovery sources are tracked for all findings
290
- - [ ] No files were modified (read-only agent)
291
- - [ ] Output format matches schema root structure (array vs object)
277
+ - [ ] No source code files were modified (read-only agent)
292
278
  </quality_gate>
@@ -139,16 +139,15 @@ When `process_docs: true`, generate planning-context.md before sub-plan.json:
139
139
 
140
140
  ## Schema-Driven Output
141
141
 
142
- **CRITICAL**: Read the schema reference first to determine output structure:
143
- - `plan-overview-base-schema.json` → Implementation plan with `approach`, `complexity`
144
- - `plan-overview-fix-schema.json` → Fix plan with `root_cause`, `severity`, `risk_level`
142
+ **CRITICAL**: Get schema info via json_builder to determine output structure:
143
+ - `ccw tool exec json_builder '{"cmd":"info","schema":"plan"}'` → Implementation plan with `approach`, `complexity`
144
+ - `ccw tool exec json_builder '{"cmd":"info","schema":"plan-fix"}'` → Fix plan with `root_cause`, `severity`, `risk_level`
145
145
 
146
- ```javascript
147
- // Step 1: Always read schema first
148
- const schema = Bash(`cat ${schema_path}`)
149
-
150
- // Step 2: Generate plan conforming to schema
151
- const planObject = generatePlanFromSchema(schema, context)
146
+ After generating plan.json and .task/*.json, validate:
147
+ ```bash
148
+ ccw tool exec json_builder '{"cmd":"validate","target":"<session>/plan.json","schema":"plan"}'
149
+ # For each task file:
150
+ ccw tool exec json_builder '{"cmd":"validate","target":"<session>/.task/TASK-001.json","schema":"task"}'
152
151
  ```
153
152
 
154
153
  </schema_driven_output>
@@ -863,7 +862,7 @@ function validateTask(task) {
863
862
 
864
863
  **ALWAYS**:
865
864
  - **Search Tool Priority**: ACE (`mcp__ace-tool__search_context`) → CCW (`mcp__ccw-tools__smart_search`) / Built-in (`Grep`, `Glob`, `Read`)
866
- - **Read schema first** to determine output structure
865
+ - **Get schema info via json_builder** to determine output structure
867
866
  - Generate task IDs (TASK-001/TASK-002 for plan, FIX-001/FIX-002 for fix-plan)
868
867
  - Include depends_on (even if empty [])
869
868
  - **Assign cli_execution_id** (`{sessionId}-{taskId}`)
@@ -981,7 +980,7 @@ Upon completion, return one of:
981
980
 
982
981
  Before returning, verify:
983
982
 
984
- - [ ] Schema reference was read and output structure matches schema type (base vs fix)
983
+ - [ ] Schema info was obtained via json_builder and output structure matches schema type (base vs fix)
985
984
  - [ ] All tasks have valid IDs (TASK-NNN or FIX-NNN format)
986
985
  - [ ] All tasks have 2+ implementation steps
987
986
  - [ ] All convergence criteria are quantified and testable (no vague language)
@@ -348,7 +348,7 @@ Write({ file_path: filePath, content: newContent })
348
348
  .workflow/issues/solutions/{issue-id}.jsonl
349
349
  ```
350
350
 
351
- Each line is a solution JSON containing tasks. Schema: `cat ~/.ccw/workflows/cli-templates/schemas/solution-schema.json`
351
+ Each line is a solution JSON containing tasks. Schema: `ccw tool exec json_builder '{"cmd":"info","schema":"solution"}'`
352
352
 
353
353
  ### 2.2 Return Summary
354
354
 
@@ -388,7 +388,7 @@ Each line is a solution JSON containing tasks. Schema: `cat ~/.ccw/workflows/cli
388
388
 
389
389
  **ALWAYS**:
390
390
  1. **Search Tool Priority**: ACE (`mcp__ace-tool__search_context`) → CCW (`mcp__ccw-tools__smart_search`) / Built-in (`Grep`, `Glob`, `Read`)
391
- 2. Read schema first: `cat ~/.ccw/workflows/cli-templates/schemas/solution-schema.json`
391
+ 2. Get schema info: `ccw tool exec json_builder '{"cmd":"info","schema":"solution"}'` (replaces reading raw schema)
392
392
  3. Use ACE semantic search as PRIMARY exploration tool
393
393
  4. Fetch issue details via `ccw issue status <id> --json`
394
394
  5. **Analyze failure history**: Check `issue.feedback` for type='failure', stage='execute'
@@ -408,6 +408,11 @@ Each line is a solution JSON containing tasks. Schema: `cat ~/.ccw/workflows/cli
408
408
  4. **Dependency ordering**: If issues must touch same files, encode execution order via `depends_on`
409
409
  5. **Scope minimization**: Prefer smaller, focused modifications over broad refactoring
410
410
 
411
+ **VALIDATE**: After writing solution JSONL, validate each solution:
412
+ ```bash
413
+ ccw tool exec json_builder '{"cmd":"validate","target":".workflow/issues/solutions/<issue-id>.jsonl","schema":"solution"}'
414
+ ```
415
+
411
416
  **NEVER**:
412
417
  1. Execute implementation (return plan only)
413
418
  2. Use vague criteria ("works correctly", "good performance")
@@ -129,7 +129,7 @@ Task(
129
129
  Analyze project for workflow initialization and generate .workflow/project-tech.json.
130
130
 
131
131
  ## MANDATORY FIRST STEPS
132
- 1. Execute: cat ~/.ccw/workflows/cli-templates/schemas/project-tech-schema.json (get schema reference)
132
+ 1. Execute: ccw tool exec json_builder '{"cmd":"info","schema":"tech"}' (get schema summary)
133
133
  2. Execute: ccw tool exec get_modules_by_depth '{}' (get project structure)
134
134
 
135
135
  ## Task
@@ -401,7 +401,7 @@ Task(
401
401
  1. Read review state: ${reviewStateJsonPath}
402
402
  2. Get target files: Read resolved_files from review-state.json
403
403
  3. Validate file access: bash(ls -la ${targetFiles.join(' ')})
404
- 4. Execute: cat ~/.ccw/workflows/cli-templates/schemas/review-dimension-results-schema.json (get output schema reference)
404
+ 4. Execute: ccw tool exec json_builder '{"cmd":"info","schema":"review-dim"}' (get output schema summary)
405
405
  5. Read: .workflow/project-tech.json (technology stack and architecture context)
406
406
  6. Read: .workflow/specs/*.md (user-defined constraints and conventions to validate against)
407
407
 
@@ -456,7 +456,7 @@ Task(
456
456
  ${getDimensionGuidance(dimension)}
457
457
 
458
458
  ## Success Criteria
459
- - [ ] Schema obtained via cat review-dimension-results-schema.json
459
+ - [ ] Schema obtained via json_builder info
460
460
  - [ ] All target files analyzed for ${dimension} concerns
461
461
  - [ ] All findings include file:line references with code snippets
462
462
  - [ ] Severity assessment follows established criteria (see reference)
@@ -505,7 +505,7 @@ Task(
505
505
  2. Read affected file: ${file}
506
506
  3. Identify related code: bash(grep -r "import.*${basename(file)}" ${projectDir}/src --include="*.ts")
507
507
  4. Read test files: bash(find ${projectDir}/tests -name "*${basename(file, '.ts')}*" -type f)
508
- 5. Execute: cat ~/.ccw/workflows/cli-templates/schemas/review-deep-dive-results-schema.json (get output schema reference)
508
+ 5. Execute: ccw tool exec json_builder '{"cmd":"info","schema":"review-deep"}' (get output schema summary)
509
509
  6. Read: .workflow/project-tech.json (technology stack and architecture context)
510
510
  7. Read: .workflow/specs/*.md (user-defined constraints for remediation compliance)
511
511
 
@@ -538,7 +538,7 @@ Task(
538
538
  - Impact assessment and rollback strategy
539
539
 
540
540
  ## Success Criteria
541
- - [ ] Schema obtained via cat review-deep-dive-results-schema.json
541
+ - [ ] Schema obtained via json_builder info
542
542
  - [ ] Root cause clearly identified with supporting evidence
543
543
  - [ ] Remediation plan is step-by-step actionable with exact file:line references
544
544
  - [ ] Each step includes specific commands and validation tests
@@ -412,7 +412,7 @@ Task(
412
412
  2. Read completed task summaries: bash(find ${summariesDir} -name "IMPL-*.md" -type f)
413
413
  3. Get changed files: bash(cd ${workflowDir} && git log --since="${sessionCreatedAt}" --name-only --pretty=format: | sort -u)
414
414
  4. Read review state: ${reviewStateJsonPath}
415
- 5. Execute: cat ~/.ccw/workflows/cli-templates/schemas/review-dimension-results-schema.json (get output schema reference)
415
+ 5. Execute: ccw tool exec json_builder '{"cmd":"info","schema":"review-dim"}' (get output schema summary)
416
416
  6. Read: .workflow/project-tech.json (technology stack and architecture context)
417
417
  7. Read: .workflow/specs/*.md (user-defined constraints and conventions to validate against)
418
418
 
@@ -467,7 +467,7 @@ Task(
467
467
  ${getDimensionGuidance(dimension)}
468
468
 
469
469
  ## Success Criteria
470
- - [ ] Schema obtained via cat review-dimension-results-schema.json
470
+ - [ ] Schema obtained via json_builder info
471
471
  - [ ] All changed files analyzed for ${dimension} concerns
472
472
  - [ ] All findings include file:line references with code snippets
473
473
  - [ ] Severity assessment follows established criteria (see reference)
@@ -516,7 +516,7 @@ Task(
516
516
  2. Read affected file: ${file}
517
517
  3. Identify related code: bash(grep -r "import.*${basename(file)}" ${workflowDir}/src --include="*.ts")
518
518
  4. Read test files: bash(find ${workflowDir}/tests -name "*${basename(file, '.ts')}*" -type f)
519
- 5. Execute: cat ~/.ccw/workflows/cli-templates/schemas/review-deep-dive-results-schema.json (get output schema reference)
519
+ 5. Execute: ccw tool exec json_builder '{"cmd":"info","schema":"review-deep"}' (get output schema summary)
520
520
  6. Read: .workflow/project-tech.json (technology stack and architecture context)
521
521
  7. Read: .workflow/specs/*.md (user-defined constraints for remediation compliance)
522
522
 
@@ -550,7 +550,7 @@ Task(
550
550
  - Impact assessment and rollback strategy
551
551
 
552
552
  ## Success Criteria
553
- - [ ] Schema obtained via cat review-deep-dive-results-schema.json
553
+ - [ ] Schema obtained via json_builder info
554
554
  - [ ] Root cause clearly identified with supporting evidence
555
555
  - [ ] Remediation plan is step-by-step actionable with exact file:line references
556
556
  - [ ] Each step includes specific commands and validation tests
@@ -78,7 +78,7 @@ Execute built-in Phase 1 (task discovery) -> role Phase 2-4 -> built-in Phase 5
78
78
  })
79
79
  ```
80
80
 
81
- **Inner Loop roles** (refactorer): Set `inner_loop: true`.
81
+ **Inner Loop roles** (refactorer): Set `inner_loop` dynamically — `true` for single mode, `false` for fan-out/independent (parallel branches).
82
82
  **Single-task roles** (analyzer, designer, validator, reviewer): Set `inner_loop: false`.
83
83
 
84
84
  ## User Commands
@@ -82,7 +82,9 @@ Find ready tasks, spawn workers, STOP.
82
82
  2. No ready + work in progress -> report waiting, STOP
83
83
  3. No ready + nothing in progress -> handleComplete
84
84
  4. Has ready -> for each:
85
- a. Check if inner loop role with active worker -> skip (worker picks up)
85
+ a. Check inner_loop: parse task description `InnerLoop:` field (NOT role.md default)
86
+ - InnerLoop: true AND same-role worker already active -> skip (worker picks up)
87
+ - InnerLoop: false OR no active same-role worker -> spawn new worker
86
88
  b. TaskUpdate -> in_progress
87
89
  c. team_msg log -> task_unblocked
88
90
  d. Spawn team-worker (see SKILL.md Spawn Template):
@@ -1,12 +1,14 @@
1
1
  ---
2
2
  role: refactorer
3
3
  prefix: REFACTOR
4
- inner_loop: true
4
+ inner_loop: dynamic
5
5
  message_types: [state_update]
6
6
  ---
7
7
 
8
8
  # Code Refactorer
9
9
 
10
+ > **inner_loop: dynamic** — Dispatch sets per-task: `true` for single mode (one REFACTOR task with iterative fix cycles), `false` for fan-out/independent modes (REFACTOR-B01..N run as separate parallel workers). When false, each branch gets its own worker.
11
+
10
12
  Implement architecture refactoring changes following the design plan. For FIX tasks, apply targeted corrections based on review/validation feedback.
11
13
 
12
14
  ## Modes
@@ -64,10 +64,10 @@
64
64
  "type": "code_generation",
65
65
  "description": "Implements architecture refactoring changes following the design plan",
66
66
  "role_spec": "roles/refactorer/role.md",
67
- "inner_loop": true,
67
+ "inner_loop": "dynamic",
68
68
  "frontmatter": {
69
69
  "prefix": "REFACTOR",
70
- "inner_loop": true,
70
+ "inner_loop": "dynamic",
71
71
  "additional_prefixes": ["FIX"],
72
72
  "discuss_rounds": [],
73
73
  "cli_tools": ["explore"],
@@ -130,9 +130,10 @@ Execute built-in Phase 1 (task discovery) -> role-spec Phase 2-4 -> built-in Pha
130
130
  })
131
131
  ```
132
132
 
133
- **Inner Loop roles** (role has 2+ serial same-prefix tasks): Set `inner_loop: true`. The team-worker agent handles the loop internally.
134
-
135
- **Single-task roles**: Set `inner_loop: false`.
133
+ **Inner Loop**: Determined per-task from task description `InnerLoop:` field, not per-role:
134
+ - Serial chain (2+ tasks, each blockedBy previous): `inner_loop: true` — single worker loops
135
+ - Parallel tasks (no mutual blockedBy): `inner_loop: false` — separate workers per task
136
+ - Single-task roles: `inner_loop: false`
136
137
 
137
138
  ---
138
139
 
@@ -130,7 +130,7 @@ For each role, determine frontmatter and generation hints:
130
130
  | Field | Derivation |
131
131
  |-------|------------|
132
132
  | `prefix` | From capability prefix (e.g., RESEARCH, DRAFT, IMPL) |
133
- | `inner_loop` | `true` if role has 2+ serial same-prefix tasks |
133
+ | `inner_loop` | `true` if role has 2+ same-prefix tasks AND they form a serial chain (each blockedBy the previous). `false` if tasks are parallel (no mutual blockedBy) or role has only 1 task |
134
134
  | `CLI tools` | Suggested, not mandatory — coordinator may adjust based on task needs |
135
135
  | `pattern_hint` | Reference pattern name from role-spec-template (research/document/code/analysis/validation) — guides coordinator's Phase 2-4 composition, NOT a rigid template selector |
136
136
  | `output_type` | `artifact` (new files in session/artifacts/) / `codebase` (modify existing project files) / `mixed` (both) — determines verification strategy in Behavioral Traits |
@@ -95,9 +95,10 @@ RoleSpec: <session-folder>/role-specs/<role-name>.md
95
95
 
96
96
  | Condition | InnerLoop |
97
97
  |-----------|-----------|
98
- | Role has 2+ serial same-prefix tasks | true |
98
+ | Role has 2+ same-prefix tasks forming a serial chain (each blockedBy the previous) | true |
99
99
  | Role has 1 task | false |
100
- | Tasks are parallel (no dependency between them) | false |
100
+ | Role has 2+ same-prefix tasks but they are parallel (no mutual blockedBy) | false |
101
+ | Mixed: some serial, some parallel within same role | Set per-task: true for serial chain members, false for parallel members |
101
102
 
102
103
  ### Dependency Validation
103
104
 
@@ -144,9 +144,10 @@ Ready tasks found?
144
144
  +- NONE + work in progress -> report waiting -> STOP
145
145
  +- NONE + nothing in progress -> PIPELINE_COMPLETE -> handleComplete
146
146
  +- HAS ready tasks -> for each:
147
- +- Is task owner an Inner Loop role AND that role already has an active_worker?
147
+ +- Parse task description `InnerLoop:` field (NOT session.roles[].inner_loop)
148
+ +- InnerLoop: true AND same-role worker already in active_workers?
148
149
  | +- YES -> SKIP spawn (existing worker will pick it up via inner loop)
149
- | +- NO -> normal spawn below
150
+ | +- NO -> normal spawn below (InnerLoop: false OR no active same-role worker)
150
151
  +- TaskUpdate -> in_progress
151
152
  +- team_msg log -> task_unblocked (session_id=<session-id>)
152
153
  +- Spawn team-worker (see spawn tool call below)
@@ -207,15 +207,9 @@ Regardless of complexity score or role count, coordinator MUST:
207
207
  - `project_root` = result of `Bash({ command: "pwd" })`
208
208
  - `skill_root` = `<project_root>/.claude/skills/team-coordinate`
209
209
 
210
- 2. **Check `needs_research` flag** from task-analysis.json:
211
- - If `true`: **Spawn researcher worker first** to gather codebase context
212
- - Wait for researcher callback
213
- - Merge research findings into task context
214
- - Update task-analysis.json with enriched context
210
+ 2. **Generate session ID**: `TC-<slug>-<date>` (slug from first 3 meaningful words of task)
215
211
 
216
- 3. **Generate session ID**: `TC-<slug>-<date>` (slug from first 3 meaningful words of task)
217
-
218
- 4. **Create session folder structure**:
212
+ 3. **Create session folder structure**:
219
213
  ```
220
214
  .workflow/.team/<session-id>/
221
215
  +-- role-specs/
@@ -226,11 +220,11 @@ Regardless of complexity score or role count, coordinator MUST:
226
220
  +-- .msg/
227
221
  ```
228
222
 
229
- 5. **Call TeamCreate** with team name derived from session ID
223
+ 4. **Call TeamCreate** with team name derived from session ID
230
224
 
231
- 6. **Read `specs/role-spec-template.md`** for Behavioral Traits + Reference Patterns
225
+ 5. **Read `specs/role-spec-template.md`** for Behavioral Traits + Reference Patterns
232
226
 
233
- 7. **For each role in task-analysis.json#roles**:
227
+ 6. **For each role in task-analysis.json#roles**:
234
228
  - Fill YAML frontmatter: role, prefix, inner_loop, additional_members, message_types
235
229
  - **Compose Phase 2-4 content** (NOT copy from template):
236
230
  - Phase 2: Derive input sources and context loading steps from **task description + upstream dependencies**
@@ -239,14 +233,14 @@ Regardless of complexity score or role count, coordinator MUST:
239
233
  - Reference Patterns may guide phase structure, but task description determines specific content
240
234
  - Write generated role-spec to `<session>/role-specs/<role-name>.md`
241
235
 
242
- 8. **Register roles** in team-session.json#roles (with `role_spec` path instead of `role_file`)
236
+ 7. **Register roles** in team-session.json#roles (with `role_spec` path instead of `role_file`)
243
237
 
244
- 9. **Initialize shared infrastructure**:
238
+ 8. **Initialize shared infrastructure**:
245
239
  - `wisdom/learnings.md`, `wisdom/decisions.md`, `wisdom/issues.md` (empty with headers)
246
240
  - `explorations/cache-index.json` (`{ "entries": [] }`)
247
241
  - `discussions/` (empty directory)
248
242
 
249
- 10. **Initialize pipeline metadata** via team_msg:
243
+ 9. **Initialize pipeline metadata** via team_msg:
250
244
  ```typescript
251
245
  // 使用 team_msg 将 pipeline 元数据写入 .msg/meta.json
252
246
  // 注意: 此处为动态角色,执行时需将 <placeholders> 替换为 task-analysis.json 中生成的实际角色列表
@@ -265,7 +259,14 @@ mcp__ccw-tools__team_msg({
265
259
  })
266
260
  ```
267
261
 
268
- 11. **Write team-session.json** with: session_id, task_description, status="active", roles, pipeline (empty), active_workers=[], completion_action="interactive", created_at
262
+ 10. **Write team-session.json** with: session_id, task_description, status="active", roles, pipeline (empty), active_workers=[], completion_action="interactive", created_at
263
+
264
+ 11. **Check `needs_research` flag** from task-analysis.json:
265
+ - If `true`: Spawn researcher worker (role-spec now exists from step 6) to gather codebase context
266
+ - Wait for researcher callback
267
+ - Merge research findings into task context
268
+ - Update task-analysis.json with enriched context
269
+ - If `false`: Skip, proceed to Phase 3
269
270
 
270
271
  **Success**: Session created, role-spec files generated, shared infrastructure initialized.
271
272
 
@@ -38,18 +38,20 @@ Phase 3-N: monitor.md
38
38
 
39
39
  ## Dependency Graph Structure
40
40
 
41
- task-analysis.json encodes the pipeline:
41
+ task-analysis.json encodes the pipeline as adjacency list (task ID -> blockedBy array):
42
42
 
43
43
  ```json
44
44
  {
45
45
  "dependency_graph": {
46
- "RESEARCH-001": { "role": "researcher", "blockedBy": [], "priority": "P0" },
47
- "IMPL-001": { "role": "developer", "blockedBy": ["RESEARCH-001"], "priority": "P1" },
48
- "TEST-001": { "role": "tester", "blockedBy": ["IMPL-001"], "priority": "P2" }
46
+ "RESEARCH-001": [],
47
+ "IMPL-001": ["RESEARCH-001"],
48
+ "TEST-001": ["IMPL-001"]
49
49
  }
50
50
  }
51
51
  ```
52
52
 
53
+ Role mapping comes from `task-analysis.json#capabilities[].tasks[]`, not from the dependency graph itself.
54
+
53
55
  ## Role-Worker Map
54
56
 
55
57
  Dynamic — loaded from session role-specs at runtime:
@@ -64,6 +66,7 @@ Role-spec files contain YAML frontmatter:
64
66
  role: <role-name>
65
67
  prefix: <PREFIX>
66
68
  inner_loop: <true|false>
69
+ output_tag: "[<role-name>]"
67
70
  message_types:
68
71
  success: <type>
69
72
  error: error
@@ -11,6 +11,7 @@ Template used by coordinator to generate lightweight worker role-spec files at r
11
11
  role: <role_name>
12
12
  prefix: <PREFIX>
13
13
  inner_loop: <true|false>
14
+ output_tag: "[<role_name>]"
14
15
  CLI tools: [<CLI tool-names>]
15
16
  message_types:
16
17
  success: <prefix>_complete
@@ -40,7 +40,7 @@ Skill(skill="team-lifecycle-v4", args="task description")
40
40
  | analyst | [roles/analyst/role.md](roles/analyst/role.md) | RESEARCH-* | false |
41
41
  | writer | [roles/writer/role.md](roles/writer/role.md) | DRAFT-* | true |
42
42
  | planner | [roles/planner/role.md](roles/planner/role.md) | PLAN-* | true |
43
- | executor | [roles/executor/role.md](roles/executor/role.md) | IMPL-* | true |
43
+ | executor | [roles/executor/role.md](roles/executor/role.md) | IMPL-* | dynamic |
44
44
  | tester | [roles/tester/role.md](roles/tester/role.md) | TEST-* | false |
45
45
  | reviewer | [roles/reviewer/role.md](roles/reviewer/role.md) | REVIEW-*, QUALITY-*, IMPROVE-* | false |
46
46
  | supervisor | [roles/supervisor/role.md](roles/supervisor/role.md) | CHECKPOINT-* | false |