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,761 +1,761 @@
1
- <workflow>
2
-
3
- <purpose>
4
- Design a COMPREHENSIVE TECHNICAL SOLUTION for a specific story. Load the story
5
- requirements and wiki references, validate inputs, load wiki documents, integration
6
- analysis (MANDATORY), and optional external analysis, then execute exhaustive
7
- solution design following the template's analysis-process phases. Write the
8
- technical solution directly INTO the story file and update the GitHub issue.
9
-
10
- This is pass 5 of the story specification pipeline (see story.xml composition).
11
- The technical solution is APPENDED to the story file as the `## Technical Solution`
12
- section. No separate artifact file is produced.
13
-
14
- Output is written to:
15
- - The story file (appended/replaced `## Technical Solution` section)
16
- - The GitHub issue body (if applicable)
17
-
18
- This workflow is executed by the `ace-technical-application-architect` agent
19
- (spawned via `subagent_type="ace-technical-application-architect"`).
20
- </purpose>
21
-
22
- <mandatory-context>
23
- Read all files referenced by the invoking command's execution-context before starting.
24
- Also read any document or text passed as parameter ($ARGUMENTS) in the invoking command.
25
- </mandatory-context>
26
-
27
- <process>
28
-
29
- <!-- ══════════════════════════════════════════════════════════════════ -->
30
- <!-- STEP 1: SETUP -->
31
- <!-- ══════════════════════════════════════════════════════════════════ -->
32
-
33
- <step name="setup" order="1">
34
- **MANDATORY FIRST STEP — Execute environment detection and story initialization:**
35
-
36
- INIT is available from the preprocessed Environment Context above — do NOT re-run init.
37
-
38
- This preprocessing validated the story parameter, extracted metadata/requirements/wiki
39
- references, computed all paths and slugs, and checked artifact existence.
40
-
41
- Parse INIT JSON for:
42
- - **Environment**: `has_git`, `has_gh_cli`, `github_project`, `analyst_model`
43
- - **Story validation**: `story_valid`, `story_error`, `story_source`
44
- - **Story metadata**: `story` (id, title, status, size), `feature` (id, title), `epic` (id, title)
45
- - **Requirements**: `user_story`, `description`, `acceptance_criteria_count`
46
- - **Paths**: `paths.*` (story_dir, story_file, integration_analysis_file, external_analysis_file, feature_dir, feature_file, etc.)
47
- - **Wiki**: `wiki_references` (system_wide, subsystem_docs, total_count), `wiki_docs_exist`
48
- - **Artifacts**: `has_external_analysis`, `has_integration_analysis`, `has_feature_file`
49
-
50
- Display stage banner:
51
-
52
- ```
53
- ╔══════════════════════════════════════════════════════════════╗
54
- ║ ACE > Research Technical Solution ║
55
- ╚══════════════════════════════════════════════════════════════╝
56
- ```
57
-
58
- **If `has_git` is false:** Initialize git:
59
- ```bash
60
- git init
61
- ```
62
-
63
- **If `INIT.story_valid` is false:**
64
- Display error using `INIT.story_error` and exit.
65
- </step>
66
-
67
- <!-- ══════════════════════════════════════════════════════════════════ -->
68
- <!-- STEP 2: VALIDATE & LOAD STORY -->
69
- <!-- ══════════════════════════════════════════════════════════════════ -->
70
-
71
- <step name="validate-story" order="2">
72
-
73
- **Story validation, parsing, metadata extraction, wiki reference extraction,
74
- and path computation were all completed by `init research-story` in step 1.**
75
- All data is available in the INIT JSON.
76
-
77
- Read the story file content for analysis context:
78
-
79
- **If `INIT.story_source` is `file`:**
80
- Read the file at `INIT.paths.story_file`. Store as STORY_CONTENT.
81
-
82
- **If `INIT.story_source` is `github-url` or `issue-number`:**
83
- Fetch the issue body using INIT's GitHub project context:
84
- ```bash
85
- GH_STORY=$(gh issue view {issue_number} --repo {INIT.github_project.owner}/{INIT.github_project.repo} --json body -q .body)
86
- ```
87
- Store as STORY_CONTENT.
88
-
89
- The story's User Story, Description, and Acceptance Criteria (from `INIT.user_story`,
90
- `INIT.description`, `INIT.acceptance_criteria_count`) define WHAT functionality to
91
- design a technical solution for. The wiki references (from `INIT.wiki_references`)
92
- define WHICH wiki documents to read for codebase context.
93
-
94
- <!-- ── 2b: Load parent feature document ────────────────────────── -->
95
-
96
- **If `INIT.has_feature_file` is true:**
97
- Read the feature document at `INIT.paths.feature_file` and extract:
98
- - Feature description, scope, and the COMPLETE feature vision
99
- - List of all stories in the feature (IDs, titles, descriptions)
100
- - Dependencies between stories
101
- - Shared components or services mentioned
102
- Store as FEATURE_CONTENT.
103
-
104
- **If `INIT.has_feature_file` is false:**
105
- Proceed without — the solution can still be designed without feature context.
106
-
107
- <!-- ── 2c: Display ───────────────────────────────────────────────── -->
108
-
109
- Set pre-computed paths from INIT:
110
- - `STORY_FILE = INIT.paths.story_file`
111
- - `STORY_DIR = INIT.paths.story_dir`
112
-
113
- Display:
114
- ```
115
- i Story loaded: {INIT.story.id} — {INIT.story.title}
116
- Feature: {INIT.feature.id} — {INIT.feature.title}
117
- Epic: {INIT.epic.id} — {INIT.epic.title}
118
- Requirements: {INIT.acceptance_criteria_count} acceptance criteria scenarios
119
- Wiki references: {INIT.wiki_references.total_count} documents to load
120
- ```
121
- </step>
122
-
123
- <!-- ══════════════════════════════════════════════════════════════════ -->
124
- <!-- STEP 3: LOAD WIKI DOCUMENTS -->
125
- <!-- ══════════════════════════════════════════════════════════════════ -->
126
-
127
- <step name="load-wiki-documents" order="3">
128
-
129
- **[MANDATORY] Read ALL wiki documents referenced in the story's Relevant Wiki section.**
130
-
131
- Wiki references were pre-extracted by `init research-story` and are available in
132
- `INIT.wiki_references` (system_wide list + subsystem_docs list). File existence
133
- was also pre-checked — see `INIT.wiki_docs_exist` (existing[] and missing[]).
134
-
135
- The wiki IS the single source of codebase knowledge.
136
-
137
- <!-- ── 3a: System-Wide documents (mandatory) ────────────────────── -->
138
-
139
- **System-Wide documents — ALWAYS load these (from `INIT.wiki_references.system_wide`):**
140
-
141
- Read each file and store its content:
142
- - `.docs/wiki/system-wide/system-structure.md` — High-level tree showing where code is
143
- - `.docs/wiki/system-wide/system-architecture.md` — Complete architectural overview
144
- - `.docs/wiki/system-wide/coding-standards.md` — **CRITICAL: Read BEFORE generating any solution code — NO EXCEPTIONS**
145
- - `.docs/wiki/system-wide/testing-framework.md` — Testing patterns and frameworks
146
-
147
- **STRONG EMPHASIS on coding-standards.md**: This file MUST be read and internalized
148
- BEFORE any class diagrams, interfaces, code snippets, or implementation patterns
149
- are produced. Every piece of code in the solution MUST comply with coding standards.
150
-
151
- **For any file in `INIT.wiki_docs_exist.missing`:** Display warning (non-fatal):
152
- ```
153
- ! Wiki document not found: {path}
154
- Continuing without it.
155
- ```
156
-
157
- <!-- ── 3b: Subsystem documents ──────────────────────────────────── -->
158
-
159
- **Subsystem documents — load all from `INIT.wiki_references.subsystem_docs`:**
160
-
161
- For EACH entry in `INIT.wiki_references.subsystem_docs`:
162
- 1. Check if the path is in `INIT.wiki_docs_exist.existing` (already verified)
163
- 2. If exists: read the file completely, store its content keyed by file path
164
- 3. If missing: display warning (non-fatal) and continue
165
-
166
- These subsystem documents provide the context that replaces:
167
- - "documentation" parameter — wiki docs cover all relevant documentation
168
- - "high-level-architecture" — system-architecture.md provides this
169
- - "sourcecode" parameter — system-structure.md has a high-level tree
170
- - "related-stories-implementations" — wiki documents capture knowledge from all stories
171
- - "documented-features" — wiki documents catalog existing feature implementations
172
- - "feature-planning" — the feature file provides this context
173
-
174
- <!-- ── 3c: Display ───────────────────────────────────────────────── -->
175
-
176
- Display:
177
- ```
178
- i Wiki documents loaded: {INIT.wiki_docs_exist.existing.length}/{INIT.wiki_references.total_count} files
179
- System-wide: {count}/4 | Subsystem: {INIT.wiki_references.subsystem_docs.length} documents
180
- Missing: {INIT.wiki_docs_exist.missing.length} (warnings shown above if any)
181
- ```
182
- </step>
183
-
184
- <!-- ══════════════════════════════════════════════════════════════════ -->
185
- <!-- STEP 4: LOAD INTEGRATION ANALYSIS (MANDATORY) -->
186
- <!-- ══════════════════════════════════════════════════════════════════ -->
187
-
188
- <step name="load-integration-analysis" order="4">
189
-
190
- **Integration analysis existence was pre-checked by `init research-story`.**
191
-
192
- The integration analysis is produced by pass 4 (`/ace:research-integration-solution`).
193
- It is a MANDATORY input — the technical solution CANNOT be designed without it.
194
-
195
- **If `INIT.has_integration_analysis` is true:**
196
- Read the file at `INIT.paths.integration_analysis_file`. Store as INTEGRATION_ANALYSIS_CONTENT.
197
- Display:
198
- ```
199
- i Integration analysis found: {INIT.paths.integration_analysis_file}
200
- Will use integration points, refactoring needs, and codebase patterns
201
- to design a seamless technical solution.
202
- ```
203
-
204
- **If `INIT.has_integration_analysis` is false:**
205
- Display error and EXIT:
206
- ```
207
- x Integration analysis NOT FOUND at {INIT.paths.integration_analysis_file}
208
- The integration analysis (pass 4) is MANDATORY for technical solution design.
209
- Run /ace:research-integration-solution first.
210
- ```
211
- **STOP — do not proceed without integration analysis.**
212
- </step>
213
-
214
- <!-- ══════════════════════════════════════════════════════════════════ -->
215
- <!-- STEP 5: CHECK FOR EXTERNAL ANALYSIS (OPTIONAL) -->
216
- <!-- ══════════════════════════════════════════════════════════════════ -->
217
-
218
- <step name="check-external-analysis" order="5">
219
-
220
- **External analysis existence was pre-checked by `init research-story`.**
221
-
222
- The external analysis is produced by pass 3 (`/ace:research-external-solution`).
223
- It is NOT a required input, but when present it provides valuable context about
224
- how external/industry-standard systems implement this functionality.
225
-
226
- **If `INIT.has_external_analysis` is true:**
227
- Read the file at `INIT.paths.external_analysis_file`. Store as EXTERNAL_ANALYSIS_CONTENT.
228
- Display:
229
- ```
230
- i External analysis found: {INIT.paths.external_analysis_file}
231
- Will consider external system algorithms and patterns where they are
232
- the MOST EFFICIENT AND PERFORMANT approach.
233
- ```
234
-
235
- **If `INIT.has_external_analysis` is false:**
236
- Set EXTERNAL_ANALYSIS_CONTENT = null.
237
- Display:
238
- ```
239
- i No external analysis found. Technical solution will rely on
240
- wiki documents, integration analysis, and Clean Architecture principles.
241
- ```
242
- </step>
243
-
244
- <!-- ══════════════════════════════════════════════════════════════════ -->
245
- <!-- STEP 6: CHECK EXISTING SOLUTION -->
246
- <!-- ══════════════════════════════════════════════════════════════════ -->
247
-
248
- <step name="check-existing" order="6">
249
-
250
- Check if the story file already contains a `## Technical Solution` section.
251
-
252
- **If the story file contains `## Technical Solution` with substantive content
253
- (more than just the placeholder comment):**
254
-
255
- Use AskUserQuestion:
256
- - header: "Existing"
257
- - question: "The story already contains a Technical Solution section. What would you like to do?"
258
- - options:
259
- - "Overwrite" — Discard and create a new solution from scratch
260
- - "Skip" — Keep the current solution as-is
261
-
262
- **If "Overwrite":** Continue to step 7.
263
- **If "Skip":** Display message and exit workflow:
264
- ```
265
- i Keeping existing technical solution. No changes made.
266
- ```
267
-
268
- **If no existing solution:** Continue to step 7.
269
- </step>
270
-
271
- <!-- ══════════════════════════════════════════════════════════════════ -->
272
- <!-- STEP 7: EXECUTE SOLUTION DESIGN -->
273
- <!-- ══════════════════════════════════════════════════════════════════ -->
274
-
275
- <step name="execute-solution-design" order="7">
276
-
277
- Display:
278
- ```
279
- ┌──────────────────────────────────────────────────────────────┐
280
- │ ACE > Research Technical Solution > Design │
281
- └──────────────────────────────────────────────────────────────┘
282
-
283
- i Starting comprehensive technical solution design.
284
- Reading wiki documents, integration analysis, coding standards,
285
- and designing architecture. This may take several minutes.
286
- ```
287
-
288
- **Execute the complete solution design following the template's `&lt;analysis-process&gt;` section.**
289
- The template (`story-technical-solution.xml`) defines the mandatory phases.
290
- You ARE the technical-application-architect — perform the design directly.
291
-
292
- <!-- ═══════════════════════════════════════════════════════════ -->
293
- <!-- Phase 1: INITIAL DISCOVERY -->
294
- <!-- ═══════════════════════════════════════════════════════════ -->
295
-
296
- <phase name="initial-discovery" order="1">
297
-
298
- <item name="understand-story" mandatory="true">
299
- **[MANDATORY] Understand the Story:**
300
-
301
- - If story is a file path: Read the markdown file directly
302
- - If story is GitHub URL/number: Use GitHub CLI (`gh issue view`)
303
- - Fully understand what functionality needs to be implemented
304
- - Identify ALL acceptance criteria scenarios (each will need a sequence diagram)
305
- </item>
306
-
307
- <item name="extract-business-requirements" mandatory="true">
308
- **[MANDATORY] Extract Business Requirements from Story:**
309
-
310
- - Thoroughly analyze the story's User Story, Description, and Acceptance Criteria
311
- - Extract business requirements and constraints
312
- - **CRITICAL**: Identify ALL scenarios from Acceptance Criteria — each will need a sequence diagram
313
- - Understand the business context and value
314
- - The story IS the source of truth for business requirements
315
- </item>
316
-
317
- <item name="study-external-analysis" mandatory="false">
318
- **[CONDITIONAL] Study External/Industry-Standard Analysis:**
319
-
320
- **WHEN TO RUN**: Only if EXTERNAL_ANALYSIS_CONTENT is available.
321
-
322
- The external analysis provides insights from industry-standard implementations.
323
- **USE WITH JUDGMENT** — extract and use:
324
-
325
- - **Algorithms**: Use the same algorithms IF they are the MOST EFFICIENT AND PERFORMANT.
326
- If you can identify a better approach, use the better approach.
327
- - **Formulas**: Use the same mathematical formulas and calculations IF they are optimal.
328
- If you know a more efficient formula, use it.
329
- - **Constants**: Consider the same constant values and thresholds as starting points.
330
- - **Business Logic**: Adopt proven business rules and validations.
331
- - **Design Patterns**: Follow their patterns where they align with Clean Architecture.
332
- - **Data Structures**: Use similar data models where appropriate.
333
- - **Event Flows**: Consider their event handling approaches.
334
- - **Error Handling**: Adopt their error handling strategies where they fit.
335
-
336
- **CRITICAL PHILOSOPHY**: The external analysis is a REFERENCE, not a blueprint.
337
- Use external patterns when they are the most efficient and performant approach.
338
- Improve upon them when you can identify a better way.
339
- </item>
340
-
341
- <item name="feature-planning-context" mandatory="true">
342
- **[MANDATORY] Feature Planning Context (from feature file):**
343
-
344
- If FEATURE_CONTENT is available, analyze it for:
345
-
346
- - **Feature Scope**: What is the COMPLETE feature trying to achieve?
347
- - **Story Dependencies**: Which stories must be completed before/after this one?
348
- - **Shared Components**: What components are used by MULTIPLE stories?
349
- - **Data Flow Between Stories**: How does data flow from one story to another?
350
- - **Integration Points**: Where do stories connect and interact?
351
- - **Feature-Level Patterns**: What patterns span across all stories?
352
-
353
- Use this to:
354
- - Ensure this story aligns with the overall feature architecture
355
- - Design components that can be reused by other stories
356
- - Create interfaces that support future stories
357
- - Avoid creating silos — think feature-wide!
358
-
359
- **NEVER DESIGN IN ISOLATION** — Consider the complete feature!
360
-
361
- If no feature file available, proceed but note this in the solution.
362
- </item>
363
-
364
- </phase>
365
-
366
- <!-- ═══════════════════════════════════════════════════════════ -->
367
- <!-- Phase 2: OUR SYSTEM ARCHITECTURE UNDERSTANDING -->
368
- <!-- ═══════════════════════════════════════════════════════════ -->
369
-
370
- <phase name="system-architecture-understanding" order="2">
371
-
372
- <item name="comprehensive-architecture" mandatory="true">
373
- **[MANDATORY] Comprehensive System Architecture (from wiki):**
374
-
375
- Using the wiki documents loaded in step 3:
376
-
377
- - **system-architecture.md**: FULLY review for COMPREHENSIVE architectural overview
378
- - Understand the complete system architecture (not just the story)
379
- - Identify architectural layers and their responsibilities
380
- - Map where this story's components will fit in the overall architecture
381
- - Understand existing patterns and conventions
382
-
383
- - **system-structure.md**: Understand the codebase layout,
384
- where relevant code lives, and the project file organization
385
- </item>
386
-
387
- <item name="wiki-subsystem-knowledge" mandatory="true">
388
- **[MANDATORY] Subsystem Knowledge (from wiki documents):**
389
-
390
- Using the subsystem wiki documents loaded in step 3, study ALL:
391
-
392
- - **Systems**: Understand system descriptions, boundaries, and APIs
393
- that relate to this story
394
- - **Patterns**: Catalog design patterns in use (Strategy, Factory, Observer, etc.)
395
- that MUST be followed for consistency
396
- - **Decisions (ADRs)**: Architecture Decision Records that constrain design choices
397
- - **Cross-Cutting Concerns**: Shared concerns to respect (auth, logging, errors, etc.)
398
- - **Guides**: Implementation guides for common tasks relevant to this story
399
- - **Walkthroughs**: Deep tutorial-style flow explanations with actual code snippets
400
-
401
- These wiki documents replace the obsolete command's parameters:
402
- - "related-stories-implementations" — wiki captures this knowledge
403
- - "documented-features" — wiki catalogs existing implementations
404
- - "documentation" — wiki IS the documentation
405
-
406
- **Extract from wiki documents:**
407
-
408
- ```yaml
409
- INTERFACES TO EXTEND (not recreate):
410
- - [Interface name and location from wiki]
411
-
412
- CLASSES TO COMPOSE (not duplicate):
413
- - [Class name and location from wiki]
414
-
415
- PATTERNS PROVEN SUCCESSFUL:
416
- - [Pattern and where documented in wiki]
417
-
418
- CONSTANTS TO REUSE (not duplicate):
419
- - [Constant file and values from wiki]
420
- ```
421
- </item>
422
-
423
- <item name="integration-analysis-study" mandatory="true">
424
- **[MANDATORY] Deep Study of Integration Analysis:**
425
-
426
- **THOROUGHLY ANALYZE** the INTEGRATION_ANALYSIS_CONTENT (from step 4).
427
- **CRITICAL**: This document tells you EXACTLY how to integrate without breaking the codebase.
428
-
429
- **Extract ALL:**
430
- - **Integration Points**: Where the new code connects to existing code
431
- - **Required Refactoring**: What existing code MUST be refactored for proper integration
432
- - **Patterns to Follow**: Existing patterns that MUST be followed
433
- - **Files to Modify**: Which existing files need changes
434
- - **Dependencies**: What the new code depends on and what depends on it
435
- - **Hardcoded Values**: All hardcoded values and placeholder code that MUST be replaced
436
- - **Architecture Compatibility**: How the story fits into Clean Architecture layers
437
- - **Testing Strategy**: How to test without breaking existing tests
438
-
439
- **USE THIS TO:**
440
- - Design refactoring strategies that maintain extensibility
441
- - Ensure seamless integration without breaking existing functionality
442
- - Keep the codebase maintainable and follow SOLID principles
443
-
444
- **NEVER SKIP REFACTORING** if the integration analysis identifies it's needed!
445
- </item>
446
-
447
- </phase>
448
-
449
- <!-- ═══════════════════════════════════════════════════════════ -->
450
- <!-- Phase 3: CODEBASE ANALYSIS -->
451
- <!-- ═══════════════════════════════════════════════════════════ -->
452
-
453
- <phase name="codebase-analysis" order="3">
454
-
455
- <item name="coding-standards-review" mandatory="true">
456
- **[MANDATORY] Coding Standards Review:**
457
-
458
- **CRITICAL** — Read and internalize `.docs/wiki/system-wide/coding-standards.md`
459
- BEFORE generating ANY solution code, class diagrams, or interfaces.
460
-
461
- Verify you understand and will enforce:
462
- - Zero hardcoding rules
463
- - Single responsibility (one class/interface/type per file!)
464
- - Interface-first design (code against interfaces)
465
- - No assumptions — verify by reading actual code
466
- - No dead code policy
467
- - File size limits
468
- - Naming conventions
469
- - Layer placement rules
470
-
471
- **EVERY piece of code in the technical solution MUST comply with coding standards.**
472
- </item>
473
-
474
- <item name="source-code-analysis" mandatory="true">
475
- **[MANDATORY] Source Code Analysis (guided by wiki and integration analysis):**
476
-
477
- Using system-structure.md as guide, and integration analysis for specific files:
478
- - Identify existing patterns and structures
479
- - Find reusable components and services
480
- - Map current layer structures
481
- - Document naming conventions
482
- - Identify external dependencies and APIs
483
-
484
- **Focus on files identified by the integration analysis** — don't search blindly.
485
- </item>
486
-
487
- </phase>
488
-
489
- <!-- ═══════════════════════════════════════════════════════════ -->
490
- <!-- Phase 4: SOLUTION DESIGN -->
491
- <!-- ═══════════════════════════════════════════════════════════ -->
492
-
493
- <phase name="solution-design" order="4">
494
-
495
- After loading all context from phases 1-3, you should have:
496
- - Complete understanding of the story and business requirements
497
- - Knowledge of industry standard approaches (if external analysis available)
498
- - Full system architecture understanding from wiki
499
- - Feature context and story dependencies
500
- - Codebase patterns and conventions from wiki
501
- - Integration requirements and constraints from integration analysis
502
- - Coding standards internalized
503
-
504
- Use ALL this information to design a viable technical solution that:
505
- - Respects Clean Architecture principles
506
- - Follows established patterns from wiki
507
- - Integrates seamlessly per integration analysis
508
- - Maintains extensibility
509
- - Enables testability
510
- - Strictly follows coding standards
511
-
512
- **Generate the complete technical solution following the template's `&lt;output-format&gt;`
513
- section in story-technical-solution.xml. This includes ALL of the following sections.**
514
-
515
- </phase>
516
-
517
- </step>
518
-
519
- <!-- ══════════════════════════════════════════════════════════════════ -->
520
- <!-- STEP 8: WRITE OUTPUT TO STORY FILE -->
521
- <!-- ══════════════════════════════════════════════════════════════════ -->
522
-
523
- <step name="write-output" order="8">
524
-
525
- **Write the complete technical solution INTO the story file.**
526
-
527
- The output follows the template's `&lt;output-format&gt;` section exactly.
528
- It includes ALL sections from the design phases above.
529
-
530
- <!-- ── 8a: Write to local story file ──────────────────────────── -->
531
-
532
- Read the current STORY_FILE content.
533
-
534
- **If the story file contains a `## Technical Solution` section placeholder:**
535
- Replace the placeholder section (from `## Technical Solution` up to the next `## `
536
- heading or end-of-file metadata section `---`) with the full technical solution.
537
-
538
- **If the story file does NOT contain a `## Technical Solution` section:**
539
- Append the technical solution after the `## Relevant Wiki` section
540
- (before the metadata section `---` at the end if it exists).
541
-
542
- Write the updated content back to STORY_FILE using the Write or Edit tool.
543
-
544
- Display:
545
- ```
546
- + Technical solution written to {STORY_FILE}
547
- ```
548
-
549
- <!-- ── 8b: Update GitHub issue (if applicable) ───────────────── -->
550
-
551
- **If the story was loaded from GitHub OR the story file header contains a GitHub link:**
552
-
553
- Extract the issue number from the story.
554
-
555
- **If `has_gh_cli` is true AND issue number is available:**
556
-
557
- Read the current GitHub issue body:
558
- ```bash
559
- GH_BODY=$(gh issue view {issue_number} --repo {REPO} --json body -q .body)
560
- ```
561
-
562
- Replace or append the `## Technical Solution` section in the issue body
563
- (same logic as local file — find and replace existing section, or append).
564
-
565
- Update the issue:
566
- ```bash
567
- gh issue edit {issue_number} --repo {REPO} --body "{updated_body}"
568
- ```
569
-
570
- Display:
571
- ```
572
- + GitHub issue #{issue_number} updated with Technical Solution section.
573
- ```
574
-
575
- **If GitHub CLI not available or no issue number:**
576
- Display:
577
- ```
578
- i No GitHub issue to update. Local file only.
579
- ```
580
- </step>
581
-
582
- <!-- ══════════════════════════════════════════════════════════════════ -->
583
- <!-- STEP 9: VALIDATION -->
584
- <!-- ══════════════════════════════════════════════════════════════════ -->
585
-
586
- <step name="validation" order="9">
587
-
588
- Read the story file and verify the technical solution against the validation
589
- checklist defined in the template (story-technical-solution.xml):
590
-
591
- **Story File Requirements:**
592
- - [ ] Technical solution section exists in the story file
593
- - [ ] Section contains all required subsections from template
594
-
595
- **Architecture Requirements:**
596
- - [ ] Component and Boundary Architecture with Mermaid diagram
597
- - [ ] Layer Architecture Analysis (Domain, Application, Infrastructure, Presentation)
598
- - [ ] Clean Architecture compliance verified (dependencies point inward)
599
- - [ ] Dependency injection strategy documented
600
-
601
- **Design Requirements:**
602
- - [ ] Design patterns documented with purpose and implementation
603
- - [ ] Technical decisions documented with rationale and trade-offs
604
- - [ ] Class diagrams with complete interface definitions
605
- - [ ] EVERY interface/class/type in its OWN SEPARATE FILE (coding standards!)
606
- - [ ] Data models and structures defined with TypeScript types
607
-
608
- **Algorithm Requirements:**
609
- - [ ] Algorithms documented with mathematical formulas
610
- - [ ] Constants and configuration values defined (NO hardcoding!)
611
- - [ ] Business rules documented with implementations
612
- - [ ] Example calculations provided
613
-
614
- **Sequence Diagram Requirements (CRITICAL!):**
615
- - [ ] Sequence diagram for EVERY AC scenario
616
- - [ ] Full flow from entry point to exit through ALL layers
617
- - [ ] Real method names used (not generic placeholders)
618
- - [ ] Error handling paths included (alt blocks)
619
- - [ ] Data structures shown at each step
620
-
621
- **Implementation Requirements:**
622
- - [ ] Complete file structure tree (new + modified files)
623
- - [ ] DI container configuration specified
624
- - [ ] Refactoring plan from integration analysis incorporated
625
- - [ ] Testing strategy (unit, integration, e2e)
626
- - [ ] Implementation order with dependencies
627
- - [ ] Implementation checklist
628
-
629
- **Compliance Requirements:**
630
- - [ ] Coding standards compliance verified throughout
631
- - [ ] Integration analysis findings incorporated
632
- - [ ] No hardcoded values in any code snippets
633
- - [ ] All code follows Clean Architecture layers
634
-
635
- **Total: 25 mandatory checklist items**
636
-
637
- If the output is incomplete or missing sections, go back and fill in
638
- the missing content before proceeding.
639
-
640
- Display:
641
- ```
642
- {check_mark} Solution validated. {passed}/{total} checks passed.
643
- ```
644
- </step>
645
-
646
- <!-- ══════════════════════════════════════════════════════════════════ -->
647
- <!-- STEP 10: REVIEW AND APPROVE -->
648
- <!-- ══════════════════════════════════════════════════════════════════ -->
649
-
650
- <step name="review" order="10">
651
-
652
- Display a summary of the solution:
653
- ```
654
- Solution Summary:
655
- ────────
656
- Sections: {count}/13 | Checklist: {passed}/25
657
- Wiki docs loaded: {N} | Integration analysis: loaded
658
- External analysis: {loaded/not found}
659
- AC scenarios: {M} | Sequence diagrams: {M}
660
- New files: {F} | Modified files: {G}
661
- Design patterns: {P} | Refactoring items: {R}
662
- ```
663
-
664
- Use AskUserQuestion:
665
- - header: "Solution"
666
- - question: "Technical solution written to `{STORY_FILE}`. Review the file in your editor — does the solution look comprehensive?"
667
- - options:
668
- - "Approve" — Looks good, commit it
669
- - "Refine" — Some sections need more depth
670
- - "Skip commit" — Keep the file but don't commit yet
671
-
672
- **If "Approve":**
673
- Continue to step 11.
674
-
675
- **If "Refine":**
676
- - Ask what sections need more depth or what's missing
677
- - Go back to the relevant design phase, read more code, and update the story file
678
- - Re-run validation (step 9)
679
- - Present for review again
680
-
681
- **If "Skip commit":**
682
- Display completion without commit:
683
- ```
684
- ╔══════════════════════════════════════════════════════════════╗
685
- ║ ACE > Technical Solution Complete (uncommitted) ║
686
- ║ {Story ID} "{Story Title}" ║
687
- ╚══════════════════════════════════════════════════════════════╝
688
-
689
- i Technical solution written to {STORY_FILE}
690
- File not committed — commit manually when ready.
691
- ```
692
- Exit workflow.
693
- </step>
694
-
695
- <!-- ══════════════════════════════════════════════════════════════════ -->
696
- <!-- STEP 11: COMMIT -->
697
- <!-- ══════════════════════════════════════════════════════════════════ -->
698
-
699
- <step name="commit" order="11">
700
-
701
- Stage and commit the story file:
702
-
703
- ```bash
704
- git add {STORY_FILE}
705
- ```
706
-
707
- ```bash
708
- git commit -m "docs: technical solution for {Story ID} — {Story Title}"
709
- ```
710
-
711
- Display completion:
712
-
713
- ```
714
- ╔══════════════════════════════════════════════════════════════╗
715
- ║ ACE > Technical Solution Complete ║
716
- ║ {Story ID} "{Story Title}" ║
717
- ╚══════════════════════════════════════════════════════════════╝
718
-
719
- + {STORY_FILE} committed.
720
-
721
- Metrics:
722
- ────────
723
- Wiki docs loaded: {N} | Integration analysis: incorporated
724
- External analysis: {incorporated/not available}
725
- AC scenarios covered: {M} sequence diagrams
726
- New files designed: {F} | Modified files: {G}
727
-
728
- i Technical solution complete. The story is now fully refined
729
- (pass 5) and ready for implementation.
730
-
731
- Next > Continue with story execution:
732
- - /ace:execute-story story=... — Implement the story
733
- - /ace:research-technical-solution story=... — Design another story
734
- - /ace:help — Check project initialization status
735
- ```
736
- </step>
737
-
738
- </process>
739
-
740
- <success_criteria>
741
- - Story loaded and requirements extracted (User Story, Description, Acceptance Criteria)
742
- - All wiki references extracted from story's Relevant Wiki section
743
- - All wiki documents loaded (system-wide mandatory, subsystem as referenced)
744
- - Coding standards read and internalized BEFORE generating solution code
745
- - Parent feature document loaded for broader context (if available)
746
- - Integration analysis loaded and studied (MANDATORY — exit if missing)
747
- - External analysis loaded if present in story directory (auto-detected, OPTIONAL)
748
- - All 4 design phases executed (Initial Discovery, System Architecture, Codebase Analysis, Solution Design)
749
- - Technical solution written to story file with ALL template sections populated
750
- - Sequence diagrams created for EVERY acceptance criteria scenario
751
- - Every interface/class/type designed as its own separate file
752
- - NO hardcoded values in any code snippets
753
- - All code follows Clean Architecture layers and coding standards
754
- - Integration analysis findings fully incorporated (refactoring, patterns, hardcoded values)
755
- - All 25 validation checklist items verified
756
- - GitHub issue updated with technical solution (if applicable)
757
- - User reviewed and approved the solution
758
- - Document committed with appropriate message
759
- </success_criteria>
760
-
761
- </workflow>
1
+ <workflow>
2
+
3
+ <purpose>
4
+ Design a COMPREHENSIVE TECHNICAL SOLUTION for a specific story. Load the story
5
+ requirements and wiki references, validate inputs, load wiki documents, integration
6
+ analysis (MANDATORY), and optional external analysis, then execute exhaustive
7
+ solution design following the template's analysis-process phases. Write the
8
+ technical solution directly INTO the story file and update the GitHub issue.
9
+
10
+ This is pass 5 of the story specification pipeline (see story.xml composition).
11
+ The technical solution is APPENDED to the story file as the `## Technical Solution`
12
+ section. No separate artifact file is produced.
13
+
14
+ Output is written to:
15
+ - The story file (appended/replaced `## Technical Solution` section)
16
+ - The GitHub issue body (if applicable)
17
+
18
+ This workflow is executed by the `ace-technical-application-architect` agent
19
+ (spawned via `subagent_type="ace-technical-application-architect"`).
20
+ </purpose>
21
+
22
+ <mandatory-context>
23
+ All supporting resource files are auto-loaded in the skill prompt above. Do NOT re-read them.
24
+ Also read any document or text passed as parameter ($ARGUMENTS) in the invoking command.
25
+ </mandatory-context>
26
+
27
+ <process>
28
+
29
+ <!-- ══════════════════════════════════════════════════════════════════ -->
30
+ <!-- STEP 1: SETUP -->
31
+ <!-- ══════════════════════════════════════════════════════════════════ -->
32
+
33
+ <step name="setup" order="1">
34
+ **MANDATORY FIRST STEP — Execute environment detection and story initialization:**
35
+
36
+ INIT is available from the preprocessed Environment Context above — do NOT re-run init.
37
+
38
+ This preprocessing validated the story parameter, extracted metadata/requirements/wiki
39
+ references, computed all paths and slugs, and checked artifact existence.
40
+
41
+ Parse INIT JSON for:
42
+ - **Environment**: `has_git`, `has_gh_cli`, `github_project`, `analyst_model`
43
+ - **Story validation**: `story_valid`, `story_error`, `story_source`
44
+ - **Story metadata**: `story` (id, title, status, size), `feature` (id, title), `epic` (id, title)
45
+ - **Requirements**: `user_story`, `description`, `acceptance_criteria_count`
46
+ - **Paths**: `paths.*` (story_dir, story_file, integration_analysis_file, external_analysis_file, feature_dir, feature_file, etc.)
47
+ - **Wiki**: `wiki_references` (system_wide, subsystem_docs, total_count), `wiki_docs_exist`
48
+ - **Artifacts**: `has_external_analysis`, `has_integration_analysis`, `has_feature_file`
49
+
50
+ Display stage banner:
51
+
52
+ ```
53
+ ╔══════════════════════════════════════════════════════════════╗
54
+ ║ ACE > Research Technical Solution ║
55
+ ╚══════════════════════════════════════════════════════════════╝
56
+ ```
57
+
58
+ **If `has_git` is false:** Initialize git:
59
+ ```bash
60
+ git init
61
+ ```
62
+
63
+ **If `INIT.story_valid` is false:**
64
+ Display error using `INIT.story_error` and exit.
65
+ </step>
66
+
67
+ <!-- ══════════════════════════════════════════════════════════════════ -->
68
+ <!-- STEP 2: VALIDATE & LOAD STORY -->
69
+ <!-- ══════════════════════════════════════════════════════════════════ -->
70
+
71
+ <step name="validate-story" order="2">
72
+
73
+ **Story validation, parsing, metadata extraction, wiki reference extraction,
74
+ and path computation were all completed by `init research-story` in step 1.**
75
+ All data is available in the INIT JSON.
76
+
77
+ Read the story file content for analysis context:
78
+
79
+ **If `INIT.story_source` is `file`:**
80
+ Read the file at `INIT.paths.story_file`. Store as STORY_CONTENT.
81
+
82
+ **If `INIT.story_source` is `github-url` or `issue-number`:**
83
+ Fetch the issue body using INIT's GitHub project context:
84
+ ```bash
85
+ GH_STORY=$(gh issue view {issue_number} --repo {INIT.github_project.owner}/{INIT.github_project.repo} --json body -q .body)
86
+ ```
87
+ Store as STORY_CONTENT.
88
+
89
+ The story's User Story, Description, and Acceptance Criteria (from `INIT.user_story`,
90
+ `INIT.description`, `INIT.acceptance_criteria_count`) define WHAT functionality to
91
+ design a technical solution for. The wiki references (from `INIT.wiki_references`)
92
+ define WHICH wiki documents to read for codebase context.
93
+
94
+ <!-- ── 2b: Load parent feature document ────────────────────────── -->
95
+
96
+ **If `INIT.has_feature_file` is true:**
97
+ Read the feature document at `INIT.paths.feature_file` and extract:
98
+ - Feature description, scope, and the COMPLETE feature vision
99
+ - List of all stories in the feature (IDs, titles, descriptions)
100
+ - Dependencies between stories
101
+ - Shared components or services mentioned
102
+ Store as FEATURE_CONTENT.
103
+
104
+ **If `INIT.has_feature_file` is false:**
105
+ Proceed without — the solution can still be designed without feature context.
106
+
107
+ <!-- ── 2c: Display ───────────────────────────────────────────────── -->
108
+
109
+ Set pre-computed paths from INIT:
110
+ - `STORY_FILE = INIT.paths.story_file`
111
+ - `STORY_DIR = INIT.paths.story_dir`
112
+
113
+ Display:
114
+ ```
115
+ i Story loaded: {INIT.story.id} — {INIT.story.title}
116
+ Feature: {INIT.feature.id} — {INIT.feature.title}
117
+ Epic: {INIT.epic.id} — {INIT.epic.title}
118
+ Requirements: {INIT.acceptance_criteria_count} acceptance criteria scenarios
119
+ Wiki references: {INIT.wiki_references.total_count} documents to load
120
+ ```
121
+ </step>
122
+
123
+ <!-- ══════════════════════════════════════════════════════════════════ -->
124
+ <!-- STEP 3: LOAD WIKI DOCUMENTS -->
125
+ <!-- ══════════════════════════════════════════════════════════════════ -->
126
+
127
+ <step name="load-wiki-documents" order="3">
128
+
129
+ **[MANDATORY] Read ALL wiki documents referenced in the story's Relevant Wiki section.**
130
+
131
+ Wiki references were pre-extracted by `init research-story` and are available in
132
+ `INIT.wiki_references` (system_wide list + subsystem_docs list). File existence
133
+ was also pre-checked — see `INIT.wiki_docs_exist` (existing[] and missing[]).
134
+
135
+ The wiki IS the single source of codebase knowledge.
136
+
137
+ <!-- ── 3a: System-Wide documents (mandatory) ────────────────────── -->
138
+
139
+ **System-Wide documents — ALWAYS load these (from `INIT.wiki_references.system_wide`):**
140
+
141
+ Read each file and store its content:
142
+ - `.docs/wiki/system-wide/system-structure.md` — High-level tree showing where code is
143
+ - `.docs/wiki/system-wide/system-architecture.md` — Complete architectural overview
144
+ - `.docs/wiki/system-wide/coding-standards.md` — **CRITICAL: Read BEFORE generating any solution code — NO EXCEPTIONS**
145
+ - `.docs/wiki/system-wide/testing-framework.md` — Testing patterns and frameworks
146
+
147
+ **STRONG EMPHASIS on coding-standards.md**: This file MUST be read and internalized
148
+ BEFORE any class diagrams, interfaces, code snippets, or implementation patterns
149
+ are produced. Every piece of code in the solution MUST comply with coding standards.
150
+
151
+ **For any file in `INIT.wiki_docs_exist.missing`:** Display warning (non-fatal):
152
+ ```
153
+ ! Wiki document not found: {path}
154
+ Continuing without it.
155
+ ```
156
+
157
+ <!-- ── 3b: Subsystem documents ──────────────────────────────────── -->
158
+
159
+ **Subsystem documents — load all from `INIT.wiki_references.subsystem_docs`:**
160
+
161
+ For EACH entry in `INIT.wiki_references.subsystem_docs`:
162
+ 1. Check if the path is in `INIT.wiki_docs_exist.existing` (already verified)
163
+ 2. If exists: read the file completely, store its content keyed by file path
164
+ 3. If missing: display warning (non-fatal) and continue
165
+
166
+ These subsystem documents provide the context that replaces:
167
+ - "documentation" parameter — wiki docs cover all relevant documentation
168
+ - "high-level-architecture" — system-architecture.md provides this
169
+ - "sourcecode" parameter — system-structure.md has a high-level tree
170
+ - "related-stories-implementations" — wiki documents capture knowledge from all stories
171
+ - "documented-features" — wiki documents catalog existing feature implementations
172
+ - "feature-planning" — the feature file provides this context
173
+
174
+ <!-- ── 3c: Display ───────────────────────────────────────────────── -->
175
+
176
+ Display:
177
+ ```
178
+ i Wiki documents loaded: {INIT.wiki_docs_exist.existing.length}/{INIT.wiki_references.total_count} files
179
+ System-wide: {count}/4 | Subsystem: {INIT.wiki_references.subsystem_docs.length} documents
180
+ Missing: {INIT.wiki_docs_exist.missing.length} (warnings shown above if any)
181
+ ```
182
+ </step>
183
+
184
+ <!-- ══════════════════════════════════════════════════════════════════ -->
185
+ <!-- STEP 4: LOAD INTEGRATION ANALYSIS (MANDATORY) -->
186
+ <!-- ══════════════════════════════════════════════════════════════════ -->
187
+
188
+ <step name="load-integration-analysis" order="4">
189
+
190
+ **Integration analysis existence was pre-checked by `init research-story`.**
191
+
192
+ The integration analysis is produced by pass 4 (`/ace:research-integration-solution`).
193
+ It is a MANDATORY input — the technical solution CANNOT be designed without it.
194
+
195
+ **If `INIT.has_integration_analysis` is true:**
196
+ Read the file at `INIT.paths.integration_analysis_file`. Store as INTEGRATION_ANALYSIS_CONTENT.
197
+ Display:
198
+ ```
199
+ i Integration analysis found: {INIT.paths.integration_analysis_file}
200
+ Will use integration points, refactoring needs, and codebase patterns
201
+ to design a seamless technical solution.
202
+ ```
203
+
204
+ **If `INIT.has_integration_analysis` is false:**
205
+ Display error and EXIT:
206
+ ```
207
+ x Integration analysis NOT FOUND at {INIT.paths.integration_analysis_file}
208
+ The integration analysis (pass 4) is MANDATORY for technical solution design.
209
+ Run /ace:research-integration-solution first.
210
+ ```
211
+ **STOP — do not proceed without integration analysis.**
212
+ </step>
213
+
214
+ <!-- ══════════════════════════════════════════════════════════════════ -->
215
+ <!-- STEP 5: CHECK FOR EXTERNAL ANALYSIS (OPTIONAL) -->
216
+ <!-- ══════════════════════════════════════════════════════════════════ -->
217
+
218
+ <step name="check-external-analysis" order="5">
219
+
220
+ **External analysis existence was pre-checked by `init research-story`.**
221
+
222
+ The external analysis is produced by pass 3 (`/ace:research-external-solution`).
223
+ It is NOT a required input, but when present it provides valuable context about
224
+ how external/industry-standard systems implement this functionality.
225
+
226
+ **If `INIT.has_external_analysis` is true:**
227
+ Read the file at `INIT.paths.external_analysis_file`. Store as EXTERNAL_ANALYSIS_CONTENT.
228
+ Display:
229
+ ```
230
+ i External analysis found: {INIT.paths.external_analysis_file}
231
+ Will consider external system algorithms and patterns where they are
232
+ the MOST EFFICIENT AND PERFORMANT approach.
233
+ ```
234
+
235
+ **If `INIT.has_external_analysis` is false:**
236
+ Set EXTERNAL_ANALYSIS_CONTENT = null.
237
+ Display:
238
+ ```
239
+ i No external analysis found. Technical solution will rely on
240
+ wiki documents, integration analysis, and Clean Architecture principles.
241
+ ```
242
+ </step>
243
+
244
+ <!-- ══════════════════════════════════════════════════════════════════ -->
245
+ <!-- STEP 6: CHECK EXISTING SOLUTION -->
246
+ <!-- ══════════════════════════════════════════════════════════════════ -->
247
+
248
+ <step name="check-existing" order="6">
249
+
250
+ Check if the story file already contains a `## Technical Solution` section.
251
+
252
+ **If the story file contains `## Technical Solution` with substantive content
253
+ (more than just the placeholder comment):**
254
+
255
+ Use AskUserQuestion:
256
+ - header: "Existing"
257
+ - question: "The story already contains a Technical Solution section. What would you like to do?"
258
+ - options:
259
+ - "Overwrite" — Discard and create a new solution from scratch
260
+ - "Skip" — Keep the current solution as-is
261
+
262
+ **If "Overwrite":** Continue to step 7.
263
+ **If "Skip":** Display message and exit workflow:
264
+ ```
265
+ i Keeping existing technical solution. No changes made.
266
+ ```
267
+
268
+ **If no existing solution:** Continue to step 7.
269
+ </step>
270
+
271
+ <!-- ══════════════════════════════════════════════════════════════════ -->
272
+ <!-- STEP 7: EXECUTE SOLUTION DESIGN -->
273
+ <!-- ══════════════════════════════════════════════════════════════════ -->
274
+
275
+ <step name="execute-solution-design" order="7">
276
+
277
+ Display:
278
+ ```
279
+ ┌──────────────────────────────────────────────────────────────┐
280
+ │ ACE > Research Technical Solution > Design │
281
+ └──────────────────────────────────────────────────────────────┘
282
+
283
+ i Starting comprehensive technical solution design.
284
+ Reading wiki documents, integration analysis, coding standards,
285
+ and designing architecture. This may take several minutes.
286
+ ```
287
+
288
+ **Execute the complete solution design following the template's `&lt;analysis-process&gt;` section.**
289
+ The template (`story-technical-solution.xml`) defines the mandatory phases.
290
+ You ARE the technical-application-architect — perform the design directly.
291
+
292
+ <!-- ═══════════════════════════════════════════════════════════ -->
293
+ <!-- Phase 1: INITIAL DISCOVERY -->
294
+ <!-- ═══════════════════════════════════════════════════════════ -->
295
+
296
+ <phase name="initial-discovery" order="1">
297
+
298
+ <item name="understand-story" mandatory="true">
299
+ **[MANDATORY] Understand the Story:**
300
+
301
+ - If story is a file path: Read the markdown file directly
302
+ - If story is GitHub URL/number: Use GitHub CLI (`gh issue view`)
303
+ - Fully understand what functionality needs to be implemented
304
+ - Identify ALL acceptance criteria scenarios (each will need a sequence diagram)
305
+ </item>
306
+
307
+ <item name="extract-business-requirements" mandatory="true">
308
+ **[MANDATORY] Extract Business Requirements from Story:**
309
+
310
+ - Thoroughly analyze the story's User Story, Description, and Acceptance Criteria
311
+ - Extract business requirements and constraints
312
+ - **CRITICAL**: Identify ALL scenarios from Acceptance Criteria — each will need a sequence diagram
313
+ - Understand the business context and value
314
+ - The story IS the source of truth for business requirements
315
+ </item>
316
+
317
+ <item name="study-external-analysis" mandatory="false">
318
+ **[CONDITIONAL] Study External/Industry-Standard Analysis:**
319
+
320
+ **WHEN TO RUN**: Only if EXTERNAL_ANALYSIS_CONTENT is available.
321
+
322
+ The external analysis provides insights from industry-standard implementations.
323
+ **USE WITH JUDGMENT** — extract and use:
324
+
325
+ - **Algorithms**: Use the same algorithms IF they are the MOST EFFICIENT AND PERFORMANT.
326
+ If you can identify a better approach, use the better approach.
327
+ - **Formulas**: Use the same mathematical formulas and calculations IF they are optimal.
328
+ If you know a more efficient formula, use it.
329
+ - **Constants**: Consider the same constant values and thresholds as starting points.
330
+ - **Business Logic**: Adopt proven business rules and validations.
331
+ - **Design Patterns**: Follow their patterns where they align with Clean Architecture.
332
+ - **Data Structures**: Use similar data models where appropriate.
333
+ - **Event Flows**: Consider their event handling approaches.
334
+ - **Error Handling**: Adopt their error handling strategies where they fit.
335
+
336
+ **CRITICAL PHILOSOPHY**: The external analysis is a REFERENCE, not a blueprint.
337
+ Use external patterns when they are the most efficient and performant approach.
338
+ Improve upon them when you can identify a better way.
339
+ </item>
340
+
341
+ <item name="feature-planning-context" mandatory="true">
342
+ **[MANDATORY] Feature Planning Context (from feature file):**
343
+
344
+ If FEATURE_CONTENT is available, analyze it for:
345
+
346
+ - **Feature Scope**: What is the COMPLETE feature trying to achieve?
347
+ - **Story Dependencies**: Which stories must be completed before/after this one?
348
+ - **Shared Components**: What components are used by MULTIPLE stories?
349
+ - **Data Flow Between Stories**: How does data flow from one story to another?
350
+ - **Integration Points**: Where do stories connect and interact?
351
+ - **Feature-Level Patterns**: What patterns span across all stories?
352
+
353
+ Use this to:
354
+ - Ensure this story aligns with the overall feature architecture
355
+ - Design components that can be reused by other stories
356
+ - Create interfaces that support future stories
357
+ - Avoid creating silos — think feature-wide!
358
+
359
+ **NEVER DESIGN IN ISOLATION** — Consider the complete feature!
360
+
361
+ If no feature file available, proceed but note this in the solution.
362
+ </item>
363
+
364
+ </phase>
365
+
366
+ <!-- ═══════════════════════════════════════════════════════════ -->
367
+ <!-- Phase 2: OUR SYSTEM ARCHITECTURE UNDERSTANDING -->
368
+ <!-- ═══════════════════════════════════════════════════════════ -->
369
+
370
+ <phase name="system-architecture-understanding" order="2">
371
+
372
+ <item name="comprehensive-architecture" mandatory="true">
373
+ **[MANDATORY] Comprehensive System Architecture (from wiki):**
374
+
375
+ Using the wiki documents loaded in step 3:
376
+
377
+ - **system-architecture.md**: FULLY review for COMPREHENSIVE architectural overview
378
+ - Understand the complete system architecture (not just the story)
379
+ - Identify architectural layers and their responsibilities
380
+ - Map where this story's components will fit in the overall architecture
381
+ - Understand existing patterns and conventions
382
+
383
+ - **system-structure.md**: Understand the codebase layout,
384
+ where relevant code lives, and the project file organization
385
+ </item>
386
+
387
+ <item name="wiki-subsystem-knowledge" mandatory="true">
388
+ **[MANDATORY] Subsystem Knowledge (from wiki documents):**
389
+
390
+ Using the subsystem wiki documents loaded in step 3, study ALL:
391
+
392
+ - **Systems**: Understand system descriptions, boundaries, and APIs
393
+ that relate to this story
394
+ - **Patterns**: Catalog design patterns in use (Strategy, Factory, Observer, etc.)
395
+ that MUST be followed for consistency
396
+ - **Decisions (ADRs)**: Architecture Decision Records that constrain design choices
397
+ - **Cross-Cutting Concerns**: Shared concerns to respect (auth, logging, errors, etc.)
398
+ - **Guides**: Implementation guides for common tasks relevant to this story
399
+ - **Walkthroughs**: Deep tutorial-style flow explanations with actual code snippets
400
+
401
+ These wiki documents replace the obsolete command's parameters:
402
+ - "related-stories-implementations" — wiki captures this knowledge
403
+ - "documented-features" — wiki catalogs existing implementations
404
+ - "documentation" — wiki IS the documentation
405
+
406
+ **Extract from wiki documents:**
407
+
408
+ ```yaml
409
+ INTERFACES TO EXTEND (not recreate):
410
+ - [Interface name and location from wiki]
411
+
412
+ CLASSES TO COMPOSE (not duplicate):
413
+ - [Class name and location from wiki]
414
+
415
+ PATTERNS PROVEN SUCCESSFUL:
416
+ - [Pattern and where documented in wiki]
417
+
418
+ CONSTANTS TO REUSE (not duplicate):
419
+ - [Constant file and values from wiki]
420
+ ```
421
+ </item>
422
+
423
+ <item name="integration-analysis-study" mandatory="true">
424
+ **[MANDATORY] Deep Study of Integration Analysis:**
425
+
426
+ **THOROUGHLY ANALYZE** the INTEGRATION_ANALYSIS_CONTENT (from step 4).
427
+ **CRITICAL**: This document tells you EXACTLY how to integrate without breaking the codebase.
428
+
429
+ **Extract ALL:**
430
+ - **Integration Points**: Where the new code connects to existing code
431
+ - **Required Refactoring**: What existing code MUST be refactored for proper integration
432
+ - **Patterns to Follow**: Existing patterns that MUST be followed
433
+ - **Files to Modify**: Which existing files need changes
434
+ - **Dependencies**: What the new code depends on and what depends on it
435
+ - **Hardcoded Values**: All hardcoded values and placeholder code that MUST be replaced
436
+ - **Architecture Compatibility**: How the story fits into Clean Architecture layers
437
+ - **Testing Strategy**: How to test without breaking existing tests
438
+
439
+ **USE THIS TO:**
440
+ - Design refactoring strategies that maintain extensibility
441
+ - Ensure seamless integration without breaking existing functionality
442
+ - Keep the codebase maintainable and follow SOLID principles
443
+
444
+ **NEVER SKIP REFACTORING** if the integration analysis identifies it's needed!
445
+ </item>
446
+
447
+ </phase>
448
+
449
+ <!-- ═══════════════════════════════════════════════════════════ -->
450
+ <!-- Phase 3: CODEBASE ANALYSIS -->
451
+ <!-- ═══════════════════════════════════════════════════════════ -->
452
+
453
+ <phase name="codebase-analysis" order="3">
454
+
455
+ <item name="coding-standards-review" mandatory="true">
456
+ **[MANDATORY] Coding Standards Review:**
457
+
458
+ **CRITICAL** — Read and internalize `.docs/wiki/system-wide/coding-standards.md`
459
+ BEFORE generating ANY solution code, class diagrams, or interfaces.
460
+
461
+ Verify you understand and will enforce:
462
+ - Zero hardcoding rules
463
+ - Single responsibility (one class/interface/type per file!)
464
+ - Interface-first design (code against interfaces)
465
+ - No assumptions — verify by reading actual code
466
+ - No dead code policy
467
+ - File size limits
468
+ - Naming conventions
469
+ - Layer placement rules
470
+
471
+ **EVERY piece of code in the technical solution MUST comply with coding standards.**
472
+ </item>
473
+
474
+ <item name="source-code-analysis" mandatory="true">
475
+ **[MANDATORY] Source Code Analysis (guided by wiki and integration analysis):**
476
+
477
+ Using system-structure.md as guide, and integration analysis for specific files:
478
+ - Identify existing patterns and structures
479
+ - Find reusable components and services
480
+ - Map current layer structures
481
+ - Document naming conventions
482
+ - Identify external dependencies and APIs
483
+
484
+ **Focus on files identified by the integration analysis** — don't search blindly.
485
+ </item>
486
+
487
+ </phase>
488
+
489
+ <!-- ═══════════════════════════════════════════════════════════ -->
490
+ <!-- Phase 4: SOLUTION DESIGN -->
491
+ <!-- ═══════════════════════════════════════════════════════════ -->
492
+
493
+ <phase name="solution-design" order="4">
494
+
495
+ After loading all context from phases 1-3, you should have:
496
+ - Complete understanding of the story and business requirements
497
+ - Knowledge of industry standard approaches (if external analysis available)
498
+ - Full system architecture understanding from wiki
499
+ - Feature context and story dependencies
500
+ - Codebase patterns and conventions from wiki
501
+ - Integration requirements and constraints from integration analysis
502
+ - Coding standards internalized
503
+
504
+ Use ALL this information to design a viable technical solution that:
505
+ - Respects Clean Architecture principles
506
+ - Follows established patterns from wiki
507
+ - Integrates seamlessly per integration analysis
508
+ - Maintains extensibility
509
+ - Enables testability
510
+ - Strictly follows coding standards
511
+
512
+ **Generate the complete technical solution following the template's `&lt;output-format&gt;`
513
+ section in story-technical-solution.xml. This includes ALL of the following sections.**
514
+
515
+ </phase>
516
+
517
+ </step>
518
+
519
+ <!-- ══════════════════════════════════════════════════════════════════ -->
520
+ <!-- STEP 8: WRITE OUTPUT TO STORY FILE -->
521
+ <!-- ══════════════════════════════════════════════════════════════════ -->
522
+
523
+ <step name="write-output" order="8">
524
+
525
+ **Write the complete technical solution INTO the story file.**
526
+
527
+ The output follows the template's `&lt;output-format&gt;` section exactly.
528
+ It includes ALL sections from the design phases above.
529
+
530
+ <!-- ── 8a: Write to local story file ──────────────────────────── -->
531
+
532
+ Read the current STORY_FILE content.
533
+
534
+ **If the story file contains a `## Technical Solution` section placeholder:**
535
+ Replace the placeholder section (from `## Technical Solution` up to the next `## `
536
+ heading or end-of-file metadata section `---`) with the full technical solution.
537
+
538
+ **If the story file does NOT contain a `## Technical Solution` section:**
539
+ Append the technical solution after the `## Relevant Wiki` section
540
+ (before the metadata section `---` at the end if it exists).
541
+
542
+ Write the updated content back to STORY_FILE using the Write or Edit tool.
543
+
544
+ Display:
545
+ ```
546
+ + Technical solution written to {STORY_FILE}
547
+ ```
548
+
549
+ <!-- ── 8b: Update GitHub issue (if applicable) ───────────────── -->
550
+
551
+ **If the story was loaded from GitHub OR the story file header contains a GitHub link:**
552
+
553
+ Extract the issue number from the story.
554
+
555
+ **If `has_gh_cli` is true AND issue number is available:**
556
+
557
+ Read the current GitHub issue body:
558
+ ```bash
559
+ GH_BODY=$(gh issue view {issue_number} --repo {REPO} --json body -q .body)
560
+ ```
561
+
562
+ Replace or append the `## Technical Solution` section in the issue body
563
+ (same logic as local file — find and replace existing section, or append).
564
+
565
+ Update the issue:
566
+ ```bash
567
+ gh issue edit {issue_number} --repo {REPO} --body "{updated_body}"
568
+ ```
569
+
570
+ Display:
571
+ ```
572
+ + GitHub issue #{issue_number} updated with Technical Solution section.
573
+ ```
574
+
575
+ **If GitHub CLI not available or no issue number:**
576
+ Display:
577
+ ```
578
+ i No GitHub issue to update. Local file only.
579
+ ```
580
+ </step>
581
+
582
+ <!-- ══════════════════════════════════════════════════════════════════ -->
583
+ <!-- STEP 9: VALIDATION -->
584
+ <!-- ══════════════════════════════════════════════════════════════════ -->
585
+
586
+ <step name="validation" order="9">
587
+
588
+ Read the story file and verify the technical solution against the validation
589
+ checklist defined in the template (story-technical-solution.xml):
590
+
591
+ **Story File Requirements:**
592
+ - [ ] Technical solution section exists in the story file
593
+ - [ ] Section contains all required subsections from template
594
+
595
+ **Architecture Requirements:**
596
+ - [ ] Component and Boundary Architecture with Mermaid diagram
597
+ - [ ] Layer Architecture Analysis (Domain, Application, Infrastructure, Presentation)
598
+ - [ ] Clean Architecture compliance verified (dependencies point inward)
599
+ - [ ] Dependency injection strategy documented
600
+
601
+ **Design Requirements:**
602
+ - [ ] Design patterns documented with purpose and implementation
603
+ - [ ] Technical decisions documented with rationale and trade-offs
604
+ - [ ] Class diagrams with complete interface definitions
605
+ - [ ] EVERY interface/class/type in its OWN SEPARATE FILE (coding standards!)
606
+ - [ ] Data models and structures defined with TypeScript types
607
+
608
+ **Algorithm Requirements:**
609
+ - [ ] Algorithms documented with mathematical formulas
610
+ - [ ] Constants and configuration values defined (NO hardcoding!)
611
+ - [ ] Business rules documented with implementations
612
+ - [ ] Example calculations provided
613
+
614
+ **Sequence Diagram Requirements (CRITICAL!):**
615
+ - [ ] Sequence diagram for EVERY AC scenario
616
+ - [ ] Full flow from entry point to exit through ALL layers
617
+ - [ ] Real method names used (not generic placeholders)
618
+ - [ ] Error handling paths included (alt blocks)
619
+ - [ ] Data structures shown at each step
620
+
621
+ **Implementation Requirements:**
622
+ - [ ] Complete file structure tree (new + modified files)
623
+ - [ ] DI container configuration specified
624
+ - [ ] Refactoring plan from integration analysis incorporated
625
+ - [ ] Testing strategy (unit, integration, e2e)
626
+ - [ ] Implementation order with dependencies
627
+ - [ ] Implementation checklist
628
+
629
+ **Compliance Requirements:**
630
+ - [ ] Coding standards compliance verified throughout
631
+ - [ ] Integration analysis findings incorporated
632
+ - [ ] No hardcoded values in any code snippets
633
+ - [ ] All code follows Clean Architecture layers
634
+
635
+ **Total: 25 mandatory checklist items**
636
+
637
+ If the output is incomplete or missing sections, go back and fill in
638
+ the missing content before proceeding.
639
+
640
+ Display:
641
+ ```
642
+ {check_mark} Solution validated. {passed}/{total} checks passed.
643
+ ```
644
+ </step>
645
+
646
+ <!-- ══════════════════════════════════════════════════════════════════ -->
647
+ <!-- STEP 10: REVIEW AND APPROVE -->
648
+ <!-- ══════════════════════════════════════════════════════════════════ -->
649
+
650
+ <step name="review" order="10">
651
+
652
+ Display a summary of the solution:
653
+ ```
654
+ Solution Summary:
655
+ ────────
656
+ Sections: {count}/13 | Checklist: {passed}/25
657
+ Wiki docs loaded: {N} | Integration analysis: loaded
658
+ External analysis: {loaded/not found}
659
+ AC scenarios: {M} | Sequence diagrams: {M}
660
+ New files: {F} | Modified files: {G}
661
+ Design patterns: {P} | Refactoring items: {R}
662
+ ```
663
+
664
+ Use AskUserQuestion:
665
+ - header: "Solution"
666
+ - question: "Technical solution written to `{STORY_FILE}`. Review the file in your editor — does the solution look comprehensive?"
667
+ - options:
668
+ - "Approve" — Looks good, commit it
669
+ - "Refine" — Some sections need more depth
670
+ - "Skip commit" — Keep the file but don't commit yet
671
+
672
+ **If "Approve":**
673
+ Continue to step 11.
674
+
675
+ **If "Refine":**
676
+ - Ask what sections need more depth or what's missing
677
+ - Go back to the relevant design phase, read more code, and update the story file
678
+ - Re-run validation (step 9)
679
+ - Present for review again
680
+
681
+ **If "Skip commit":**
682
+ Display completion without commit:
683
+ ```
684
+ ╔══════════════════════════════════════════════════════════════╗
685
+ ║ ACE > Technical Solution Complete (uncommitted) ║
686
+ ║ {Story ID} "{Story Title}" ║
687
+ ╚══════════════════════════════════════════════════════════════╝
688
+
689
+ i Technical solution written to {STORY_FILE}
690
+ File not committed — commit manually when ready.
691
+ ```
692
+ Exit workflow.
693
+ </step>
694
+
695
+ <!-- ══════════════════════════════════════════════════════════════════ -->
696
+ <!-- STEP 11: COMMIT -->
697
+ <!-- ══════════════════════════════════════════════════════════════════ -->
698
+
699
+ <step name="commit" order="11">
700
+
701
+ Stage and commit the story file:
702
+
703
+ ```bash
704
+ git add {STORY_FILE}
705
+ ```
706
+
707
+ ```bash
708
+ git commit -m "docs: technical solution for {Story ID} — {Story Title}"
709
+ ```
710
+
711
+ Display completion:
712
+
713
+ ```
714
+ ╔══════════════════════════════════════════════════════════════╗
715
+ ║ ACE > Technical Solution Complete ║
716
+ ║ {Story ID} "{Story Title}" ║
717
+ ╚══════════════════════════════════════════════════════════════╝
718
+
719
+ + {STORY_FILE} committed.
720
+
721
+ Metrics:
722
+ ────────
723
+ Wiki docs loaded: {N} | Integration analysis: incorporated
724
+ External analysis: {incorporated/not available}
725
+ AC scenarios covered: {M} sequence diagrams
726
+ New files designed: {F} | Modified files: {G}
727
+
728
+ i Technical solution complete. The story is now fully refined
729
+ (pass 5) and ready for implementation.
730
+
731
+ Next > Continue with story execution:
732
+ - /ace:execute-story story=... — Implement the story
733
+ - /ace:research-technical-solution story=... — Design another story
734
+ - /ace:help — Check project initialization status
735
+ ```
736
+ </step>
737
+
738
+ </process>
739
+
740
+ <success_criteria>
741
+ - Story loaded and requirements extracted (User Story, Description, Acceptance Criteria)
742
+ - All wiki references extracted from story's Relevant Wiki section
743
+ - All wiki documents loaded (system-wide mandatory, subsystem as referenced)
744
+ - Coding standards read and internalized BEFORE generating solution code
745
+ - Parent feature document loaded for broader context (if available)
746
+ - Integration analysis loaded and studied (MANDATORY — exit if missing)
747
+ - External analysis loaded if present in story directory (auto-detected, OPTIONAL)
748
+ - All 4 design phases executed (Initial Discovery, System Architecture, Codebase Analysis, Solution Design)
749
+ - Technical solution written to story file with ALL template sections populated
750
+ - Sequence diagrams created for EVERY acceptance criteria scenario
751
+ - Every interface/class/type designed as its own separate file
752
+ - NO hardcoded values in any code snippets
753
+ - All code follows Clean Architecture layers and coding standards
754
+ - Integration analysis findings fully incorporated (refactoring, patterns, hardcoded values)
755
+ - All 25 validation checklist items verified
756
+ - GitHub issue updated with technical solution (if applicable)
757
+ - User reviewed and approved the solution
758
+ - Document committed with appropriate message
759
+ </success_criteria>
760
+
761
+ </workflow>