maestro-flow 0.4.9 → 0.4.10

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 (187) hide show
  1. package/.agy/agents/cli-explore-agent.md +186 -0
  2. package/.agy/agents/conceptual-planning-agent.md +244 -0
  3. package/.agy/agents/impeccable-agent.md +97 -0
  4. package/.agy/agents/team-supervisor.md +142 -0
  5. package/.agy/agents/team-worker.md +236 -0
  6. package/.agy/agents/ui-design-agent.md +286 -0
  7. package/.agy/agents/workflow-analyzer.md +114 -0
  8. package/.agy/agents/workflow-codebase-mapper.md +76 -0
  9. package/.agy/agents/workflow-collab-planner.md +142 -0
  10. package/.agy/agents/workflow-debugger.md +102 -0
  11. package/.agy/agents/workflow-executor.md +131 -0
  12. package/.agy/agents/workflow-external-researcher.md +86 -0
  13. package/.agy/agents/workflow-integration-checker.md +82 -0
  14. package/.agy/agents/workflow-nyquist-auditor.md +84 -0
  15. package/.agy/agents/workflow-phase-researcher.md +84 -0
  16. package/.agy/agents/workflow-plan-checker.md +89 -0
  17. package/.agy/agents/workflow-planner.md +194 -0
  18. package/.agy/agents/workflow-project-researcher.md +73 -0
  19. package/.agy/agents/workflow-research-synthesizer.md +70 -0
  20. package/.agy/agents/workflow-reviewer.md +81 -0
  21. package/.agy/agents/workflow-roadmapper.md +81 -0
  22. package/.agy/agents/workflow-verifier.md +119 -0
  23. package/.agy/skills/codify-to-knowhow/SKILL.md +172 -0
  24. package/.agy/skills/codify-to-knowhow/phases/01-load-manifest.md +101 -0
  25. package/.agy/skills/codify-to-knowhow/phases/02-generate-knowhow.md +97 -0
  26. package/.agy/skills/codify-to-knowhow/phases/03-generate-specs.md +92 -0
  27. package/.agy/skills/codify-to-knowhow/phases/04-index-verify.md +119 -0
  28. package/.agy/skills/learn-decompose/SKILL.md +118 -0
  29. package/.agy/skills/learn-follow/SKILL.md +129 -0
  30. package/.agy/skills/learn-investigate/SKILL.md +154 -0
  31. package/.agy/skills/learn-retro/SKILL.md +159 -0
  32. package/.agy/skills/learn-second-opinion/SKILL.md +124 -0
  33. package/.agy/skills/maestro/SKILL.md +221 -0
  34. package/.agy/skills/maestro-amend/SKILL.md +162 -0
  35. package/.agy/skills/maestro-analyze/SKILL.md +135 -0
  36. package/.agy/skills/maestro-brainstorm/SKILL.md +118 -0
  37. package/.agy/skills/maestro-collab/SKILL.md +174 -0
  38. package/.agy/skills/maestro-composer/SKILL.md +180 -0
  39. package/.agy/skills/maestro-execute/SKILL.md +133 -0
  40. package/.agy/skills/maestro-fork/SKILL.md +88 -0
  41. package/.agy/skills/maestro-guard/SKILL.md +101 -0
  42. package/.agy/skills/maestro-help/SKILL.md +267 -0
  43. package/.agy/skills/maestro-help/index/catalog.json +184 -0
  44. package/.agy/skills/maestro-help/phases/01-parse-intent.md +122 -0
  45. package/.agy/skills/maestro-help/phases/02-search-present.md +181 -0
  46. package/.agy/skills/maestro-help/phases/03-workflow-guide.md +186 -0
  47. package/.agy/skills/maestro-impeccable/SKILL.md +250 -0
  48. package/.agy/skills/maestro-init/SKILL.md +80 -0
  49. package/.agy/skills/maestro-learn/SKILL.md +142 -0
  50. package/.agy/skills/maestro-merge/SKILL.md +66 -0
  51. package/.agy/skills/maestro-milestone-audit/SKILL.md +70 -0
  52. package/.agy/skills/maestro-milestone-complete/SKILL.md +77 -0
  53. package/.agy/skills/maestro-milestone-release/SKILL.md +98 -0
  54. package/.agy/skills/maestro-overlay/SKILL.md +177 -0
  55. package/.agy/skills/maestro-plan/SKILL.md +172 -0
  56. package/.agy/skills/maestro-player/SKILL.md +176 -0
  57. package/.agy/skills/maestro-quick/SKILL.md +67 -0
  58. package/.agy/skills/maestro-ralph/SKILL.md +546 -0
  59. package/.agy/skills/maestro-ralph-execute/SKILL.md +255 -0
  60. package/.agy/skills/maestro-roadmap/SKILL.md +170 -0
  61. package/.agy/skills/maestro-tools-execute/SKILL.md +119 -0
  62. package/.agy/skills/maestro-tools-register/SKILL.md +159 -0
  63. package/.agy/skills/maestro-ui-codify/SKILL.md +81 -0
  64. package/.agy/skills/maestro-update/SKILL.md +175 -0
  65. package/.agy/skills/maestro-verify/SKILL.md +111 -0
  66. package/.agy/skills/manage-codebase-rebuild/SKILL.md +77 -0
  67. package/.agy/skills/manage-codebase-refresh/SKILL.md +59 -0
  68. package/.agy/skills/manage-harvest/SKILL.md +96 -0
  69. package/.agy/skills/manage-issue/SKILL.md +72 -0
  70. package/.agy/skills/manage-issue-discover/SKILL.md +83 -0
  71. package/.agy/skills/manage-knowhow/SKILL.md +76 -0
  72. package/.agy/skills/manage-knowhow-capture/SKILL.md +78 -0
  73. package/.agy/skills/manage-learn/SKILL.md +64 -0
  74. package/.agy/skills/manage-status/SKILL.md +51 -0
  75. package/.agy/skills/manage-wiki/SKILL.md +61 -0
  76. package/.agy/skills/quality-auto-test/SKILL.md +135 -0
  77. package/.agy/skills/quality-debug/SKILL.md +122 -0
  78. package/.agy/skills/quality-refactor/SKILL.md +69 -0
  79. package/.agy/skills/quality-retrospective/SKILL.md +79 -0
  80. package/.agy/skills/quality-review/SKILL.md +130 -0
  81. package/.agy/skills/quality-sync/SKILL.md +53 -0
  82. package/.agy/skills/quality-test/SKILL.md +119 -0
  83. package/.agy/skills/security-audit/SKILL.md +157 -0
  84. package/.agy/skills/skill-iter-tune/SKILL.md +381 -0
  85. package/.agy/skills/skill-iter-tune/phases/01-setup.md +144 -0
  86. package/.agy/skills/skill-iter-tune/phases/02-execute.md +292 -0
  87. package/.agy/skills/skill-iter-tune/phases/03-evaluate.md +312 -0
  88. package/.agy/skills/skill-iter-tune/phases/04-improve.md +198 -0
  89. package/.agy/skills/skill-iter-tune/phases/05-report.md +166 -0
  90. package/.agy/skills/skill-iter-tune/specs/evaluation-criteria.md +63 -0
  91. package/.agy/skills/skill-iter-tune/templates/eval-prompt.md +134 -0
  92. package/.agy/skills/skill-iter-tune/templates/execute-prompt.md +97 -0
  93. package/.agy/skills/spec-add/SKILL.md +67 -0
  94. package/.agy/skills/spec-load/SKILL.md +70 -0
  95. package/.agy/skills/spec-remove/SKILL.md +50 -0
  96. package/.agy/skills/spec-setup/SKILL.md +47 -0
  97. package/.agy/skills/team-coordinate/SKILL.md +267 -0
  98. package/.agy/skills/team-coordinate/roles/coordinator/commands/analyze-task.md +247 -0
  99. package/.agy/skills/team-coordinate/roles/coordinator/commands/dispatch.md +131 -0
  100. package/.agy/skills/team-coordinate/roles/coordinator/commands/monitor.md +348 -0
  101. package/.agy/skills/team-coordinate/roles/coordinator/role.md +362 -0
  102. package/.agy/skills/team-coordinate/specs/knowledge-transfer.md +111 -0
  103. package/.agy/skills/team-coordinate/specs/pipelines.md +97 -0
  104. package/.agy/skills/team-coordinate/specs/quality-gates.md +112 -0
  105. package/.agy/skills/team-coordinate/specs/role-spec-template.md +198 -0
  106. package/.agy/skills/team-executor/SKILL.md +180 -0
  107. package/.agy/skills/team-executor/roles/executor/commands/monitor.md +235 -0
  108. package/.agy/skills/team-executor/roles/executor/role.md +171 -0
  109. package/.agy/skills/team-executor/specs/session-schema.md +264 -0
  110. package/.agy/skills/team-lifecycle-v4/SKILL.md +189 -0
  111. package/.agy/skills/team-lifecycle-v4/roles/analyst/role.md +92 -0
  112. package/.agy/skills/team-lifecycle-v4/roles/coordinator/commands/analyze.md +56 -0
  113. package/.agy/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +56 -0
  114. package/.agy/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +206 -0
  115. package/.agy/skills/team-lifecycle-v4/roles/coordinator/role.md +130 -0
  116. package/.agy/skills/team-lifecycle-v4/roles/executor/commands/fix.md +35 -0
  117. package/.agy/skills/team-lifecycle-v4/roles/executor/commands/implement.md +62 -0
  118. package/.agy/skills/team-lifecycle-v4/roles/executor/role.md +64 -0
  119. package/.agy/skills/team-lifecycle-v4/roles/planner/role.md +82 -0
  120. package/.agy/skills/team-lifecycle-v4/roles/reviewer/commands/review-code.md +34 -0
  121. package/.agy/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +44 -0
  122. package/.agy/skills/team-lifecycle-v4/roles/reviewer/role.md +65 -0
  123. package/.agy/skills/team-lifecycle-v4/roles/supervisor/role.md +188 -0
  124. package/.agy/skills/team-lifecycle-v4/roles/tester/role.md +84 -0
  125. package/.agy/skills/team-lifecycle-v4/roles/writer/role.md +92 -0
  126. package/.agy/skills/team-lifecycle-v4/specs/knowledge-transfer.md +114 -0
  127. package/.agy/skills/team-lifecycle-v4/specs/pipelines.md +140 -0
  128. package/.agy/skills/team-lifecycle-v4/specs/quality-gates.md +130 -0
  129. package/.agy/skills/team-lifecycle-v4/templates/architecture.md +254 -0
  130. package/.agy/skills/team-lifecycle-v4/templates/epics.md +196 -0
  131. package/.agy/skills/team-lifecycle-v4/templates/product-brief.md +133 -0
  132. package/.agy/skills/team-lifecycle-v4/templates/requirements.md +224 -0
  133. package/.agy/skills/team-quality-assurance/SKILL.md +148 -0
  134. package/.agy/skills/team-quality-assurance/roles/analyst/role.md +85 -0
  135. package/.agy/skills/team-quality-assurance/roles/coordinator/commands/analyze.md +72 -0
  136. package/.agy/skills/team-quality-assurance/roles/coordinator/commands/dispatch.md +111 -0
  137. package/.agy/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +235 -0
  138. package/.agy/skills/team-quality-assurance/roles/coordinator/role.md +143 -0
  139. package/.agy/skills/team-quality-assurance/roles/executor/role.md +62 -0
  140. package/.agy/skills/team-quality-assurance/roles/generator/role.md +65 -0
  141. package/.agy/skills/team-quality-assurance/roles/scout/role.md +72 -0
  142. package/.agy/skills/team-quality-assurance/roles/strategist/role.md +69 -0
  143. package/.agy/skills/team-quality-assurance/specs/pipelines.md +115 -0
  144. package/.agy/skills/team-quality-assurance/specs/team-config.json +131 -0
  145. package/.agy/skills/team-review/SKILL.md +149 -0
  146. package/.agy/skills/team-review/roles/coordinator/commands/analyze.md +71 -0
  147. package/.agy/skills/team-review/roles/coordinator/commands/dispatch.md +91 -0
  148. package/.agy/skills/team-review/roles/coordinator/commands/monitor.md +209 -0
  149. package/.agy/skills/team-review/roles/coordinator/role.md +132 -0
  150. package/.agy/skills/team-review/roles/fixer/role.md +74 -0
  151. package/.agy/skills/team-review/roles/reviewer/role.md +66 -0
  152. package/.agy/skills/team-review/roles/scanner/role.md +77 -0
  153. package/.agy/skills/team-review/specs/dimensions.md +82 -0
  154. package/.agy/skills/team-review/specs/finding-schema.json +82 -0
  155. package/.agy/skills/team-review/specs/pipelines.md +102 -0
  156. package/.agy/skills/team-review/specs/team-config.json +27 -0
  157. package/.agy/skills/team-tech-debt/SKILL.md +133 -0
  158. package/.agy/skills/team-tech-debt/roles/assessor/role.md +76 -0
  159. package/.agy/skills/team-tech-debt/roles/coordinator/commands/analyze.md +47 -0
  160. package/.agy/skills/team-tech-debt/roles/coordinator/commands/dispatch.md +156 -0
  161. package/.agy/skills/team-tech-debt/roles/coordinator/commands/monitor.md +198 -0
  162. package/.agy/skills/team-tech-debt/roles/coordinator/role.md +123 -0
  163. package/.agy/skills/team-tech-debt/roles/executor/role.md +76 -0
  164. package/.agy/skills/team-tech-debt/roles/planner/role.md +68 -0
  165. package/.agy/skills/team-tech-debt/roles/scanner/role.md +90 -0
  166. package/.agy/skills/team-tech-debt/roles/validator/role.md +78 -0
  167. package/.agy/skills/team-tech-debt/specs/pipelines.md +47 -0
  168. package/.agy/skills/team-tech-debt/specs/team-config.json +129 -0
  169. package/.agy/skills/team-testing/SKILL.md +144 -0
  170. package/.agy/skills/team-testing/roles/analyst/role.md +101 -0
  171. package/.agy/skills/team-testing/roles/coordinator/commands/analyze.md +70 -0
  172. package/.agy/skills/team-testing/roles/coordinator/commands/dispatch.md +108 -0
  173. package/.agy/skills/team-testing/roles/coordinator/commands/monitor.md +242 -0
  174. package/.agy/skills/team-testing/roles/coordinator/role.md +134 -0
  175. package/.agy/skills/team-testing/roles/executor/role.md +95 -0
  176. package/.agy/skills/team-testing/roles/generator/role.md +95 -0
  177. package/.agy/skills/team-testing/roles/strategist/role.md +81 -0
  178. package/.agy/skills/team-testing/specs/pipelines.md +101 -0
  179. package/.agy/skills/team-testing/specs/team-config.json +93 -0
  180. package/.agy/skills/wiki-connect/SKILL.md +64 -0
  181. package/.agy/skills/wiki-digest/SKILL.md +70 -0
  182. package/.agy/skills/workflow-skill-designer/SKILL.md +506 -0
  183. package/.agy/skills/workflow-skill-designer/phases/01-requirements-analysis.md +356 -0
  184. package/.agy/skills/workflow-skill-designer/phases/02-orchestrator-design.md +444 -0
  185. package/.agy/skills/workflow-skill-designer/phases/03-phase-design.md +458 -0
  186. package/.agy/skills/workflow-skill-designer/phases/04-validation.md +471 -0
  187. package/package.json +3 -1
