agile-context-engineering 0.5.0 → 0.5.1

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 (102) hide show
  1. package/.claude-plugin/marketplace.json +18 -0
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +7 -1
  4. package/README.md +16 -12
  5. package/agents/ace-code-discovery-analyst.md +245 -245
  6. package/agents/ace-code-integration-analyst.md +248 -248
  7. package/agents/ace-code-reviewer.md +375 -375
  8. package/agents/ace-product-owner.md +365 -361
  9. package/agents/ace-project-researcher.md +606 -606
  10. package/agents/ace-technical-application-architect.md +315 -315
  11. package/bin/install.js +587 -173
  12. package/hooks/ace-check-update.js +15 -14
  13. package/hooks/ace-statusline.js +30 -12
  14. package/hooks/hooks.json +14 -0
  15. package/package.json +3 -2
  16. package/shared/lib/ace-core.js +53 -0
  17. package/shared/lib/ace-core.test.js +308 -308
  18. package/shared/lib/ace-story.test.js +250 -250
  19. package/skills/execute-story/SKILL.md +116 -110
  20. package/skills/execute-story/script.js +13 -27
  21. package/skills/execute-story/script.test.js +261 -261
  22. package/skills/execute-story/story-template.xml +451 -451
  23. package/skills/execute-story/workflow.xml +3 -1
  24. package/skills/help/SKILL.md +71 -69
  25. package/skills/help/script.js +32 -35
  26. package/skills/help/script.test.js +183 -183
  27. package/skills/help/workflow.xml +14 -3
  28. package/skills/init-coding-standards/SKILL.md +91 -72
  29. package/skills/init-coding-standards/coding-standards-template.xml +531 -531
  30. package/skills/init-coding-standards/script.js +50 -59
  31. package/skills/init-coding-standards/script.test.js +70 -70
  32. package/skills/init-coding-standards/workflow.xml +1 -1
  33. package/skills/map-cross-cutting/SKILL.md +126 -89
  34. package/skills/map-cross-cutting/workflow.xml +1 -1
  35. package/skills/map-guide/SKILL.md +126 -89
  36. package/skills/map-guide/workflow.xml +1 -1
  37. package/skills/map-pattern/SKILL.md +125 -89
  38. package/skills/map-pattern/workflow.xml +1 -1
  39. package/skills/map-story/SKILL.md +180 -127
  40. package/skills/map-story/templates/tech-debt-index.xml +125 -125
  41. package/skills/map-story/workflow.xml +2 -2
  42. package/skills/map-subsystem/SKILL.md +155 -111
  43. package/skills/map-subsystem/script.js +51 -60
  44. package/skills/map-subsystem/script.test.js +68 -68
  45. package/skills/map-subsystem/templates/subsystem-architecture.xml +343 -343
  46. package/skills/map-subsystem/templates/subsystem-structure.xml +234 -234
  47. package/skills/map-subsystem/workflow.xml +1173 -1173
  48. package/skills/map-sys-doc/SKILL.md +125 -90
  49. package/skills/map-sys-doc/workflow.xml +1 -1
  50. package/skills/map-system/SKILL.md +103 -85
  51. package/skills/map-system/script.js +75 -84
  52. package/skills/map-system/script.test.js +73 -73
  53. package/skills/map-system/templates/system-structure.xml +177 -177
  54. package/skills/map-system/templates/testing-framework.xml +283 -283
  55. package/skills/map-system/workflow.xml +667 -667
  56. package/skills/map-walkthrough/SKILL.md +140 -92
  57. package/skills/map-walkthrough/workflow.xml +457 -457
  58. package/skills/plan-backlog/SKILL.md +93 -75
  59. package/skills/plan-backlog/script.js +121 -136
  60. package/skills/plan-backlog/script.test.js +83 -83
  61. package/skills/plan-backlog/workflow.xml +1348 -1348
  62. package/skills/plan-feature/SKILL.md +99 -76
  63. package/skills/plan-feature/feature-template.xml +361 -361
  64. package/skills/plan-feature/script.js +131 -148
  65. package/skills/plan-feature/script.test.js +80 -80
  66. package/skills/plan-feature/workflow.xml +1 -1
  67. package/skills/plan-product-vision/SKILL.md +91 -75
  68. package/skills/plan-product-vision/product-vision-template.xml +227 -227
  69. package/skills/plan-product-vision/script.js +51 -60
  70. package/skills/plan-product-vision/script.test.js +69 -69
  71. package/skills/plan-product-vision/workflow.xml +337 -337
  72. package/skills/plan-story/SKILL.md +125 -102
  73. package/skills/plan-story/script.js +18 -49
  74. package/skills/plan-story/story-template.xml +8 -1
  75. package/skills/plan-story/workflow.xml +17 -1
  76. package/skills/research-external-solution/SKILL.md +120 -107
  77. package/skills/research-external-solution/external-solution-template.xml +832 -832
  78. package/skills/research-external-solution/script.js +229 -238
  79. package/skills/research-external-solution/script.test.js +134 -134
  80. package/skills/research-external-solution/workflow.xml +657 -657
  81. package/skills/research-integration-solution/SKILL.md +121 -98
  82. package/skills/research-integration-solution/integration-solution-template.xml +1015 -1015
  83. package/skills/research-integration-solution/script.js +223 -231
  84. package/skills/research-integration-solution/script.test.js +134 -134
  85. package/skills/research-integration-solution/workflow.xml +711 -711
  86. package/skills/research-story-wiki/SKILL.md +101 -92
  87. package/skills/research-story-wiki/script.js +223 -231
  88. package/skills/research-story-wiki/script.test.js +138 -138
  89. package/skills/research-story-wiki/story-wiki-template.xml +194 -194
  90. package/skills/research-story-wiki/workflow.xml +473 -473
  91. package/skills/research-technical-solution/SKILL.md +131 -103
  92. package/skills/research-technical-solution/script.js +223 -231
  93. package/skills/research-technical-solution/script.test.js +134 -134
  94. package/skills/research-technical-solution/technical-solution-template.xml +1025 -1025
  95. package/skills/research-technical-solution/workflow.xml +761 -761
  96. package/skills/review-story/SKILL.md +99 -100
  97. package/skills/review-story/script.js +8 -16
  98. package/skills/review-story/script.test.js +169 -169
  99. package/skills/review-story/story-template.xml +451 -451
  100. package/skills/review-story/workflow.xml +1 -1
  101. package/skills/update/SKILL.md +65 -53
  102. package/skills/update/workflow.xml +21 -5
