claude-code-orchestrator-kit 1.0.0

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 (130) hide show
  1. package/.claude/agents/database/workers/api-builder.md +155 -0
  2. package/.claude/agents/database/workers/database-architect.md +193 -0
  3. package/.claude/agents/database/workers/supabase-auditor.md +1070 -0
  4. package/.claude/agents/development/workers/code-reviewer.md +968 -0
  5. package/.claude/agents/development/workers/cost-calculator-specialist.md +683 -0
  6. package/.claude/agents/development/workers/llm-service-specialist.md +999 -0
  7. package/.claude/agents/development/workers/skill-builder-v2.md +480 -0
  8. package/.claude/agents/development/workers/typescript-types-specialist.md +649 -0
  9. package/.claude/agents/development/workers/utility-builder.md +582 -0
  10. package/.claude/agents/documentation/workers/technical-writer.md +152 -0
  11. package/.claude/agents/frontend/workers/fullstack-nextjs-specialist.md +206 -0
  12. package/.claude/agents/frontend/workers/visual-effects-creator.md +159 -0
  13. package/.claude/agents/health/orchestrators/bug-orchestrator.md +1045 -0
  14. package/.claude/agents/health/orchestrators/dead-code-orchestrator.md +1045 -0
  15. package/.claude/agents/health/orchestrators/dependency-orchestrator.md +1045 -0
  16. package/.claude/agents/health/orchestrators/security-orchestrator.md +1045 -0
  17. package/.claude/agents/health/workers/bug-fixer.md +525 -0
  18. package/.claude/agents/health/workers/bug-hunter.md +649 -0
  19. package/.claude/agents/health/workers/dead-code-hunter.md +446 -0
  20. package/.claude/agents/health/workers/dead-code-remover.md +437 -0
  21. package/.claude/agents/health/workers/dependency-auditor.md +379 -0
  22. package/.claude/agents/health/workers/dependency-updater.md +436 -0
  23. package/.claude/agents/health/workers/security-scanner.md +700 -0
  24. package/.claude/agents/health/workers/vulnerability-fixer.md +524 -0
  25. package/.claude/agents/infrastructure/workers/infrastructure-specialist.md +156 -0
  26. package/.claude/agents/infrastructure/workers/orchestration-logic-specialist.md +1260 -0
  27. package/.claude/agents/infrastructure/workers/qdrant-specialist.md +503 -0
  28. package/.claude/agents/infrastructure/workers/quality-validator-specialist.md +984 -0
  29. package/.claude/agents/meta/workers/meta-agent-v3.md +503 -0
  30. package/.claude/agents/research/workers/problem-investigator.md +507 -0
  31. package/.claude/agents/research/workers/research-specialist.md +423 -0
  32. package/.claude/agents/testing/workers/accessibility-tester.md +813 -0
  33. package/.claude/agents/testing/workers/integration-tester.md +188 -0
  34. package/.claude/agents/testing/workers/mobile-fixes-implementer.md +252 -0
  35. package/.claude/agents/testing/workers/mobile-responsiveness-tester.md +180 -0
  36. package/.claude/agents/testing/workers/performance-optimizer.md +262 -0
  37. package/.claude/agents/testing/workers/test-writer.md +800 -0
  38. package/.claude/commands/health-bugs.md +297 -0
  39. package/.claude/commands/health-cleanup.md +297 -0
  40. package/.claude/commands/health-deps.md +297 -0
  41. package/.claude/commands/health-metrics.md +747 -0
  42. package/.claude/commands/health-security.md +297 -0
  43. package/.claude/commands/push.md +21 -0
  44. package/.claude/commands/speckit.analyze.md +184 -0
  45. package/.claude/commands/speckit.checklist.md +294 -0
  46. package/.claude/commands/speckit.clarify.md +178 -0
  47. package/.claude/commands/speckit.constitution.md +78 -0
  48. package/.claude/commands/speckit.implement.md +182 -0
  49. package/.claude/commands/speckit.plan.md +87 -0
  50. package/.claude/commands/speckit.specify.md +250 -0
  51. package/.claude/commands/speckit.tasks.md +137 -0
  52. package/.claude/commands/translate-doc.md +95 -0
  53. package/.claude/commands/worktree-cleanup.md +382 -0
  54. package/.claude/commands/worktree-create.md +287 -0
  55. package/.claude/commands/worktree-list.md +239 -0
  56. package/.claude/commands/worktree-remove.md +339 -0
  57. package/.claude/schemas/base-plan.schema.json +82 -0
  58. package/.claude/schemas/bug-plan.schema.json +71 -0
  59. package/.claude/schemas/dead-code-plan.schema.json +71 -0
  60. package/.claude/schemas/dependency-plan.schema.json +74 -0
  61. package/.claude/schemas/security-plan.schema.json +71 -0
  62. package/.claude/scripts/gates/check-bundle-size.sh +47 -0
  63. package/.claude/scripts/gates/check-coverage.sh +67 -0
  64. package/.claude/scripts/gates/check-security.sh +46 -0
  65. package/.claude/scripts/release.sh +740 -0
  66. package/.claude/settings.local.json +21 -0
  67. package/.claude/settings.local.json.example +20 -0
  68. package/.claude/skills/calculate-priority-score/SKILL.md +229 -0
  69. package/.claude/skills/calculate-priority-score/scoring-matrix.json +83 -0
  70. package/.claude/skills/extract-version/SKILL.md +228 -0
  71. package/.claude/skills/format-commit-message/SKILL.md +189 -0
  72. package/.claude/skills/format-commit-message/template.md +64 -0
  73. package/.claude/skills/format-markdown-table/SKILL.md +202 -0
  74. package/.claude/skills/format-markdown-table/examples.md +84 -0
  75. package/.claude/skills/format-todo-list/SKILL.md +222 -0
  76. package/.claude/skills/format-todo-list/template.json +30 -0
  77. package/.claude/skills/generate-changelog/SKILL.md +258 -0
  78. package/.claude/skills/generate-changelog/commit-mapping.json +47 -0
  79. package/.claude/skills/generate-report-header/SKILL.md +228 -0
  80. package/.claude/skills/generate-report-header/template.md +66 -0
  81. package/.claude/skills/parse-error-logs/SKILL.md +286 -0
  82. package/.claude/skills/parse-error-logs/patterns.json +26 -0
  83. package/.claude/skills/parse-git-status/SKILL.md +164 -0
  84. package/.claude/skills/parse-package-json/SKILL.md +151 -0
  85. package/.claude/skills/parse-package-json/schema.json +43 -0
  86. package/.claude/skills/render-template/SKILL.md +245 -0
  87. package/.claude/skills/rollback-changes/SKILL.md +582 -0
  88. package/.claude/skills/rollback-changes/changes-log-schema.json +101 -0
  89. package/.claude/skills/run-quality-gate/SKILL.md +404 -0
  90. package/.claude/skills/run-quality-gate/gate-mappings.json +97 -0
  91. package/.claude/skills/validate-plan-file/SKILL.md +327 -0
  92. package/.claude/skills/validate-plan-file/schema.json +35 -0
  93. package/.claude/skills/validate-report-file/SKILL.md +256 -0
  94. package/.claude/skills/validate-report-file/schema.json +67 -0
  95. package/.env.example +49 -0
  96. package/.github/BRANCH_PROTECTION.md +137 -0
  97. package/.github/workflows/build.yml +70 -0
  98. package/.github/workflows/claude-code-review.yml +255 -0
  99. package/.github/workflows/claude.yml +79 -0
  100. package/.github/workflows/deploy-staging.yml +90 -0
  101. package/.github/workflows/test.yml +104 -0
  102. package/.gitignore +116 -0
  103. package/CLAUDE.md +137 -0
  104. package/LICENSE +72 -0
  105. package/README.md +1098 -0
  106. package/docs/ARCHITECTURE.md +746 -0
  107. package/docs/Agents Ecosystem/AGENT-ORCHESTRATION.md +568 -0
  108. package/docs/Agents Ecosystem/AI-AGENT-ECOSYSTEM-README.md +658 -0
  109. package/docs/Agents Ecosystem/ARCHITECTURE.md +606 -0
  110. package/docs/Agents Ecosystem/QUALITY-GATES-SPECIFICATION.md +1315 -0
  111. package/docs/Agents Ecosystem/REPORT-TEMPLATE-STANDARD.md +1324 -0
  112. package/docs/Agents Ecosystem/spec-kit-comprehensive-updates.md +478 -0
  113. package/docs/FAQ.md +572 -0
  114. package/docs/MIGRATION-GUIDE.md +542 -0
  115. package/docs/PERFORMANCE-OPTIMIZATION.md +494 -0
  116. package/docs/ROADMAP.md +439 -0
  117. package/docs/TUTORIAL-CUSTOM-AGENTS.md +2041 -0
  118. package/docs/USE-CASES.md +706 -0
  119. package/index.js +96 -0
  120. package/mcp/.mcp.base.json +21 -0
  121. package/mcp/.mcp.frontend.json +29 -0
  122. package/mcp/.mcp.full.json +67 -0
  123. package/mcp/.mcp.local.example.json +7 -0
  124. package/mcp/.mcp.local.json +7 -0
  125. package/mcp/.mcp.n8n.json +45 -0
  126. package/mcp/.mcp.supabase-full.json +35 -0
  127. package/mcp/.mcp.supabase-only.json +28 -0
  128. package/package.json +78 -0
  129. package/postinstall.js +71 -0
  130. package/switch-mcp.sh +101 -0
