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