@@ -1,1348 +1,1348 @@
1
- <workflow>
2
-
3
- <purpose>
4
- Orchestrate product backlog creation or update through environment detection, GitHub issue
5
- import, product-vision loading, optional wiki analysis (parallel sub-agents for brownfield
6
- projects), optional domain research, deep questioning, document writing, and optional
7
- GitHub sync. Produces `.ace/artifacts/product/product-backlog.md` — the ordered backlog
8
- of Epics and Features that defines what the product will deliver.
9
-
10
- The product vision's High-Level Capabilities are the primary input — each capability
11
- maps to one or more Epics. For brownfield projects with wiki documentation, parallel
12
- analysis agents extract existing feature inventories and status from the wiki, keeping
13
- raw content out of the main context window. When GitHub Project integration is enabled,
14
- existing issues are imported and new items can be synced back to GitHub.
15
- </purpose>
16
-
17
- <mandatory-context>
18
- Read all files referenced by the invoking command's execution-context before starting.
19
- Also read any document or text passed as parameter ($ARGUMENTS) in the invoking command.
20
- </mandatory-context>
21
-
22
- <process>
23
-
24
- <!-- ══════════════════════════════════════════════════════════════════ -->
25
- <!-- STEP 1: SETUP -->
26
- <!-- ══════════════════════════════════════════════════════════════════ -->
27
-
28
- <step name="setup" order="1">
29
- **MANDATORY FIRST STEP — Execute environment detection before any user interaction:**
30
-
31
- INIT is available from the preprocessed Environment Context above — do NOT re-run init.
32
-
33
- Parse INIT JSON for: `product_owner_model`, `researcher_model`, `commit_docs`,
34
- `has_product_vision`, `has_product_backlog`,
35
- `has_features_research`, `has_architecture_research`, `has_wiki_analysis`,
36
- `is_brownfield`, `is_greenfield`,
37
- `has_existing_code`, `has_package_file`, `has_wiki`, `has_wiki_system_wide`,
38
- `has_wiki_subsystems`, `wiki_subsystem_names`, `has_system_architecture`,
39
- `has_system_structure`, `has_testing_framework`, `has_git`, `has_gh_cli`,
40
- `github_project` (object: `enabled`, `gh_installed`, `repo`, `project_number`, `owner`).
41
-
42
- PO_MODEL is available from INIT.product_owner_model — do NOT re-run resolve-model.
43
-
44
- Display stage banner:
45
-
46
- ```
47
- ╔══════════════════════════════════════════════════╗
48
- ║ ACE > Plan Backlog ║
49
- ╚══════════════════════════════════════════════════╝
50
- ```
51
-
52
- **If `has_product_backlog` is true:**
53
-
54
- Use AskUserQuestion:
55
- - header: "Backlog exists"
56
- - question: "A product backlog already exists at `.ace/artifacts/product/product-backlog.md`. What would you like to do?"
57
- - options:
58
- - "Update it" — Review and refine the existing backlog
59
- - "Start fresh" — Discard and create a new backlog from scratch
60
- - "Skip" — Keep the current backlog as-is
61
-
62
- If "Update": Read existing file, hold as EXISTING_BACKLOG context, continue to step 2.
63
- If "Start fresh": Set EXISTING_BACKLOG = null, continue to step 2.
64
- If "Skip": Exit workflow.
65
-
66
- **If `has_git` is false:** Initialize git:
67
- ```bash
68
- git init
69
- ```
70
- </step>
71
-
72
- <!-- ══════════════════════════════════════════════════════════════════ -->
73
- <!-- STEP 2: FETCH GITHUB ISSUES -->
74
- <!-- ══════════════════════════════════════════════════════════════════ -->
75
-
76
- <step name="fetch-github-issues" order="2">
77
-
78
- **If `github_project.enabled` is false AND `has_gh_cli` is true:**
79
-
80
- GitHub CLI is installed but GitHub Project integration isn't configured in ACE.
81
- Check if this is a GitHub repo:
82
- ```bash
83
- gh repo view --json name,owner 2>/dev/null
84
- ```
85
-
86
- If the command succeeds (this IS a GitHub repo):
87
-
88
- Use AskUserQuestion:
89
- - header: "GitHub"
90
- - question: "I detected a GitHub repo but GitHub Project integration isn't configured in ACE. If you have epics/features in a GitHub Project, I can import them. How would you like to proceed?"
91
- - options:
92
- - "Configure GitHub first" — Run /ace:help to set up GitHub Project integration, then re-run
93
- - "Skip GitHub" — Continue without GitHub import
94
-
95
- If "Configure GitHub first":
96
- - Display:
97
- ```
98
- ┌──────────────────────────────────────────────────┐
99
- │ Next > /ace:help │
100
- │ Configure GitHub Project integration, │
101
- │ then re-run /ace:plan-backlog │
102
- └──────────────────────────────────────────────────┘
103
- ```
104
- - Exit workflow.
105
-
106
- If "Skip GitHub":
107
- - Set GITHUB_ISSUES = null.
108
- - Continue to step 3.
109
-
110
- If the command fails (not a GitHub repo), or if `has_gh_cli` is false:
111
- - Set GITHUB_ISSUES = null.
112
- - Continue to step 3.
113
-
114
- **If `github_project.enabled` is true AND `github_project.gh_installed` is false:**
115
-
116
- GitHub Project is configured but `gh` CLI is not installed. Warn the user:
117
- - Display:
118
- ```
119
- ! GitHub Project integration is enabled but `gh` CLI is not installed.
120
- Install it: https://cli.github.com/
121
- Continuing without GitHub import.
122
- ```
123
- - Set GITHUB_ISSUES = null.
124
- - Continue to step 3.
125
-
126
- **If `github_project.enabled` is true AND `github_project.gh_installed` is true:**
127
-
128
- Extract settings: REPO = `github_project.repo`, PROJECT_NUMBER = `github_project.project_number`, OWNER = `github_project.owner`.
129
-
130
- Display:
131
- ```
132
- ┌──────────────────────────────────────────────────┐
133
- │ ACE > Plan Backlog > GitHub Import │
134
- └──────────────────────────────────────────────────┘
135
-
136
- i Fetching epics and features from GitHub Project #{PROJECT_NUMBER}...
137
- Repo: {REPO} | Owner: {OWNER}
138
- ```
139
-
140
- **Fetch all epics and features with full field data (single command):**
141
-
142
- ```bash
143
- GITHUB_ISSUES=$(node "${CLAUDE_SKILL_DIR}/script.js" fetch-issues \
144
- repo={REPO} owner={OWNER} project={PROJECT_NUMBER})
145
- ```
146
-
147
- This uses a single paginated GraphQL query to return all Epics and Features with:
148
- - **number** — GitHub issue number
149
- - **title** — issue title (preserved as-is)
150
- - **status** — from the project's Status field (Todo, Refined, In Progress, Done)
151
- - **priority** — from the project's Priority field (P0–P4)
152
- - **estimate** — from the project's Estimate field (number)
153
- - **sprint** — from the project's Sprint/Iteration field
154
- - **milestone** — from the issue's milestone
155
- - **url** — full GitHub issue URL
156
- - **state** — issue state (OPEN/CLOSED)
157
- - **parent_number** / **parent_title** — parent issue (features only)
158
-
159
- Type detection uses this priority order (handled by ace-tools):
160
- 1. If native `issueType` is set → use it (Epic / Feature)
161
- 2. If title starts with `[Epic]` → type = Epic
162
- 3. If title starts with `[Feature]` → type = Feature
163
- 4. Otherwise → skipped (not an epic or feature)
164
-
165
- The command returns structured JSON:
166
- ```json
167
- {
168
- "epics": [{ number, title, status, priority, estimate, sprint, milestone, url, state }],
169
- "features": [{ number, title, status, priority, estimate, sprint, milestone, parent_number, parent_title, url, state }],
170
- "counts": { total, epics, features, skipped }
171
- }
172
- ```
173
-
174
- Features without a parent Epic are "unparented" — present them separately
175
- during questioning.
176
-
177
- Hold the parsed JSON as GITHUB_ISSUES.
178
-
179
- Display summary:
180
- ```
181
- + Found {N} epics and {M} features in GitHub Project #{PROJECT_NUMBER}.
182
- [list epic titles with issue numbers]
183
- ```
184
-
185
- Continue to step 3.
186
- </step>
187
-
188
- <!-- ══════════════════════════════════════════════════════════════════ -->
189
- <!-- STEP 3: PREREQUISITE — PRODUCT VISION -->
190
- <!-- ══════════════════════════════════════════════════════════════════ -->
191
-
192
- <step name="prerequisite-vision" order="3">
193
-
194
- **If `has_product_vision` is false:**
195
-
196
- Inform the user:
197
- "The product vision is the foundation for backlog planning. It defines the
198
- high-level capabilities that become epics. Without it, I'd be guessing at
199
- the product's direction."
200
-
201
- Use AskUserQuestion:
202
- - header: "Product Vision"
203
- - question: "No product vision found. The vision drives backlog structure — each capability becomes an epic. How would you like to proceed?"
204
- - options:
205
- - "Run /ace:plan-product-vision first" — Create the vision, then come back
206
- - "Continue without vision" — I'll describe capabilities during questioning
207
-
208
- If "Run /ace:plan-product-vision first":
209
- - Display:
210
- ```
211
- ┌──────────────────────────────────────────────────┐
212
- │ Next > /ace:plan-product-vision │
213
- │ Then re-run /ace:plan-backlog │
214
- └──────────────────────────────────────────────────┘
215
- ```
216
- - Exit workflow.
217
-
218
- If "Continue without vision":
219
- - Set VISION = null
220
- - Continue to step 4.
221
-
222
- **If `has_product_vision` is true:**
223
-
224
- Read `.docs/product/product-vision.md`.
225
-
226
- Extract and hold as VISION context:
227
- - **Vision Statement** — the north star (1-2 sentences)
228
- - **Target Audience** — who uses this product
229
- - **High-Level Capabilities** — these map directly to epic candidates
230
- - **Key Objectives** — measurable outcomes (epics should trace to these)
231
- - **Constraints** — tech, timeline, budget (affects sizing and milestones)
232
-
233
- The High-Level Capabilities list is the **primary seed for epic discovery**.
234
- Each capability is a candidate epic. Some may split into multiple epics,
235
- some may merge. The questioning step will refine this.
236
-
237
- Continue to step 4.
238
- </step>
239
-
240
- <!-- ══════════════════════════════════════════════════════════════════ -->
241
- <!-- STEP 4: BROWNFIELD WIKI ANALYSIS (Parallel Sub-Agents) -->
242
- <!-- ══════════════════════════════════════════════════════════════════ -->
243
-
244
- <step name="wiki-analysis" order="4">
245
-
246
- **If `is_greenfield` OR `has_wiki` is false:**
247
-
248
- Set WIKI_ANALYSIS = null.
249
- Continue to step 5.
250
-
251
- **If `is_brownfield` AND `has_wiki` is true:**
252
-
253
- Check `has_wiki_analysis` from INIT (already resolved — do NOT use shell commands to check file existence):
254
-
255
- If `has_wiki_analysis` is TRUE:
256
- - Use AskUserQuestion:
257
- - header: "Wiki Analysis"
258
- - question: "A previous wiki analysis exists (`.ace/artifacts/wiki/wiki-analysis.md`). What would you like to do?"
259
- - options:
260
- - "Reuse it" — Skip wiki analysis, load the existing file
261
- - "Re-run analysis" — Delete and re-analyze from wiki docs
262
- - If "Reuse it": read `.ace/artifacts/wiki/wiki-analysis.md`, hold as WIKI_ANALYSIS, continue to step 5.
263
- - If "Re-run analysis": delete the file and proceed below.
264
-
265
- Display:
266
- ```
267
- ┌──────────────────────────────────────────────────┐
268
- │ ACE > Plan Backlog > Wiki Analysis │
269
- └──────────────────────────────────────────────────┘
270
-
271
- i Analyzing wiki documentation to infer existing
272
- epics, features, and their status...
273
- ```
274
-
275
- Spawn parallel analysis agents using `run_in_background=true`. Each agent reads wiki
276
- content and APPENDS its summary directly to a shared file on disk.
277
-
278
- **CRITICAL — Context Window Protection:**
279
- The `ace-product-owner` agent has a built-in `<structured-returns>` protocol:
280
- when spawned as a background agent, it writes to disk and returns ONLY a ~10-line
281
- confirmation (file path + line count). This prevents agent output from inflating
282
- the main context window.
283
-
284
- **CRITICAL — Do NOT call TaskOutput:**
285
- After spawning background agents, do NOT call TaskOutput to read their results.
286
- You will be automatically notified when each agent completes — IGNORE those notifications.
287
- The agents write to `.ace/artifacts/wiki/wiki-analysis.md` on disk. You do not need their return messages.
288
- After all notifications arrive, verify the file with `wc -l .ace/artifacts/wiki/wiki-analysis.md`,
289
- then proceed directly to the synthesizer.
290
-
291
- Scale agents by subsystem count: 1 system-wide + 1 per subsystem, up to 10 total.
292
- If subsystems exceed 9, batch 2-3 per agent.
293
-
294
- All agents write to the same file: `.ace/artifacts/wiki/wiki-analysis.md`
295
-
296
- First, create the file with a header:
297
- ```bash
298
- mkdir -p .ace/artifacts/wiki
299
- echo "# Wiki Analysis for Backlog Planning" > .ace/artifacts/wiki/wiki-analysis.md
300
- echo "" >> .ace/artifacts/wiki/wiki-analysis.md
301
- ```
302
-
303
- Display:
304
- ```
305
- i Spawning [N] wiki analysis agents in background
306
- (1 system-wide + [M] subsystem-specific)...
307
- Agents write directly to .ace/artifacts/wiki/wiki-analysis.md
308
- ```
309
-
310
- **Agent 1: System-Wide Analyst** (always, if `has_wiki_system_wide`):
311
-
312
- Task tool parameters:
313
- ```
314
- subagent_type: "ace-product-owner"
315
- model: "{PO_MODEL}"
316
- run_in_background: true
317
- description: "Analyze system-wide wiki"
318
- ```
319
-
320
- Prompt:
321
- ```
322
- You are analyzing wiki documentation to extract backlog-relevant information.
323
-
324
- **Read these files (if they exist):**
325
- - .docs/wiki/system-wide/system-architecture.md
326
- - .docs/wiki/system-wide/system-structure.md
327
-
328
- **APPEND the following structured summary to `.ace/artifacts/wiki/wiki-analysis.md`:**
329
-
330
- ## System-Wide
331
-
332
- - **System overview:** [1-2 sentences from system overview]
333
- - **Subsystem count:** [N]
334
- - **Subsystem responsibilities:**
335
- - [Subsystem Name]: [Responsibility from matrix]
336
- - [Subsystem Name]: [Responsibility from matrix]
337
- - **Tech stack:** [comma-separated list of key technologies]
338
- - **Communication patterns:** [sync/async/hybrid]
339
- - **Capability areas inferred:** [list of broad capability areas derived from subsystem responsibilities]
340
-
341
- IMPORTANT: Use Bash with `>> .ace/artifacts/wiki/wiki-analysis.md` to APPEND — do NOT overwrite.
342
- If a file does not exist, note 'not found' for that section in the appended output.
343
- ```
344
-
345
- **1 agent per subsystem** (if `has_wiki_subsystems` AND `wiki_subsystem_names` is non-empty):
346
-
347
- For each subsystem name (or batch of 2-3 if more than 9 subsystems):
348
-
349
- Task tool parameters:
350
- ```
351
- subagent_type: "ace-product-owner"
352
- model: "{PO_MODEL}"
353
- run_in_background: true
354
- description: "Analyze {subsystem_name} wiki"
355
- ```
356
-
357
- Prompt:
358
- ```
359
- You are analyzing subsystem wiki documentation to extract features and their status.
360
-
361
- **Subsystem to analyze:** {subsystem_name}
362
-
363
- **Read these files (if they exist):**
364
- - .docs/wiki/subsystems/{subsystem_name}/architecture.md
365
- - .docs/wiki/subsystems/{subsystem_name}/structure.md
366
-
367
- **APPEND the following structured summary to `.ace/artifacts/wiki/wiki-analysis.md`:**
368
-
369
- ## Subsystem: {subsystem_name}
370
-
371
- - **Responsibility:** [from architecture.md system context or overview]
372
- - **Components:** [list of L3 components from architecture.md]
373
- - **Inferred features:**
374
- - [Feature name]: [status] — [evidence]
375
- (Status inference logic:
376
- - 'Done' if architecture doc shows component with documented flows AND structure shows implementation files
377
- - 'In Progress' if partially documented — structure exists but architecture incomplete, or vice versa
378
- - 'Todo' if mentioned in responsibilities but no components or flows documented)
379
- - **Data ownership:** [what data this subsystem owns]
380
- - **Key dependencies:** [inbound/outbound from dependency inventory]
381
-
382
- IMPORTANT: Use Bash with `>> .ace/artifacts/wiki/wiki-analysis.md` to APPEND — do NOT overwrite.
383
- If a file does not exist, note 'not found' for that section in the appended output.
384
- ```
385
-
386
- **After all background notifications arrive:**
387
-
388
- Do NOT call TaskOutput. Just verify the file:
389
- ```bash
390
- wc -l .ace/artifacts/wiki/wiki-analysis.md
391
- ```
392
-
393
- **Synthesize wiki analysis:**
394
-
395
- The raw `.ace/artifacts/wiki/wiki-analysis.md` contains appended outputs from all agents —
396
- useful data but unstructured. Spawn a synthesizer agent to read it and produce
397
- a concise, opinionated summary focused on backlog implications.
398
-
399
- Task tool parameters:
400
- ```
401
- subagent_type: "ace-product-owner"
402
- model: "{PO_MODEL}"
403
- description: "Synthesize wiki analysis"
404
- ```
405
-
406
- Prompt:
407
- ```
408
- You are synthesizing wiki analysis for backlog planning.
409
-
410
- **Read:** `.ace/artifacts/wiki/wiki-analysis.md`
411
-
412
- This file contains raw structured summaries from multiple wiki analysis agents
413
- (1 system-wide + N subsystem-specific). Your job: synthesize into a single
414
- concise backlog-relevant summary.
415
-
416
- **Write a synthesized summary to `.ace/artifacts/wiki/wiki-analysis.md` (overwrite the raw version):**
417
-
418
- # Wiki Analysis Summary
419
-
420
- ## System Overview
421
- [2-3 sentences: what is this system, what does it do]
422
-
423
- ## Tech Stack
424
- [comma-separated key technologies found]
425
-
426
- ## Capability Areas
427
- [List of broad capability areas derived from subsystem responsibilities — these become epic candidates]
428
-
429
- ## Feature Inventory
430
- | Subsystem | Feature | Status | Evidence |
431
- |-----------|---------|--------|----------|
432
- [One row per inferred feature across ALL subsystems. Status: Done/In Progress/Todo]
433
-
434
- ## Cross-Cutting Concerns
435
- [Patterns that span multiple subsystems — communication, shared data, etc.]
436
-
437
- ## Gaps & Unknowns
438
- [What couldn't be determined from wiki docs alone]
439
-
440
- RULES:
441
- - Synthesize, don't concatenate — integrate findings across subsystems
442
- - Feature inventory table must be comprehensive (every feature from every subsystem)
443
- - Be opinionated: 'This system has N capability areas suggesting N epics'
444
- - Keep it concise — this will be held in the main context window
445
- ```
446
-
447
- After synthesis completes, read `.ace/artifacts/wiki/wiki-analysis.md` and hold as WIKI_ANALYSIS.
448
-
449
- Continue to step 5.
450
- </step>
451
-
452
- <!-- ══════════════════════════════════════════════════════════════════ -->
453
- <!-- STEP 5: OPTIONAL DOMAIN RESEARCH -->
454
- <!-- ══════════════════════════════════════════════════════════════════ -->
455
-
456
- <step name="domain-research-decision" order="5a">
457
-
458
- Use `has_features_research` and `has_architecture_research` from INIT
459
- (already resolved — do NOT use shell commands to check file existence).
460
-
461
- <!-- ── 5a-1: Existing research found ─────────────────────────────── -->
462
-
463
- **If `has_features_research` is TRUE:**
464
-
465
- Read `.ace/research/FEATURES.md` and display a brief summary (table stakes count,
466
- differentiator count, key categories). If `has_architecture_research` is also TRUE,
467
- read `.ace/research/ARCHITECTURE.md` and summarize (capability areas, component count).
468
-
469
- Use AskUserQuestion:
470
- - header: "Research"
471
- - question: "I found existing domain research. Would you like to reuse it or regenerate?"
472
- - options:
473
- - "Use existing research (Recommended)" — Reuse the current FEATURES.md and ARCHITECTURE.md
474
- - "Regenerate research" — Discard and re-run domain research from scratch
475
- - "Skip research" — Don't use any research for this backlog
476
-
477
- If "Use existing research":
478
- - Hold `.ace/research/FEATURES.md` content as RESEARCH.features
479
- - If `has_architecture_research` is TRUE AND `has_system_architecture` is FALSE,
480
- hold `.ace/research/ARCHITECTURE.md` content as RESEARCH.architecture
481
- - Display the "Research Complete" banner (same as step 5b) with findings from existing files
482
- - Continue to step 6.
483
-
484
- If "Skip research":
485
- - Set RESEARCH = null.
486
- - Continue to step 6.
487
-
488
- If "Regenerate research":
489
- - Continue to step 5b (execute research).
490
-
491
- <!-- ── 5a-2: No existing research ────────────────────────────────── -->
492
-
493
- **If `has_features_research` is FALSE:**
494
-
495
- If VISION is null AND WIKI_ANALYSIS is null AND no $ARGUMENTS provided:
496
- - Research is strongly recommended (bare context). Skip the question and
497
- auto-recommend: "I have very little context. Let me research the domain first."
498
- - Continue to step 5b (execute research).
499
-
500
- Otherwise:
501
-
502
- Use AskUserQuestion:
503
- - header: "Research"
504
- - question: "Would you like me to research standard features and capability areas for this domain before planning the backlog?"
505
- - options:
506
- - "Research first (Recommended)" — Discover standard stacks, expected features, common epic structures
507
- - "Skip research" — I know this domain well, go straight to questioning
508
-
509
- If "Research first" (or auto-recommended):
510
- - Continue to step 5b (execute research).
511
-
512
- If "Skip research":
513
- - Set RESEARCH = null.
514
- - Continue to step 6.
515
-
516
- </step>
517
-
518
- <step name="domain-research-execute" order="5b">
519
-
520
- Infer the domain from VISION (if available) or from the user's earlier description.
521
-
522
- Determine which researchers to spawn based on existing wiki documentation:
523
-
524
- - **Features Researcher** — ALWAYS spawned (domain feature landscape is distinct from wiki docs)
525
- - **Architecture Patterns Researcher** — ONLY if `has_system_architecture` is FALSE.
526
- If the wiki already has system-architecture.md (from /ace:map-system), that architecture
527
- context was already captured in WIKI_ANALYSIS (step 4). Spawning a domain architecture
528
- researcher would produce redundant or conflicting content.
529
-
530
- Display (adapts to researcher count):
531
- ```
532
- ┌──────────────────────────────────────────────────┐
533
- │ ACE > Plan Backlog > Domain Research │
534
- └──────────────────────────────────────────────────┘
535
-
536
- i Researching [domain] ecosystem...
537
- Spawning [1 or 2] researcher(s):
538
- → Features research
539
- [→ Architecture patterns research] ← only if no wiki architecture exists
540
- ```
541
-
542
- If `has_system_architecture` is TRUE, also display:
543
- ```
544
- i Skipping architecture research — wiki architecture already captured in step 4.
545
- ```
546
-
547
- RESEARCHER_MODEL is available from INIT.researcher_model — do NOT re-run resolve-model.
548
-
549
- **Features Researcher (always spawned):**
550
-
551
- Task tool parameters:
552
- ```
553
- subagent_type: "general-purpose"
554
- model: "{RESEARCHER_MODEL}"
555
- run_in_background: true
556
- description: "Features research"
557
- ```
558
-
559
- Prompt:
560
- ```
561
- You are the ace-project-researcher agent. Follow your agent instructions.
562
-
563
- <research_type>
564
- Project Research — Features dimension for [domain].
565
- </research_type>
566
-
567
- <question>
568
- What features do [domain] products have? What's table stakes vs differentiating?
569
- </question>
570
-
571
- <project_context>
572
- [VISION summary if available, or user's product description]
573
- </project_context>
574
-
575
- <downstream_consumer>
576
- Your FEATURES.md feeds into backlog creation. Categorize clearly:
577
- - Table stakes (must have or users leave)
578
- - Differentiators (competitive advantage)
579
- - Anti-features (things to deliberately NOT build)
580
- - Feature dependencies (what depends on what)
581
- </downstream_consumer>
582
-
583
- <output>
584
- Write to: .ace/research/FEATURES.md
585
- </output>
586
-
587
- **WRITE TO FILE DIRECTLY. RETURN ONLY CONFIRMATION.**
588
- Your response must be ~5 lines max. Just confirm what was written and the line count.
589
- Do NOT return file contents or research findings in your response.
590
- ```
591
-
592
- **Architecture Patterns Researcher (only if `has_system_architecture` is FALSE):**
593
-
594
- Task tool parameters:
595
- ```
596
- subagent_type: "general-purpose"
597
- model: "{RESEARCHER_MODEL}"
598
- run_in_background: true
599
- description: "Architecture patterns research"
600
- ```
601
-
602
- Prompt:
603
- ```
604
- You are the ace-project-researcher agent. Follow your agent instructions.
605
-
606
- <research_type>
607
- Project Research — Architecture/Epic structure dimension for [domain].
608
- </research_type>
609
-
610
- <question>
611
- How are [domain] systems typically structured? What are common capability
612
- boundaries that translate to epics? What are the major components?
613
- </question>
614
-
615
- <project_context>
616
- [VISION summary if available, or user's product description]
617
- </project_context>
618
-
619
- <downstream_consumer>
620
- Your ARCHITECTURE.md informs epic structure in the backlog. Include:
621
- - Component boundaries (what talks to what)
622
- - Suggested epic/capability groupings
623
- - Data flow (how information moves)
624
- - Suggested build order (dependencies between components)
625
- </downstream_consumer>
626
-
627
- <output>
628
- Write to: .ace/research/ARCHITECTURE.md
629
- </output>
630
-
631
- **WRITE TO FILE DIRECTLY. RETURN ONLY CONFIRMATION.**
632
- Your response must be ~5 lines max. Just confirm what was written and the line count.
633
- Do NOT return file contents or research findings in your response.
634
- ```
635
-
636
- **After all background notifications arrive:**
637
-
638
- Do NOT call TaskOutput. Just verify the files exist:
639
- ```bash
640
- wc -l .ace/research/FEATURES.md .ace/research/ARCHITECTURE.md 2>/dev/null
641
- ```
642
-
643
- Read the research files and hold combined results as RESEARCH:
644
- - features: key findings from .ace/research/FEATURES.md (table stakes, differentiators, anti-features)
645
- - architecture: IF .ace/research/ARCHITECTURE.md was created, include its key findings
646
- (capability boundaries, suggested epics). Otherwise, architecture context comes from
647
- WIKI_ANALYSIS (step 3) — do NOT duplicate it into RESEARCH.
648
-
649
- Display key findings:
650
- ```
651
- ┌──────────────────────────────────────────────────┐
652
- │ ACE > Plan Backlog > Research Complete │
653
- └──────────────────────────────────────────────────┘
654
-
655
- + Research complete.
656
-
657
- Table stakes: [comma-separated list]
658
- Differentiators: [comma-separated list]
659
- [Suggested capability areas: [comma-separated list]] ← only if architecture was researched
660
-
661
- Files: .ace/research/
662
- ```
663
-
664
- Continue to step 6.
665
- </step>
666
-
667
- <!-- ══════════════════════════════════════════════════════════════════ -->
668
- <!-- STEP 6: ABSORB INPUT -->
669
- <!-- ══════════════════════════════════════════════════════════════════ -->
670
-
671
- <step name="absorb-input" order="6">
672
-
673
- **If $ARGUMENTS is provided (user passed text or file):**
674
-
675
- Read/absorb the input content. Hold as INPUT_CONTEXT.
676
-
677
- Do NOT summarize it back to the user. Do NOT restructure it yet.
678
- Simply hold it for use in step 7 questioning.
679
-
680
- Note what kind of input it is:
681
- - Contains suggested epics/features? Hold as SUGGESTED_ITEMS.
682
- - Contains product description? Hold as PRODUCT_DESCRIPTION.
683
- - Contains PRD or specs? Hold as SPECS.
684
- - Contains a mix? Categorize each section.
685
-
686
- **If no $ARGUMENTS:**
687
-
688
- Set INPUT_CONTEXT = null.
689
-
690
- Continue to step 7.
691
- </step>
692
-
693
- <!-- ══════════════════════════════════════════════════════════════════ -->
694
- <!-- STEP 7: DEEP QUESTIONING -->
695
- <!-- ══════════════════════════════════════════════════════════════════ -->
696
-
697
- <step name="deep-questioning" order="7">
698
- Follow the questioning guide from `questioning.xml`. You are a thinking partner,
699
- not an interviewer.
700
-
701
- <!-- ── 7a: Determine run mode ─────────────────────────────────────── -->
702
-
703
- **Determine RUN_MODE:**
704
-
705
- - **UPDATE** — EXISTING_BACKLOG is set (user chose "Update it" in step 1)
706
- - **CREATE** — EXISTING_BACKLOG is null (first run or "Start fresh")
707
-
708
- <!-- ── 7b: UPDATE mode — start from existing backlog ──────────────── -->
709
-
710
- **If RUN_MODE is UPDATE:**
711
-
712
- Read EXISTING_BACKLOG and build a current inventory:
713
- - Parse all epics (IDs, titles, feature counts, statuses, GitHub links)
714
- - Parse all features (IDs, titles, parent epic, statuses, GitHub links)
715
-
716
- If GITHUB_ISSUES is set, cross-reference:
717
- - **Backlog-only items** — items in backlog without a GitHub link
718
- - **GitHub-only items** — epics/features in GitHub NOT found in the backlog
719
- (match by issue number in Link column; unmatched GitHub items are new)
720
- - **Status drift** — items where backlog status differs from GitHub status
721
- - **New GitHub items** — epics/features added directly in GitHub since last sync
722
-
723
- Present the current state:
724
- ```
725
- Your backlog has [N] epics with [M] features.
726
- [If GitHub: [X] items linked to GitHub, [Y] not yet linked.]
727
- [If drift: [Z] items have status changes in GitHub.]
728
- [If new GH items: [W] new items found in GitHub not in the backlog.]
729
- ```
730
-
731
- Use AskUserQuestion:
732
- - header: "Update"
733
- - question: "What would you like to change?"
734
- - options:
735
- - "Add new epics/features" — Expand the backlog with new items
736
- - "Sync from GitHub" — Import new GitHub items and update statuses
737
- - "Reorganize" — Reorder, merge, split, or remove items
738
- - "Full review" — Walk through all epics and refine
739
-
740
- If "Add new epics/features":
741
- - Ask what to add. Follow natural conversation. Then proceed to decision gate.
742
-
743
- If "Sync from GitHub":
744
- - If there are GitHub-only items: present them and ask which to add to backlog.
745
- - If there are status drifts: present them and ask which to accept.
746
- - Merge accepted changes into the backlog plan. Then proceed to decision gate.
747
-
748
- If "Reorganize":
749
- - Present the epic index. Ask what to change. Iterate. Then proceed to decision gate.
750
-
751
- If "Full review":
752
- - Fall through to the epic-by-epic refinement below (same as CREATE mode).
753
-
754
- <!-- ── 7c: CREATE mode — context-aware opening ────────────────────── -->
755
-
756
- **If RUN_MODE is CREATE:**
757
-
758
- Assess available context richness:
759
-
760
- Compute CONTEXT_RICHNESS:
761
- - RICH: VISION is set AND (WIKI_ANALYSIS is set OR RESEARCH is set OR GITHUB_ISSUES is set)
762
- - MODERATE: VISION is set OR (WIKI_ANALYSIS is set AND INPUT_CONTEXT is set) OR (RESEARCH is set AND INPUT_CONTEXT is set) OR GITHUB_ISSUES is set
763
- - LEAN: INPUT_CONTEXT only (no vision, no wiki, no research, no GitHub issues)
764
- - BARE: Nothing available
765
-
766
- **Opening — adapt based on context richness:**
767
-
768
- If RICH (vision + wiki/research/github + possibly input):
769
- - Synthesize what you know: "Based on your product vision and
770
- [codebase analysis / domain research / GitHub issues], I see these capability areas..."
771
- - Present a draft epic list derived from:
772
- 1. Vision High-Level Capabilities (primary source)
773
- 2. GitHub Issues — use EXACT GitHub titles and #[issue_number] as ID (if exists)
774
- 3. Subsystem responsibilities from WIKI_ANALYSIS (if exists)
775
- 4. Research findings — table stakes and suggested capability areas (if exists)
776
- 5. INPUT_CONTEXT suggested items (if any)
777
- - For GitHub issues: present with EXACT titles (do NOT rephrase), #N as ID, and their GitHub status/priority
778
- - For brownfield with wiki: note inferred feature statuses (Done/In Progress/Todo)
779
- - For research: highlight table stakes that aren't yet covered
780
- - Probe: "Does this match your mental model? What's missing? What should be
781
- reordered or merged?"
782
-
783
- If MODERATE (some context, not the full picture):
784
- - If vision exists: "Your product vision lists these capability areas:
785
- [list from High-Level Capabilities]. Let's turn these into epics with
786
- concrete features. Starting with the first — what are the specific
787
- things it needs to deliver?"
788
- - If no vision but wiki + input: "I've analyzed your codebase documentation
789
- and your input. Here's what I see as the current state: [summary].
790
- Let's structure this into a backlog."
791
- - If research + input: "Domain research suggests these capability areas:
792
- [list]. Combined with your input, let me propose an initial structure."
793
-
794
- If LEAN (input doc only):
795
- - Absorb the input. Probe structure: "I've read your document. It mentions
796
- [key themes]. Let me make sure I understand the scope before we structure
797
- the backlog."
798
-
799
- If BARE (nothing):
800
- - Open with: "What are the major things this product needs to do?"
801
- - Wait for their response. This gives you context for intelligent follow-ups.
802
-
803
- **Follow the thread:**
804
-
805
- Based on what they said (and what you absorbed), ask follow-up questions that dig
806
- into their response. Use AskUserQuestion with options that probe what they mentioned —
807
- interpretations, clarifications, concrete examples.
808
-
809
- Keep following threads. Each answer opens new threads to explore:
810
- - What capability area is this feature part of?
811
- - What does this feature actually deliver to the user?
812
- - Is this already partially built? (use wiki analysis to confirm)
813
- - What's the relative priority?
814
- - What depends on what?
815
- - What's MVP vs future?
816
-
817
- **Map answers to backlog template structure (background, not out loud):**
818
-
819
- **CRITICAL — GitHub identity preservation:**
820
- Items from GITHUB_ISSUES use #[issue_number] as their ID and their EXACT GitHub title.
821
- Do NOT assign E[N]/F[N] IDs to GitHub-linked items. Do NOT rephrase their titles.
822
- Only new items (not in GitHub) get E[N]/F[N] IDs and new titles.
823
-
824
- As you question, mentally track coverage against backlog needs:
825
- - [ ] Capability areas (epics) identified — as many as the product naturally requires
826
- - [ ] Each epic has features — as many as naturally emerge (Agile scoping, not arbitrary limits)
827
- - [ ] Features are concrete deliverables (what it delivers, not how)
828
- - [ ] Status understood for each (Todo / Refined / In Progress / Done)
829
- - [ ] Size estimated using Fibonacci×10 (10, 20, 30, 50, 80, 130)
830
- - [ ] Milestones assigned (mvp, v0.1.0, v0.2.0, etc.)
831
- - [ ] Cross-epic dependencies identified
832
- - [ ] Vision capability coverage validated (every capability maps to at least 1 epic)
833
-
834
- Don't walk through this as a checklist. Weave questions naturally based on
835
- the conversation. If gaps remain after the conversation feels complete, probe
836
- those specific areas.
837
-
838
- **Epic-by-epic refinement:**
839
-
840
- Once the initial epic list is established, go through each epic:
841
-
842
- Use AskUserQuestion for each epic:
843
- - header: "[Epic Title]"
844
- - question: "Here are the features I have for [Epic Title]. Confirm, add, or remove:"
845
- - options:
846
- - "Looks good" — Features are complete for this epic
847
- - "Add more" — I have more features to add
848
- - "Remove some" — Some of these don't belong
849
- - "Split this epic" — This is too broad, let's break it apart
850
-
851
- For each feature in the epic, confirm or discuss:
852
- - Title and description
853
- - Status (if brownfield with wiki, present inferred status for confirmation)
854
- - Size (Fibonacci×10: 10, 20, 30, 50, 80, 130)
855
- - Milestone
856
-
857
- **Gap check:**
858
-
859
- After all epics are refined:
860
- - "Any capability areas we haven't covered?"
861
- - If VISION exists, validate: "Every vision capability should map to at least one
862
- epic. Let me check..." Present any unmapped capabilities.
863
- - If RESEARCH exists, validate: "Research identified these table stakes:
864
- [list]. Are they all covered?" Surface any missing table stakes.
865
- - "Any cross-cutting concerns that need their own epic? (e.g., DevOps/CI,
866
- Monitoring, Documentation, Security)"
867
-
868
- **Decision gate:**
869
-
870
- When the backlog feels complete:
871
-
872
- Use AskUserQuestion:
873
- - header: "Ready?"
874
- - question: "I have [N] epics with [M] total features. Ready to create the product backlog?"
875
- - options:
876
- - "Create product backlog" — Let's write it
877
- - "Keep exploring" — I want to add more or adjust
878
- - "Show me what you have" — Present a summary before deciding
879
-
880
- If "Show me what you have":
881
- - Display epic index as a quick table:
882
- ```
883
- | ID | Epic | Features | Milestone |
884
- |----|------|----------|-----------|
885
- | E1 | [Title] | [count] features | [milestone] |
886
- | E2 | [Title] | [count] features | [milestone] |
887
- ...
888
- ```
889
- - Return to decision gate.
890
-
891
- If "Keep exploring" — ask what they want to add, or identify gaps and probe naturally.
892
-
893
- Loop until "Create product backlog" selected.
894
- </step>
895
-
896
- <!-- ══════════════════════════════════════════════════════════════════ -->
897
- <!-- STEP 8: WRITE BACKLOG -->
898
- <!-- ══════════════════════════════════════════════════════════════════ -->
899
-
900
- <step name="write-backlog" order="8">
901
-
902
- **Determine WRITE_MODE based on RUN_MODE and what changed:**
903
-
904
- - **CREATE** — RUN_MODE is CREATE, or user chose "Start fresh" in step 1.
905
- Writes a new backlog from scratch.
906
- - **UPDATE** — RUN_MODE is UPDATE. Edits the existing backlog in place,
907
- preserving IDs, GitHub links, and unchanged items.
908
-
909
- <!-- ── 8a: CREATE mode — write new backlog ────────────────────────── -->
910
-
911
- **If WRITE_MODE is CREATE:**
912
-
913
- Create directory structure:
914
- ```bash
915
- mkdir -p .ace/artifacts/product
916
- ```
917
-
918
- Prepare a context brief (500 words max) that distills:
919
- - Product direction summary (from vision if available, else from questioning)
920
- - Complete epic list with: ID, Title, Description, Status, Priority, Size (Fibonacci×10), Sprint, Milestone, Link
921
- - ID = #[issue_number] for GitHub-linked epics, E[N] for new epics
922
- - Title = EXACT GitHub title for GitHub-linked items (verbatim)
923
- - For each epic, complete feature list with: ID, Title, Description, Status, Priority, Size, Sprint, Milestone, Link
924
- - ID = #[issue_number] for GitHub-linked features, F[N] for new features
925
- - Title = EXACT GitHub title for GitHub-linked items (verbatim)
926
- - Local Feature ID numbering: sequential across entire backlog (F1, F2, ... FN) — only for non-GitHub items
927
- - Epic ordering rationale (strategic priority)
928
- - Any cross-epic dependencies noted
929
- - If RESEARCH exists: flag any table stakes that were included and their coverage
930
- - If GITHUB_ISSUES exists: include GitHub issue numbers and URLs for items that already
931
- have corresponding GitHub issues. Map GitHub Status/Priority/Sprint/Estimate to our columns.
932
-
933
- Spawn the backlog-writing agent:
934
-
935
- ```
936
- Task(
937
- prompt="You are an Agile Product Owner writing a product backlog document.
938
-
939
- **Context brief from questioning session:**
940
- {paste the context brief here}
941
-
942
- **Instructions:**
943
- 1. Read the product backlog template: ${CLAUDE_SKILL_DIR}/product-backlog-template.xml
944
- 2. Write `.ace/artifacts/product/product-backlog.md` following the template structure exactly
945
- 3. Include the header paragraph explaining product direction
946
- 4. Write the Epic Index table (ordered by strategic priority)
947
- 5. Write each Epic Detail section with its Feature table
948
- 6. Follow all column definitions from the template:
949
- - ID: #[issue_number] for GitHub-linked items, E[N] for local epics, F[N] for local features
950
- - Title: EXACT GitHub title for GitHub-linked items (do NOT rephrase); 5-10 words for new items
951
- - Description: 1-2 sentences
952
- - Status: Todo | Refined | In Progress | Done
953
- - Priority: Critical | High | Medium | Low
954
- - Size: Fibonacci×10 values only (10, 20, 30, 50, 80, 130)
955
- - Sprint: Sprint name/iteration or '—' if unassigned
956
- - Milestone: mvp | v0.1.0 | v0.2.0 | etc.
957
- - Link: [#N](url) if GitHub issue exists, otherwise '—'
958
- 7. Apply ordering rules: epics by strategic priority, features by delivery sequence
959
- 8. Apply Agile scoping principles:
960
- - Epics are broad capability categories — as many as the product naturally requires
961
- - Features are concrete deliverables within epics — as many as naturally emerge
962
- - Local Feature IDs (F[N]) are globally sequential (F1, F2, F3... not restarting per epic)
963
- - Epic status reflects aggregate of features
964
- - 130-point items flagged for potential splitting
965
- 9. GitHub integration (CRITICAL — identity preservation):
966
- - GitHub-linked items: ID = #[issue_number], Title = EXACT GitHub title (verbatim, no rephrasing)
967
- - Epic detail section headers: ### #45: Exact GitHub Title (not ### E1: ...)
968
- - Link column: [#N](url) for GitHub items, '—' for local items
969
- - Map GitHub Priority/Status/Sprint/Estimate to our columns
970
- - Only items without a GitHub issue get E[N]/F[N] IDs
971
-
972
- 10. Table formatting (CRITICAL for readability):
973
- - Pad ALL cells with spaces so column separators | align vertically
974
- - Separator row dashes must match column widths
975
- - Follow the table-formatting guideline in the template for minimum column widths
976
- - Every row in a table must have the same total width
977
-
978
- Write the file using the Write tool.
979
-
980
- **Return format — ONLY this, nothing else:**
981
- DONE
982
- - Epic count: [N]
983
- - Feature count: [N]
984
- - MVP scope: [number of features in mvp milestone]
985
- - Epics: [comma-separated list of epic titles]
986
- - GitHub-linked items: [N]",
987
- subagent_type="ace-product-owner",
988
- model="{PO_MODEL}",
989
- description="Write product backlog document"
990
- )
991
- ```
992
-
993
- <!-- ── 8b: UPDATE mode — edit existing backlog ────────────────────── -->
994
-
995
- **If WRITE_MODE is UPDATE:**
996
-
997
- Prepare a change brief that describes exactly what to change:
998
- - **Additions:** new epics/features to add (with all columns populated)
999
- - New Feature IDs continue from the highest existing F[N] in the backlog
1000
- - New Epic IDs continue from the highest existing E[N]
1001
- - **Removals:** items to delete (by ID)
1002
- - **Modifications:** items to update (by ID, with field changes — e.g., status, size, milestone, priority)
1003
- - **Status syncs from GitHub:** items where GitHub status should overwrite backlog status
1004
- - **New GitHub imports:** items from GitHub to add to the backlog
1005
- (include issue number and URL for the Link column)
1006
- - **Reorders:** if epic ordering changed
1007
-
1008
- Spawn the backlog-editing agent:
1009
-
1010
- ```
1011
- Task(
1012
- prompt="You are an Agile Product Owner editing an existing product backlog.
1013
-
1014
- **Read the current backlog:** `.ace/artifacts/product/product-backlog.md`
1015
- **Read the template for reference:** `${CLAUDE_SKILL_DIR}/product-backlog-template.xml`
1016
-
1017
- **Changes to apply:**
1018
- {paste the change brief here}
1019
-
1020
- **Rules:**
1021
- - PRESERVE all existing IDs (#N for GitHub-linked, E[N]/F[N] for local), titles, and unchanged items exactly as-is
1022
- - GitHub-linked items keep their #[issue_number] ID and EXACT GitHub title — never change these
1023
- - New local Feature IDs continue sequentially from the highest existing F[N]
1024
- - New local Epic IDs continue sequentially from the highest existing E[N]
1025
- - Update the Epic Index table to reflect any additions, removals, or reorders
1026
- - Update Epic status to reflect aggregate of its features
1027
- - Size values must be Fibonacci×10 only: 10, 20, 30, 50, 80, 130
1028
- - Maintain all template formatting — especially table column alignment:
1029
- pad cells with spaces so | separators align vertically across all rows.
1030
- Follow the table-formatting guideline in the template for minimum column widths.
1031
- - If adding items with GitHub issue numbers, set Link = [#N](url)
1032
- - Do NOT change items that aren't in the change brief
1033
-
1034
- Use the Edit tool to modify in place. If changes are extensive (new epics added,
1035
- major reorders), use the Write tool to rewrite the file completely.
1036
-
1037
- **Return format — ONLY this, nothing else:**
1038
- DONE
1039
- - Added: [N] epics, [M] features
1040
- - Modified: [X] items
1041
- - Removed: [Y] items
1042
- - Total: [N] epics, [M] features
1043
- - GitHub-linked items: [Z]",
1044
- subagent_type="ace-product-owner",
1045
- model="{PO_MODEL}",
1046
- description="Update product backlog document"
1047
- )
1048
- ```
1049
- </step>
1050
-
1051
- <!-- ══════════════════════════════════════════════════════════════════ -->
1052
- <!-- STEP 9: REVIEW AND APPROVE -->
1053
- <!-- ══════════════════════════════════════════════════════════════════ -->
1054
-
1055
- <step name="review" order="9">
1056
- Show the agent's returned summary to the user. Then:
1057
-
1058
- Use AskUserQuestion:
1059
- - header: "Backlog"
1060
- - question: "Product backlog written to `.ace/artifacts/product/product-backlog.md`. Does this look right? Review the full file in your editor for details."
1061
- - options:
1062
- - "Approve" — Looks good, commit it
1063
- - "Adjust" — I want to change some things
1064
- - "Redo questioning" — Let's go back and explore more
1065
-
1066
- **If "Adjust":**
1067
- - Ask what they want to change (add/remove epics, reorder, change milestones, etc.)
1068
- - Spawn a Task agent to edit:
1069
- ```
1070
- Task(
1071
- prompt="Read `.ace/artifacts/product/product-backlog.md` and make these changes:
1072
- {user's requested changes}.
1073
-
1074
- **Rules:**
1075
- - Maintain all template formatting — especially table column alignment:
1076
- pad cells with spaces so | separators align vertically across all rows
1077
- - Keep Feature IDs globally sequential — if adding new features, use the next available F[N]
1078
- - Update Epic status to reflect aggregate feature status
1079
- - Size values must be Fibonacci×10 only: 10, 20, 30, 50, 80, 130
1080
- - Re-read the template for reference: ${CLAUDE_SKILL_DIR}/product-backlog-template.xml
1081
-
1082
- Use the Edit tool to modify in place. Return only a confirmation of what changed.",
1083
- subagent_type="general-purpose",
1084
- model="{PO_MODEL}",
1085
- description="Adjust product backlog"
1086
- )
1087
- ```
1088
- - Present for review again. Loop until approved.
1089
-
1090
- **If "Redo questioning":**
1091
- - Return to step 7 (deep-questioning)
1092
- - Preserve VISION, WIKI_ANALYSIS, RESEARCH, GITHUB_ISSUES, and INPUT_CONTEXT
1093
- - Hold previous answers as additional context
1094
-
1095
- **If "Approve":**
1096
- Continue to step 10.
1097
- </step>
1098
-
1099
- <!-- ══════════════════════════════════════════════════════════════════ -->
1100
- <!-- STEP 10: GITHUB SYNC -->
1101
- <!-- ══════════════════════════════════════════════════════════════════ -->
1102
-
1103
- <step name="github-sync" order="10">
1104
-
1105
- **If `github_project.enabled` is false OR `github_project.gh_installed` is false:**
1106
-
1107
- Skip to step 11.
1108
-
1109
- **If `github_project.enabled` is true AND `github_project.gh_installed` is true:**
1110
-
1111
- Read the approved `.ace/artifacts/product/product-backlog.md` and cross-reference
1112
- with GITHUB_ISSUES (from step 2) to identify sync actions:
1113
-
1114
- - **Unlinked items** — backlog items with Link = "—" → candidates for GitHub creation
1115
- - **Linked but modified** — backlog items whose status/priority/estimate changed
1116
- during this session vs their GitHub values → candidates for GitHub update
1117
- - **Already synced** — backlog items with Link that match GitHub exactly → no action
1118
-
1119
- If no sync actions needed (all items linked, nothing changed):
1120
- - Display: "All backlog items are already synced with GitHub."
1121
- - Continue to step 11.
1122
-
1123
- If there are unlinked items:
1124
-
1125
- Build a sync summary and present it:
1126
- ```
1127
- GitHub Sync Summary:
1128
- - New (unlinked): [N] epics, [M] features
1129
- [- Modified: [X] items with field changes to push]
1130
- ```
1131
-
1132
- Use AskUserQuestion:
1133
- - header: "GitHub Sync"
1134
- - question: "How would you like to sync with GitHub?"
1135
- - options:
1136
- - "Sync all (Recommended)" — Create new issues and update modified ones
1137
- - "Create new only" — Create unlinked items, don't update existing
1138
- - "Create epics only" — Only create Epic issues, skip features and updates
1139
- - "Skip" — Don't sync to GitHub
1140
-
1141
- **If "Skip":**
1142
- Continue to step 11.
1143
-
1144
- **If any sync option selected:**
1145
-
1146
- Display:
1147
- ```
1148
- ┌──────────────────────────────────────────────────┐
1149
- │ ACE > Plan Backlog > GitHub Sync │
1150
- └──────────────────────────────────────────────────┘
1151
-
1152
- i Creating GitHub issues...
1153
- Repo: {REPO} | Project: #{PROJECT_NUMBER}
1154
- ```
1155
-
1156
- **Prerequisite — Resolve all field and type IDs (once, before creating any issues):**
1157
-
1158
- ```bash
1159
- GH_FIELDS=$(node "${CLAUDE_SKILL_DIR}/script.js" resolve-fields repo={REPO} owner={OWNER} project={PROJECT_NUMBER})
1160
- ```
1161
-
1162
- Parse the JSON response. Extract and cache:
1163
- - `issue_types.Epic` → EPIC_TYPE_ID
1164
- - `issue_types.Feature` → FEATURE_TYPE_ID
1165
- - `project_id` → PROJECT_ID
1166
- - `fields.Status.id` → STATUS_FIELD_ID
1167
- - `fields.Status.options` → STATUS_OPTIONS map (e.g., `{ "Todo": "id", "In Progress": "id", ... }`)
1168
- - `fields.Priority.id` → PRIORITY_FIELD_ID (if exists)
1169
- - `fields.Priority.options` → PRIORITY_OPTIONS map (e.g., `{ "P0": "id", "P1": "id", ... }`)
1170
- - `fields.Estimate.id` → ESTIMATE_FIELD_ID (if exists)
1171
-
1172
- If Epic or Feature type doesn't exist in `issue_types`, log a warning and skip type-setting.
1173
-
1174
- **For each unlinked Epic (in order):**
1175
-
1176
- ```bash
1177
- EPIC_RESULT=$(node "${CLAUDE_SKILL_DIR}/script.js" create-issue \
1178
- type=Epic \
1179
- "title={Epic Title}" \
1180
- "body={Epic Description}" \
1181
- repo={REPO} \
1182
- owner={OWNER} \
1183
- project={PROJECT_NUMBER} \
1184
- project_id={PROJECT_ID} \
1185
- type_id={EPIC_TYPE_ID} \
1186
- [priority_field_id={PRIORITY_FIELD_ID} priority_option_id={PRIORITY_OPTIONS[priority]}])
1187
- ```
1188
-
1189
- Epics do NOT get Status or Estimate — only Priority (optional).
1190
- Parse the JSON response: `number`, `url`, `item_id`, and status flags.
1191
- Store the epic's issue number for use as parent when creating features.
1192
-
1193
- Display progress:
1194
- ```
1195
- + Created [Epic] {Title} → #{number}
1196
- ```
1197
-
1198
- **If "Create new only" or "Sync all" was selected, for each unlinked Feature (in order):**
1199
-
1200
- ```bash
1201
- FEATURE_RESULT=$(node "${CLAUDE_SKILL_DIR}/script.js" create-issue \
1202
- type=Feature \
1203
- "title={Feature Title}" \
1204
- "body={Feature Description}" \
1205
- repo={REPO} \
1206
- owner={OWNER} \
1207
- project={PROJECT_NUMBER} \
1208
- project_id={PROJECT_ID} \
1209
- type_id={FEATURE_TYPE_ID} \
1210
- status_field_id={STATUS_FIELD_ID} \
1211
- status_option_id={STATUS_OPTIONS[status]} \
1212
- estimate_field_id={ESTIMATE_FIELD_ID} \
1213
- estimate={size_value} \
1214
- [priority_field_id={PRIORITY_FIELD_ID} priority_option_id={PRIORITY_OPTIONS[priority]}] \
1215
- [parent={epic_issue_number}] \
1216
- [milestone={Milestone}])
1217
- ```
1218
-
1219
- Status and Estimate are ALWAYS set for Features. Priority, parent, and milestone are optional.
1220
- Parse the JSON response: `number`, `url`, status flags.
1221
-
1222
- Display progress:
1223
- ```
1224
- + Created [Feature] {Title} → #{number} (parent: #{epic_number})
1225
- ```
1226
-
1227
- **If "Sync all" was selected, update modified existing issues:**
1228
-
1229
- For each linked item whose fields changed during this session
1230
- (status, priority, estimate differ from GITHUB_ISSUES values fetched in step 2):
1231
-
1232
- Use `gh project item-edit` to update the changed fields:
1233
- - Status change → `gh project item-edit --project-id {PROJECT_ID} --id {ITEM_ID} --field-id {STATUS_FIELD_ID} --single-select-option-id {STATUS_OPTIONS[new_status]}`
1234
- - Priority change → `gh project item-edit --project-id {PROJECT_ID} --id {ITEM_ID} --field-id {PRIORITY_FIELD_ID} --single-select-option-id {PRIORITY_OPTIONS[new_priority]}`
1235
- - Estimate change → `gh project item-edit --project-id {PROJECT_ID} --id {ITEM_ID} --field-id {ESTIMATE_FIELD_ID} --number {new_estimate}`
1236
-
1237
- Note: To get the ITEM_ID for existing linked issues, use:
1238
- ```bash
1239
- ITEM_ID=$(gh project item-list {PROJECT_NUMBER} --owner {OWNER} --format json --limit 500 | jq -r '.items[] | select(.content.number == {issue_number}) | .id')
1240
- ```
1241
-
1242
- Display progress for each update:
1243
- ```
1244
- ~ Updated [Feature] {Title} #{number} — status: {old} → {new}
1245
- ```
1246
-
1247
- **After all creates and updates, update the backlog file:**
1248
-
1249
- Read `.ace/artifacts/product/product-backlog.md` and update every newly created
1250
- item's Link column from "—" to `[#N](https://github.com/{REPO}/issues/N)`.
1251
-
1252
- Use the Edit tool to make targeted replacements in the markdown tables.
1253
-
1254
- Display summary:
1255
- ```
1256
- + Created {N} GitHub issues.
1257
- [~ Updated {X} existing issues.]
1258
- Backlog Link column updated.
1259
- ```
1260
-
1261
- Continue to step 11.
1262
- </step>
1263
-
1264
- <!-- ══════════════════════════════════════════════════════════════════ -->
1265
- <!-- STEP 11: COMMIT -->
1266
- <!-- ══════════════════════════════════════════════════════════════════ -->
1267
-
1268
- <step name="commit" order="11">
1269
- Stage and commit all changed files in a single commit.
1270
- Only stage files that actually changed (use `git diff` / `git status` to check).
1271
-
1272
- Files that may have changed:
1273
- - `.ace/artifacts/product/product-backlog.md` — always (this is the main output)
1274
- - `.ace/research/FEATURES.md` — if research was regenerated in step 5b
1275
- - `.ace/research/ARCHITECTURE.md` — if research was regenerated in step 5b
1276
- - `.ace/artifacts/wiki/wiki-analysis.md` — if wiki analysis was re-run in step 4
1277
-
1278
- ```bash
1279
- git add .ace/artifacts/product/product-backlog.md
1280
- ```
1281
-
1282
- If research files were created or regenerated this session:
1283
- ```bash
1284
- git add .ace/research/
1285
- ```
1286
-
1287
- If wiki analysis was re-run this session:
1288
- ```bash
1289
- git add .ace/artifacts/wiki/wiki-analysis.md
1290
- ```
1291
-
1292
- Commit with a message that reflects what happened:
1293
- - CREATE mode: `git commit -m "docs: initialize product backlog"`
1294
- - UPDATE mode: `git commit -m "docs: update product backlog — [brief summary of changes]"`
1295
- Examples:
1296
- - "docs: update product backlog — add 2 epics, 5 features"
1297
- - "docs: update product backlog — sync status from GitHub"
1298
- - "docs: update product backlog — reorganize epic order"
1299
-
1300
- Display completion (adapt banner to mode):
1301
-
1302
- ```
1303
- ╔══════════════════════════════════════════════════╗
1304
- ║ ACE > Product Backlog [Created | Updated] ║
1305
- ╚══════════════════════════════════════════════════╝
1306
-
1307
- + .ace/artifacts/product/product-backlog.md committed.
1308
- [If UPDATE: Changes: +N epics, +M features, ~X modified]
1309
-
1310
- Summary:
1311
- ────────
1312
- [N] epics, [M] features
1313
- MVP scope: [X] features across [Y] epics
1314
-
1315
- i This backlog will be used as context by ACE commands
1316
- when planning features, stories, and sprints.
1317
-
1318
- Next > /ace:plan-feature E1
1319
- Break the first epic into detailed stories.
1320
- > /ace:help
1321
- Check project status and available commands.
1322
- ```
1323
- </step>
1324
-
1325
- </process>
1326
-
1327
- <success_criteria>
1328
- - Init function executed (environment detected, wiki state checked, GitHub settings loaded)
1329
- - GitHub issues fetched via `github fetch-issues` if GitHub Project integration is enabled
1330
- - Product vision loaded as primary input (if exists)
1331
- - Brownfield with wiki: analysis reused from cache or re-run with parallel agents
1332
- - Domain research reused from cache or regenerated if selected
1333
- - User-provided input absorbed and integrated
1334
- - Deep questioning adapted to run mode (CREATE = from scratch, UPDATE = targeted changes)
1335
- - Every vision capability mapped to at least one epic (if vision exists)
1336
- - Research table stakes validated against backlog (if research exists)
1337
- - Epics and features scoped using Agile methodology (no arbitrary count limits)
1338
- - Size estimated using Fibonacci×10 (10, 20, 30, 50, 80, 130)
1339
- - Priority, status, size, sprint, milestone, and link assigned to every item
1340
- - product-backlog.md written (CREATE) or edited in place (UPDATE) following template structure
1341
- - Existing IDs, GitHub links, and unchanged items preserved during updates
1342
- - User reviewed and approved the document
1343
- - GitHub sync: new issues created, modified issues updated (if user chose to sync)
1344
- - Link column updated with GitHub issue numbers and URLs
1345
- - Document committed with mode-appropriate message (initialize vs update + summary)
1346
- </success_criteria>
1347
-
1348
- </workflow>
1
+ <workflow>
2
+
3
+ <purpose>
4
+ Orchestrate product backlog creation or update through environment detection, GitHub issue
5
+ import, product-vision loading, optional wiki analysis (parallel sub-agents for brownfield
6
+ projects), optional domain research, deep questioning, document writing, and optional
7
+ GitHub sync. Produces `.ace/artifacts/product/product-backlog.md` — the ordered backlog
8
+ of Epics and Features that defines what the product will deliver.
9
+
10
+ The product vision's High-Level Capabilities are the primary input — each capability
11
+ maps to one or more Epics. For brownfield projects with wiki documentation, parallel
12
+ analysis agents extract existing feature inventories and status from the wiki, keeping
13
+ raw content out of the main context window. When GitHub Project integration is enabled,
14
+ existing issues are imported and new items can be synced back to GitHub.
15
+ </purpose>
16
+
17
+ <mandatory-context>
18
+ All supporting resource files are auto-loaded in the skill prompt above. Do NOT re-read them.
19
+ Also read any document or text passed as parameter ($ARGUMENTS) in the invoking command.
20
+ </mandatory-context>
21
+
22
+ <process>
23
+
24
+ <!-- ══════════════════════════════════════════════════════════════════ -->
25
+ <!-- STEP 1: SETUP -->
26
+ <!-- ══════════════════════════════════════════════════════════════════ -->
27
+
28
+ <step name="setup" order="1">
29
+ **MANDATORY FIRST STEP — Execute environment detection before any user interaction:**
30
+
31
+ INIT is available from the preprocessed Environment Context above — do NOT re-run init.
32
+
33
+ Parse INIT JSON for: `product_owner_model`, `researcher_model`, `commit_docs`,
34
+ `has_product_vision`, `has_product_backlog`,
35
+ `has_features_research`, `has_architecture_research`, `has_wiki_analysis`,
36
+ `is_brownfield`, `is_greenfield`,
37
+ `has_existing_code`, `has_package_file`, `has_wiki`, `has_wiki_system_wide`,
38
+ `has_wiki_subsystems`, `wiki_subsystem_names`, `has_system_architecture`,
39
+ `has_system_structure`, `has_testing_framework`, `has_git`, `has_gh_cli`,
40
+ `github_project` (object: `enabled`, `gh_installed`, `repo`, `project_number`, `owner`).
41
+
42
+ PO_MODEL is available from INIT.product_owner_model — do NOT re-run resolve-model.
43
+
44
+ Display stage banner:
45
+
46
+ ```
47
+ ╔══════════════════════════════════════════════════╗
48
+ ║ ACE > Plan Backlog ║
49
+ ╚══════════════════════════════════════════════════╝
50
+ ```
51
+
52
+ **If `has_product_backlog` is true:**
53
+
54
+ Use AskUserQuestion:
55
+ - header: "Backlog exists"
56
+ - question: "A product backlog already exists at `.ace/artifacts/product/product-backlog.md`. What would you like to do?"
57
+ - options:
58
+ - "Update it" — Review and refine the existing backlog
59
+ - "Start fresh" — Discard and create a new backlog from scratch
60
+ - "Skip" — Keep the current backlog as-is
61
+
62
+ If "Update": Read existing file, hold as EXISTING_BACKLOG context, continue to step 2.
63
+ If "Start fresh": Set EXISTING_BACKLOG = null, continue to step 2.
64
+ If "Skip": Exit workflow.
65
+
66
+ **If `has_git` is false:** Initialize git:
67
+ ```bash
68
+ git init
69
+ ```
70
+ </step>
71
+
72
+ <!-- ══════════════════════════════════════════════════════════════════ -->
73
+ <!-- STEP 2: FETCH GITHUB ISSUES -->
74
+ <!-- ══════════════════════════════════════════════════════════════════ -->
75
+
76
+ <step name="fetch-github-issues" order="2">
77
+
78
+ **If `github_project.enabled` is false AND `has_gh_cli` is true:**
79
+
80
+ GitHub CLI is installed but GitHub Project integration isn't configured in ACE.
81
+ Check if this is a GitHub repo:
82
+ ```bash
83
+ gh repo view --json name,owner 2>/dev/null
84
+ ```
85
+
86
+ If the command succeeds (this IS a GitHub repo):
87
+
88
+ Use AskUserQuestion:
89
+ - header: "GitHub"
90
+ - question: "I detected a GitHub repo but GitHub Project integration isn't configured in ACE. If you have epics/features in a GitHub Project, I can import them. How would you like to proceed?"
91
+ - options:
92
+ - "Configure GitHub first" — Run /ace:help to set up GitHub Project integration, then re-run
93
+ - "Skip GitHub" — Continue without GitHub import
94
+
95
+ If "Configure GitHub first":
96
+ - Display:
97
+ ```
98
+ ┌──────────────────────────────────────────────────┐
99
+ │ Next > /ace:help │
100
+ │ Configure GitHub Project integration, │
101
+ │ then re-run /ace:plan-backlog │
102
+ └──────────────────────────────────────────────────┘
103
+ ```
104
+ - Exit workflow.
105
+
106
+ If "Skip GitHub":
107
+ - Set GITHUB_ISSUES = null.
108
+ - Continue to step 3.
109
+
110
+ If the command fails (not a GitHub repo), or if `has_gh_cli` is false:
111
+ - Set GITHUB_ISSUES = null.
112
+ - Continue to step 3.
113
+
114
+ **If `github_project.enabled` is true AND `github_project.gh_installed` is false:**
115
+
116
+ GitHub Project is configured but `gh` CLI is not installed. Warn the user:
117
+ - Display:
118
+ ```
119
+ ! GitHub Project integration is enabled but `gh` CLI is not installed.
120
+ Install it: https://cli.github.com/
121
+ Continuing without GitHub import.
122
+ ```
123
+ - Set GITHUB_ISSUES = null.
124
+ - Continue to step 3.
125
+
126
+ **If `github_project.enabled` is true AND `github_project.gh_installed` is true:**
127
+
128
+ Extract settings: REPO = `github_project.repo`, PROJECT_NUMBER = `github_project.project_number`, OWNER = `github_project.owner`.
129
+
130
+ Display:
131
+ ```
132
+ ┌──────────────────────────────────────────────────┐
133
+ │ ACE > Plan Backlog > GitHub Import │
134
+ └──────────────────────────────────────────────────┘
135
+
136
+ i Fetching epics and features from GitHub Project #{PROJECT_NUMBER}...
137
+ Repo: {REPO} | Owner: {OWNER}
138
+ ```
139
+
140
+ **Fetch all epics and features with full field data (single command):**
141
+
142
+ ```bash
143
+ GITHUB_ISSUES=$(node "${CLAUDE_SKILL_DIR}/script.js" fetch-issues \
144
+ repo={REPO} owner={OWNER} project={PROJECT_NUMBER})
145
+ ```
146
+
147
+ This uses a single paginated GraphQL query to return all Epics and Features with:
148
+ - **number** — GitHub issue number
149
+ - **title** — issue title (preserved as-is)
150
+ - **status** — from the project's Status field (Todo, Refined, In Progress, Done)
151
+ - **priority** — from the project's Priority field (P0–P4)
152
+ - **estimate** — from the project's Estimate field (number)
153
+ - **sprint** — from the project's Sprint/Iteration field
154
+ - **milestone** — from the issue's milestone
155
+ - **url** — full GitHub issue URL
156
+ - **state** — issue state (OPEN/CLOSED)
157
+ - **parent_number** / **parent_title** — parent issue (features only)
158
+
159
+ Type detection uses this priority order (handled by ace-tools):
160
+ 1. If native `issueType` is set → use it (Epic / Feature)
161
+ 2. If title starts with `[Epic]` → type = Epic
162
+ 3. If title starts with `[Feature]` → type = Feature
163
+ 4. Otherwise → skipped (not an epic or feature)
164
+
165
+ The command returns structured JSON:
166
+ ```json
167
+ {
168
+ "epics": [{ number, title, status, priority, estimate, sprint, milestone, url, state }],
169
+ "features": [{ number, title, status, priority, estimate, sprint, milestone, parent_number, parent_title, url, state }],
170
+ "counts": { total, epics, features, skipped }
171
+ }
172
+ ```
173
+
174
+ Features without a parent Epic are "unparented" — present them separately
175
+ during questioning.
176
+
177
+ Hold the parsed JSON as GITHUB_ISSUES.
178
+
179
+ Display summary:
180
+ ```
181
+ + Found {N} epics and {M} features in GitHub Project #{PROJECT_NUMBER}.
182
+ [list epic titles with issue numbers]
183
+ ```
184
+
185
+ Continue to step 3.
186
+ </step>
187
+
188
+ <!-- ══════════════════════════════════════════════════════════════════ -->
189
+ <!-- STEP 3: PREREQUISITE — PRODUCT VISION -->
190
+ <!-- ══════════════════════════════════════════════════════════════════ -->
191
+
192
+ <step name="prerequisite-vision" order="3">
193
+
194
+ **If `has_product_vision` is false:**
195
+
196
+ Inform the user:
197
+ "The product vision is the foundation for backlog planning. It defines the
198
+ high-level capabilities that become epics. Without it, I'd be guessing at
199
+ the product's direction."
200
+
201
+ Use AskUserQuestion:
202
+ - header: "Product Vision"
203
+ - question: "No product vision found. The vision drives backlog structure — each capability becomes an epic. How would you like to proceed?"
204
+ - options:
205
+ - "Run /ace:plan-product-vision first" — Create the vision, then come back
206
+ - "Continue without vision" — I'll describe capabilities during questioning
207
+
208
+ If "Run /ace:plan-product-vision first":
209
+ - Display:
210
+ ```
211
+ ┌──────────────────────────────────────────────────┐
212
+ │ Next > /ace:plan-product-vision │
213
+ │ Then re-run /ace:plan-backlog │
214
+ └──────────────────────────────────────────────────┘
215
+ ```
216
+ - Exit workflow.
217
+
218
+ If "Continue without vision":
219
+ - Set VISION = null
220
+ - Continue to step 4.
221
+
222
+ **If `has_product_vision` is true:**
223
+
224
+ Read `.docs/product/product-vision.md`.
225
+
226
+ Extract and hold as VISION context:
227
+ - **Vision Statement** — the north star (1-2 sentences)
228
+ - **Target Audience** — who uses this product
229
+ - **High-Level Capabilities** — these map directly to epic candidates
230
+ - **Key Objectives** — measurable outcomes (epics should trace to these)
231
+ - **Constraints** — tech, timeline, budget (affects sizing and milestones)
232
+
233
+ The High-Level Capabilities list is the **primary seed for epic discovery**.
234
+ Each capability is a candidate epic. Some may split into multiple epics,
235
+ some may merge. The questioning step will refine this.
236
+
237
+ Continue to step 4.
238
+ </step>
239
+
240
+ <!-- ══════════════════════════════════════════════════════════════════ -->
241
+ <!-- STEP 4: BROWNFIELD WIKI ANALYSIS (Parallel Sub-Agents) -->
242
+ <!-- ══════════════════════════════════════════════════════════════════ -->
243
+
244
+ <step name="wiki-analysis" order="4">
245
+
246
+ **If `is_greenfield` OR `has_wiki` is false:**
247
+
248
+ Set WIKI_ANALYSIS = null.
249
+ Continue to step 5.
250
+
251
+ **If `is_brownfield` AND `has_wiki` is true:**
252
+
253
+ Check `has_wiki_analysis` from INIT (already resolved — do NOT use shell commands to check file existence):
254
+
255
+ If `has_wiki_analysis` is TRUE:
256
+ - Use AskUserQuestion:
257
+ - header: "Wiki Analysis"
258
+ - question: "A previous wiki analysis exists (`.ace/artifacts/wiki/wiki-analysis.md`). What would you like to do?"
259
+ - options:
260
+ - "Reuse it" — Skip wiki analysis, load the existing file
261
+ - "Re-run analysis" — Delete and re-analyze from wiki docs
262
+ - If "Reuse it": read `.ace/artifacts/wiki/wiki-analysis.md`, hold as WIKI_ANALYSIS, continue to step 5.
263
+ - If "Re-run analysis": delete the file and proceed below.
264
+
265
+ Display:
266
+ ```
267
+ ┌──────────────────────────────────────────────────┐
268
+ │ ACE > Plan Backlog > Wiki Analysis │
269
+ └──────────────────────────────────────────────────┘
270
+
271
+ i Analyzing wiki documentation to infer existing
272
+ epics, features, and their status...
273
+ ```
274
+
275
+ Spawn parallel analysis agents using `run_in_background=true`. Each agent reads wiki
276
+ content and APPENDS its summary directly to a shared file on disk.
277
+
278
+ **CRITICAL — Context Window Protection:**
279
+ The `ace-product-owner` agent has a built-in `<structured-returns>` protocol:
280
+ when spawned as a background agent, it writes to disk and returns ONLY a ~10-line
281
+ confirmation (file path + line count). This prevents agent output from inflating
282
+ the main context window.
283
+
284
+ **CRITICAL — Do NOT call TaskOutput:**
285
+ After spawning background agents, do NOT call TaskOutput to read their results.
286
+ You will be automatically notified when each agent completes — IGNORE those notifications.
287
+ The agents write to `.ace/artifacts/wiki/wiki-analysis.md` on disk. You do not need their return messages.
288
+ After all notifications arrive, verify the file with `wc -l .ace/artifacts/wiki/wiki-analysis.md`,
289
+ then proceed directly to the synthesizer.
290
+
291
+ Scale agents by subsystem count: 1 system-wide + 1 per subsystem, up to 10 total.
292
+ If subsystems exceed 9, batch 2-3 per agent.
293
+
294
+ All agents write to the same file: `.ace/artifacts/wiki/wiki-analysis.md`
295
+
296
+ First, create the file with a header:
297
+ ```bash
298
+ mkdir -p .ace/artifacts/wiki
299
+ echo "# Wiki Analysis for Backlog Planning" > .ace/artifacts/wiki/wiki-analysis.md
300
+ echo "" >> .ace/artifacts/wiki/wiki-analysis.md
301
+ ```
302
+
303
+ Display:
304
+ ```
305
+ i Spawning [N] wiki analysis agents in background
306
+ (1 system-wide + [M] subsystem-specific)...
307
+ Agents write directly to .ace/artifacts/wiki/wiki-analysis.md
308
+ ```
309
+
310
+ **Agent 1: System-Wide Analyst** (always, if `has_wiki_system_wide`):
311
+
312
+ Task tool parameters:
313
+ ```
314
+ subagent_type: "ace-product-owner"
315
+ model: "{PO_MODEL}"
316
+ run_in_background: true
317
+ description: "Analyze system-wide wiki"
318
+ ```
319
+
320
+ Prompt:
321
+ ```
322
+ You are analyzing wiki documentation to extract backlog-relevant information.
323
+
324
+ **Read these files (if they exist):**
325
+ - .docs/wiki/system-wide/system-architecture.md
326
+ - .docs/wiki/system-wide/system-structure.md
327
+
328
+ **APPEND the following structured summary to `.ace/artifacts/wiki/wiki-analysis.md`:**
329
+
330
+ ## System-Wide
331
+
332
+ - **System overview:** [1-2 sentences from system overview]
333
+ - **Subsystem count:** [N]
334
+ - **Subsystem responsibilities:**
335
+ - [Subsystem Name]: [Responsibility from matrix]
336
+ - [Subsystem Name]: [Responsibility from matrix]
337
+ - **Tech stack:** [comma-separated list of key technologies]
338
+ - **Communication patterns:** [sync/async/hybrid]
339
+ - **Capability areas inferred:** [list of broad capability areas derived from subsystem responsibilities]
340
+
341
+ IMPORTANT: Use Bash with `>> .ace/artifacts/wiki/wiki-analysis.md` to APPEND — do NOT overwrite.
342
+ If a file does not exist, note 'not found' for that section in the appended output.
343
+ ```
344
+
345
+ **1 agent per subsystem** (if `has_wiki_subsystems` AND `wiki_subsystem_names` is non-empty):
346
+
347
+ For each subsystem name (or batch of 2-3 if more than 9 subsystems):
348
+
349
+ Task tool parameters:
350
+ ```
351
+ subagent_type: "ace-product-owner"
352
+ model: "{PO_MODEL}"
353
+ run_in_background: true
354
+ description: "Analyze {subsystem_name} wiki"
355
+ ```
356
+
357
+ Prompt:
358
+ ```
359
+ You are analyzing subsystem wiki documentation to extract features and their status.
360
+
361
+ **Subsystem to analyze:** {subsystem_name}
362
+
363
+ **Read these files (if they exist):**
364
+ - .docs/wiki/subsystems/{subsystem_name}/architecture.md
365
+ - .docs/wiki/subsystems/{subsystem_name}/structure.md
366
+
367
+ **APPEND the following structured summary to `.ace/artifacts/wiki/wiki-analysis.md`:**
368
+
369
+ ## Subsystem: {subsystem_name}
370
+
371
+ - **Responsibility:** [from architecture.md system context or overview]
372
+ - **Components:** [list of L3 components from architecture.md]
373
+ - **Inferred features:**
374
+ - [Feature name]: [status] — [evidence]
375
+ (Status inference logic:
376
+ - 'Done' if architecture doc shows component with documented flows AND structure shows implementation files
377
+ - 'In Progress' if partially documented — structure exists but architecture incomplete, or vice versa
378
+ - 'Todo' if mentioned in responsibilities but no components or flows documented)
379
+ - **Data ownership:** [what data this subsystem owns]
380
+ - **Key dependencies:** [inbound/outbound from dependency inventory]
381
+
382
+ IMPORTANT: Use Bash with `>> .ace/artifacts/wiki/wiki-analysis.md` to APPEND — do NOT overwrite.
383
+ If a file does not exist, note 'not found' for that section in the appended output.
384
+ ```
385
+
386
+ **After all background notifications arrive:**
387
+
388
+ Do NOT call TaskOutput. Just verify the file:
389
+ ```bash
390
+ wc -l .ace/artifacts/wiki/wiki-analysis.md
391
+ ```
392
+
393
+ **Synthesize wiki analysis:**
394
+
395
+ The raw `.ace/artifacts/wiki/wiki-analysis.md` contains appended outputs from all agents —
396
+ useful data but unstructured. Spawn a synthesizer agent to read it and produce
397
+ a concise, opinionated summary focused on backlog implications.
398
+
399
+ Task tool parameters:
400
+ ```
401
+ subagent_type: "ace-product-owner"
402
+ model: "{PO_MODEL}"
403
+ description: "Synthesize wiki analysis"
404
+ ```
405
+
406
+ Prompt:
407
+ ```
408
+ You are synthesizing wiki analysis for backlog planning.
409
+
410
+ **Read:** `.ace/artifacts/wiki/wiki-analysis.md`
411
+
412
+ This file contains raw structured summaries from multiple wiki analysis agents
413
+ (1 system-wide + N subsystem-specific). Your job: synthesize into a single
414
+ concise backlog-relevant summary.
415
+
416
+ **Write a synthesized summary to `.ace/artifacts/wiki/wiki-analysis.md` (overwrite the raw version):**
417
+
418
+ # Wiki Analysis Summary
419
+
420
+ ## System Overview
421
+ [2-3 sentences: what is this system, what does it do]
422
+
423
+ ## Tech Stack
424
+ [comma-separated key technologies found]
425
+
426
+ ## Capability Areas
427
+ [List of broad capability areas derived from subsystem responsibilities — these become epic candidates]
428
+
429
+ ## Feature Inventory
430
+ | Subsystem | Feature | Status | Evidence |
431
+ |-----------|---------|--------|----------|
432
+ [One row per inferred feature across ALL subsystems. Status: Done/In Progress/Todo]
433
+
434
+ ## Cross-Cutting Concerns
435
+ [Patterns that span multiple subsystems — communication, shared data, etc.]
436
+
437
+ ## Gaps & Unknowns
438
+ [What couldn't be determined from wiki docs alone]
439
+
440
+ RULES:
441
+ - Synthesize, don't concatenate — integrate findings across subsystems
442
+ - Feature inventory table must be comprehensive (every feature from every subsystem)
443
+ - Be opinionated: 'This system has N capability areas suggesting N epics'
444
+ - Keep it concise — this will be held in the main context window
445
+ ```
446
+
447
+ After synthesis completes, read `.ace/artifacts/wiki/wiki-analysis.md` and hold as WIKI_ANALYSIS.
448
+
449
+ Continue to step 5.
450
+ </step>
451
+
452
+ <!-- ══════════════════════════════════════════════════════════════════ -->
453
+ <!-- STEP 5: OPTIONAL DOMAIN RESEARCH -->
454
+ <!-- ══════════════════════════════════════════════════════════════════ -->
455
+
456
+ <step name="domain-research-decision" order="5a">
457
+
458
+ Use `has_features_research` and `has_architecture_research` from INIT
459
+ (already resolved — do NOT use shell commands to check file existence).
460
+
461
+ <!-- ── 5a-1: Existing research found ─────────────────────────────── -->
462
+
463
+ **If `has_features_research` is TRUE:**
464
+
465
+ Read `.ace/research/FEATURES.md` and display a brief summary (table stakes count,
466
+ differentiator count, key categories). If `has_architecture_research` is also TRUE,
467
+ read `.ace/research/ARCHITECTURE.md` and summarize (capability areas, component count).
468
+
469
+ Use AskUserQuestion:
470
+ - header: "Research"
471
+ - question: "I found existing domain research. Would you like to reuse it or regenerate?"
472
+ - options:
473
+ - "Use existing research (Recommended)" — Reuse the current FEATURES.md and ARCHITECTURE.md
474
+ - "Regenerate research" — Discard and re-run domain research from scratch
475
+ - "Skip research" — Don't use any research for this backlog
476
+
477
+ If "Use existing research":
478
+ - Hold `.ace/research/FEATURES.md` content as RESEARCH.features
479
+ - If `has_architecture_research` is TRUE AND `has_system_architecture` is FALSE,
480
+ hold `.ace/research/ARCHITECTURE.md` content as RESEARCH.architecture
481
+ - Display the "Research Complete" banner (same as step 5b) with findings from existing files
482
+ - Continue to step 6.
483
+
484
+ If "Skip research":
485
+ - Set RESEARCH = null.
486
+ - Continue to step 6.
487
+
488
+ If "Regenerate research":
489
+ - Continue to step 5b (execute research).
490
+
491
+ <!-- ── 5a-2: No existing research ────────────────────────────────── -->
492
+
493
+ **If `has_features_research` is FALSE:**
494
+
495
+ If VISION is null AND WIKI_ANALYSIS is null AND no $ARGUMENTS provided:
496
+ - Research is strongly recommended (bare context). Skip the question and
497
+ auto-recommend: "I have very little context. Let me research the domain first."
498
+ - Continue to step 5b (execute research).
499
+
500
+ Otherwise:
501
+
502
+ Use AskUserQuestion:
503
+ - header: "Research"
504
+ - question: "Would you like me to research standard features and capability areas for this domain before planning the backlog?"
505
+ - options:
506
+ - "Research first (Recommended)" — Discover standard stacks, expected features, common epic structures
507
+ - "Skip research" — I know this domain well, go straight to questioning
508
+
509
+ If "Research first" (or auto-recommended):
510
+ - Continue to step 5b (execute research).
511
+
512
+ If "Skip research":
513
+ - Set RESEARCH = null.
514
+ - Continue to step 6.
515
+
516
+ </step>
517
+
518
+ <step name="domain-research-execute" order="5b">
519
+
520
+ Infer the domain from VISION (if available) or from the user's earlier description.
521
+
522
+ Determine which researchers to spawn based on existing wiki documentation:
523
+
524
+ - **Features Researcher** — ALWAYS spawned (domain feature landscape is distinct from wiki docs)
525
+ - **Architecture Patterns Researcher** — ONLY if `has_system_architecture` is FALSE.
526
+ If the wiki already has system-architecture.md (from /ace:map-system), that architecture
527
+ context was already captured in WIKI_ANALYSIS (step 4). Spawning a domain architecture
528
+ researcher would produce redundant or conflicting content.
529
+
530
+ Display (adapts to researcher count):
531
+ ```
532
+ ┌──────────────────────────────────────────────────┐
533
+ │ ACE > Plan Backlog > Domain Research │
534
+ └──────────────────────────────────────────────────┘
535
+
536
+ i Researching [domain] ecosystem...
537
+ Spawning [1 or 2] researcher(s):
538
+ → Features research
539
+ [→ Architecture patterns research] ← only if no wiki architecture exists
540
+ ```
541
+
542
+ If `has_system_architecture` is TRUE, also display:
543
+ ```
544
+ i Skipping architecture research — wiki architecture already captured in step 4.
545
+ ```
546
+
547
+ RESEARCHER_MODEL is available from INIT.researcher_model — do NOT re-run resolve-model.
548
+
549
+ **Features Researcher (always spawned):**
550
+
551
+ Task tool parameters:
552
+ ```
553
+ subagent_type: "general-purpose"
554
+ model: "{RESEARCHER_MODEL}"
555
+ run_in_background: true
556
+ description: "Features research"
557
+ ```
558
+
559
+ Prompt:
560
+ ```
561
+ You are the ace-project-researcher agent. Follow your agent instructions.
562
+
563
+ <research_type>
564
+ Project Research — Features dimension for [domain].
565
+ </research_type>
566
+
567
+ <question>
568
+ What features do [domain] products have? What's table stakes vs differentiating?
569
+ </question>
570
+
571
+ <project_context>
572
+ [VISION summary if available, or user's product description]
573
+ </project_context>
574
+
575
+ <downstream_consumer>
576
+ Your FEATURES.md feeds into backlog creation. Categorize clearly:
577
+ - Table stakes (must have or users leave)
578
+ - Differentiators (competitive advantage)
579
+ - Anti-features (things to deliberately NOT build)
580
+ - Feature dependencies (what depends on what)
581
+ </downstream_consumer>
582
+
583
+ <output>
584
+ Write to: .ace/research/FEATURES.md
585
+ </output>
586
+
587
+ **WRITE TO FILE DIRECTLY. RETURN ONLY CONFIRMATION.**
588
+ Your response must be ~5 lines max. Just confirm what was written and the line count.
589
+ Do NOT return file contents or research findings in your response.
590
+ ```
591
+
592
+ **Architecture Patterns Researcher (only if `has_system_architecture` is FALSE):**
593
+
594
+ Task tool parameters:
595
+ ```
596
+ subagent_type: "general-purpose"
597
+ model: "{RESEARCHER_MODEL}"
598
+ run_in_background: true
599
+ description: "Architecture patterns research"
600
+ ```
601
+
602
+ Prompt:
603
+ ```
604
+ You are the ace-project-researcher agent. Follow your agent instructions.
605
+
606
+ <research_type>
607
+ Project Research — Architecture/Epic structure dimension for [domain].
608
+ </research_type>
609
+
610
+ <question>
611
+ How are [domain] systems typically structured? What are common capability
612
+ boundaries that translate to epics? What are the major components?
613
+ </question>
614
+
615
+ <project_context>
616
+ [VISION summary if available, or user's product description]
617
+ </project_context>
618
+
619
+ <downstream_consumer>
620
+ Your ARCHITECTURE.md informs epic structure in the backlog. Include:
621
+ - Component boundaries (what talks to what)
622
+ - Suggested epic/capability groupings
623
+ - Data flow (how information moves)
624
+ - Suggested build order (dependencies between components)
625
+ </downstream_consumer>
626
+
627
+ <output>
628
+ Write to: .ace/research/ARCHITECTURE.md
629
+ </output>
630
+
631
+ **WRITE TO FILE DIRECTLY. RETURN ONLY CONFIRMATION.**
632
+ Your response must be ~5 lines max. Just confirm what was written and the line count.
633
+ Do NOT return file contents or research findings in your response.
634
+ ```
635
+
636
+ **After all background notifications arrive:**
637
+
638
+ Do NOT call TaskOutput. Just verify the files exist:
639
+ ```bash
640
+ wc -l .ace/research/FEATURES.md .ace/research/ARCHITECTURE.md 2>/dev/null
641
+ ```
642
+
643
+ Read the research files and hold combined results as RESEARCH:
644
+ - features: key findings from .ace/research/FEATURES.md (table stakes, differentiators, anti-features)
645
+ - architecture: IF .ace/research/ARCHITECTURE.md was created, include its key findings
646
+ (capability boundaries, suggested epics). Otherwise, architecture context comes from
647
+ WIKI_ANALYSIS (step 3) — do NOT duplicate it into RESEARCH.
648
+
649
+ Display key findings:
650
+ ```
651
+ ┌──────────────────────────────────────────────────┐
652
+ │ ACE > Plan Backlog > Research Complete │
653
+ └──────────────────────────────────────────────────┘
654
+
655
+ + Research complete.
656
+
657
+ Table stakes: [comma-separated list]
658
+ Differentiators: [comma-separated list]
659
+ [Suggested capability areas: [comma-separated list]] ← only if architecture was researched
660
+
661
+ Files: .ace/research/
662
+ ```
663
+
664
+ Continue to step 6.
665
+ </step>
666
+
667
+ <!-- ══════════════════════════════════════════════════════════════════ -->
668
+ <!-- STEP 6: ABSORB INPUT -->
669
+ <!-- ══════════════════════════════════════════════════════════════════ -->
670
+
671
+ <step name="absorb-input" order="6">
672
+
673
+ **If $ARGUMENTS is provided (user passed text or file):**
674
+
675
+ Read/absorb the input content. Hold as INPUT_CONTEXT.
676
+
677
+ Do NOT summarize it back to the user. Do NOT restructure it yet.
678
+ Simply hold it for use in step 7 questioning.
679
+
680
+ Note what kind of input it is:
681
+ - Contains suggested epics/features? Hold as SUGGESTED_ITEMS.
682
+ - Contains product description? Hold as PRODUCT_DESCRIPTION.
683
+ - Contains PRD or specs? Hold as SPECS.
684
+ - Contains a mix? Categorize each section.
685
+
686
+ **If no $ARGUMENTS:**
687
+
688
+ Set INPUT_CONTEXT = null.
689
+
690
+ Continue to step 7.
691
+ </step>
692
+
693
+ <!-- ══════════════════════════════════════════════════════════════════ -->
694
+ <!-- STEP 7: DEEP QUESTIONING -->
695
+ <!-- ══════════════════════════════════════════════════════════════════ -->
696
+
697
+ <step name="deep-questioning" order="7">
698
+ Follow the questioning guide from `questioning.xml`. You are a thinking partner,
699
+ not an interviewer.
700
+
701
+ <!-- ── 7a: Determine run mode ─────────────────────────────────────── -->
702
+
703
+ **Determine RUN_MODE:**
704
+
705
+ - **UPDATE** — EXISTING_BACKLOG is set (user chose "Update it" in step 1)
706
+ - **CREATE** — EXISTING_BACKLOG is null (first run or "Start fresh")
707
+
708
+ <!-- ── 7b: UPDATE mode — start from existing backlog ──────────────── -->
709
+
710
+ **If RUN_MODE is UPDATE:**
711
+
712
+ Read EXISTING_BACKLOG and build a current inventory:
713
+ - Parse all epics (IDs, titles, feature counts, statuses, GitHub links)
714
+ - Parse all features (IDs, titles, parent epic, statuses, GitHub links)
715
+
716
+ If GITHUB_ISSUES is set, cross-reference:
717
+ - **Backlog-only items** — items in backlog without a GitHub link
718
+ - **GitHub-only items** — epics/features in GitHub NOT found in the backlog
719
+ (match by issue number in Link column; unmatched GitHub items are new)
720
+ - **Status drift** — items where backlog status differs from GitHub status
721
+ - **New GitHub items** — epics/features added directly in GitHub since last sync
722
+
723
+ Present the current state:
724
+ ```
725
+ Your backlog has [N] epics with [M] features.
726
+ [If GitHub: [X] items linked to GitHub, [Y] not yet linked.]
727
+ [If drift: [Z] items have status changes in GitHub.]
728
+ [If new GH items: [W] new items found in GitHub not in the backlog.]
729
+ ```
730
+
731
+ Use AskUserQuestion:
732
+ - header: "Update"
733
+ - question: "What would you like to change?"
734
+ - options:
735
+ - "Add new epics/features" — Expand the backlog with new items
736
+ - "Sync from GitHub" — Import new GitHub items and update statuses
737
+ - "Reorganize" — Reorder, merge, split, or remove items
738
+ - "Full review" — Walk through all epics and refine
739
+
740
+ If "Add new epics/features":
741
+ - Ask what to add. Follow natural conversation. Then proceed to decision gate.
742
+
743
+ If "Sync from GitHub":
744
+ - If there are GitHub-only items: present them and ask which to add to backlog.
745
+ - If there are status drifts: present them and ask which to accept.
746
+ - Merge accepted changes into the backlog plan. Then proceed to decision gate.
747
+
748
+ If "Reorganize":
749
+ - Present the epic index. Ask what to change. Iterate. Then proceed to decision gate.
750
+
751
+ If "Full review":
752
+ - Fall through to the epic-by-epic refinement below (same as CREATE mode).
753
+
754
+ <!-- ── 7c: CREATE mode — context-aware opening ────────────────────── -->
755
+
756
+ **If RUN_MODE is CREATE:**
757
+
758
+ Assess available context richness:
759
+
760
+ Compute CONTEXT_RICHNESS:
761
+ - RICH: VISION is set AND (WIKI_ANALYSIS is set OR RESEARCH is set OR GITHUB_ISSUES is set)
762
+ - MODERATE: VISION is set OR (WIKI_ANALYSIS is set AND INPUT_CONTEXT is set) OR (RESEARCH is set AND INPUT_CONTEXT is set) OR GITHUB_ISSUES is set
763
+ - LEAN: INPUT_CONTEXT only (no vision, no wiki, no research, no GitHub issues)
764
+ - BARE: Nothing available
765
+
766
+ **Opening — adapt based on context richness:**
767
+
768
+ If RICH (vision + wiki/research/github + possibly input):
769
+ - Synthesize what you know: "Based on your product vision and
770
+ [codebase analysis / domain research / GitHub issues], I see these capability areas..."
771
+ - Present a draft epic list derived from:
772
+ 1. Vision High-Level Capabilities (primary source)
773
+ 2. GitHub Issues — use EXACT GitHub titles and #[issue_number] as ID (if exists)
774
+ 3. Subsystem responsibilities from WIKI_ANALYSIS (if exists)
775
+ 4. Research findings — table stakes and suggested capability areas (if exists)
776
+ 5. INPUT_CONTEXT suggested items (if any)
777
+ - For GitHub issues: present with EXACT titles (do NOT rephrase), #N as ID, and their GitHub status/priority
778
+ - For brownfield with wiki: note inferred feature statuses (Done/In Progress/Todo)
779
+ - For research: highlight table stakes that aren't yet covered
780
+ - Probe: "Does this match your mental model? What's missing? What should be
781
+ reordered or merged?"
782
+
783
+ If MODERATE (some context, not the full picture):
784
+ - If vision exists: "Your product vision lists these capability areas:
785
+ [list from High-Level Capabilities]. Let's turn these into epics with
786
+ concrete features. Starting with the first — what are the specific
787
+ things it needs to deliver?"
788
+ - If no vision but wiki + input: "I've analyzed your codebase documentation
789
+ and your input. Here's what I see as the current state: [summary].
790
+ Let's structure this into a backlog."
791
+ - If research + input: "Domain research suggests these capability areas:
792
+ [list]. Combined with your input, let me propose an initial structure."
793
+
794
+ If LEAN (input doc only):
795
+ - Absorb the input. Probe structure: "I've read your document. It mentions
796
+ [key themes]. Let me make sure I understand the scope before we structure
797
+ the backlog."
798
+
799
+ If BARE (nothing):
800
+ - Open with: "What are the major things this product needs to do?"
801
+ - Wait for their response. This gives you context for intelligent follow-ups.
802
+
803
+ **Follow the thread:**
804
+
805
+ Based on what they said (and what you absorbed), ask follow-up questions that dig
806
+ into their response. Use AskUserQuestion with options that probe what they mentioned —
807
+ interpretations, clarifications, concrete examples.
808
+
809
+ Keep following threads. Each answer opens new threads to explore:
810
+ - What capability area is this feature part of?
811
+ - What does this feature actually deliver to the user?
812
+ - Is this already partially built? (use wiki analysis to confirm)
813
+ - What's the relative priority?
814
+ - What depends on what?
815
+ - What's MVP vs future?
816
+
817
+ **Map answers to backlog template structure (background, not out loud):**
818
+
819
+ **CRITICAL — GitHub identity preservation:**
820
+ Items from GITHUB_ISSUES use #[issue_number] as their ID and their EXACT GitHub title.
821
+ Do NOT assign E[N]/F[N] IDs to GitHub-linked items. Do NOT rephrase their titles.
822
+ Only new items (not in GitHub) get E[N]/F[N] IDs and new titles.
823
+
824
+ As you question, mentally track coverage against backlog needs:
825
+ - [ ] Capability areas (epics) identified — as many as the product naturally requires
826
+ - [ ] Each epic has features — as many as naturally emerge (Agile scoping, not arbitrary limits)
827
+ - [ ] Features are concrete deliverables (what it delivers, not how)
828
+ - [ ] Status understood for each (Todo / Refined / In Progress / Done)
829
+ - [ ] Size estimated using Fibonacci×10 (10, 20, 30, 50, 80, 130)
830
+ - [ ] Milestones assigned (mvp, v0.1.0, v0.2.0, etc.)
831
+ - [ ] Cross-epic dependencies identified
832
+ - [ ] Vision capability coverage validated (every capability maps to at least 1 epic)
833
+
834
+ Don't walk through this as a checklist. Weave questions naturally based on
835
+ the conversation. If gaps remain after the conversation feels complete, probe
836
+ those specific areas.
837
+
838
+ **Epic-by-epic refinement:**
839
+
840
+ Once the initial epic list is established, go through each epic:
841
+
842
+ Use AskUserQuestion for each epic:
843
+ - header: "[Epic Title]"
844
+ - question: "Here are the features I have for [Epic Title]. Confirm, add, or remove:"
845
+ - options:
846
+ - "Looks good" — Features are complete for this epic
847
+ - "Add more" — I have more features to add
848
+ - "Remove some" — Some of these don't belong
849
+ - "Split this epic" — This is too broad, let's break it apart
850
+
851
+ For each feature in the epic, confirm or discuss:
852
+ - Title and description
853
+ - Status (if brownfield with wiki, present inferred status for confirmation)
854
+ - Size (Fibonacci×10: 10, 20, 30, 50, 80, 130)
855
+ - Milestone
856
+
857
+ **Gap check:**
858
+
859
+ After all epics are refined:
860
+ - "Any capability areas we haven't covered?"
861
+ - If VISION exists, validate: "Every vision capability should map to at least one
862
+ epic. Let me check..." Present any unmapped capabilities.
863
+ - If RESEARCH exists, validate: "Research identified these table stakes:
864
+ [list]. Are they all covered?" Surface any missing table stakes.
865
+ - "Any cross-cutting concerns that need their own epic? (e.g., DevOps/CI,
866
+ Monitoring, Documentation, Security)"
867
+
868
+ **Decision gate:**
869
+
870
+ When the backlog feels complete:
871
+
872
+ Use AskUserQuestion:
873
+ - header: "Ready?"
874
+ - question: "I have [N] epics with [M] total features. Ready to create the product backlog?"
875
+ - options:
876
+ - "Create product backlog" — Let's write it
877
+ - "Keep exploring" — I want to add more or adjust
878
+ - "Show me what you have" — Present a summary before deciding
879
+
880
+ If "Show me what you have":
881
+ - Display epic index as a quick table:
882
+ ```
883
+ | ID | Epic | Features | Milestone |
884
+ |----|------|----------|-----------|
885
+ | E1 | [Title] | [count] features | [milestone] |
886
+ | E2 | [Title] | [count] features | [milestone] |
887
+ ...
888
+ ```
889
+ - Return to decision gate.
890
+
891
+ If "Keep exploring" — ask what they want to add, or identify gaps and probe naturally.
892
+
893
+ Loop until "Create product backlog" selected.
894
+ </step>
895
+
896
+ <!-- ══════════════════════════════════════════════════════════════════ -->
897
+ <!-- STEP 8: WRITE BACKLOG -->
898
+ <!-- ══════════════════════════════════════════════════════════════════ -->
899
+
900
+ <step name="write-backlog" order="8">
901
+
902
+ **Determine WRITE_MODE based on RUN_MODE and what changed:**
903
+
904
+ - **CREATE** — RUN_MODE is CREATE, or user chose "Start fresh" in step 1.
905
+ Writes a new backlog from scratch.
906
+ - **UPDATE** — RUN_MODE is UPDATE. Edits the existing backlog in place,
907
+ preserving IDs, GitHub links, and unchanged items.
908
+
909
+ <!-- ── 8a: CREATE mode — write new backlog ────────────────────────── -->
910
+
911
+ **If WRITE_MODE is CREATE:**
912
+
913
+ Create directory structure:
914
+ ```bash
915
+ mkdir -p .ace/artifacts/product
916
+ ```
917
+
918
+ Prepare a context brief (500 words max) that distills:
919
+ - Product direction summary (from vision if available, else from questioning)
920
+ - Complete epic list with: ID, Title, Description, Status, Priority, Size (Fibonacci×10), Sprint, Milestone, Link
921
+ - ID = #[issue_number] for GitHub-linked epics, E[N] for new epics
922
+ - Title = EXACT GitHub title for GitHub-linked items (verbatim)
923
+ - For each epic, complete feature list with: ID, Title, Description, Status, Priority, Size, Sprint, Milestone, Link
924
+ - ID = #[issue_number] for GitHub-linked features, F[N] for new features
925
+ - Title = EXACT GitHub title for GitHub-linked items (verbatim)
926
+ - Local Feature ID numbering: sequential across entire backlog (F1, F2, ... FN) — only for non-GitHub items
927
+ - Epic ordering rationale (strategic priority)
928
+ - Any cross-epic dependencies noted
929
+ - If RESEARCH exists: flag any table stakes that were included and their coverage
930
+ - If GITHUB_ISSUES exists: include GitHub issue numbers and URLs for items that already
931
+ have corresponding GitHub issues. Map GitHub Status/Priority/Sprint/Estimate to our columns.
932
+
933
+ Spawn the backlog-writing agent:
934
+
935
+ ```
936
+ Task(
937
+ prompt="You are an Agile Product Owner writing a product backlog document.
938
+
939
+ **Context brief from questioning session:**
940
+ {paste the context brief here}
941
+
942
+ **Instructions:**
943
+ 1. Read the product backlog template: ${CLAUDE_SKILL_DIR}/product-backlog-template.xml
944
+ 2. Write `.ace/artifacts/product/product-backlog.md` following the template structure exactly
945
+ 3. Include the header paragraph explaining product direction
946
+ 4. Write the Epic Index table (ordered by strategic priority)
947
+ 5. Write each Epic Detail section with its Feature table
948
+ 6. Follow all column definitions from the template:
949
+ - ID: #[issue_number] for GitHub-linked items, E[N] for local epics, F[N] for local features
950
+ - Title: EXACT GitHub title for GitHub-linked items (do NOT rephrase); 5-10 words for new items
951
+ - Description: 1-2 sentences
952
+ - Status: Todo | Refined | In Progress | Done
953
+ - Priority: Critical | High | Medium | Low
954
+ - Size: Fibonacci×10 values only (10, 20, 30, 50, 80, 130)
955
+ - Sprint: Sprint name/iteration or '—' if unassigned
956
+ - Milestone: mvp | v0.1.0 | v0.2.0 | etc.
957
+ - Link: [#N](url) if GitHub issue exists, otherwise '—'
958
+ 7. Apply ordering rules: epics by strategic priority, features by delivery sequence
959
+ 8. Apply Agile scoping principles:
960
+ - Epics are broad capability categories — as many as the product naturally requires
961
+ - Features are concrete deliverables within epics — as many as naturally emerge
962
+ - Local Feature IDs (F[N]) are globally sequential (F1, F2, F3... not restarting per epic)
963
+ - Epic status reflects aggregate of features
964
+ - 130-point items flagged for potential splitting
965
+ 9. GitHub integration (CRITICAL — identity preservation):
966
+ - GitHub-linked items: ID = #[issue_number], Title = EXACT GitHub title (verbatim, no rephrasing)
967
+ - Epic detail section headers: ### #45: Exact GitHub Title (not ### E1: ...)
968
+ - Link column: [#N](url) for GitHub items, '—' for local items
969
+ - Map GitHub Priority/Status/Sprint/Estimate to our columns
970
+ - Only items without a GitHub issue get E[N]/F[N] IDs
971
+
972
+ 10. Table formatting (CRITICAL for readability):
973
+ - Pad ALL cells with spaces so column separators | align vertically
974
+ - Separator row dashes must match column widths
975
+ - Follow the table-formatting guideline in the template for minimum column widths
976
+ - Every row in a table must have the same total width
977
+
978
+ Write the file using the Write tool.
979
+
980
+ **Return format — ONLY this, nothing else:**
981
+ DONE
982
+ - Epic count: [N]
983
+ - Feature count: [N]
984
+ - MVP scope: [number of features in mvp milestone]
985
+ - Epics: [comma-separated list of epic titles]
986
+ - GitHub-linked items: [N]",
987
+ subagent_type="ace-product-owner",
988
+ model="{PO_MODEL}",
989
+ description="Write product backlog document"
990
+ )
991
+ ```
992
+
993
+ <!-- ── 8b: UPDATE mode — edit existing backlog ────────────────────── -->
994
+
995
+ **If WRITE_MODE is UPDATE:**
996
+
997
+ Prepare a change brief that describes exactly what to change:
998
+ - **Additions:** new epics/features to add (with all columns populated)
999
+ - New Feature IDs continue from the highest existing F[N] in the backlog
1000
+ - New Epic IDs continue from the highest existing E[N]
1001
+ - **Removals:** items to delete (by ID)
1002
+ - **Modifications:** items to update (by ID, with field changes — e.g., status, size, milestone, priority)
1003
+ - **Status syncs from GitHub:** items where GitHub status should overwrite backlog status
1004
+ - **New GitHub imports:** items from GitHub to add to the backlog
1005
+ (include issue number and URL for the Link column)
1006
+ - **Reorders:** if epic ordering changed
1007
+
1008
+ Spawn the backlog-editing agent:
1009
+
1010
+ ```
1011
+ Task(
1012
+ prompt="You are an Agile Product Owner editing an existing product backlog.
1013
+
1014
+ **Read the current backlog:** `.ace/artifacts/product/product-backlog.md`
1015
+ **Read the template for reference:** `${CLAUDE_SKILL_DIR}/product-backlog-template.xml`
1016
+
1017
+ **Changes to apply:**
1018
+ {paste the change brief here}
1019
+
1020
+ **Rules:**
1021
+ - PRESERVE all existing IDs (#N for GitHub-linked, E[N]/F[N] for local), titles, and unchanged items exactly as-is
1022
+ - GitHub-linked items keep their #[issue_number] ID and EXACT GitHub title — never change these
1023
+ - New local Feature IDs continue sequentially from the highest existing F[N]
1024
+ - New local Epic IDs continue sequentially from the highest existing E[N]
1025
+ - Update the Epic Index table to reflect any additions, removals, or reorders
1026
+ - Update Epic status to reflect aggregate of its features
1027
+ - Size values must be Fibonacci×10 only: 10, 20, 30, 50, 80, 130
1028
+ - Maintain all template formatting — especially table column alignment:
1029
+ pad cells with spaces so | separators align vertically across all rows.
1030
+ Follow the table-formatting guideline in the template for minimum column widths.
1031
+ - If adding items with GitHub issue numbers, set Link = [#N](url)
1032
+ - Do NOT change items that aren't in the change brief
1033
+
1034
+ Use the Edit tool to modify in place. If changes are extensive (new epics added,
1035
+ major reorders), use the Write tool to rewrite the file completely.
1036
+
1037
+ **Return format — ONLY this, nothing else:**
1038
+ DONE
1039
+ - Added: [N] epics, [M] features
1040
+ - Modified: [X] items
1041
+ - Removed: [Y] items
1042
+ - Total: [N] epics, [M] features
1043
+ - GitHub-linked items: [Z]",
1044
+ subagent_type="ace-product-owner",
1045
+ model="{PO_MODEL}",
1046
+ description="Update product backlog document"
1047
+ )
1048
+ ```
1049
+ </step>
1050
+
1051
+ <!-- ══════════════════════════════════════════════════════════════════ -->
1052
+ <!-- STEP 9: REVIEW AND APPROVE -->
1053
+ <!-- ══════════════════════════════════════════════════════════════════ -->
1054
+
1055
+ <step name="review" order="9">
1056
+ Show the agent's returned summary to the user. Then:
1057
+
1058
+ Use AskUserQuestion:
1059
+ - header: "Backlog"
1060
+ - question: "Product backlog written to `.ace/artifacts/product/product-backlog.md`. Does this look right? Review the full file in your editor for details."
1061
+ - options:
1062
+ - "Approve" — Looks good, commit it
1063
+ - "Adjust" — I want to change some things
1064
+ - "Redo questioning" — Let's go back and explore more
1065
+
1066
+ **If "Adjust":**
1067
+ - Ask what they want to change (add/remove epics, reorder, change milestones, etc.)
1068
+ - Spawn a Task agent to edit:
1069
+ ```
1070
+ Task(
1071
+ prompt="Read `.ace/artifacts/product/product-backlog.md` and make these changes:
1072
+ {user's requested changes}.
1073
+
1074
+ **Rules:**
1075
+ - Maintain all template formatting — especially table column alignment:
1076
+ pad cells with spaces so | separators align vertically across all rows
1077
+ - Keep Feature IDs globally sequential — if adding new features, use the next available F[N]
1078
+ - Update Epic status to reflect aggregate feature status
1079
+ - Size values must be Fibonacci×10 only: 10, 20, 30, 50, 80, 130
1080
+ - Re-read the template for reference: ${CLAUDE_SKILL_DIR}/product-backlog-template.xml
1081
+
1082
+ Use the Edit tool to modify in place. Return only a confirmation of what changed.",
1083
+ subagent_type="general-purpose",
1084
+ model="{PO_MODEL}",
1085
+ description="Adjust product backlog"
1086
+ )
1087
+ ```
1088
+ - Present for review again. Loop until approved.
1089
+
1090
+ **If "Redo questioning":**
1091
+ - Return to step 7 (deep-questioning)
1092
+ - Preserve VISION, WIKI_ANALYSIS, RESEARCH, GITHUB_ISSUES, and INPUT_CONTEXT
1093
+ - Hold previous answers as additional context
1094
+
1095
+ **If "Approve":**
1096
+ Continue to step 10.
1097
+ </step>
1098
+
1099
+ <!-- ══════════════════════════════════════════════════════════════════ -->
1100
+ <!-- STEP 10: GITHUB SYNC -->
1101
+ <!-- ══════════════════════════════════════════════════════════════════ -->
1102
+
1103
+ <step name="github-sync" order="10">
1104
+
1105
+ **If `github_project.enabled` is false OR `github_project.gh_installed` is false:**
1106
+
1107
+ Skip to step 11.
1108
+
1109
+ **If `github_project.enabled` is true AND `github_project.gh_installed` is true:**
1110
+
1111
+ Read the approved `.ace/artifacts/product/product-backlog.md` and cross-reference
1112
+ with GITHUB_ISSUES (from step 2) to identify sync actions:
1113
+
1114
+ - **Unlinked items** — backlog items with Link = "—" → candidates for GitHub creation
1115
+ - **Linked but modified** — backlog items whose status/priority/estimate changed
1116
+ during this session vs their GitHub values → candidates for GitHub update
1117
+ - **Already synced** — backlog items with Link that match GitHub exactly → no action
1118
+
1119
+ If no sync actions needed (all items linked, nothing changed):
1120
+ - Display: "All backlog items are already synced with GitHub."
1121
+ - Continue to step 11.
1122
+
1123
+ If there are unlinked items:
1124
+
1125
+ Build a sync summary and present it:
1126
+ ```
1127
+ GitHub Sync Summary:
1128
+ - New (unlinked): [N] epics, [M] features
1129
+ [- Modified: [X] items with field changes to push]
1130
+ ```
1131
+
1132
+ Use AskUserQuestion:
1133
+ - header: "GitHub Sync"
1134
+ - question: "How would you like to sync with GitHub?"
1135
+ - options:
1136
+ - "Sync all (Recommended)" — Create new issues and update modified ones
1137
+ - "Create new only" — Create unlinked items, don't update existing
1138
+ - "Create epics only" — Only create Epic issues, skip features and updates
1139
+ - "Skip" — Don't sync to GitHub
1140
+
1141
+ **If "Skip":**
1142
+ Continue to step 11.
1143
+
1144
+ **If any sync option selected:**
1145
+
1146
+ Display:
1147
+ ```
1148
+ ┌──────────────────────────────────────────────────┐
1149
+ │ ACE > Plan Backlog > GitHub Sync │
1150
+ └──────────────────────────────────────────────────┘
1151
+
1152
+ i Creating GitHub issues...
1153
+ Repo: {REPO} | Project: #{PROJECT_NUMBER}
1154
+ ```
1155
+
1156
+ **Prerequisite — Resolve all field and type IDs (once, before creating any issues):**
1157
+
1158
+ ```bash
1159
+ GH_FIELDS=$(node "${CLAUDE_SKILL_DIR}/script.js" resolve-fields repo={REPO} owner={OWNER} project={PROJECT_NUMBER})
1160
+ ```
1161
+
1162
+ Parse the JSON response. Extract and cache:
1163
+ - `issue_types.Epic` → EPIC_TYPE_ID
1164
+ - `issue_types.Feature` → FEATURE_TYPE_ID
1165
+ - `project_id` → PROJECT_ID
1166
+ - `fields.Status.id` → STATUS_FIELD_ID
1167
+ - `fields.Status.options` → STATUS_OPTIONS map (e.g., `{ "Todo": "id", "In Progress": "id", ... }`)
1168
+ - `fields.Priority.id` → PRIORITY_FIELD_ID (if exists)
1169
+ - `fields.Priority.options` → PRIORITY_OPTIONS map (e.g., `{ "P0": "id", "P1": "id", ... }`)
1170
+ - `fields.Estimate.id` → ESTIMATE_FIELD_ID (if exists)
1171
+
1172
+ If Epic or Feature type doesn't exist in `issue_types`, log a warning and skip type-setting.
1173
+
1174
+ **For each unlinked Epic (in order):**
1175
+
1176
+ ```bash
1177
+ EPIC_RESULT=$(node "${CLAUDE_SKILL_DIR}/script.js" create-issue \
1178
+ type=Epic \
1179
+ "title={Epic Title}" \
1180
+ "body={Epic Description}" \
1181
+ repo={REPO} \
1182
+ owner={OWNER} \
1183
+ project={PROJECT_NUMBER} \
1184
+ project_id={PROJECT_ID} \
1185
+ type_id={EPIC_TYPE_ID} \
1186
+ [priority_field_id={PRIORITY_FIELD_ID} priority_option_id={PRIORITY_OPTIONS[priority]}])
1187
+ ```
1188
+
1189
+ Epics do NOT get Status or Estimate — only Priority (optional).
1190
+ Parse the JSON response: `number`, `url`, `item_id`, and status flags.
1191
+ Store the epic's issue number for use as parent when creating features.
1192
+
1193
+ Display progress:
1194
+ ```
1195
+ + Created [Epic] {Title} → #{number}
1196
+ ```
1197
+
1198
+ **If "Create new only" or "Sync all" was selected, for each unlinked Feature (in order):**
1199
+
1200
+ ```bash
1201
+ FEATURE_RESULT=$(node "${CLAUDE_SKILL_DIR}/script.js" create-issue \
1202
+ type=Feature \
1203
+ "title={Feature Title}" \
1204
+ "body={Feature Description}" \
1205
+ repo={REPO} \
1206
+ owner={OWNER} \
1207
+ project={PROJECT_NUMBER} \
1208
+ project_id={PROJECT_ID} \
1209
+ type_id={FEATURE_TYPE_ID} \
1210
+ status_field_id={STATUS_FIELD_ID} \
1211
+ status_option_id={STATUS_OPTIONS[status]} \
1212
+ estimate_field_id={ESTIMATE_FIELD_ID} \
1213
+ estimate={size_value} \
1214
+ [priority_field_id={PRIORITY_FIELD_ID} priority_option_id={PRIORITY_OPTIONS[priority]}] \
1215
+ [parent={epic_issue_number}] \
1216
+ [milestone={Milestone}])
1217
+ ```
1218
+
1219
+ Status and Estimate are ALWAYS set for Features. Priority, parent, and milestone are optional.
1220
+ Parse the JSON response: `number`, `url`, status flags.
1221
+
1222
+ Display progress:
1223
+ ```
1224
+ + Created [Feature] {Title} → #{number} (parent: #{epic_number})
1225
+ ```
1226
+
1227
+ **If "Sync all" was selected, update modified existing issues:**
1228
+
1229
+ For each linked item whose fields changed during this session
1230
+ (status, priority, estimate differ from GITHUB_ISSUES values fetched in step 2):
1231
+
1232
+ Use `gh project item-edit` to update the changed fields:
1233
+ - Status change → `gh project item-edit --project-id {PROJECT_ID} --id {ITEM_ID} --field-id {STATUS_FIELD_ID} --single-select-option-id {STATUS_OPTIONS[new_status]}`
1234
+ - Priority change → `gh project item-edit --project-id {PROJECT_ID} --id {ITEM_ID} --field-id {PRIORITY_FIELD_ID} --single-select-option-id {PRIORITY_OPTIONS[new_priority]}`
1235
+ - Estimate change → `gh project item-edit --project-id {PROJECT_ID} --id {ITEM_ID} --field-id {ESTIMATE_FIELD_ID} --number {new_estimate}`
1236
+
1237
+ Note: To get the ITEM_ID for existing linked issues, use:
1238
+ ```bash
1239
+ ITEM_ID=$(gh project item-list {PROJECT_NUMBER} --owner {OWNER} --format json --limit 500 | jq -r '.items[] | select(.content.number == {issue_number}) | .id')
1240
+ ```
1241
+
1242
+ Display progress for each update:
1243
+ ```
1244
+ ~ Updated [Feature] {Title} #{number} — status: {old} → {new}
1245
+ ```
1246
+
1247
+ **After all creates and updates, update the backlog file:**
1248
+
1249
+ Read `.ace/artifacts/product/product-backlog.md` and update every newly created
1250
+ item's Link column from "—" to `[#N](https://github.com/{REPO}/issues/N)`.
1251
+
1252
+ Use the Edit tool to make targeted replacements in the markdown tables.
1253
+
1254
+ Display summary:
1255
+ ```
1256
+ + Created {N} GitHub issues.
1257
+ [~ Updated {X} existing issues.]
1258
+ Backlog Link column updated.
1259
+ ```
1260
+
1261
+ Continue to step 11.
1262
+ </step>
1263
+
1264
+ <!-- ══════════════════════════════════════════════════════════════════ -->
1265
+ <!-- STEP 11: COMMIT -->
1266
+ <!-- ══════════════════════════════════════════════════════════════════ -->
1267
+
1268
+ <step name="commit" order="11">
1269
+ Stage and commit all changed files in a single commit.
1270
+ Only stage files that actually changed (use `git diff` / `git status` to check).
1271
+
1272
+ Files that may have changed:
1273
+ - `.ace/artifacts/product/product-backlog.md` — always (this is the main output)
1274
+ - `.ace/research/FEATURES.md` — if research was regenerated in step 5b
1275
+ - `.ace/research/ARCHITECTURE.md` — if research was regenerated in step 5b
1276
+ - `.ace/artifacts/wiki/wiki-analysis.md` — if wiki analysis was re-run in step 4
1277
+
1278
+ ```bash
1279
+ git add .ace/artifacts/product/product-backlog.md
1280
+ ```
1281
+
1282
+ If research files were created or regenerated this session:
1283
+ ```bash
1284
+ git add .ace/research/
1285
+ ```
1286
+
1287
+ If wiki analysis was re-run this session:
1288
+ ```bash
1289
+ git add .ace/artifacts/wiki/wiki-analysis.md
1290
+ ```
1291
+
1292
+ Commit with a message that reflects what happened:
1293
+ - CREATE mode: `git commit -m "docs: initialize product backlog"`
1294
+ - UPDATE mode: `git commit -m "docs: update product backlog — [brief summary of changes]"`
1295
+ Examples:
1296
+ - "docs: update product backlog — add 2 epics, 5 features"
1297
+ - "docs: update product backlog — sync status from GitHub"
1298
+ - "docs: update product backlog — reorganize epic order"
1299
+
1300
+ Display completion (adapt banner to mode):
1301
+
1302
+ ```
1303
+ ╔══════════════════════════════════════════════════╗
1304
+ ║ ACE > Product Backlog [Created | Updated] ║
1305
+ ╚══════════════════════════════════════════════════╝
1306
+
1307
+ + .ace/artifacts/product/product-backlog.md committed.
1308
+ [If UPDATE: Changes: +N epics, +M features, ~X modified]
1309
+
1310
+ Summary:
1311
+ ────────
1312
+ [N] epics, [M] features
1313
+ MVP scope: [X] features across [Y] epics
1314
+
1315
+ i This backlog will be used as context by ACE commands
1316
+ when planning features, stories, and sprints.
1317
+
1318
+ Next > /ace:plan-feature E1
1319
+ Break the first epic into detailed stories.
1320
+ > /ace:help
1321
+ Check project status and available commands.
1322
+ ```
1323
+ </step>
1324
+
1325
+ </process>
1326
+
1327
+ <success_criteria>
1328
+ - Init function executed (environment detected, wiki state checked, GitHub settings loaded)
1329
+ - GitHub issues fetched via `github fetch-issues` if GitHub Project integration is enabled
1330
+ - Product vision loaded as primary input (if exists)
1331
+ - Brownfield with wiki: analysis reused from cache or re-run with parallel agents
1332
+ - Domain research reused from cache or regenerated if selected
1333
+ - User-provided input absorbed and integrated
1334
+ - Deep questioning adapted to run mode (CREATE = from scratch, UPDATE = targeted changes)
1335
+ - Every vision capability mapped to at least one epic (if vision exists)
1336
+ - Research table stakes validated against backlog (if research exists)
1337
+ - Epics and features scoped using Agile methodology (no arbitrary count limits)
1338
+ - Size estimated using Fibonacci×10 (10, 20, 30, 50, 80, 130)
1339
+ - Priority, status, size, sprint, milestone, and link assigned to every item
1340
+ - product-backlog.md written (CREATE) or edited in place (UPDATE) following template structure
1341
+ - Existing IDs, GitHub links, and unchanged items preserved during updates
1342
+ - User reviewed and approved the document
1343
+ - GitHub sync: new issues created, modified issues updated (if user chose to sync)
1344
+ - Link column updated with GitHub issue numbers and URLs
1345
+ - Document committed with mode-appropriate message (initialize vs update + summary)
1346
+ </success_criteria>
1347
+
1348
+ </workflow>