@@ -0,0 +1,92 @@
1
+ ---
2
+ role: analyst
3
+ prefix: RESEARCH
4
+ inner_loop: false
5
+ discuss_rounds: [DISCUSS-001]
6
+ message_types:
7
+ ---
8
+
9
+ # Analyst
10
+
11
+ Research and codebase exploration for context gathering.
12
+
13
+ ## Identity
14
+ - Tag: [analyst] | Prefix: RESEARCH-*
15
+ - Responsibility: Gather structured context from topic and codebase
16
+
17
+ ## Boundaries
18
+ ### MUST
19
+ - Extract structured seed information from task topic
20
+ - Explore codebase if project detected
21
+ - Package context for downstream roles
22
+ ### MUST NOT
23
+ - Implement code or modify files
24
+ - Make architectural decisions
25
+ - Skip codebase exploration when project files exist
26
+
27
+ ## Phase 2: Seed Analysis
28
+
29
+ 1. Read upstream artifacts via team_msg(operation="get_state")
30
+ 2. Extract session folder from task description
31
+ 3. Parse topic from task description
32
+ 4. If topic references file (@path or .md/.txt) → read it
33
+ 5. CLI seed analysis:
34
+ ```
35
+ run_command({ command: `maestro delegate "PURPOSE: Analyze topic, extract structured seed info.
36
+ TASK: • Extract problem statement • Identify target users • Determine domain
37
+ • List constraints • Identify 3-5 exploration dimensions
38
+ TOPIC: <topic-content>
39
+ MODE: analysis
40
+ EXPECTED: JSON with: problem_statement, target_users[], domain, constraints[], exploration_dimensions[]" --tool gemini --mode analysis`, run_in_background: false })
41
+ ```
42
+ 6. Parse result JSON
43
+
44
+ ## Phase 3: Codebase Exploration
45
+
46
+ | Condition | Action |
47
+ |-----------|--------|
48
+ | package.json / Cargo.toml / pyproject.toml / go.mod exists | Explore |
49
+ | No project files | Skip (codebase_context = null) |
50
+
51
+ When project detected:
52
+ ```
53
+ run_command({ command: `maestro delegate "PURPOSE: Explore codebase for context
54
+ TASK: • Identify tech stack • Map architecture patterns • Document conventions • List integration points
55
+ MODE: analysis
56
+ CONTEXT: @**/*
57
+ EXPECTED: JSON with: tech_stack[], architecture_patterns[], conventions[], integration_points[]" --tool gemini --mode analysis`, run_in_background: false })
58
+ ```
59
+
60
+ ### Tech Profile Scan
61
+
62
+ After codebase exploration, scan results for context-aware trigger signals (based on detected codebase characteristics):
63
+
64
+ 1. Check imports/dependencies → framework signals (`sql_detected`, `auth_detected`, `ml_detected`, `frontend_framework`)
65
+ 2. Check file patterns → infrastructure signals (`devops_detected`, `data_migration`, `realtime_detected`)
66
+ 3. Check code patterns → risk signals (`perf_sensitive`, `crypto_usage`, `legacy_patterns`, `test_gap`)
67
+ 4. Include `tech_profile` in Phase 5 state_update data:
68
+ ```json
69
+ "tech_profile": {
70
+ "signals": ["<detected signals>"],
71
+ "evidence": { "<signal>": ["<file paths>"] },
72
+ "confidence": "high|medium|low"
73
+ }
74
+ ```
75
+
76
+ ## Phase 4: Context Packaging
77
+
78
+ 1. Write spec-config.json → <session>/spec/
79
+ 2. Write discovery-context.json → <session>/spec/
80
+ 3. Inline Discuss (DISCUSS-001):
81
+ - Artifact: <session>/spec/discovery-context.json
82
+ - Perspectives: product, risk, coverage
83
+ 4. Handle verdict per consensus protocol
84
+ 5. Report: complexity, codebase presence, dimensions, discuss verdict, output paths
85
+
86
+ ## Error Handling
87
+
88
+ | Scenario | Resolution |
89
+ |----------|------------|
90
+ | CLI failure | Fallback to direct analysis |
91
+ | No project detected | Continue as new project |
92
+ | Topic too vague | Report with clarification questions |
@@ -0,0 +1,56 @@
1
+ # Analyze Task
2
+
3
+ Parse user task -> detect capabilities -> build dependency graph -> design roles.
4
+
5
+ **CONSTRAINT**: Text-level analysis only. NO source code reading, NO codebase exploration.
6
+
7
+ ## Signal Detection
8
+
9
+ | Keywords | Capability | Prefix |
10
+ |----------|------------|--------|
11
+ | investigate, explore, research | analyst | RESEARCH |
12
+ | write, draft, document | writer | DRAFT |
13
+ | implement, build, code, fix | executor | IMPL |
14
+ | design, architect, plan | planner | PLAN |
15
+ | test, verify, validate | tester | TEST |
16
+ | analyze, review, audit | reviewer | REVIEW |
17
+
18
+ ## Dependency Graph
19
+
20
+ Natural ordering tiers:
21
+ - Tier 0: analyst, planner (knowledge gathering)
22
+ - Tier 1: writer (creation requires context)
23
+ - Tier 2: executor (implementation requires plan/design)
24
+ - Tier 3: tester, reviewer (validation requires artifacts)
25
+
26
+ ## Complexity Scoring
27
+
28
+ | Factor | Points |
29
+ |--------|--------|
30
+ | Per capability | +1 |
31
+ | Cross-domain | +2 |
32
+ | Parallel tracks | +1 per track |
33
+ | Serial depth > 3 | +1 |
34
+
35
+ Results: 1-3 Low, 4-6 Medium, 7+ High
36
+
37
+ ## Role Minimization
38
+
39
+ - Cap at 5 roles
40
+ - Merge overlapping capabilities
41
+ - Absorb trivial single-step roles
42
+
43
+ ## Output
44
+
45
+ Write <session>/task-analysis.json:
46
+ ```json
47
+ {
48
+ "task_description": "<original>",
49
+ "pipeline_type": "<spec-only|impl-only|full-lifecycle|...>",
50
+ "capabilities": [{ "name": "<cap>", "prefix": "<PREFIX>", "keywords": ["..."] }],
51
+ "dependency_graph": { "<TASK-ID>": { "role": "<role>", "blockedBy": ["..."], "priority": "P0|P1|P2" } },
52
+ "roles": [{ "name": "<role>", "prefix": "<PREFIX>", "inner_loop": false }],
53
+ "complexity": { "score": 0, "level": "Low|Medium|High" },
54
+ "needs_research": true
55
+ }
56
+ ```
@@ -0,0 +1,56 @@
1
+ # Dispatch Tasks
2
+
3
+ Create task chains from dependency graph with proper blockedBy relationships.
4
+
5
+ ## Workflow
6
+
7
+ 1. Read task-analysis.json -> extract dependency_graph
8
+ 2. Read specs/pipelines.md -> get task registry for selected pipeline
9
+ 3. Topological sort tasks (respect blockedBy)
10
+ 4. Validate all owners exist in role registry (SKILL.md)
11
+ 5. For each task (in order):
12
+ - TaskCreate with structured description (see template below)
13
+ - TaskUpdate with blockedBy + owner assignment
14
+ 6. Update team-session.json with pipeline.tasks_total
15
+ 7. Validate chain (no orphans, no cycles, all refs valid)
16
+
17
+ ## Task Description Template
18
+
19
+ ```
20
+ PURPOSE: <goal> | Success: <criteria>
21
+ TASK:
22
+ - <step 1>
23
+ - <step 2>
24
+ CONTEXT:
25
+ - Session: <session-folder>
26
+ - Upstream artifacts: <list>
27
+ - Key files: <list>
28
+ EXPECTED: <artifact path> + <quality criteria>
29
+ CONSTRAINTS: <scope limits>
30
+ ---
31
+ InnerLoop: <true|false>
32
+ RoleSpec: ~ or <project>/.claude/skills/team-lifecycle-v4/roles/<role>/role.md
33
+ ```
34
+
35
+ ## InnerLoop Flag Rules
36
+
37
+ - true: Role has 2+ serial same-prefix tasks (writer: DRAFT-001->004)
38
+ - false: Role has 1 task, or tasks are parallel
39
+
40
+ ## CHECKPOINT Task Rules
41
+
42
+ CHECKPOINT tasks are dispatched like regular tasks but handled differently at spawn time:
43
+
44
+ - Created via TaskCreate with proper blockedBy (upstream tasks that must complete first)
45
+ - Owner: supervisor
46
+ - **NOT spawned as team-worker** — coordinator wakes the resident supervisor via send_message
47
+ - If `supervision: false` in team-session.json, skip creating CHECKPOINT tasks entirely
48
+ - RoleSpec in description: `~ or <project>/.claude/skills/team-lifecycle-v4/roles/supervisor/role.md`
49
+
50
+ ## Dependency Validation
51
+
52
+ - No orphan tasks (all tasks have valid owner)
53
+ - No circular dependencies
54
+ - All blockedBy references exist
55
+ - Session reference in every task description
56
+ - RoleSpec reference in every task description
@@ -0,0 +1,206 @@
1
+ # Monitor Pipeline
2
+
3
+ Event-driven pipeline coordination. Beat model: coordinator wake -> process -> spawn -> STOP.
4
+
5
+ ## Constants
6
+
7
+ - SPAWN_MODE: background
8
+ - ONE_STEP_PER_INVOCATION: true
9
+ - FAST_ADVANCE_AWARE: true
10
+ - WORKER_AGENT: team-worker
11
+ - SUPERVISOR_AGENT: team-supervisor (resident, woken via send_message)
12
+
13
+ ## Handler Router
14
+
15
+ | Source | Handler |
16
+ |--------|---------|
17
+ | Message contains [role-name] | handleCallback |
18
+ | "capability_gap" | handleAdapt |
19
+ | "check" or "status" | handleCheck |
20
+ | "resume" or "continue" | handleResume |
21
+ | All tasks completed | handleComplete |
22
+ | Default | handleSpawnNext |
23
+
24
+ ## handleCallback
25
+
26
+ Worker completed. Process and advance.
27
+
28
+ 1. Find matching worker by role in message
29
+ 2. Check if progress update (inner loop) or final completion
30
+ 3. Progress -> update session state, STOP
31
+ 4. Completion -> mark task done
32
+ - Resident agent (supervisor) -> keep in active_workers (stays alive for future checkpoints)
33
+ - Standard worker -> remove from active_workers
34
+ 4.5. **evaluateSpecialistInjection** (based on detected codebase characteristics):
35
+ - If callback from analyst, planner, or executor role:
36
+ a. `get_state(role=<callback_role>)` → extract `tech_profile.signals`
37
+ b. Merge with previously collected signals from other roles
38
+ c. Evaluate against trigger matrix (§4)
39
+ d. P0 matches → TaskCreate with blockedBy on current stage, blocks downstream
40
+ e. P1 matches → TaskCreate parallel with REVIEW/TEST stage
41
+ f. Log: `team_msg(type="specialist_injection", data={ specialist, signals, priority, evidence })`
42
+ g. Dedup: skip if same specialist already injected this session
43
+ 5. Check for checkpoints:
44
+ - CHECKPOINT-* with verdict "block" -> ask_question: Override / Revise upstream / Abort
45
+ - CHECKPOINT-* with verdict "warn" -> log risks to wisdom, proceed normally
46
+ - CHECKPOINT-* with verdict "pass" -> proceed normally
47
+ - QUALITY-001 -> display quality gate, pause for user commands
48
+ - PLAN-001 -> dynamicImplDispatch (see below)
49
+ 6. -> handleSpawnNext
50
+
51
+ ### dynamicImplDispatch (PLAN-001 callback)
52
+
53
+ When PLAN-001 completes, coordinator creates IMPL tasks based on complexity:
54
+
55
+ 1. Read `<session>/plan/plan.json` → extract `complexity`, `tasks[]`
56
+ 2. Route by complexity (per specs/pipelines.md §6):
57
+
58
+ | Complexity | Action |
59
+ |------------|--------|
60
+ | Low (1-2 modules) | Create single IMPL-001, blockedBy: [PLAN-001], InnerLoop: true |
61
+ | Medium (3-4 modules) | Create IMPL-{1..N}, each blockedBy: [PLAN-001] only, InnerLoop: false |
62
+ | High (5+ modules) | Create IMPL-{1..N} with DAG deps from plan.json, InnerLoop per dispatch rules |
63
+
64
+ 3. For each IMPL task: TaskCreate with structured description (dispatch.md template)
65
+ 4. Set blockedBy:
66
+ - **Parallel tasks**: blockedBy: [PLAN-001] (or [CHECKPOINT-003] if supervision enabled)
67
+ - **Serial chain within DAG**: blockedBy includes upstream IMPL task IDs
68
+ 5. Update team-session.json: `pipeline.tasks_total`, `pipeline.impl_topology: "single"|"parallel"|"dag"`
69
+ 6. Log via team_msg: `{ type: "state_update", data: { impl_count: N, topology: "..." } }`
70
+
71
+ ### dynamicImplDispatch (PLAN-001 callback)
72
+
73
+ When PLAN-001 completes, coordinator creates IMPL tasks based on complexity:
74
+
75
+ 1. Read `<session>/plan/plan.json` → extract `complexity`, `tasks[]`
76
+ 2. Route by complexity (per specs/pipelines.md §6):
77
+
78
+ | Complexity | Action |
79
+ |------------|--------|
80
+ | Low (1-2 modules) | Create single IMPL-001, blockedBy: [PLAN-001], InnerLoop: true |
81
+ | Medium (3-4 modules) | Create IMPL-{1..N}, each blockedBy: [PLAN-001] only, InnerLoop: false |
82
+ | High (5+ modules) | Create IMPL-{1..N} with DAG deps from plan.json, InnerLoop per dispatch rules |
83
+
84
+ 3. For each IMPL task: TaskCreate with structured description (dispatch.md template)
85
+ 4. Set blockedBy:
86
+ - **Parallel tasks**: blockedBy: [PLAN-001] (or [CHECKPOINT-003] if supervision enabled)
87
+ - **Serial chain within DAG**: blockedBy includes upstream IMPL task IDs
88
+ 5. Update team-session.json: `pipeline.tasks_total`, `pipeline.impl_topology: "single"|"parallel"|"dag"`
89
+ 6. Log via team_msg: `{ type: "state_update", data: { impl_count: N, topology: "..." } }`
90
+
91
+ ## handleCheck
92
+
93
+ Read-only status report, then STOP.
94
+
95
+ **Worker Progress** (from message bus):
96
+
97
+ Before generating status output, read worker milestones:
98
+
99
+ ```javascript
100
+ const progressMsgs = mcp__ccw-tools__team_msg({
101
+ operation: "list", session_id: sessionId, type: "progress", last: 50
102
+ })
103
+ const blockerMsgs = mcp__ccw-tools__team_msg({
104
+ operation: "list", session_id: sessionId, type: "blocker", last: 10
105
+ })
106
+
107
+ // Aggregate latest milestone per task
108
+ const taskProgress = {}
109
+ for (const msg of (progressMsgs.result?.messages || [])) {
110
+ const tid = msg.data?.task_id
111
+ if (tid && (!taskProgress[tid] || msg.ts > taskProgress[tid].ts)) {
112
+ taskProgress[tid] = { phase: msg.data.phase, pct: msg.data.progress_pct, ts: msg.ts }
113
+ }
114
+ }
115
+ ```
116
+
117
+ Include in status output:
118
+ - Per-worker latest milestone (phase + progress_pct) next to task status
119
+ - Active blockers section (if any blockerMsgs found)
120
+
121
+ Output:
122
+ ```
123
+ [coordinator] Pipeline Status
124
+ [coordinator] Progress: <done>/<total> (<pct>%)
125
+ [coordinator] Active: <workers with elapsed time>
126
+ [coordinator] Ready: <pending tasks with resolved deps>
127
+ [coordinator] Commands: 'resume' to advance | 'check' to refresh
128
+ ```
129
+
130
+ ## handleResume
131
+
132
+ 1. No active workers -> handleSpawnNext
133
+ 2. Has active -> check each status
134
+ - completed -> mark done
135
+ - in_progress -> still running
136
+ - Resident agent (supervisor) with `resident: true` + no CHECKPOINT in_progress + pending CHECKPOINT exists
137
+ -> supervisor may have crashed. Respawn with `recovery: true`
138
+ 3. Some completed -> handleSpawnNext
139
+ 4. All running -> report status, STOP
140
+
141
+ ## handleSpawnNext
142
+
143
+ Find ready tasks, spawn workers, STOP.
144
+
145
+ 1. Collect: completedSubjects, inProgressSubjects, readySubjects
146
+ 2. No ready + work in progress -> report waiting, STOP
147
+ 3. No ready + nothing in progress -> handleComplete
148
+ 4. Has ready -> for each:
149
+ a. Check if inner loop role with active worker -> skip (worker picks up)
150
+ b. **CHECKPOINT-* task** -> wake resident supervisor (see below)
151
+ c. Other tasks -> standard spawn:
152
+ - TaskUpdate -> in_progress
153
+ - team_msg log -> task_unblocked
154
+ - Spawn team-worker (see SKILL.md Worker Spawn Template)
155
+ - Add to active_workers
156
+ 5. Update session, output summary, STOP
157
+
158
+ ### Wake Supervisor for CHECKPOINT
159
+
160
+ When a ready task has prefix `CHECKPOINT-*`:
161
+
162
+ 1. Verify supervisor is in active_workers with `resident: true`
163
+ - Not found -> spawn supervisor using SKILL.md Supervisor Spawn Template, wait for ready callback, then wake
164
+ 2. Determine scope: list task IDs that this checkpoint depends on (its blockedBy tasks)
165
+ 3. send_message to supervisor (see SKILL.md Supervisor Wake Template):
166
+ ```
167
+ send_message({
168
+ type: "message",
169
+ recipient: "supervisor",
170
+ content: "## Checkpoint Request\ntask_id: <CHECKPOINT-NNN>\nscope: [<upstream-task-ids>]\npipeline_progress: <done>/<total> tasks completed",
171
+ summary: "Checkpoint request: <CHECKPOINT-NNN>"
172
+ })
173
+ ```
174
+ 4. Do NOT TaskUpdate in_progress — supervisor claims the task itself
175
+ 5. Do NOT add duplicate entry to active_workers (supervisor already tracked)
176
+
177
+ ## handleComplete
178
+
179
+ Pipeline done. Generate report and completion action.
180
+
181
+ 1. Shutdown resident supervisor (if active):
182
+ ```
183
+ send_message({ to: "supervisor", message: { type: "shutdown_request", reason: "Pipeline complete" } })
184
+ ```
185
+ 2. Generate summary (deliverables, stats, discussions)
186
+ 3. Read session.completion_action:
187
+ - interactive -> ask_question (Archive/Keep/Export)
188
+ - auto_archive -> Archive & Clean (status=completed, TeamDelete)
189
+ - auto_keep -> Keep Active (status=paused)
190
+
191
+ ## handleAdapt
192
+
193
+ Capability gap reported mid-pipeline.
194
+
195
+ 1. Parse gap description
196
+ 2. Check if existing role covers it -> redirect
197
+ 3. Role count < 5 -> generate dynamic role-spec in <session>/role-specs/
198
+ 4. Create new task, spawn worker
199
+ 5. Role count >= 5 -> merge or pause
200
+
201
+ ## Fast-Advance Reconciliation
202
+
203
+ On every coordinator wake:
204
+ 1. Read team_msg entries with type="fast_advance"
205
+ 2. Sync active_workers with spawned successors
206
+ 3. No duplicate spawns
@@ -0,0 +1,130 @@
1
+ # Coordinator Role
2
+
3
+ Orchestrate team-lifecycle-v4: analyze -> dispatch -> spawn -> monitor -> report.
4
+
5
+ ## Identity
6
+ - Name: coordinator | Tag: [coordinator]
7
+ - Responsibility: Analyze task -> Create team -> Dispatch tasks -> Monitor progress -> Report results
8
+
9
+ ## Boundaries
10
+
11
+ ### MUST
12
+ - Parse task description (text-level only, no codebase reading)
13
+ - Create team and spawn team-worker agents in background
14
+ - Dispatch tasks with proper dependency chains
15
+ - Monitor progress via callbacks and route messages
16
+ - Maintain session state (team-session.json)
17
+ - Handle capability_gap reports
18
+ - Execute completion action when pipeline finishes
19
+
20
+ ### MUST NOT
21
+ - Read source code or explore codebase (delegate to workers)
22
+ - Execute task work directly
23
+ - Modify task output artifacts
24
+ - Spawn workers with general-purpose agent (MUST use team-worker)
25
+ - Generate more than 5 worker roles
26
+
27
+ ## Command Execution Protocol
28
+ When coordinator needs to execute a specific phase:
29
+ 1. Read `commands/<command>.md`
30
+ 2. Follow the workflow defined in the command
31
+ 3. Commands are inline execution guides, NOT separate agents
32
+ 4. Execute synchronously, complete before proceeding
33
+
34
+ ## Entry Router
35
+
36
+ | Detection | Condition | Handler |
37
+ |-----------|-----------|---------|
38
+ | Worker callback | Message contains [role-name] | -> handleCallback (monitor.md) |
39
+ | Status check | Args contain "check" or "status" | -> handleCheck (monitor.md) |
40
+ | Manual resume | Args contain "resume" or "continue" | -> handleResume (monitor.md) |
41
+ | Capability gap | Message contains "capability_gap" | -> handleAdapt (monitor.md) |
42
+ | Pipeline complete | All tasks completed | -> handleComplete (monitor.md) |
43
+ | Interrupted session | Active session in .workflow/.team/TLV4-* | -> Phase 0 |
44
+ | New session | None of above | -> Phase 1 |
45
+
46
+ For callback/check/resume/adapt/complete: load @commands/monitor.md, execute handler, STOP.
47
+
48
+ ## Phase 0: Session Resume Check
49
+
50
+ 1. Scan .workflow/.team/TLV4-*/team-session.json for active/paused sessions
51
+ 2. No sessions -> Phase 1
52
+ 3. Single session -> reconcile:
53
+ a. Audit TaskList, reset in_progress->pending
54
+ b. Rebuild team workers
55
+ c. If pipeline has CHECKPOINT tasks AND `supervision !== false`:
56
+ - Respawn supervisor with `recovery: true` (see SKILL.md Supervisor Spawn Template)
57
+ - Supervisor auto-rebuilds context from existing CHECKPOINT-*-report.md files
58
+ d. Kick first ready task
59
+ 4. Multiple -> ask_question for selection
60
+
61
+ ## Phase 1: Requirement Clarification
62
+
63
+ TEXT-LEVEL ONLY. No source code reading.
64
+
65
+ 1. Parse task description
66
+ 2. Clarify if ambiguous (ask_question: scope, deliverables, constraints)
67
+ 3. Delegate to @commands/analyze.md
68
+ 4. Output: task-analysis.json
69
+ 5. CRITICAL: Always proceed to Phase 2, never skip team workflow
70
+
71
+ ## Phase 2: Create Team + Initialize Session
72
+
73
+ 1. Resolve workspace paths (MUST do first):
74
+ - `project_root` = result of `run_command({ command: "pwd" })`
75
+ - `skill_root` = `<project_root>/.claude/skills/team-lifecycle-v4`
76
+ 2. Generate session ID: TLV4-<slug>-<date>
77
+ 3. Create session folder structure
78
+ 4. TeamCreate with team name
79
+ 5. Read specs/pipelines.md -> select pipeline
80
+ 6. Register roles in team-session.json
81
+ 7. Initialize shared infrastructure (wisdom/*.md, explorations/cache-index.json)
82
+ 8. Initialize pipeline via team_msg state_update:
83
+ ```
84
+ mcp__ccw-tools__team_msg({
85
+ operation: "log", session_id: "<id>", from: "coordinator",
86
+ type: "state_update", summary: "Session initialized",
87
+ data: { pipeline_mode: "<mode>", pipeline_stages: [...], team_name: "<name>" }
88
+ })
89
+ ```
90
+ 9. Write team-session.json
91
+ 10. Spawn resident supervisor (if pipeline has CHECKPOINT tasks AND `supervision !== false`):
92
+ - Use SKILL.md Supervisor Spawn Template (subagent_type: "team-supervisor")
93
+ - Wait for "[supervisor] Ready" callback before proceeding to Phase 3
94
+ - Record supervisor in active_workers with `resident: true` flag
95
+
96
+ ## Phase 3: Create Task Chain
97
+
98
+ Delegate to @commands/dispatch.md:
99
+ 1. Read dependency graph from task-analysis.json
100
+ 2. Read specs/pipelines.md for selected pipeline's task registry
101
+ 3. Topological sort tasks
102
+ 4. Create tasks via TaskCreate with blockedBy
103
+ 5. Update team-session.json
104
+
105
+ ## Phase 4: Spawn-and-Stop
106
+
107
+ Delegate to @commands/monitor.md#handleSpawnNext:
108
+ 1. Find ready tasks (pending + blockedBy resolved)
109
+ 2. Spawn team-worker agents (see SKILL.md Spawn Template)
110
+ 3. Output status summary
111
+ 4. STOP
112
+
113
+ ## Phase 5: Report + Completion Action
114
+
115
+ 1. Generate summary (deliverables, pipeline stats, discussions)
116
+ 2. Execute completion action per session.completion_action:
117
+ - interactive -> ask_question (Archive/Keep/Export)
118
+ - auto_archive -> Archive & Clean
119
+ - auto_keep -> Keep Active
120
+
121
+ ## Error Handling
122
+
123
+ | Error | Resolution |
124
+ |-------|------------|
125
+ | Task too vague | ask_question for clarification |
126
+ | Session corruption | Attempt recovery, fallback to manual |
127
+ | Worker crash | Reset task to pending, respawn |
128
+ | Supervisor crash | Respawn with `recovery: true` in prompt, supervisor rebuilds context from existing reports |
129
+ | Dependency cycle | Detect in analysis, halt |
130
+ | Role limit exceeded | Merge overlapping roles |
@@ -0,0 +1,35 @@
1
+ # Fix
2
+
3
+ Revision workflow for bug fixes and feedback-driven changes.
4
+
5
+ ## Workflow
6
+
7
+ 1. Read original task + feedback/revision notes from task description
8
+ 2. Load original implementation context (files modified, approach taken)
9
+ 3. Analyze feedback to identify specific changes needed
10
+ 4. Apply fixes:
11
+ - Agent mode: Edit tool for targeted changes
12
+ - CLI mode: Resume previous session with fix prompt
13
+ 5. Re-validate convergence criteria
14
+ 6. Report: original task, changes applied, validation result
15
+
16
+ ## Fix Prompt Template (CLI mode)
17
+
18
+ ```
19
+ PURPOSE: Fix issues in <task.title> based on feedback
20
+ TASK:
21
+ - Review original implementation
22
+ - Apply feedback: <feedback text>
23
+ - Verify fixes address all feedback points
24
+ MODE: write
25
+ CONTEXT: @<modified files>
26
+ EXPECTED: All feedback points addressed, convergence criteria met
27
+ CONSTRAINTS: Minimal changes | No scope creep
28
+ ```
29
+
30
+ ## Quality Rules
31
+
32
+ - Fix ONLY what feedback requests
33
+ - No refactoring beyond fix scope
34
+ - Verify original convergence criteria still pass
35
+ - Report partial_completion if some feedback unclear
@@ -0,0 +1,62 @@
1
+ # Implement
2
+
3
+ Execute implementation from task JSON via agent or CLI delegation.
4
+
5
+ ## Agent Mode
6
+
7
+ Direct implementation using Edit/Write/Bash tools:
8
+
9
+ 1. Read task.files[] as target files
10
+ 2. Read task.implementation[] as step-by-step instructions
11
+ 3. For each step:
12
+ - Substitute [variable] placeholders with pre_analysis results
13
+ - New file → Write tool; Modify file → Edit tool
14
+ - Follow task.reference patterns
15
+ 4. Apply task.rationale.chosen_approach
16
+ 5. Mitigate task.risks[] during implementation
17
+
18
+ Quality rules:
19
+ - Verify module existence before referencing
20
+ - Incremental progress — small working changes
21
+ - Follow existing patterns from task.reference
22
+ - ASCII-only, no premature abstractions
23
+
24
+ ## CLI Delegation Mode
25
+
26
+ Build prompt from task JSON, delegate to CLI:
27
+
28
+ Prompt structure:
29
+ ```
30
+ PURPOSE: <task.title>
31
+ <task.description>
32
+
33
+ TARGET FILES:
34
+ <task.files[] with paths and changes>
35
+
36
+ IMPLEMENTATION STEPS:
37
+ <task.implementation[] numbered>
38
+
39
+ PRE-ANALYSIS CONTEXT:
40
+ <pre_analysis results>
41
+
42
+ REFERENCE:
43
+ <task.reference pattern and files>
44
+
45
+ DONE WHEN:
46
+ <task.convergence.criteria[]>
47
+
48
+ MODE: write
49
+ CONSTRAINTS: Only modify listed files | Follow existing patterns
50
+ ```
51
+
52
+ CLI call:
53
+ ```
54
+ run_command({ command: `maestro delegate "<prompt>" --to <tool> --mode write --rule development-implement-feature`,
55
+ run_in_background: false, timeout: 3600000 })
56
+ ```
57
+
58
+ Resume strategy:
59
+ | Strategy | Command |
60
+ |----------|---------|
61
+ | new | --id <session>-<task_id> |
62
+ | resume | --resume <parent_id> |