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,473 +1,473 @@
1
- <workflow>
2
-
3
- <purpose>
4
- Research and curate the Relevant Wiki section for a story specification.
5
- Load the story requirements (User Story, Description, AC), read the parent feature
6
- for broader context, scan `.docs/wiki/` system-wide and subsystem documents,
7
- and compile a curated list of wiki references that directly inform the technical
8
- solution for this story.
9
-
10
- The output is written INTO the story file — populating the `## Relevant Wiki`
11
- section placeholder. If the story has a GitHub issue, the issue body is also updated.
12
-
13
- This is pass 2 of the story specification pipeline (see story.xml composition).
14
- Input: story file with sections 1-8 complete (from pass 1).
15
- Output: `## Relevant Wiki` section appended/replaced in the story file.
16
-
17
- This workflow is executed by the orchestrator directly. It spawns `ace-wiki-mapper`
18
- subagents (via `subagent_type="ace-wiki-mapper"`) for parallel subsystem research.
19
- </purpose>
20
-
21
- <mandatory-context>
22
- Read all files referenced by the invoking command's execution-context before starting.
23
- Also read any document or text passed as parameter ($ARGUMENTS) in the invoking command.
24
-
25
- Key context files:
26
- - **story-wiki.xml template**: defines the output-format, selection-criteria, and guidelines
27
- for the `## Relevant Wiki` section. The compiled output MUST follow this template exactly.
28
- </mandatory-context>
29
-
30
- <process>
31
-
32
- <!-- ══════════════════════════════════════════════════════════════════ -->
33
- <!-- STEP 1: SETUP -->
34
- <!-- ══════════════════════════════════════════════════════════════════ -->
35
-
36
- <step name="setup" order="1">
37
- **MANDATORY FIRST STEP — Execute environment detection and story initialization:**
38
-
39
- INIT is available from the preprocessed Environment Context above — do NOT re-run init.
40
-
41
- This preprocessing validated the story parameter, extracted metadata/requirements/wiki
42
- references, computed all paths and slugs, and checked artifact existence.
43
-
44
- Parse INIT JSON for:
45
- - **Environment**: `has_git`, `has_gh_cli`, `github_project`, `mapper_model`
46
- - **Story validation**: `story_valid`, `story_error`, `story_source`
47
- - **Story metadata**: `story` (id, title, status, size), `feature` (id, title), `epic` (id, title)
48
- - **Requirements**: `user_story`, `description`, `acceptance_criteria_count`
49
- - **Paths**: `paths.*` (story_dir, story_file, feature_dir, feature_file, etc.)
50
- - **Wiki**: `wiki_references` (system_wide, subsystem_docs, total_count), `wiki_docs_exist`
51
- - **Artifacts**: `has_external_analysis`, `has_integration_analysis`, `has_feature_file`
52
-
53
- Display stage banner:
54
-
55
- ```
56
- ╔══════════════════════════════════════════════════╗
57
- ║ ACE > Research Story Wiki ║
58
- ╚══════════════════════════════════════════════════╝
59
- ```
60
-
61
- **If `has_git` is false:** Initialize git:
62
- ```bash
63
- git init
64
- ```
65
-
66
- **If `INIT.story_valid` is false:**
67
- Display error using `INIT.story_error` and exit.
68
-
69
- **Verify wiki exists** — check that `.docs/wiki/` directory exists.
70
- **If wiki not found:**
71
- Display error and exit:
72
- ```
73
- x No wiki found at .docs/wiki/
74
- The wiki must exist before researching story wiki references.
75
- Run /ace:init-wiki or /ace:map-system first.
76
- ```
77
- </step>
78
-
79
- <!-- ══════════════════════════════════════════════════════════════════ -->
80
- <!-- STEP 2: VALIDATE & LOAD STORY -->
81
- <!-- ══════════════════════════════════════════════════════════════════ -->
82
-
83
- <step name="validate-story" order="2">
84
-
85
- **Story validation, parsing, and path computation were completed by
86
- `init research-story` in step 1.** All metadata, requirements, and
87
- paths are available in the INIT JSON.
88
-
89
- Read the story file content for use in wiki research:
90
-
91
- **If `INIT.story_source` is `file`:**
92
- Read the file at `INIT.paths.story_file`. Store as STORY_CONTENT.
93
-
94
- **If `INIT.story_source` is `github-url` or `issue-number`:**
95
- Fetch the issue body using INIT's GitHub project context:
96
- ```bash
97
- GH_STORY=$(gh issue view {issue_number} --repo {INIT.github_project.owner}/{INIT.github_project.repo} --json body -q .body)
98
- ```
99
- Store as STORY_CONTENT.
100
-
101
- Set pre-computed paths from INIT:
102
- - `STORY_FILE = INIT.paths.story_file`
103
- - `STORY_DIR = INIT.paths.story_dir`
104
-
105
- Display:
106
- ```
107
- i Story loaded: {INIT.story.id} — {INIT.story.title}
108
- Feature: {INIT.feature.id} — {INIT.feature.title}
109
- Epic: {INIT.epic.id} — {INIT.epic.title}
110
- Requirements: {INIT.acceptance_criteria_count} acceptance criteria scenarios
111
- ```
112
- </step>
113
-
114
- <!-- ══════════════════════════════════════════════════════════════════ -->
115
- <!-- STEP 3: LOAD FEATURE CONTEXT -->
116
- <!-- ══════════════════════════════════════════════════════════════════ -->
117
-
118
- <step name="load-feature-context" order="3">
119
-
120
- <!-- ── 3a: Read parent feature document ──────────────────────── -->
121
-
122
- **If `INIT.has_feature_file` is true:**
123
- Read the feature document at `INIT.paths.feature_file` and extract:
124
- - Feature scope and description
125
- - Other stories in the feature and their relationships
126
- - Subsystems or components mentioned in the feature
127
- Store as FEATURE_CONTEXT.
128
-
129
- **If `INIT.has_feature_file` is false:**
130
- Proceed without — log a note but do not fail.
131
-
132
- <!-- ── 3b: Check for feature-level relevant-wiki hint ─────────── -->
133
-
134
- Check if a feature-level relevant-wiki file exists at:
135
- `{INIT.paths.feature_dir}/relevant-wiki.md`
136
-
137
- **If exists:** Read it. This file provides a HINT for which subsystems and
138
- wiki documents are likely relevant. Use it as a starting point for subsystem
139
- identification — but still verify each document's relevance to THIS story.
140
- Store as FEATURE_WIKI_HINTS.
141
-
142
- **If not exists:** Proceed without. This is optional.
143
-
144
- Display:
145
- ```
146
- i Feature context: {loaded | not found}
147
- Feature wiki hints: {loaded | not found}
148
- ```
149
- </step>
150
-
151
- <!-- ══════════════════════════════════════════════════════════════════ -->
152
- <!-- STEP 4: CURATE SYSTEM-WIDE WIKI DOCS -->
153
- <!-- ══════════════════════════════════════════════════════════════════ -->
154
-
155
- <step name="include-system-wide" order="4">
156
-
157
- The four system-wide wiki documents are ALWAYS included — no reading or
158
- assessment needed. They are mandatory context for every story implementation.
159
-
160
- Set SYSTEM_WIDE_REFS to the fixed list:
161
- - `.docs/wiki/system-wide/system-structure.md` — Mandatory system-wide context
162
- - `.docs/wiki/system-wide/system-architecture.md` — Mandatory system-wide context
163
- - `.docs/wiki/system-wide/coding-standards.md` — Mandatory system-wide context
164
- - `.docs/wiki/system-wide/testing-framework.md` — Mandatory system-wide context
165
-
166
- **Do NOT read these files.** The implementing agent (pass 5) will read them.
167
- This step only ensures they appear in the output.
168
- </step>
169
-
170
- <!-- ══════════════════════════════════════════════════════════════════ -->
171
- <!-- STEP 5: IDENTIFY AFFECTED SUBSYSTEMS -->
172
- <!-- ══════════════════════════════════════════════════════════════════ -->
173
-
174
- <step name="identify-subsystems" order="5">
175
-
176
- Read `.docs/wiki/system-wide/system-architecture.md` to understand subsystem
177
- boundaries, responsibilities, and how they interact. This is the ONE system-wide
178
- doc worth reading during wiki research — it maps the subsystem landscape.
179
-
180
- Then analyze the story requirements (User Story, Description, AC) and feature context
181
- against the architecture doc to determine which subsystems are affected by this story.
182
-
183
- Sources for subsystem identification:
184
- 1. **System architecture doc**: subsystem boundaries, responsibilities, integration points
185
- 2. **Story content**: keywords, component names, service names in the AC
186
- 3. **Feature context**: subsystems mentioned in the parent feature document
187
- 4. **Feature wiki hints**: subsystems listed in the feature-level relevant-wiki.md
188
- 5. **Wiki subsystem list**: compare against `wiki_subsystem_names` from INIT
189
-
190
- For each identified subsystem, verify it exists in `.docs/wiki/subsystems/`:
191
- ```bash
192
- ls .docs/wiki/subsystems/
193
- ```
194
-
195
- Store the list of affected subsystem names as AFFECTED_SUBSYSTEMS.
196
-
197
- **If no subsystems identified:**
198
- Display:
199
- ```
200
- i No specific subsystems identified. Wiki research limited to system-wide docs.
201
- ```
202
- Skip to step 7.
203
-
204
- **If subsystems identified:**
205
- Display:
206
- ```
207
- i Affected subsystems: {subsystem1}, {subsystem2}, ...
208
- Spawning wiki research agents...
209
- ```
210
- </step>
211
-
212
- <!-- ══════════════════════════════════════════════════════════════════ -->
213
- <!-- STEP 6: PARALLEL SUBSYSTEM WIKI RESEARCH -->
214
- <!-- ══════════════════════════════════════════════════════════════════ -->
215
-
216
- <step name="subsystem-research" order="6">
217
-
218
- For each subsystem in AFFECTED_SUBSYSTEMS, spawn an ace-wiki-mapper agent
219
- to read and assess the subsystem's wiki documents for relevance to THIS story.
220
-
221
- **IMPORTANT**: Spawn agents IN PARALLEL when there are multiple subsystems.
222
- Each agent reads the subsystem's wiki docs and returns ONLY a list of relevant
223
- files with reasons — it does NOT write any files.
224
-
225
- For each subsystem, spawn:
226
-
227
- ```
228
- Task(
229
- prompt="Focus: wiki-curation-for-story
230
-
231
- You are assessing wiki documents in a single subsystem for relevance to a story.
232
- DO NOT write or modify any files. ONLY read and assess.
233
-
234
- Story context:
235
- - Story: {Story ID} — {Story Title}
236
- - User Story: {user_story_statement}
237
- - Description: {description}
238
- - Acceptance Criteria: {all_AC_scenarios}
239
- - Feature: {Feature ID} — {Feature Title}
240
-
241
- Subsystem to investigate: {subsystem_name}
242
- Subsystem wiki path: .docs/wiki/subsystems/{subsystem_name}/
243
-
244
- Instructions:
245
- 1. List all files in .docs/wiki/subsystems/{subsystem_name}/ recursively
246
- 2. Read each document (structure.md, architecture.md, and any docs in
247
- systems/, patterns/, cross-cutting/, guides/, walkthroughs/, decisions/ subdirectories)
248
- 3. For each document, assess: does it directly inform the technical solution
249
- for THIS story? Apply these criteria:
250
- - INCLUDE if: describes a system this story modifies/extends, documents a
251
- pattern this story must follow, covers a cross-cutting concern this story
252
- must respect, contains a guide for a task this story requires, records an
253
- ADR that constrains design choices
254
- - EXCLUDE if: only tangentially related, describes something the story reads
255
- but doesn't modify, would be nice-to-know but doesn't change implementation
256
-
257
- 4. Return your findings in this EXACT format:
258
-
259
- RELEVANT_FILES:
260
- - `.docs/wiki/subsystems/{subsystem_name}/{path}` — {one-line reason}
261
- - `.docs/wiki/subsystems/{subsystem_name}/{path}` — {one-line reason}
262
-
263
- NOT_RELEVANT:
264
- - `.docs/wiki/subsystems/{subsystem_name}/{path}` — {one-line reason for exclusion}
265
-
266
- If NO documents are relevant, return RELEVANT_FILES with no entries.
267
- Do NOT write any files. Return text only.",
268
- subagent_type="ace-wiki-mapper",
269
- model="{MAPPER_MODEL}",
270
- run_in_background=true,
271
- description="Wiki research: {subsystem_name}"
272
- )
273
- ```
274
-
275
- Wait for ALL agents to complete. Collect their RELEVANT_FILES lists.
276
- Merge into a single list: SUBSYSTEM_REFS.
277
-
278
- Display:
279
- ```
280
- i Subsystem research complete.
281
- {N} relevant docs found across {M} subsystems.
282
- ```
283
- </step>
284
-
285
- <!-- ══════════════════════════════════════════════════════════════════ -->
286
- <!-- STEP 7: COMPILE RELEVANT WIKI SECTION -->
287
- <!-- ══════════════════════════════════════════════════════════════════ -->
288
-
289
- <step name="compile-output" order="7">
290
-
291
- Compile the final `## Relevant Wiki` section by combining:
292
- 1. SYSTEM_WIDE_REFS (always present — the four mandatory system-wide docs)
293
- 2. SUBSYSTEM_REFS (from parallel agent research — may be empty)
294
-
295
- Group subsystem references by wiki document type:
296
- - **Systems**: files under `subsystems/*/systems/`
297
- - **Patterns**: files under `subsystems/*/patterns/`
298
- - **Cross-Cutting Concerns**: files under `subsystems/*/cross-cutting/`
299
- - **Guides**: files under `subsystems/*/guides/`
300
- - **Walkthroughs**: files under `subsystems/*/walkthroughs/`
301
- - **Decisions**: files under `subsystems/*/decisions/`
302
- - **Architecture**: `subsystems/*/architecture.md` files
303
- - **Structure**: `subsystems/*/structure.md` files (include under Systems category)
304
-
305
- Omit any category header that has zero entries.
306
- The `### System-Wide` header is NEVER omitted.
307
-
308
- Follow the output-format defined in story-wiki.xml template exactly.
309
-
310
- Store the compiled markdown as WIKI_SECTION.
311
- </step>
312
-
313
- <!-- ══════════════════════════════════════════════════════════════════ -->
314
- <!-- STEP 8: WRITE TO STORY FILE -->
315
- <!-- ══════════════════════════════════════════════════════════════════ -->
316
-
317
- <step name="write-output" order="8">
318
-
319
- <!-- ── 8a: Write to local story file ──────────────────────────── -->
320
-
321
- Read the current STORY_FILE content.
322
-
323
- **If the story file contains a `## Relevant Wiki` section placeholder:**
324
- Replace the placeholder section (from `## Relevant Wiki` up to the next `## `
325
- heading or end of file) with WIKI_SECTION.
326
-
327
- **If the story file does NOT contain a `## Relevant Wiki` section:**
328
- Append WIKI_SECTION after the `## Definition of Done` section
329
- (before `## Technical Solution` if it exists, otherwise before the metadata section).
330
-
331
- Write the updated content back to STORY_FILE.
332
-
333
- Display:
334
- ```
335
- + Relevant Wiki section written to {STORY_FILE}
336
- ```
337
-
338
- <!-- ── 8b: Update GitHub issue (if applicable) ───────────────── -->
339
-
340
- **If the story was loaded from GitHub OR the story file header contains a GitHub link:**
341
-
342
- Extract the issue number from the story.
343
-
344
- **If `has_gh_cli` is true AND issue number is available:**
345
-
346
- Read the current GitHub issue body:
347
- ```bash
348
- GH_BODY=$(gh issue view {issue_number} --repo {REPO} --json body -q .body)
349
- ```
350
-
351
- Replace or append the `## Relevant Wiki` section in the issue body
352
- (same logic as local file — find and replace existing section, or append).
353
-
354
- Update the issue:
355
- ```bash
356
- gh issue edit {issue_number} --repo {REPO} --body "{updated_body}"
357
- ```
358
-
359
- Display:
360
- ```
361
- + GitHub issue #{issue_number} updated with Relevant Wiki section.
362
- ```
363
-
364
- **If GitHub CLI not available or no issue number:**
365
- Display:
366
- ```
367
- i No GitHub issue to update. Local file only.
368
- ```
369
- </step>
370
-
371
- <!-- ══════════════════════════════════════════════════════════════════ -->
372
- <!-- STEP 9: VALIDATION -->
373
- <!-- ══════════════════════════════════════════════════════════════════ -->
374
-
375
- <step name="validation" order="9">
376
-
377
- Re-read STORY_FILE and verify:
378
-
379
- **Content Requirements:**
380
- - [ ] `## Relevant Wiki` section exists in the story file
381
- - [ ] `### System-Wide` subsection is present with all four docs listed
382
- - [ ] Subsystem references (if any) are grouped by wiki document type
383
- - [ ] Each subsystem reference has a one-line reason
384
- - [ ] No empty category headers (omit categories with zero entries)
385
- - [ ] No placeholder text left unfilled
386
- - [ ] File paths use backtick formatting
387
-
388
- **Quality Requirements:**
389
- - [ ] Subsystem reasons are story-specific, not generic ("related to auth" = FAIL)
390
- - [ ] Only directly relevant subsystem docs included (no tangential references)
391
- - [ ] Markdown renders cleanly (no broken formatting)
392
-
393
- **Total: 10 mandatory checklist items**
394
-
395
- If any check fails, fix the issue before proceeding.
396
-
397
- Display:
398
- ```
399
- {check_mark} Relevant Wiki validated. {passed}/{total} checks passed.
400
- ```
401
- </step>
402
-
403
- <!-- ══════════════════════════════════════════════════════════════════ -->
404
- <!-- STEP 10: REVIEW -->
405
- <!-- ══════════════════════════════════════════════════════════════════ -->
406
-
407
- <step name="review" order="10">
408
-
409
- Display a summary:
410
- ```
411
- Wiki Research Summary:
412
- ────────
413
- System-wide docs: 4
414
- Subsystem docs: {N}
415
- Subsystems scanned: {M}
416
- Total references: {4 + N}
417
- ```
418
-
419
- Use AskUserQuestion:
420
- - header: "Wiki"
421
- - question: "Relevant Wiki section written to `{STORY_FILE}`. Does it look comprehensive?"
422
- - options:
423
- - "Approve" — Looks good
424
- - "Refine" — Some references are missing or incorrect
425
-
426
- **If "Approve":**
427
-
428
- Display completion:
429
- ```
430
- ╔══════════════════════════════════════════════════╗
431
- ║ ACE > Story Wiki Research Complete ║
432
- ║ {Story ID} "{Story Title}" ║
433
- ╚══════════════════════════════════════════════════╝
434
-
435
- + {STORY_FILE} updated.
436
-
437
- References:
438
- ────────
439
- System-wide: 4 | Subsystem: {N} | Total: {4 + N}
440
-
441
- i Wiki research complete. The Relevant Wiki section is now
442
- part of the story file and will be used by pass 5
443
- (technical solution) to load implementation context.
444
-
445
- Next > Continue with story refinement:
446
- - /ace:research-external-solution — analyze external reference systems
447
- - /ace:plan-story — continue the story pipeline
448
- ```
449
-
450
- **If "Refine":**
451
- - Ask what references are missing or incorrect
452
- - Go back to the relevant step (re-read wiki docs, adjust references)
453
- - Re-validate (step 9) and present for review again
454
- </step>
455
-
456
- </process>
457
-
458
- <success_criteria>
459
- - Story loaded and requirements extracted (User Story, Description, AC)
460
- - Parent feature document loaded for broader context (if available)
461
- - Feature-level relevant-wiki.md checked for subsystem hints (if exists)
462
- - All four system-wide wiki docs included (fixed list, not read)
463
- - Affected subsystems identified from story content and feature context
464
- - Parallel ace-wiki-mapper agents spawned for each affected subsystem
465
- - Agent results collected and merged into categorized references
466
- - Relevant Wiki section compiled following story-wiki.xml template
467
- - Story file updated with the Relevant Wiki section
468
- - GitHub issue updated (if applicable)
469
- - All 10 validation checklist items verified
470
- - User reviewed and approved the output
471
- </success_criteria>
472
-
473
- </workflow>
1
+ <workflow>
2
+
3
+ <purpose>
4
+ Research and curate the Relevant Wiki section for a story specification.
5
+ Load the story requirements (User Story, Description, AC), read the parent feature
6
+ for broader context, scan `.docs/wiki/` system-wide and subsystem documents,
7
+ and compile a curated list of wiki references that directly inform the technical
8
+ solution for this story.
9
+
10
+ The output is written INTO the story file — populating the `## Relevant Wiki`
11
+ section placeholder. If the story has a GitHub issue, the issue body is also updated.
12
+
13
+ This is pass 2 of the story specification pipeline (see story.xml composition).
14
+ Input: story file with sections 1-8 complete (from pass 1).
15
+ Output: `## Relevant Wiki` section appended/replaced in the story file.
16
+
17
+ This workflow is executed by the orchestrator directly. It spawns `ace-wiki-mapper`
18
+ subagents (via `subagent_type="ace-wiki-mapper"`) for parallel subsystem research.
19
+ </purpose>
20
+
21
+ <mandatory-context>
22
+ All supporting resource files are auto-loaded in the skill prompt above. Do NOT re-read them.
23
+ Also read any document or text passed as parameter ($ARGUMENTS) in the invoking command.
24
+
25
+ Key context files:
26
+ - **story-wiki.xml template**: defines the output-format, selection-criteria, and guidelines
27
+ for the `## Relevant Wiki` section. The compiled output MUST follow this template exactly.
28
+ </mandatory-context>
29
+
30
+ <process>
31
+
32
+ <!-- ══════════════════════════════════════════════════════════════════ -->
33
+ <!-- STEP 1: SETUP -->
34
+ <!-- ══════════════════════════════════════════════════════════════════ -->
35
+
36
+ <step name="setup" order="1">
37
+ **MANDATORY FIRST STEP — Execute environment detection and story initialization:**
38
+
39
+ INIT is available from the preprocessed Environment Context above — do NOT re-run init.
40
+
41
+ This preprocessing validated the story parameter, extracted metadata/requirements/wiki
42
+ references, computed all paths and slugs, and checked artifact existence.
43
+
44
+ Parse INIT JSON for:
45
+ - **Environment**: `has_git`, `has_gh_cli`, `github_project`, `mapper_model`
46
+ - **Story validation**: `story_valid`, `story_error`, `story_source`
47
+ - **Story metadata**: `story` (id, title, status, size), `feature` (id, title), `epic` (id, title)
48
+ - **Requirements**: `user_story`, `description`, `acceptance_criteria_count`
49
+ - **Paths**: `paths.*` (story_dir, story_file, feature_dir, feature_file, etc.)
50
+ - **Wiki**: `wiki_references` (system_wide, subsystem_docs, total_count), `wiki_docs_exist`
51
+ - **Artifacts**: `has_external_analysis`, `has_integration_analysis`, `has_feature_file`
52
+
53
+ Display stage banner:
54
+
55
+ ```
56
+ ╔══════════════════════════════════════════════════╗
57
+ ║ ACE > Research Story Wiki ║
58
+ ╚══════════════════════════════════════════════════╝
59
+ ```
60
+
61
+ **If `has_git` is false:** Initialize git:
62
+ ```bash
63
+ git init
64
+ ```
65
+
66
+ **If `INIT.story_valid` is false:**
67
+ Display error using `INIT.story_error` and exit.
68
+
69
+ **Verify wiki exists** — check that `.docs/wiki/` directory exists.
70
+ **If wiki not found:**
71
+ Display error and exit:
72
+ ```
73
+ x No wiki found at .docs/wiki/
74
+ The wiki must exist before researching story wiki references.
75
+ Run /ace:init-wiki or /ace:map-system first.
76
+ ```
77
+ </step>
78
+
79
+ <!-- ══════════════════════════════════════════════════════════════════ -->
80
+ <!-- STEP 2: VALIDATE & LOAD STORY -->
81
+ <!-- ══════════════════════════════════════════════════════════════════ -->
82
+
83
+ <step name="validate-story" order="2">
84
+
85
+ **Story validation, parsing, and path computation were completed by
86
+ `init research-story` in step 1.** All metadata, requirements, and
87
+ paths are available in the INIT JSON.
88
+
89
+ Read the story file content for use in wiki research:
90
+
91
+ **If `INIT.story_source` is `file`:**
92
+ Read the file at `INIT.paths.story_file`. Store as STORY_CONTENT.
93
+
94
+ **If `INIT.story_source` is `github-url` or `issue-number`:**
95
+ Fetch the issue body using INIT's GitHub project context:
96
+ ```bash
97
+ GH_STORY=$(gh issue view {issue_number} --repo {INIT.github_project.owner}/{INIT.github_project.repo} --json body -q .body)
98
+ ```
99
+ Store as STORY_CONTENT.
100
+
101
+ Set pre-computed paths from INIT:
102
+ - `STORY_FILE = INIT.paths.story_file`
103
+ - `STORY_DIR = INIT.paths.story_dir`
104
+
105
+ Display:
106
+ ```
107
+ i Story loaded: {INIT.story.id} — {INIT.story.title}
108
+ Feature: {INIT.feature.id} — {INIT.feature.title}
109
+ Epic: {INIT.epic.id} — {INIT.epic.title}
110
+ Requirements: {INIT.acceptance_criteria_count} acceptance criteria scenarios
111
+ ```
112
+ </step>
113
+
114
+ <!-- ══════════════════════════════════════════════════════════════════ -->
115
+ <!-- STEP 3: LOAD FEATURE CONTEXT -->
116
+ <!-- ══════════════════════════════════════════════════════════════════ -->
117
+
118
+ <step name="load-feature-context" order="3">
119
+
120
+ <!-- ── 3a: Read parent feature document ──────────────────────── -->
121
+
122
+ **If `INIT.has_feature_file` is true:**
123
+ Read the feature document at `INIT.paths.feature_file` and extract:
124
+ - Feature scope and description
125
+ - Other stories in the feature and their relationships
126
+ - Subsystems or components mentioned in the feature
127
+ Store as FEATURE_CONTEXT.
128
+
129
+ **If `INIT.has_feature_file` is false:**
130
+ Proceed without — log a note but do not fail.
131
+
132
+ <!-- ── 3b: Check for feature-level relevant-wiki hint ─────────── -->
133
+
134
+ Check if a feature-level relevant-wiki file exists at:
135
+ `{INIT.paths.feature_dir}/relevant-wiki.md`
136
+
137
+ **If exists:** Read it. This file provides a HINT for which subsystems and
138
+ wiki documents are likely relevant. Use it as a starting point for subsystem
139
+ identification — but still verify each document's relevance to THIS story.
140
+ Store as FEATURE_WIKI_HINTS.
141
+
142
+ **If not exists:** Proceed without. This is optional.
143
+
144
+ Display:
145
+ ```
146
+ i Feature context: {loaded | not found}
147
+ Feature wiki hints: {loaded | not found}
148
+ ```
149
+ </step>
150
+
151
+ <!-- ══════════════════════════════════════════════════════════════════ -->
152
+ <!-- STEP 4: CURATE SYSTEM-WIDE WIKI DOCS -->
153
+ <!-- ══════════════════════════════════════════════════════════════════ -->
154
+
155
+ <step name="include-system-wide" order="4">
156
+
157
+ The four system-wide wiki documents are ALWAYS included — no reading or
158
+ assessment needed. They are mandatory context for every story implementation.
159
+
160
+ Set SYSTEM_WIDE_REFS to the fixed list:
161
+ - `.docs/wiki/system-wide/system-structure.md` — Mandatory system-wide context
162
+ - `.docs/wiki/system-wide/system-architecture.md` — Mandatory system-wide context
163
+ - `.docs/wiki/system-wide/coding-standards.md` — Mandatory system-wide context
164
+ - `.docs/wiki/system-wide/testing-framework.md` — Mandatory system-wide context
165
+
166
+ **Do NOT read these files.** The implementing agent (pass 5) will read them.
167
+ This step only ensures they appear in the output.
168
+ </step>
169
+
170
+ <!-- ══════════════════════════════════════════════════════════════════ -->
171
+ <!-- STEP 5: IDENTIFY AFFECTED SUBSYSTEMS -->
172
+ <!-- ══════════════════════════════════════════════════════════════════ -->
173
+
174
+ <step name="identify-subsystems" order="5">
175
+
176
+ Read `.docs/wiki/system-wide/system-architecture.md` to understand subsystem
177
+ boundaries, responsibilities, and how they interact. This is the ONE system-wide
178
+ doc worth reading during wiki research — it maps the subsystem landscape.
179
+
180
+ Then analyze the story requirements (User Story, Description, AC) and feature context
181
+ against the architecture doc to determine which subsystems are affected by this story.
182
+
183
+ Sources for subsystem identification:
184
+ 1. **System architecture doc**: subsystem boundaries, responsibilities, integration points
185
+ 2. **Story content**: keywords, component names, service names in the AC
186
+ 3. **Feature context**: subsystems mentioned in the parent feature document
187
+ 4. **Feature wiki hints**: subsystems listed in the feature-level relevant-wiki.md
188
+ 5. **Wiki subsystem list**: compare against `wiki_subsystem_names` from INIT
189
+
190
+ For each identified subsystem, verify it exists in `.docs/wiki/subsystems/`:
191
+ ```bash
192
+ ls .docs/wiki/subsystems/
193
+ ```
194
+
195
+ Store the list of affected subsystem names as AFFECTED_SUBSYSTEMS.
196
+
197
+ **If no subsystems identified:**
198
+ Display:
199
+ ```
200
+ i No specific subsystems identified. Wiki research limited to system-wide docs.
201
+ ```
202
+ Skip to step 7.
203
+
204
+ **If subsystems identified:**
205
+ Display:
206
+ ```
207
+ i Affected subsystems: {subsystem1}, {subsystem2}, ...
208
+ Spawning wiki research agents...
209
+ ```
210
+ </step>
211
+
212
+ <!-- ══════════════════════════════════════════════════════════════════ -->
213
+ <!-- STEP 6: PARALLEL SUBSYSTEM WIKI RESEARCH -->
214
+ <!-- ══════════════════════════════════════════════════════════════════ -->
215
+
216
+ <step name="subsystem-research" order="6">
217
+
218
+ For each subsystem in AFFECTED_SUBSYSTEMS, spawn an ace-wiki-mapper agent
219
+ to read and assess the subsystem's wiki documents for relevance to THIS story.
220
+
221
+ **IMPORTANT**: Spawn agents IN PARALLEL when there are multiple subsystems.
222
+ Each agent reads the subsystem's wiki docs and returns ONLY a list of relevant
223
+ files with reasons — it does NOT write any files.
224
+
225
+ For each subsystem, spawn:
226
+
227
+ ```
228
+ Task(
229
+ prompt="Focus: wiki-curation-for-story
230
+
231
+ You are assessing wiki documents in a single subsystem for relevance to a story.
232
+ DO NOT write or modify any files. ONLY read and assess.
233
+
234
+ Story context:
235
+ - Story: {Story ID} — {Story Title}
236
+ - User Story: {user_story_statement}
237
+ - Description: {description}
238
+ - Acceptance Criteria: {all_AC_scenarios}
239
+ - Feature: {Feature ID} — {Feature Title}
240
+
241
+ Subsystem to investigate: {subsystem_name}
242
+ Subsystem wiki path: .docs/wiki/subsystems/{subsystem_name}/
243
+
244
+ Instructions:
245
+ 1. List all files in .docs/wiki/subsystems/{subsystem_name}/ recursively
246
+ 2. Read each document (structure.md, architecture.md, and any docs in
247
+ systems/, patterns/, cross-cutting/, guides/, walkthroughs/, decisions/ subdirectories)
248
+ 3. For each document, assess: does it directly inform the technical solution
249
+ for THIS story? Apply these criteria:
250
+ - INCLUDE if: describes a system this story modifies/extends, documents a
251
+ pattern this story must follow, covers a cross-cutting concern this story
252
+ must respect, contains a guide for a task this story requires, records an
253
+ ADR that constrains design choices
254
+ - EXCLUDE if: only tangentially related, describes something the story reads
255
+ but doesn't modify, would be nice-to-know but doesn't change implementation
256
+
257
+ 4. Return your findings in this EXACT format:
258
+
259
+ RELEVANT_FILES:
260
+ - `.docs/wiki/subsystems/{subsystem_name}/{path}` — {one-line reason}
261
+ - `.docs/wiki/subsystems/{subsystem_name}/{path}` — {one-line reason}
262
+
263
+ NOT_RELEVANT:
264
+ - `.docs/wiki/subsystems/{subsystem_name}/{path}` — {one-line reason for exclusion}
265
+
266
+ If NO documents are relevant, return RELEVANT_FILES with no entries.
267
+ Do NOT write any files. Return text only.",
268
+ subagent_type="ace-wiki-mapper",
269
+ model="{MAPPER_MODEL}",
270
+ run_in_background=true,
271
+ description="Wiki research: {subsystem_name}"
272
+ )
273
+ ```
274
+
275
+ Wait for ALL agents to complete. Collect their RELEVANT_FILES lists.
276
+ Merge into a single list: SUBSYSTEM_REFS.
277
+
278
+ Display:
279
+ ```
280
+ i Subsystem research complete.
281
+ {N} relevant docs found across {M} subsystems.
282
+ ```
283
+ </step>
284
+
285
+ <!-- ══════════════════════════════════════════════════════════════════ -->
286
+ <!-- STEP 7: COMPILE RELEVANT WIKI SECTION -->
287
+ <!-- ══════════════════════════════════════════════════════════════════ -->
288
+
289
+ <step name="compile-output" order="7">
290
+
291
+ Compile the final `## Relevant Wiki` section by combining:
292
+ 1. SYSTEM_WIDE_REFS (always present — the four mandatory system-wide docs)
293
+ 2. SUBSYSTEM_REFS (from parallel agent research — may be empty)
294
+
295
+ Group subsystem references by wiki document type:
296
+ - **Systems**: files under `subsystems/*/systems/`
297
+ - **Patterns**: files under `subsystems/*/patterns/`
298
+ - **Cross-Cutting Concerns**: files under `subsystems/*/cross-cutting/`
299
+ - **Guides**: files under `subsystems/*/guides/`
300
+ - **Walkthroughs**: files under `subsystems/*/walkthroughs/`
301
+ - **Decisions**: files under `subsystems/*/decisions/`
302
+ - **Architecture**: `subsystems/*/architecture.md` files
303
+ - **Structure**: `subsystems/*/structure.md` files (include under Systems category)
304
+
305
+ Omit any category header that has zero entries.
306
+ The `### System-Wide` header is NEVER omitted.
307
+
308
+ Follow the output-format defined in story-wiki.xml template exactly.
309
+
310
+ Store the compiled markdown as WIKI_SECTION.
311
+ </step>
312
+
313
+ <!-- ══════════════════════════════════════════════════════════════════ -->
314
+ <!-- STEP 8: WRITE TO STORY FILE -->
315
+ <!-- ══════════════════════════════════════════════════════════════════ -->
316
+
317
+ <step name="write-output" order="8">
318
+
319
+ <!-- ── 8a: Write to local story file ──────────────────────────── -->
320
+
321
+ Read the current STORY_FILE content.
322
+
323
+ **If the story file contains a `## Relevant Wiki` section placeholder:**
324
+ Replace the placeholder section (from `## Relevant Wiki` up to the next `## `
325
+ heading or end of file) with WIKI_SECTION.
326
+
327
+ **If the story file does NOT contain a `## Relevant Wiki` section:**
328
+ Append WIKI_SECTION after the `## Definition of Done` section
329
+ (before `## Technical Solution` if it exists, otherwise before the metadata section).
330
+
331
+ Write the updated content back to STORY_FILE.
332
+
333
+ Display:
334
+ ```
335
+ + Relevant Wiki section written to {STORY_FILE}
336
+ ```
337
+
338
+ <!-- ── 8b: Update GitHub issue (if applicable) ───────────────── -->
339
+
340
+ **If the story was loaded from GitHub OR the story file header contains a GitHub link:**
341
+
342
+ Extract the issue number from the story.
343
+
344
+ **If `has_gh_cli` is true AND issue number is available:**
345
+
346
+ Read the current GitHub issue body:
347
+ ```bash
348
+ GH_BODY=$(gh issue view {issue_number} --repo {REPO} --json body -q .body)
349
+ ```
350
+
351
+ Replace or append the `## Relevant Wiki` section in the issue body
352
+ (same logic as local file — find and replace existing section, or append).
353
+
354
+ Update the issue:
355
+ ```bash
356
+ gh issue edit {issue_number} --repo {REPO} --body "{updated_body}"
357
+ ```
358
+
359
+ Display:
360
+ ```
361
+ + GitHub issue #{issue_number} updated with Relevant Wiki section.
362
+ ```
363
+
364
+ **If GitHub CLI not available or no issue number:**
365
+ Display:
366
+ ```
367
+ i No GitHub issue to update. Local file only.
368
+ ```
369
+ </step>
370
+
371
+ <!-- ══════════════════════════════════════════════════════════════════ -->
372
+ <!-- STEP 9: VALIDATION -->
373
+ <!-- ══════════════════════════════════════════════════════════════════ -->
374
+
375
+ <step name="validation" order="9">
376
+
377
+ Re-read STORY_FILE and verify:
378
+
379
+ **Content Requirements:**
380
+ - [ ] `## Relevant Wiki` section exists in the story file
381
+ - [ ] `### System-Wide` subsection is present with all four docs listed
382
+ - [ ] Subsystem references (if any) are grouped by wiki document type
383
+ - [ ] Each subsystem reference has a one-line reason
384
+ - [ ] No empty category headers (omit categories with zero entries)
385
+ - [ ] No placeholder text left unfilled
386
+ - [ ] File paths use backtick formatting
387
+
388
+ **Quality Requirements:**
389
+ - [ ] Subsystem reasons are story-specific, not generic ("related to auth" = FAIL)
390
+ - [ ] Only directly relevant subsystem docs included (no tangential references)
391
+ - [ ] Markdown renders cleanly (no broken formatting)
392
+
393
+ **Total: 10 mandatory checklist items**
394
+
395
+ If any check fails, fix the issue before proceeding.
396
+
397
+ Display:
398
+ ```
399
+ {check_mark} Relevant Wiki validated. {passed}/{total} checks passed.
400
+ ```
401
+ </step>
402
+
403
+ <!-- ══════════════════════════════════════════════════════════════════ -->
404
+ <!-- STEP 10: REVIEW -->
405
+ <!-- ══════════════════════════════════════════════════════════════════ -->
406
+
407
+ <step name="review" order="10">
408
+
409
+ Display a summary:
410
+ ```
411
+ Wiki Research Summary:
412
+ ────────
413
+ System-wide docs: 4
414
+ Subsystem docs: {N}
415
+ Subsystems scanned: {M}
416
+ Total references: {4 + N}
417
+ ```
418
+
419
+ Use AskUserQuestion:
420
+ - header: "Wiki"
421
+ - question: "Relevant Wiki section written to `{STORY_FILE}`. Does it look comprehensive?"
422
+ - options:
423
+ - "Approve" — Looks good
424
+ - "Refine" — Some references are missing or incorrect
425
+
426
+ **If "Approve":**
427
+
428
+ Display completion:
429
+ ```
430
+ ╔══════════════════════════════════════════════════╗
431
+ ║ ACE > Story Wiki Research Complete ║
432
+ ║ {Story ID} "{Story Title}" ║
433
+ ╚══════════════════════════════════════════════════╝
434
+
435
+ + {STORY_FILE} updated.
436
+
437
+ References:
438
+ ────────
439
+ System-wide: 4 | Subsystem: {N} | Total: {4 + N}
440
+
441
+ i Wiki research complete. The Relevant Wiki section is now
442
+ part of the story file and will be used by pass 5
443
+ (technical solution) to load implementation context.
444
+
445
+ Next > Continue with story refinement:
446
+ - /ace:research-external-solution — analyze external reference systems
447
+ - /ace:plan-story — continue the story pipeline
448
+ ```
449
+
450
+ **If "Refine":**
451
+ - Ask what references are missing or incorrect
452
+ - Go back to the relevant step (re-read wiki docs, adjust references)
453
+ - Re-validate (step 9) and present for review again
454
+ </step>
455
+
456
+ </process>
457
+
458
+ <success_criteria>
459
+ - Story loaded and requirements extracted (User Story, Description, AC)
460
+ - Parent feature document loaded for broader context (if available)
461
+ - Feature-level relevant-wiki.md checked for subsystem hints (if exists)
462
+ - All four system-wide wiki docs included (fixed list, not read)
463
+ - Affected subsystems identified from story content and feature context
464
+ - Parallel ace-wiki-mapper agents spawned for each affected subsystem
465
+ - Agent results collected and merged into categorized references
466
+ - Relevant Wiki section compiled following story-wiki.xml template
467
+ - Story file updated with the Relevant Wiki section
468
+ - GitHub issue updated (if applicable)
469
+ - All 10 validation checklist items verified
470
+ - User reviewed and approved the output
471
+ </success_criteria>
472
+
473
+ </workflow>