@@ -0,0 +1,478 @@
1
+ # Spec-Kit Comprehensive Updates
2
+
3
+ > **Purpose**: This document defines all required updates to integrate orchestration improvements, planning phase, research tasks, and atomicity rules across the entire spec-kit workflow.
4
+
5
+ ---
6
+
7
+ ## Priority & Sources
8
+
9
+ 1. **PRIMARY**: Orchestration rules from CLAUDE.md (context gathering, verification, delegation)
10
+ 2. **SECONDARY**: New requirements from user specification (planning phase, research tasks, atomicity)
11
+ 3. **TERTIARY**: Existing patterns (maintain compatibility where possible)
12
+
13
+ ---
14
+
15
+ ## Core Patterns to Implement
16
+
17
+ ### A. PLANNING PHASE (New - First Step in Tasks)
18
+
19
+ **Position**: Always the first phase in tasks.md execution
20
+
21
+ **Responsibilities**:
22
+ 1. **Task Analysis**:
23
+ - Review all tasks from tasks.md
24
+ - Classify each as PARALLEL or SEQUENTIAL execution
25
+ - Identify dependencies between tasks
26
+
27
+ 2. **Subagent Assignment**:
28
+ - `[EXECUTOR: MAIN]` - ONLY for trivial tasks (1-2 line fixes, simple imports, single dependency install)
29
+ - For complex tasks: thoroughly examine existing subagents, assign only if 100% match
30
+ - If no 100% match: assign FUTURE agent name (to be created) - `[EXECUTOR: future-agent-name]`
31
+
32
+ 3. **Missing Subagents**:
33
+ - After all assignments: if FUTURE agents exist, launch N meta-agent-v3 calls in single message
34
+ - Each FUTURE agent = 1 separate meta-agent-v3 call (atomicity rule)
35
+ - After agent creation: ask user to restart claude-code
36
+
37
+ 4. **Atomicity Rule** (CRITICAL):
38
+ - **1 Task = 1 Agent Invocation**
39
+ - Never give multiple tasks to one agent in single run
40
+ - **Parallel execution**: Launch N agent calls in single message (not sequentially)
41
+ - Example: 3 parallel tasks for meta-agent → 3 meta-agent calls in single message
42
+ - Example: 5 parallel tasks for fullstack → 5 fullstack calls in single message
43
+ - Sequential tasks: 1 agent run, wait for completion, then next agent run
44
+
45
+ **Output**: Updated tasks.md with:
46
+ - `[EXECUTOR: name]` annotations
47
+ - `[SEQUENTIAL]` or `[PARALLEL-GROUP-X]` markers
48
+ - Meta-agent creation tasks if needed
49
+
50
+ ---
51
+
52
+ ### B. RESEARCH TASK HANDLING (New - During Planning)
53
+
54
+ **When**: Planning phase, after subagent assignment
55
+
56
+ **Classification**:
57
+ - **Simple Research**: Questions with clear answer path, solvable with agent + existing tools
58
+ - **Complex Research**: Questions without obvious answers, require deep investigation
59
+
60
+ **Simple Research Workflow**:
61
+ 1. Agent identifies question
62
+ 2. Agent uses available tools (Grep, Read, WebSearch, Context7, Supabase docs)
63
+ 3. Agent formulates answer
64
+ 4. Agent documents findings in planning notes
65
+ 5. Continue to next task
66
+
67
+ **Complex Research Workflow**:
68
+ 1. Agent identifies complex question without clear answer
69
+ 2. Agent creates detailed English prompt for deepresearch:
70
+ - **File**: `{FEATURE_DIR}/research/{topic-slug}.md`
71
+ - **Format**: Research question + context + constraints + expected output format
72
+ - **Language**: English (for deepresearch compatibility)
73
+ 3. Agent adds TODO: "Wait for deepresearch results on {topic}"
74
+ 4. Agent STOPS and reports to user: "Complex research required: {file-path}"
75
+ 5. **User action**: Run deepresearch with prompt, save results
76
+ 6. Agent reads deepresearch results
77
+ 7. Agent incorporates findings into planning
78
+ 8. Continue to next task
79
+
80
+ **Output**:
81
+ - Research findings documented
82
+ - Complex research prompts in `{FEATURE_DIR}/research/` if needed
83
+ - Updated tasks.md with research-informed decisions
84
+
85
+ ---
86
+
87
+ ### C. ORCHESTRATION RULES (Enhanced)
88
+
89
+ **Main Agent Role**: Orchestrator ONLY
90
+ - Execute trivial tasks directly (1-2 line fixes, imports, single npm install)
91
+ - Delegate ALL complex tasks to subagents
92
+ - NEVER implement multi-file changes directly
93
+ - NEVER implement logic changes directly
94
+
95
+ **Before Delegation**:
96
+ 1. **Gather Full Context** (MANDATORY):
97
+ - Read existing code in target files
98
+ - Search codebase for similar patterns (Grep, Glob)
99
+ - Review relevant documentation (specs, ADRs, research)
100
+ - Check recent commits in related areas (`git log -- path`)
101
+ - Understand dependencies and integration points
102
+ 2. **Prepare Complete Context** for subagent:
103
+ - Code snippets from related files
104
+ - File paths (absolute)
105
+ - Expected output format
106
+ - Validation criteria (type-check, tests, build)
107
+ - Patterns to follow (examples from codebase)
108
+
109
+ **After Delegation**:
110
+ 1. **Detailed Verification**:
111
+ - Read ALL modified files
112
+ - Run `pnpm type-check` (or relevant validation)
113
+ - Run tests if applicable
114
+ - Check for regressions in related code
115
+ 2. **Accept/Reject Loop**:
116
+ - **Accept**: If all validations pass → mark task completed
117
+ - **Reject**: If validations fail → re-delegate with:
118
+ - Error messages (full type-check output)
119
+ - Specific corrections needed
120
+ - Additional context if missing
121
+ - Loop until accepted (no limit, quality over speed)
122
+
123
+ **Commit Strategy** (DECISION: Per-Task Commits):
124
+ - **When**: After EACH task marked completed
125
+ - **Command**: `/push patch`
126
+ - **Before commit**:
127
+ 1. Mark task `[X]` in tasks.md
128
+ 2. Add artifacts to task: `→ Artifacts: [file1](path), [file2](path)`
129
+ 3. Update TodoWrite to completed
130
+ 4. Then run `/push patch`
131
+ - **Rationale**:
132
+ - Detailed git history (1 commit = 1 task)
133
+ - Easy rollback to specific task
134
+ - Better for review and debugging
135
+ - Atomic changes in version control
136
+
137
+ ---
138
+
139
+ ### D. IMPLEMENT COMMAND EXECUTION MODEL (Enhanced)
140
+
141
+ **Task Discovery**:
142
+ - Find FIRST incomplete task in tasks.md (not last)
143
+ - Respect phase order: Setup → Tests → Core → Integration → Polish
144
+ - Within phase: respect dependencies and sequential markers
145
+
146
+ **Execution Loop** (Per Task):
147
+ ```
148
+ 1. UPDATE TODO: Mark task `in_progress` in TodoWrite
149
+ 2. CHECK EXECUTOR:
150
+ - [EXECUTOR: MAIN]? → Execute directly if trivial, else delegate
151
+ - [EXECUTOR: subagent-name]? → Delegate to specified subagent
152
+ 3. GATHER CONTEXT: (see Orchestration Rules section B)
153
+ 4. EXECUTE:
154
+ - Direct: Use Edit/Write tools
155
+ - Delegated: Launch Task tool with complete context
156
+ 5. VERIFY: (see Orchestration Rules section C)
157
+ 6. ACCEPT/REJECT:
158
+ - Accept? → Continue to step 7
159
+ - Reject? → Re-delegate with corrections, go to step 4
160
+ 7. UPDATE TODO: Mark task `completed` in TodoWrite
161
+ 8. UPDATE tasks.md: Mark task `[X]`, add artifacts
162
+ 9. COMMIT: Run `/push patch`
163
+ 10. NEXT TASK: Move to next incomplete task, go to step 1
164
+ ```
165
+
166
+ **Critical Rules**:
167
+ - NEVER skip verification
168
+ - NEVER proceed if task failed
169
+ - NEVER batch commits (1 task = 1 commit)
170
+ - ONE task in_progress at a time (atomic execution)
171
+
172
+ ---
173
+
174
+ ## Files to Update
175
+
176
+ ### 1. Commands (.claude/commands/)
177
+
178
+ #### A. `speckit.implement.md`
179
+
180
+ **Changes**:
181
+ 1. Add orchestration reminder blockquote (already done in generation-json)
182
+ 2. Update step 3 (Load context) to include research/ directory:
183
+ ```markdown
184
+ - **IF EXISTS**: Read research/ for complex research findings and decisions
185
+ ```
186
+ 3. Replace step 4 with PLANNING PHASE:
187
+ ```markdown
188
+ 4. **PLANNING PHASE** (Execute Before Implementation):
189
+ - Review all tasks and classify execution model (parallel vs sequential)
190
+ - **Subagent Assignment** (Phase 0):
191
+ * [EXECUTOR: MAIN] - ONLY for trivial tasks (1-2 line fixes, simple imports, single dependency install)
192
+ * For complex tasks: thoroughly examine existing subagents, assign only if 100% match
193
+ * If no 100% match: assign FUTURE agent name (to be created) - `[EXECUTOR: future-agent-name]`
194
+ * After all assignments: if FUTURE agents exist, launch N meta-agent-v3 calls in single message
195
+ * After agent creation: ask user to restart claude-code
196
+ - Annotate tasks with `[EXECUTOR: name]` and `[SEQUENTIAL]`/`[PARALLEL-GROUP-X]`
197
+ - Handle research tasks:
198
+ * Simple: solve with agent tools
199
+ * Complex: create research prompt in research/, wait for user deepresearch
200
+ - Output: Updated tasks.md with executor annotations
201
+ ```
202
+ 4. Update step 6 (Execution Strategy) to clarify task discovery:
203
+ ```markdown
204
+ **Task Discovery**: Find FIRST incomplete task (respect phase order)
205
+ ```
206
+ 5. Update step 7 (Atomic Task Execution) to include commit:
207
+ ```markdown
208
+ 6. UPDATE tasks.md: Mark task [X] and add artifacts
209
+ 7. COMMIT: Run `/push patch`
210
+ 8. NEXT TASK: Move to next incomplete task
211
+ ```
212
+ 6. Update step 8 (Progress Tracking) with commit reminder:
213
+ ```markdown
214
+ - **Commit after each task**: Run `/push patch` before moving to next
215
+ ```
216
+
217
+ #### B. `speckit.tasks.md`
218
+
219
+ **Changes**:
220
+ 1. Add research task classification in outline:
221
+ ```markdown
222
+ - **Research Tasks**: Questions without obvious answers
223
+ * Simple: Agent solves with available tools
224
+ * Complex: Create research prompt → wait for deepresearch → incorporate
225
+ ```
226
+ 2. Add planning phase instructions:
227
+ ```markdown
228
+ - After generating tasks, add PLANNING PHASE as first phase
229
+ - Planning phase includes: executor assignment, research resolution, meta-agent creation
230
+ ```
231
+
232
+ #### C. `speckit.plan.md`
233
+
234
+ **Changes**:
235
+ 1. Add research considerations to tech stack analysis:
236
+ ```markdown
237
+ - If tech decisions unclear, classify as research task
238
+ - Document research questions in plan with classification (simple/complex)
239
+ ```
240
+
241
+ #### D. `speckit.specify.md` & `speckit.clarify.md`
242
+
243
+ **Changes**:
244
+ 1. Add note about research questions:
245
+ ```markdown
246
+ - If clarifications reveal complex unknowns, flag for research phase
247
+ ```
248
+
249
+ ---
250
+
251
+ ### 2. Templates (.specify/templates/)
252
+
253
+ #### A. `tasks.md` Template
254
+
255
+ **Add Planning Phase Template**:
256
+ ```markdown
257
+ ## Phase 0: Planning
258
+
259
+ ### P001: Task Analysis & Executor Assignment
260
+ **Description**: Analyze all tasks, assign executors (MAIN for trivial, existing if 100% match, FUTURE otherwise)
261
+ **Executor**: MAIN
262
+ **Dependencies**: None
263
+ **Output**:
264
+ - All tasks annotated with [EXECUTOR: name] or [EXECUTOR: future-agent-name]
265
+ - All tasks marked [SEQUENTIAL] or [PARALLEL-GROUP-X]
266
+ - List of FUTURE agents to create (if any)
267
+ **Artifacts**: Updated tasks.md
268
+
269
+ ### P002: Research Task Resolution
270
+ **Description**: Identify and resolve research questions (simple: solve now, complex: create prompts)
271
+ **Executor**: MAIN
272
+ **Dependencies**: P001
273
+ **Output**:
274
+ - Simple research: documented findings
275
+ - Complex research: prompts in research/ directory
276
+ **Artifacts**: research/*.md (if complex research needed)
277
+
278
+ ### P003: Meta-Agent Subagent Creation (if needed)
279
+ **Description**: Create FUTURE agents using meta-agent-v3, then ask user to restart claude-code
280
+ **Executor**: meta-agent-v3
281
+ **Dependencies**: P001
282
+ **Execution**: Launch N meta-agent-v3 calls in single message (1 FUTURE agent = 1 call)
283
+ **Tasks**: [List FUTURE agents from P001]
284
+ **Post-Creation**: Ask user to restart claude-code
285
+ **Artifacts**: .claude/agents/{domain}/{type}/{name}.md
286
+
287
+ ---
288
+ ```
289
+
290
+ ---
291
+
292
+ ### 3. Scripts (.specify/scripts/bash/)
293
+
294
+ #### A. `check-prerequisites.sh`
295
+
296
+ **Changes**:
297
+ 1. Add research directory check:
298
+ ```bash
299
+ # Check for research directory
300
+ if [ -d "$FEATURE_DIR/research" ]; then
301
+ RESEARCH_DIR="$FEATURE_DIR/research"
302
+ RESEARCH_FILES=$(find "$RESEARCH_DIR" -name "*.md" 2>/dev/null)
303
+ fi
304
+ ```
305
+ 2. Include research files in JSON output:
306
+ ```json
307
+ "research": ["$FEATURE_DIR/research/file1.md", ...]
308
+ ```
309
+
310
+ ---
311
+
312
+ ### 4. Documentation
313
+
314
+ #### A. `CLAUDE.md`
315
+
316
+ **Changes**:
317
+ 1. Update "Main Pattern: You Are The Orchestrator" section, step 6 (Execution Pattern):
318
+ ```markdown
319
+ FOR EACH TASK:
320
+ 1. Read task description
321
+ 2. GATHER FULL CONTEXT (code + docs + patterns + history + research)
322
+ 3. Delegate to subagent OR execute directly (trivial only)
323
+ 4. Verify implementation (read files + run type-check)
324
+ 5. Accept/reject loop (re-delegate if needed)
325
+ 6. Update TodoWrite to completed
326
+ 7. Mark task [X] in tasks.md + add artifacts
327
+ 8. Run /push patch
328
+ 9. Move to next task
329
+ ```
330
+
331
+ 2. Add new section after "Main Pattern":
332
+ ```markdown
333
+ ### Planning Phase (ALWAYS First)
334
+
335
+ Before implementing any tasks:
336
+ - Analyze task execution model (parallel/sequential)
337
+ - Assign executors: MAIN for trivial only, existing subagents if 100% match, FUTURE agents otherwise
338
+ - Create FUTURE agents: launch N meta-agent-v3 calls in single message, then ask restart
339
+ - Resolve research questions (simple: solve now, complex: deepresearch prompt)
340
+ - Apply atomicity rule: 1 task = 1 agent invocation
341
+ - Parallel tasks: launch N agent calls in single message (not sequentially)
342
+
343
+ See speckit.implement.md for detailed workflow.
344
+ ```
345
+
346
+ 3. Update "COMMIT STRATEGY" section:
347
+ ```markdown
348
+ **5. COMMIT STRATEGY**
349
+
350
+ Run `/push patch` after EACH completed task (not batched):
351
+ - Mark task [X] in tasks.md
352
+ - Add artifacts to task description
353
+ - Update TodoWrite to completed
354
+ - Then `/push patch`
355
+
356
+ Rationale: Atomic commits, detailed history, easy rollback, better review.
357
+ ```
358
+
359
+ #### B. `docs/Agents Ecosystem/AGENT-ORCHESTRATION.md`
360
+
361
+ **Changes**:
362
+ 1. Add "Planning Phase" section before "Orchestration Patterns"
363
+ 2. Add "Research Task Workflow" section
364
+ 3. Update orchestration patterns with atomicity rule
365
+ 4. Add examples of 1-task-1-agent-run pattern
366
+
367
+ ---
368
+
369
+ ## Implementation Steps (How to Apply)
370
+
371
+ ### Step 1: Update speckit.implement.md
372
+ 1. Open `.claude/commands/speckit.implement.md`
373
+ 2. Add orchestration blockquote after frontmatter (if not present)
374
+ 3. Add research/ to step 3 context loading
375
+ 4. Replace step 4 with PLANNING PHASE section
376
+ 5. Update step 6 task discovery
377
+ 6. Update step 7 with commit step
378
+ 7. Update step 8 with commit reminder
379
+ 8. Save file
380
+
381
+ ### Step 2: Update CLAUDE.md
382
+ 1. Open `CLAUDE.md`
383
+ 2. Update step 6 in "Execution Pattern"
384
+ 3. Add "Planning Phase" section (with FUTURE agents logic)
385
+ 4. Update "COMMIT STRATEGY"
386
+ 5. Save file
387
+
388
+ ### Step 3: Update tasks.md Template
389
+ 1. Open `.specify/templates/tasks.md`
390
+ 2. Add "Phase 0: Planning" section at top
391
+ 3. Add P001 (with FUTURE agents logic), P002, P003 (with restart prompt) tasks
392
+ 4. Save file
393
+
394
+ ### Step 4: Update Other Commands
395
+ 1. Update `speckit.tasks.md` - add research classification
396
+ 2. Update `speckit.plan.md` - add research considerations
397
+ 3. Update `speckit.specify.md` and `speckit.clarify.md` - add research notes
398
+ 4. Save all files
399
+
400
+ ### Step 5: Update Scripts
401
+ 1. Open `.specify/scripts/bash/check-prerequisites.sh`
402
+ 2. Add research directory check
403
+ 3. Add research files to JSON output
404
+ 4. Save file
405
+
406
+ ### Step 6: Update Documentation
407
+ 1. Update `docs/Agents Ecosystem/AGENT-ORCHESTRATION.md`
408
+ 2. Add planning phase, research workflow, atomicity examples
409
+ 3. Save file
410
+
411
+ ### Step 7: Test Workflow
412
+ 1. Create test feature in specs/
413
+ 2. Run `/speckit.specify` - verify research question handling
414
+ 3. Run `/speckit.tasks` - verify planning phase in tasks.md
415
+ 4. Run `/speckit.implement` - verify planning execution, atomicity, per-task commits
416
+ 5. Validate: each task = 1 commit, all annotations present, research handled
417
+
418
+ ---
419
+
420
+ ## Validation Checklist
421
+
422
+ After applying all updates:
423
+
424
+ - [ ] `speckit.implement.md` has orchestration blockquote
425
+ - [ ] `speckit.implement.md` has planning phase with FUTURE agents logic (step 4)
426
+ - [ ] `speckit.implement.md` has atomicity rule with "single message" for parallel tasks
427
+ - [ ] `speckit.implement.md` commits after each task (step 7)
428
+ - [ ] `CLAUDE.md` has updated execution pattern
429
+ - [ ] `CLAUDE.md` has planning phase section with FUTURE agents and parallel tasks rule
430
+ - [ ] `CLAUDE.md` has per-task commit strategy
431
+ - [ ] `tasks.md` template has Phase 0: Planning with P001 (FUTURE agents) and P003 (single message)
432
+ - [ ] `speckit.tasks.md` mentions FUTURE agents and single message in Planning Phase
433
+ - [ ] Other commands reference research handling
434
+ - [ ] `check-prerequisites.sh` includes research directory
435
+ - [ ] Documentation updated with new patterns
436
+ - [ ] Test run completes with atomicity and commits
437
+
438
+ ---
439
+
440
+ ## Key Principles (Summary)
441
+
442
+ 1. **Planning First**: Always execute planning phase before implementation
443
+ 2. **Atomicity**: 1 task = 1 agent invocation; parallel tasks = N agent calls in single message
444
+ 3. **Orchestration**: Main agent delegates complex, verifies thoroughly, re-delegates on failure
445
+ 4. **Research**: Classify simple vs complex, use deepresearch for complex unknowns
446
+ 5. **Commits**: 1 task = 1 commit (after validation, with artifacts, via /push patch)
447
+ 6. **Context**: Gather full context before every delegation (code, docs, patterns, history, research)
448
+ 7. **Verification**: Read files + type-check + tests before accepting task completion
449
+
450
+ ---
451
+
452
+ ## Recent Updates
453
+
454
+ **Change 1**: Enhanced subagent assignment with FUTURE agents logic
455
+ - Strict rules: MAIN for trivial, existing if 100% match, FUTURE otherwise
456
+ - FUTURE agents: launch N meta-agent-v3 calls in single message, ask restart
457
+ - Updated: speckit.implement.md, speckit.tasks.md, tasks-template.md, CLAUDE.md
458
+
459
+ **Change 2**: Clarified "single message" rule for ALL parallel tasks
460
+ - Parallel execution applies to all agents, not just meta-agent
461
+ - Updated atomicity rule: launch N agent calls in single message
462
+ - Updated: speckit.implement.md, tasks-template.md, CLAUDE.md, this document
463
+
464
+ **Change 3**: Optimized CLAUDE.md and all templates for token efficiency
465
+ - CLAUDE.md: Added CRITICAL verification rule, removed duplicates (net -18 lines, -12%)
466
+ - tasks-template.md: Removed emojis (5 instances)
467
+ - checklist-template.md: Condensed comments (40 → 27 lines, -33%)
468
+ - spec-template.md: Removed verbosity (115 → 81 lines, -30%)
469
+ - plan-template.md: Simplified instructions (105 → 95 lines, -10%)
470
+ - Total templates reduction: -57 lines
471
+
472
+ **Rationale**: Specialized agents for quality, single-message for performance, token efficiency for cost.
473
+
474
+ ---
475
+
476
+ **End of Document**
477
+
478
+ This comprehensive specification ensures all orchestration improvements are applied consistently across the entire spec-kit workflow, maintaining interconnections and preventing pattern drift.