agile-context-engineering 0.3.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 (139) hide show
  1. package/.claude-plugin/marketplace.json +18 -0
  2. package/.claude-plugin/plugin.json +10 -0
  3. package/CHANGELOG.md +7 -1
  4. package/LICENSE +51 -51
  5. package/README.md +330 -318
  6. package/agents/ace-code-discovery-analyst.md +245 -245
  7. package/agents/ace-code-integration-analyst.md +248 -248
  8. package/agents/ace-code-reviewer.md +375 -375
  9. package/agents/ace-product-owner.md +365 -361
  10. package/agents/ace-project-researcher.md +606 -606
  11. package/agents/ace-research-synthesizer.md +228 -228
  12. package/agents/ace-technical-application-architect.md +315 -315
  13. package/agents/ace-wiki-mapper.md +449 -445
  14. package/bin/install.js +605 -195
  15. package/hooks/ace-check-update.js +71 -62
  16. package/hooks/ace-statusline.js +107 -89
  17. package/hooks/hooks.json +14 -0
  18. package/package.json +7 -5
  19. package/shared/lib/ace-core.js +361 -0
  20. package/shared/lib/ace-core.test.js +308 -0
  21. package/shared/lib/ace-github.js +753 -0
  22. package/shared/lib/ace-story.js +400 -0
  23. package/shared/lib/ace-story.test.js +250 -0
  24. package/{agile-context-engineering → shared}/utils/questioning.xml +110 -110
  25. package/{agile-context-engineering → shared}/utils/ui-formatting.md +299 -299
  26. package/{commands/ace/execute-story.md → skills/execute-story/SKILL.md} +116 -138
  27. package/skills/execute-story/script.js +291 -0
  28. package/skills/execute-story/script.test.js +261 -0
  29. package/{agile-context-engineering/templates/product/story.xml → skills/execute-story/story-template.xml} +451 -451
  30. package/skills/execute-story/walkthrough-template.xml +255 -0
  31. package/{agile-context-engineering/workflows/execute-story.xml → skills/execute-story/workflow.xml} +1221 -1219
  32. package/skills/help/SKILL.md +71 -0
  33. package/skills/help/script.js +315 -0
  34. package/skills/help/script.test.js +183 -0
  35. package/{agile-context-engineering/workflows/help.xml → skills/help/workflow.xml} +544 -533
  36. package/{commands/ace/init-coding-standards.md → skills/init-coding-standards/SKILL.md} +91 -83
  37. package/{agile-context-engineering/templates/wiki/coding-standards.xml → skills/init-coding-standards/coding-standards-template.xml} +531 -531
  38. package/skills/init-coding-standards/script.js +50 -0
  39. package/skills/init-coding-standards/script.test.js +70 -0
  40. package/{agile-context-engineering/workflows/init-coding-standards.xml → skills/init-coding-standards/workflow.xml} +381 -386
  41. package/skills/map-cross-cutting/SKILL.md +126 -0
  42. package/{agile-context-engineering/templates/wiki → skills/map-cross-cutting}/system-cross-cutting.xml +197 -197
  43. package/skills/map-cross-cutting/workflow.xml +330 -0
  44. package/skills/map-guide/SKILL.md +126 -0
  45. package/{agile-context-engineering/templates/wiki → skills/map-guide}/guide.xml +137 -137
  46. package/skills/map-guide/workflow.xml +320 -0
  47. package/skills/map-pattern/SKILL.md +125 -0
  48. package/{agile-context-engineering/templates/wiki → skills/map-pattern}/pattern.xml +159 -159
  49. package/skills/map-pattern/workflow.xml +331 -0
  50. package/{commands/ace/map-story.md → skills/map-story/SKILL.md} +180 -165
  51. package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/decizions.xml +115 -115
  52. package/skills/map-story/templates/guide.xml +137 -0
  53. package/skills/map-story/templates/pattern.xml +159 -0
  54. package/skills/map-story/templates/system-cross-cutting.xml +197 -0
  55. package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/system.xml +381 -381
  56. package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/tech-debt-index.xml +125 -125
  57. package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/walkthrough.xml +255 -255
  58. package/{agile-context-engineering/workflows/map-story.xml → skills/map-story/workflow.xml} +1046 -1046
  59. package/{commands/ace/map-subsystem.md → skills/map-subsystem/SKILL.md} +155 -140
  60. package/skills/map-subsystem/script.js +51 -0
  61. package/skills/map-subsystem/script.test.js +68 -0
  62. package/skills/map-subsystem/templates/decizions.xml +115 -0
  63. package/skills/map-subsystem/templates/guide.xml +137 -0
  64. package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/module-discovery.xml +174 -174
  65. package/skills/map-subsystem/templates/pattern.xml +159 -0
  66. package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/subsystem-architecture.xml +343 -343
  67. package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/subsystem-structure.xml +234 -234
  68. package/skills/map-subsystem/templates/system-cross-cutting.xml +197 -0
  69. package/skills/map-subsystem/templates/system.xml +381 -0
  70. package/skills/map-subsystem/templates/walkthrough.xml +255 -0
  71. package/{agile-context-engineering/workflows/map-subsystem.xml → skills/map-subsystem/workflow.xml} +1173 -1178
  72. package/skills/map-sys-doc/SKILL.md +125 -0
  73. package/skills/map-sys-doc/system.xml +381 -0
  74. package/skills/map-sys-doc/workflow.xml +336 -0
  75. package/{commands/ace/map-system.md → skills/map-system/SKILL.md} +103 -92
  76. package/skills/map-system/script.js +75 -0
  77. package/skills/map-system/script.test.js +73 -0
  78. package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/system-architecture.xml +254 -254
  79. package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/system-structure.xml +177 -177
  80. package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/testing-framework.xml +283 -283
  81. package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/wiki-readme.xml +296 -296
  82. package/{agile-context-engineering/workflows/map-system.xml → skills/map-system/workflow.xml} +667 -672
  83. package/{commands/ace/map-walkthrough.md → skills/map-walkthrough/SKILL.md} +140 -127
  84. package/skills/map-walkthrough/walkthrough.xml +255 -0
  85. package/{agile-context-engineering/workflows/map-walkthrough.xml → skills/map-walkthrough/workflow.xml} +457 -457
  86. package/{commands/ace/plan-backlog.md → skills/plan-backlog/SKILL.md} +93 -83
  87. package/{agile-context-engineering/templates/product/product-backlog.xml → skills/plan-backlog/product-backlog-template.xml} +231 -231
  88. package/skills/plan-backlog/script.js +121 -0
  89. package/skills/plan-backlog/script.test.js +83 -0
  90. package/{agile-context-engineering/workflows/plan-backlog.xml → skills/plan-backlog/workflow.xml} +1348 -1356
  91. package/{commands/ace/plan-feature.md → skills/plan-feature/SKILL.md} +99 -89
  92. package/{agile-context-engineering/templates/product/feature.xml → skills/plan-feature/feature-template.xml} +361 -361
  93. package/skills/plan-feature/script.js +131 -0
  94. package/skills/plan-feature/script.test.js +80 -0
  95. package/{agile-context-engineering/workflows/plan-feature.xml → skills/plan-feature/workflow.xml} +1487 -1495
  96. package/{commands/ace/plan-product-vision.md → skills/plan-product-vision/SKILL.md} +91 -81
  97. package/{agile-context-engineering/templates/product/product-vision.xml → skills/plan-product-vision/product-vision-template.xml} +227 -227
  98. package/skills/plan-product-vision/script.js +51 -0
  99. package/skills/plan-product-vision/script.test.js +69 -0
  100. package/{agile-context-engineering/workflows/plan-product-vision.xml → skills/plan-product-vision/workflow.xml} +337 -342
  101. package/{commands/ace/plan-story.md → skills/plan-story/SKILL.md} +139 -159
  102. package/skills/plan-story/script.js +295 -0
  103. package/skills/plan-story/script.test.js +240 -0
  104. package/skills/plan-story/story-template.xml +458 -0
  105. package/{agile-context-engineering/workflows/plan-story.xml → skills/plan-story/workflow.xml} +1301 -944
  106. package/{commands/ace/research-external-solution.md → skills/research-external-solution/SKILL.md} +120 -138
  107. package/{agile-context-engineering/templates/product/external-solution.xml → skills/research-external-solution/external-solution-template.xml} +832 -832
  108. package/skills/research-external-solution/script.js +229 -0
  109. package/skills/research-external-solution/script.test.js +134 -0
  110. package/{agile-context-engineering/workflows/research-external-solution.xml → skills/research-external-solution/workflow.xml} +657 -659
  111. package/{commands/ace/research-integration-solution.md → skills/research-integration-solution/SKILL.md} +121 -135
  112. package/{agile-context-engineering/templates/product/story-integration-solution.xml → skills/research-integration-solution/integration-solution-template.xml} +1015 -1015
  113. package/skills/research-integration-solution/script.js +223 -0
  114. package/skills/research-integration-solution/script.test.js +134 -0
  115. package/{agile-context-engineering/workflows/research-integration-solution.xml → skills/research-integration-solution/workflow.xml} +711 -713
  116. package/{commands/ace/research-story-wiki.md → skills/research-story-wiki/SKILL.md} +101 -116
  117. package/skills/research-story-wiki/script.js +223 -0
  118. package/skills/research-story-wiki/script.test.js +138 -0
  119. package/{agile-context-engineering/templates/product/story-wiki.xml → skills/research-story-wiki/story-wiki-template.xml} +194 -194
  120. package/{agile-context-engineering/workflows/research-story-wiki.xml → skills/research-story-wiki/workflow.xml} +473 -475
  121. package/{commands/ace/research-technical-solution.md → skills/research-technical-solution/SKILL.md} +131 -147
  122. package/skills/research-technical-solution/script.js +223 -0
  123. package/skills/research-technical-solution/script.test.js +134 -0
  124. package/{agile-context-engineering/templates/product/story-technical-solution.xml → skills/research-technical-solution/technical-solution-template.xml} +1025 -1025
  125. package/{agile-context-engineering/workflows/research-technical-solution.xml → skills/research-technical-solution/workflow.xml} +761 -763
  126. package/{commands/ace/review-story.md → skills/review-story/SKILL.md} +99 -109
  127. package/skills/review-story/script.js +249 -0
  128. package/skills/review-story/script.test.js +169 -0
  129. package/skills/review-story/story-template.xml +451 -0
  130. package/{agile-context-engineering/workflows/review-story.xml → skills/review-story/workflow.xml} +279 -281
  131. package/{commands/ace/update.md → skills/update/SKILL.md} +65 -56
  132. package/{agile-context-engineering/workflows/update.xml → skills/update/workflow.xml} +33 -18
  133. package/agile-context-engineering/src/ace-tools.js +0 -2881
  134. package/agile-context-engineering/src/ace-tools.test.js +0 -1089
  135. package/agile-context-engineering/templates/_command.md +0 -54
  136. package/agile-context-engineering/templates/_workflow.xml +0 -17
  137. package/agile-context-engineering/templates/config.json +0 -0
  138. package/agile-context-engineering/templates/product/integration-solution.xml +0 -0
  139. package/commands/ace/help.md +0 -93
@@ -1,672 +1,667 @@
1
- <workflow>
2
-
3
- <purpose>
4
- Orchestrate system-wide wiki mapping: detect environment, determine which documents need
5
- creation or updates, spawn ace-wiki-mapper agents to produce them, and optionally add
6
- CLAUDE.md instructions to keep the wiki current.
7
-
8
- Produces documents in `.docs/wiki/system-wide/`:
9
- - system-structure.md — physical layout, subsystem index, shared directories
10
- - testing-framework.md — test runner, patterns, conventions
11
- - system-architecture.md — L1/L2 views, core flows, tech stack
12
-
13
- Brownfield projects get documents filled from codebase analysis.
14
- Greenfield projects get system-architecture.md via deep questioning (structure and testing
15
- are scaffolded with headings only — filled as code is added).
16
- </purpose>
17
-
18
- <mandatory-context>
19
- Read all files referenced by the invoking command's execution-context before starting.
20
- Also read any document or text passed as parameter ($ARGUMENTS) in the invoking command.
21
- </mandatory-context>
22
-
23
- <process>
24
-
25
- <!-- ══════════════════════════════════════════════════════════════════ -->
26
- <!-- STEP 1: SETUP -->
27
- <!-- ══════════════════════════════════════════════════════════════════ -->
28
-
29
- <step name="setup" order="1">
30
- **MANDATORY FIRST STEP — Execute environment detection before any user interaction:**
31
-
32
- ```bash
33
- INIT=$(node ~/.claude/agile-context-engineering/src/ace-tools.js init map-system)
34
- ```
35
-
36
- Parse JSON for: `mapper_model`, `commit_docs`, `is_brownfield`, `is_greenfield`,
37
- `has_existing_code`, `has_package_file`, `wiki_dir_exists`, `existing_wiki_files`,
38
- `has_system_structure`, `has_system_architecture`, `has_testing_framework`,
39
- `has_coding_standards`, `has_git`.
40
-
41
- Also resolve the mapper model for spawning agents:
42
- ```bash
43
- MAPPER_MODEL=$(node ~/.claude/agile-context-engineering/src/ace-tools.js resolve-model ace-wiki-mapper --raw)
44
- ```
45
-
46
- Display stage banner:
47
-
48
- ```
49
- ╔══════════════════════════════════════════════════╗
50
- ║ ACE > Map System ║
51
- ╚══════════════════════════════════════════════════╝
52
- ```
53
-
54
- **If `has_git` is false:** Initialize git:
55
- ```bash
56
- git init
57
- ```
58
-
59
- Continue to step 2 (document triage).
60
- </step>
61
-
62
- <!-- ══════════════════════════════════════════════════════════════════ -->
63
- <!-- STEP 2: DOCUMENT TRIAGE -->
64
- <!-- Determine per-document action: create, update, recreate, or skip -->
65
- <!-- ══════════════════════════════════════════════════════════════════ -->
66
-
67
- <step name="document-triage" order="2">
68
-
69
- Build a **document action plan** — a list of `{ document, action }` entries where
70
- action is one of: `create`, `update`, `recreate`, `scaffold`, `skip`.
71
-
72
- Evaluate each document independently:
73
-
74
- <!-- ── system-structure.md ────────────────────────────────────── -->
75
-
76
- **system-structure.md:**
77
-
78
- If `is_greenfield`:
79
- - Action: `scaffold` — create with headings and placeholder sections.
80
- The document will be filled as subsystems are added.
81
-
82
- If `is_brownfield` AND `has_system_structure` is false:
83
- - Action: `create` analyze codebase and produce full document.
84
-
85
- If `is_brownfield` AND `has_system_structure` is true:
86
- - Use AskUserQuestion:
87
- - header: "Structure"
88
- - question: "System structure document already exists at `.docs/wiki/system-wide/system-structure.md`. What would you like to do?"
89
- - options:
90
- - "Update" Refresh the existing document with current codebase state
91
- - "Recreate" — Discard and rebuild from scratch
92
- - "Skip" — Keep the current document as-is
93
- - Map user choice to action: `update`, `recreate`, or `skip`.
94
-
95
- <!-- ── testing-framework.md ───────────────────────────────────── -->
96
-
97
- **testing-framework.md:**
98
-
99
- If `is_greenfield`:
100
- - Action: `scaffold` — create with headings and placeholder sections.
101
- Filled once a test framework is chosen and tests are written.
102
-
103
- If `is_brownfield` AND `has_testing_framework` is false:
104
- - Action: `create` analyze codebase and produce full document.
105
-
106
- If `is_brownfield` AND `has_testing_framework` is true:
107
- - Use AskUserQuestion:
108
- - header: "Testing"
109
- - question: "Testing framework document already exists at `.docs/wiki/system-wide/testing-framework.md`. What would you like to do?"
110
- - options:
111
- - "Update" Refresh the existing document with current codebase state
112
- - "Recreate" — Discard and rebuild from scratch
113
- - "Skip" — Keep the current document as-is
114
- - Map user choice to action: `update`, `recreate`, or `skip`.
115
-
116
- <!-- ── system-architecture.md ─────────────────────────────────── -->
117
-
118
- **system-architecture.md:**
119
-
120
- If `is_greenfield`:
121
- - Action: `create_with_interview` — requires deep questioning before writing.
122
- Cannot be scaffolded because architecture decisions must be made upfront.
123
-
124
- If `is_brownfield` AND `has_system_architecture` is false:
125
- - Action: `create` analyze codebase and produce full document.
126
-
127
- If `is_brownfield` AND `has_system_architecture` is true:
128
- - Use AskUserQuestion:
129
- - header: "Architecture"
130
- - question: "System architecture document already exists at `.docs/wiki/system-wide/system-architecture.md`. What would you like to do?"
131
- - options:
132
- - "Update" Refresh the existing document with current codebase state
133
- - "Recreate" Discard and rebuild from scratch
134
- - "Skip" — Keep the current document as-is
135
- - Map user choice to action: `update`, `recreate`, or `skip`.
136
-
137
- **IMPORTANT:** Ask all questions that need asking in a SINGLE AskUserQuestion call
138
- where possible (up to 4 questions). If multiple documents exist, batch the questions.
139
-
140
- Display the action plan to the user:
141
-
142
- ```
143
- ┌──────────────────────────────────────────────────┐
144
- │ ACE > Map System > Action Plan │
145
- └──────────────────────────────────────────────────┘
146
-
147
- Document Action
148
- ──────────────────────── ──────────
149
- system-structure.md [create/update/recreate/scaffold/skip]
150
- testing-framework.md [create/update/recreate/scaffold/skip]
151
- system-architecture.md [create/update/recreate/scaffold/skip/create_with_interview]
152
- ```
153
-
154
- If ALL actions are `skip`, exit workflow with message:
155
- ```
156
- i All documents already exist and were skipped. Nothing to do.
157
-
158
- Next > `/clear` first for a fresh context window, then:
159
-
160
- /ace:map-subsystems
161
- Map individual subsystem internals.
162
- ```
163
-
164
- Continue to step 3 (create directory structure).
165
- </step>
166
-
167
- <!-- ══════════════════════════════════════════════════════════════════ -->
168
- <!-- STEP 3: CREATE DIRECTORY STRUCTURE -->
169
- <!-- ══════════════════════════════════════════════════════════════════ -->
170
-
171
- <step name="create-directories" order="3">
172
- Create the wiki directory if it doesn't exist:
173
-
174
- ```bash
175
- mkdir -p .docs/wiki/system-wide
176
- ```
177
-
178
- **Generate wiki-readme.md if it does not already exist:**
179
-
180
- Check if `.docs/wiki/wiki-readme.md` exists. If it does NOT exist, generate it
181
- from the wiki-readme template (`~/.claude/agile-context-engineering/templates/wiki/wiki-readme.xml`).
182
-
183
- Read the template's `<template>` section and write the markdown content to
184
- `.docs/wiki/wiki-readme.md`. This is a mostly-static meta-document fill it
185
- directly without spawning an agent:
186
- - Directory Structure section: use as-is from template (canonical layout)
187
- - Document Types tables: use as-is from template
188
- - How to Use sections: use as-is from template
189
- - Creating New Documents section: use as-is from template
190
- - Keeping Current section: use as-is from template
191
- - Subsystems table: leave with placeholder rows — will be populated when
192
- `/ace:map-subsystem` runs
193
-
194
- If `.docs/wiki/wiki-readme.md` already exists, skip — do not overwrite.
195
-
196
- Continue to step 4.
197
- </step>
198
-
199
- <!-- ══════════════════════════════════════════════════════════════════ -->
200
- <!-- STEP 4: SYSTEM STRUCTURE -->
201
- <!-- ══════════════════════════════════════════════════════════════════ -->
202
-
203
- <step name="system-structure" order="4">
204
- Skip this step if system-structure action is `skip`.
205
-
206
- **If action is `scaffold` (greenfield):**
207
-
208
- Create an empty file:
209
-
210
- ```bash
211
- touch .docs/wiki/system-wide/system-structure.md
212
- ```
213
-
214
- It will be filled by `/ace:map-system` once source code exists.
215
-
216
- **If action is `create` or `recreate`:**
217
-
218
- Spawn ace-wiki-mapper agent:
219
-
220
- ```
221
- Task(
222
- prompt="Focus: system-structure
223
-
224
- Analyze this codebase and produce the system-wide structure document.
225
-
226
- **Template:** Read ~/.claude/agile-context-engineering/templates/wiki/system-structure.xml
227
- **Output:** Write to .docs/wiki/system-wide/system-structure.md
228
-
229
- Follow the template structure. Fill every section with real data from the codebase.
230
- Identify all subsystems (microservices, monolith modules, or library packages).
231
-
232
- Return confirmation only — do NOT return document contents.",
233
- subagent_type="ace-wiki-mapper",
234
- model="{MAPPER_MODEL}",
235
- description="Map system structure"
236
- )
237
- ```
238
-
239
- **If action is `update`:**
240
-
241
- Spawn ace-wiki-mapper agent with existing content as context:
242
-
243
- ```
244
- Task(
245
- prompt="Focus: system-structure
246
-
247
- UPDATE the existing system structure document.
248
-
249
- **Current document:** Read .docs/wiki/system-wide/system-structure.md
250
- **Template:** Read ~/.claude/agile-context-engineering/templates/wiki/system-structure.xml
251
-
252
- Compare the current document against the actual codebase state.
253
- Update sections that are stale. Add new subsystems or shared directories
254
- that were added since the document was written. Remove entries for
255
- deleted subsystems or directories.
256
-
257
- Preserve accurate content. Only change what's actually stale.
258
-
259
- Write the updated file to .docs/wiki/system-wide/system-structure.md
260
- Return confirmation only — do NOT return document contents.",
261
- subagent_type="ace-wiki-mapper",
262
- model="{MAPPER_MODEL}",
263
- description="Update system structure"
264
- )
265
- ```
266
-
267
- Continue to step 5.
268
- </step>
269
-
270
- <!-- ══════════════════════════════════════════════════════════════════ -->
271
- <!-- STEP 5: TESTING FRAMEWORK -->
272
- <!-- ══════════════════════════════════════════════════════════════════ -->
273
-
274
- <step name="testing-framework" order="5">
275
- Skip this step if testing-framework action is `skip`.
276
-
277
- **NOTE:** This step can run IN PARALLEL with step 4 (system-structure) if both
278
- need agent work. Use `run_in_background=true` for the agents in steps 4 and 5,
279
- then collect results before step 6.
280
-
281
- **If action is `scaffold` (greenfield):**
282
-
283
- Create an empty file:
284
-
285
- ```bash
286
- touch .docs/wiki/system-wide/testing-framework.md
287
- ```
288
-
289
- It will be filled by `/ace:map-system` once tests exist.
290
-
291
- **If action is `create` or `recreate`:**
292
-
293
- Spawn ace-wiki-mapper agent:
294
-
295
- ```
296
- Task(
297
- prompt="Focus: testing-framework
298
-
299
- Analyze this codebase and produce the testing framework document.
300
-
301
- **Template:** Read ~/.claude/agile-context-engineering/templates/wiki/testing-framework.xml
302
- **Output:** Write to .docs/wiki/system-wide/testing-framework.md
303
-
304
- Check package.json/config files for test runner and scripts.
305
- Read 3-5 existing test files for patterns.
306
- Look for test utilities, fixtures, factories.
307
- If NO tests exist, write a minimal document noting 'No tests found'
308
- instead of a document full of placeholders.
309
-
310
- Return confirmation only — do NOT return document contents.",
311
- subagent_type="ace-wiki-mapper",
312
- model="{MAPPER_MODEL}",
313
- description="Map testing framework"
314
- )
315
- ```
316
-
317
- **If action is `update`:**
318
-
319
- Spawn ace-wiki-mapper agent with update instructions:
320
-
321
- ```
322
- Task(
323
- prompt="Focus: testing-framework
324
-
325
- UPDATE the existing testing framework document.
326
-
327
- **Current document:** Read .docs/wiki/system-wide/testing-framework.md
328
- **Template:** Read ~/.claude/agile-context-engineering/templates/wiki/testing-framework.xml
329
-
330
- Compare against current codebase state. Update stale sections only.
331
- Check for new test runner config, new test patterns, changed coverage settings.
332
-
333
- Write the updated file to .docs/wiki/system-wide/testing-framework.md
334
- Return confirmation only — do NOT return document contents.",
335
- subagent_type="ace-wiki-mapper",
336
- model="{MAPPER_MODEL}",
337
- description="Update testing framework"
338
- )
339
- ```
340
-
341
- Continue to step 6 (wait for parallel agents from steps 4-5 if applicable).
342
- </step>
343
-
344
- <!-- ══════════════════════════════════════════════════════════════════ -->
345
- <!-- STEP 5.5: COLLECT PARALLEL RESULTS -->
346
- <!-- ══════════════════════════════════════════════════════════════════ -->
347
-
348
- <step name="collect-parallel" order="5.5">
349
- If steps 4 and 5 spawned background agents, wait for both to complete.
350
- Read each agent's output to collect confirmations.
351
-
352
- If any agent failed, note the failure and inform the user.
353
- Do NOT re-attempt — let the user decide.
354
-
355
- Continue to step 6.
356
- </step>
357
-
358
- <!-- ══════════════════════════════════════════════════════════════════ -->
359
- <!-- STEP 6: SYSTEM ARCHITECTURE -->
360
- <!-- ══════════════════════════════════════════════════════════════════ -->
361
-
362
- <step name="system-architecture" order="6">
363
- Skip this step if system-architecture action is `skip`.
364
-
365
- <!-- ── 6a: BROWNFIELD CREATE / RECREATE ──────────────────────── -->
366
-
367
- **If action is `create` or `recreate` AND `is_brownfield`:**
368
-
369
- Spawn ace-wiki-mapper agent directly (codebase provides all the answers):
370
-
371
- ```
372
- Task(
373
- prompt="Focus: system-architecture
374
-
375
- Analyze this codebase and produce the system-wide architecture document.
376
-
377
- **Template:** Read ~/.claude/agile-context-engineering/templates/wiki/system-architecture.xml
378
- **Output:** Write to .docs/wiki/system-wide/system-architecture.md
379
-
380
- **Also read (if it exists):** .docs/wiki/system-wide/system-structure.md
381
- use the subsystem index from the structure doc to inform the L2 container diagram
382
- and subsystem responsibility matrix. Do NOT duplicate content.
383
-
384
- Follow the template structure. Fill every section with real data.
385
- Generate C4 L1 and L2 Mermaid diagrams.
386
- Trace 1-2 core flows as sequence diagrams.
387
- Catalog the tech stack from actual dependency files (versions from lock files).
388
-
389
- Return confirmation only — do NOT return document contents.",
390
- subagent_type="ace-wiki-mapper",
391
- model="{MAPPER_MODEL}",
392
- description="Map system architecture"
393
- )
394
- ```
395
-
396
- <!-- ── 6b: BROWNFIELD UPDATE ─────────────────────────────────── -->
397
-
398
- **If action is `update`:**
399
-
400
- Spawn ace-wiki-mapper agent with update instructions:
401
-
402
- ```
403
- Task(
404
- prompt="Focus: system-architecture
405
-
406
- UPDATE the existing system architecture document.
407
-
408
- **Current document:** Read .docs/wiki/system-wide/system-architecture.md
409
- **Template:** Read ~/.claude/agile-context-engineering/templates/wiki/system-architecture.xml
410
- **Also read (if it exists):** .docs/wiki/system-wide/system-structure.md
411
-
412
- Compare against current codebase state. Check:
413
- - New subsystems or removed subsystems?
414
- - New external integrations?
415
- - Tech stack changes (new frameworks, version bumps)?
416
- - Core flow shape changes?
417
-
418
- Update only stale sections. Preserve accurate content.
419
-
420
- Write the updated file to .docs/wiki/system-wide/system-architecture.md
421
- Return confirmation only — do NOT return document contents.",
422
- subagent_type="ace-wiki-mapper",
423
- model="{MAPPER_MODEL}",
424
- description="Update system architecture"
425
- )
426
- ```
427
-
428
- <!-- ── 6c: GREENFIELD DEEP QUESTIONING ─────────────────────── -->
429
-
430
- **If action is `create_with_interview` (greenfield):**
431
-
432
- Architecture cannot be inferred from code that doesn't exist yet.
433
- Conduct a deep questioning session to gather architecture decisions.
434
-
435
- Follow the questioning guide from `questioning.xml`. You are a thinking partner
436
- helping the user articulate their system architecture.
437
-
438
- **Opening:**
439
- ```
440
- ┌──────────────────────────────────────────────────┐
441
- │ ACE > Map System > Architecture Interview │
442
- └──────────────────────────────────────────────────┘
443
-
444
- This is a greenfield project no codebase to analyze.
445
- I need to understand your architecture plans to create
446
- the system-architecture document.
447
- ```
448
-
449
- **Key areas to explore (adapt based on conversation, don't checklist):**
450
-
451
- 1. **System purpose**
452
- "In 2-3 sentences, what does this system do and who uses it?"
453
-
454
- 2. **Subsystem breakdown**
455
- "What are the major components/services/modules?"
456
- Use AskUserQuestion:
457
- - header: "Topology"
458
- - question: "What's your deployment topology?"
459
- - options:
460
- - "Monolith" — Single deployable with internal modules
461
- - "Microservices" Multiple independently deployed services
462
- - "Monorepo packages" Multiple packages in one repo
463
- - "Hybrid" — Mix of approaches
464
-
465
- 3. **External integrations**
466
- "What external systems will this integrate with?"
467
- (databases, auth providers, third-party APIs, message brokers)
468
-
469
- 4. **Communication patterns**
470
- If multiple subsystems: "How will they communicate?"
471
- - Sync (HTTP/gRPC) vs Async (events/queues) vs Hybrid
472
-
473
- 5. **Tech stack**
474
- "What technologies are you using?"
475
- Use AskUserQuestion:
476
- - header: "Backend"
477
- - question: "What's your primary backend technology?"
478
- - options: (adapt to context, e.g., "Node.js/TypeScript", "C#/.NET", "Python", "Go")
479
-
480
- Follow up for: frontend, database, cache, messaging if applicable.
481
-
482
- 6. **Key architectural decisions**
483
- "Any architectural patterns you're committed to?"
484
- (Clean Architecture, CQRS, Event Sourcing, etc.)
485
-
486
- **Decision gate:**
487
- When you understand the architecture:
488
- - header: "Ready?"
489
- - question: "I have enough to create your architecture document. Ready to generate?"
490
- - options:
491
- - "Generate" Create the document
492
- - "Keep exploring" I have more to share
493
-
494
- Loop until "Generate" selected.
495
-
496
- **Then prepare a context brief (300-500 words) that distills:**
497
- - System purpose and users
498
- - Subsystem breakdown (names, responsibilities)
499
- - External integrations (what, direction, protocol)
500
- - Communication patterns between subsystems
501
- - Tech stack with expected versions
502
- - Key architectural decisions
503
-
504
- **Spawn the ace-wiki-mapper agent with the interview context:**
505
-
506
- ```
507
- Task(
508
- prompt="Focus: system-architecture
509
-
510
- Create the system-wide architecture document for a GREENFIELD project.
511
-
512
- **Architecture brief from user interview:**
513
- {paste the context brief here}
514
-
515
- **Template:** Read ~/.claude/agile-context-engineering/templates/wiki/system-architecture.xml
516
- **Output:** Write to .docs/wiki/system-wide/system-architecture.md
517
-
518
- **Also read (if it exists):** .docs/wiki/system-wide/system-structure.md
519
-
520
- Follow the template structure. Generate Mermaid C4 diagrams based on the
521
- interview data. For greenfield, subsystem boxes in L2 may be planned but
522
- not yet implemented — that's fine, document the intended architecture.
523
-
524
- Return confirmation only — do NOT return document contents.",
525
- subagent_type="ace-wiki-mapper",
526
- model="{MAPPER_MODEL}",
527
- description="Write system architecture (greenfield)"
528
- )
529
- ```
530
-
531
- Continue to step 7.
532
- </step>
533
-
534
- <!-- ══════════════════════════════════════════════════════════════════ -->
535
- <!-- STEP 7: CLAUDE.MD INSTRUCTIONS -->
536
- <!-- ══════════════════════════════════════════════════════════════════ -->
537
-
538
- <step name="claude-md-instructions" order="7">
539
- **Add wiki maintenance instructions to CLAUDE.md** so that future code changes
540
- trigger wiki updates.
541
-
542
- Check if `CLAUDE.md` exists at project root. If not, create it.
543
- If it exists, append the wiki section only if it's not already present.
544
-
545
- Search for "Wiki Maintenance" in CLAUDE.md. If found, skip this step.
546
-
547
- **Content to add:**
548
-
549
- ```markdown
550
-
551
- ## Wiki Maintenance
552
-
553
- When adding, removing, or renaming files or directories:
554
- - Update `.docs/wiki/system-wide/system-structure.md` if the change affects subsystem boundaries, shared directories, or root config files.
555
- - Update `.docs/wiki/subsystems/[subsystem-name]/structure.md` for any subsystem where files changed.
556
-
557
- When adding a new subsystem, external integration, or changing communication patterns:
558
- - Update `.docs/wiki/system-wide/system-architecture.md`.
559
-
560
- When changing test framework, runner, mocking approach, or coverage config:
561
- - Update `.docs/wiki/system-wide/testing-framework.md`.
562
- ```
563
-
564
- Continue to step 8.
565
- </step>
566
-
567
- <!-- ══════════════════════════════════════════════════════════════════ -->
568
- <!-- STEP 8: VERIFY AND COMMIT -->
569
- <!-- ══════════════════════════════════════════════════════════════════ -->
570
-
571
- <step name="verify-and-commit" order="8">
572
- **Verify all expected documents exist and are non-empty:**
573
-
574
- For each document where the action was NOT `skip`:
575
- - Check file exists
576
- - Check file has content (>5 lines for scaffold, >20 lines for create/update/recreate)
577
-
578
- If any document is missing or empty, warn the user.
579
-
580
- **Security scan** before commit — use the Grep tool (NOT bash grep):
581
-
582
- ```
583
- Grep(
584
- pattern="(sk-[a-zA-Z0-9]{20,}|sk_live_|sk_test_|ghp_[a-zA-Z0-9]{36}|AKIA[A-Z0-9]{16}|-----BEGIN.*PRIVATE KEY)",
585
- path=".docs/wiki/system-wide/",
586
- glob="*.md",
587
- output_mode="content"
588
- )
589
- ```
590
-
591
- If matches found: SECRETS_FOUND — pause and alert user.
592
- If no matches: CLEAN.
593
-
594
- If SECRETS_FOUND: pause and alert user before committing.
595
-
596
- **Commit** (if `commit_docs` is true):
597
-
598
- ```bash
599
- git add .docs/wiki/system-wide/
600
- ```
601
-
602
- If wiki-readme.md was created in step 3:
603
- ```bash
604
- git add .docs/wiki/wiki-readme.md
605
- ```
606
-
607
- If CLAUDE.md was created or updated:
608
- ```bash
609
- git add CLAUDE.md
610
- ```
611
-
612
- ```bash
613
- git commit -m "docs: map system-wide wiki documents"
614
- ```
615
-
616
- Continue to step 9.
617
- </step>
618
-
619
- <!-- ══════════════════════════════════════════════════════════════════ -->
620
- <!-- STEP 9: COMPLETION -->
621
- <!-- ══════════════════════════════════════════════════════════════════ -->
622
-
623
- <step name="completion" order="9">
624
- Display completion banner and next steps.
625
-
626
- ```
627
- ╔══════════════════════════════════════════════════╗
628
- ║ ACE > System Mapped ║
629
- ╚══════════════════════════════════════════════════╝
630
-
631
- Documents:
632
- ──────────
633
- [For each document, show action taken and line count]
634
- + wiki-readme.md ([N] lines) — [created | already exists]
635
- + system-structure.md ([N] lines) [created/updated/recreated/scaffolded]
636
- + testing-framework.md ([N] lines) — [created/updated/recreated/scaffolded]
637
- + system-architecture.md ([N] lines) [created/updated/recreated/scaffolded]
638
- - [document] skipped
639
-
640
- i Wiki maintenance rules added to CLAUDE.md.
641
-
642
- Next > `/clear` first for a fresh context window, then:
643
-
644
- /ace:map-subsystems
645
- Map individual subsystem internals.
646
-
647
- Also available (`/clear` first):
648
- - /ace:init-coding-standards — Define coding standards
649
- - /ace:map-system — Re-run this command to refresh
650
- - Review files in .docs/wiki/system-wide/
651
- ```
652
-
653
- End workflow.
654
- </step>
655
-
656
- </process>
657
-
658
- <success_criteria>
659
- - Init function executed (brownfield/greenfield detected, document existence checked)
660
- - wiki-readme.md created at .docs/wiki/wiki-readme.md if it did not already exist
661
- - Each document triaged independently (create/update/recreate/scaffold/skip)
662
- - Greenfield: structure and testing scaffolded, architecture created via interview
663
- - Brownfield: all documents created/updated by ace-wiki-mapper agents
664
- - Agents spawned in parallel where possible (structure + testing)
665
- - CLAUDE.md updated with wiki maintenance instructions
666
- - All created documents verified for content (non-empty, non-placeholder for brownfield)
667
- - Security scan passed (no secrets in generated docs)
668
- - Documents committed to .docs/wiki/system-wide/ (and .docs/wiki/wiki-readme.md)
669
- - User sees clear completion summary and next steps
670
- </success_criteria>
671
-
672
- </workflow>
1
+ <workflow>
2
+
3
+ <purpose>
4
+ Orchestrate system-wide wiki mapping: detect environment, determine which documents need
5
+ creation or updates, spawn ace-wiki-mapper agents to produce them, and optionally add
6
+ CLAUDE.md instructions to keep the wiki current.
7
+
8
+ Produces documents in `.docs/wiki/system-wide/`:
9
+ - system-structure.md — physical layout, subsystem index, shared directories
10
+ - testing-framework.md — test runner, patterns, conventions
11
+ - system-architecture.md — L1/L2 views, core flows, tech stack
12
+
13
+ Brownfield projects get documents filled from codebase analysis.
14
+ Greenfield projects get system-architecture.md via deep questioning (structure and testing
15
+ are scaffolded with headings only — filled as code is added).
16
+ </purpose>
17
+
18
+ <mandatory-context>
19
+ All supporting resource files are auto-loaded in the skill prompt above. Do NOT re-read them.
20
+ Also read any document or text passed as parameter ($ARGUMENTS) in the invoking command.
21
+ </mandatory-context>
22
+
23
+ <process>
24
+
25
+ <!-- ══════════════════════════════════════════════════════════════════ -->
26
+ <!-- STEP 1: SETUP -->
27
+ <!-- ══════════════════════════════════════════════════════════════════ -->
28
+
29
+ <step name="setup" order="1">
30
+ **MANDATORY FIRST STEP — Execute environment detection before any user interaction:**
31
+
32
+ INIT is available from the preprocessed Environment Context above — do NOT re-run init.
33
+
34
+ Parse INIT JSON for: `mapper_model`, `commit_docs`, `is_brownfield`, `is_greenfield`,
35
+ `has_existing_code`, `has_package_file`, `wiki_dir_exists`, `existing_wiki_files`,
36
+ `has_system_structure`, `has_system_architecture`, `has_testing_framework`,
37
+ `has_coding_standards`, `has_git`.
38
+
39
+ MAPPER_MODEL is available from INIT.mapper_model — do NOT re-run resolve-model.
40
+
41
+ Display stage banner:
42
+
43
+ ```
44
+ ╔══════════════════════════════════════════════════╗
45
+ ║ ACE > Map System ║
46
+ ╚══════════════════════════════════════════════════╝
47
+ ```
48
+
49
+ **If `has_git` is false:** Initialize git:
50
+ ```bash
51
+ git init
52
+ ```
53
+
54
+ Continue to step 2 (document triage).
55
+ </step>
56
+
57
+ <!-- ══════════════════════════════════════════════════════════════════ -->
58
+ <!-- STEP 2: DOCUMENT TRIAGE -->
59
+ <!-- Determine per-document action: create, update, recreate, or skip -->
60
+ <!-- ══════════════════════════════════════════════════════════════════ -->
61
+
62
+ <step name="document-triage" order="2">
63
+
64
+ Build a **document action plan** a list of `{ document, action }` entries where
65
+ action is one of: `create`, `update`, `recreate`, `scaffold`, `skip`.
66
+
67
+ Evaluate each document independently:
68
+
69
+ <!-- ── system-structure.md ────────────────────────────────────── -->
70
+
71
+ **system-structure.md:**
72
+
73
+ If `is_greenfield`:
74
+ - Action: `scaffold` create with headings and placeholder sections.
75
+ The document will be filled as subsystems are added.
76
+
77
+ If `is_brownfield` AND `has_system_structure` is false:
78
+ - Action: `create` — analyze codebase and produce full document.
79
+
80
+ If `is_brownfield` AND `has_system_structure` is true:
81
+ - Use AskUserQuestion:
82
+ - header: "Structure"
83
+ - question: "System structure document already exists at `.docs/wiki/system-wide/system-structure.md`. What would you like to do?"
84
+ - options:
85
+ - "Update" Refresh the existing document with current codebase state
86
+ - "Recreate" — Discard and rebuild from scratch
87
+ - "Skip" — Keep the current document as-is
88
+ - Map user choice to action: `update`, `recreate`, or `skip`.
89
+
90
+ <!-- ── testing-framework.md ───────────────────────────────────── -->
91
+
92
+ **testing-framework.md:**
93
+
94
+ If `is_greenfield`:
95
+ - Action: `scaffold` create with headings and placeholder sections.
96
+ Filled once a test framework is chosen and tests are written.
97
+
98
+ If `is_brownfield` AND `has_testing_framework` is false:
99
+ - Action: `create` — analyze codebase and produce full document.
100
+
101
+ If `is_brownfield` AND `has_testing_framework` is true:
102
+ - Use AskUserQuestion:
103
+ - header: "Testing"
104
+ - question: "Testing framework document already exists at `.docs/wiki/system-wide/testing-framework.md`. What would you like to do?"
105
+ - options:
106
+ - "Update" Refresh the existing document with current codebase state
107
+ - "Recreate" — Discard and rebuild from scratch
108
+ - "Skip" — Keep the current document as-is
109
+ - Map user choice to action: `update`, `recreate`, or `skip`.
110
+
111
+ <!-- ── system-architecture.md ─────────────────────────────────── -->
112
+
113
+ **system-architecture.md:**
114
+
115
+ If `is_greenfield`:
116
+ - Action: `create_with_interview` requires deep questioning before writing.
117
+ Cannot be scaffolded because architecture decisions must be made upfront.
118
+
119
+ If `is_brownfield` AND `has_system_architecture` is false:
120
+ - Action: `create` — analyze codebase and produce full document.
121
+
122
+ If `is_brownfield` AND `has_system_architecture` is true:
123
+ - Use AskUserQuestion:
124
+ - header: "Architecture"
125
+ - question: "System architecture document already exists at `.docs/wiki/system-wide/system-architecture.md`. What would you like to do?"
126
+ - options:
127
+ - "Update" Refresh the existing document with current codebase state
128
+ - "Recreate" — Discard and rebuild from scratch
129
+ - "Skip" — Keep the current document as-is
130
+ - Map user choice to action: `update`, `recreate`, or `skip`.
131
+
132
+ **IMPORTANT:** Ask all questions that need asking in a SINGLE AskUserQuestion call
133
+ where possible (up to 4 questions). If multiple documents exist, batch the questions.
134
+
135
+ Display the action plan to the user:
136
+
137
+ ```
138
+ ┌──────────────────────────────────────────────────┐
139
+ │ ACE > Map System > Action Plan │
140
+ └──────────────────────────────────────────────────┘
141
+
142
+ Document Action
143
+ ──────────────────────── ──────────
144
+ system-structure.md [create/update/recreate/scaffold/skip]
145
+ testing-framework.md [create/update/recreate/scaffold/skip]
146
+ system-architecture.md [create/update/recreate/scaffold/skip/create_with_interview]
147
+ ```
148
+
149
+ If ALL actions are `skip`, exit workflow with message:
150
+ ```
151
+ i All documents already exist and were skipped. Nothing to do.
152
+
153
+ Next > `/clear` first for a fresh context window, then:
154
+
155
+ /ace:map-subsystems
156
+ Map individual subsystem internals.
157
+ ```
158
+
159
+ Continue to step 3 (create directory structure).
160
+ </step>
161
+
162
+ <!-- ══════════════════════════════════════════════════════════════════ -->
163
+ <!-- STEP 3: CREATE DIRECTORY STRUCTURE -->
164
+ <!-- ══════════════════════════════════════════════════════════════════ -->
165
+
166
+ <step name="create-directories" order="3">
167
+ Create the wiki directory if it doesn't exist:
168
+
169
+ ```bash
170
+ mkdir -p .docs/wiki/system-wide
171
+ ```
172
+
173
+ **Generate wiki-readme.md if it does not already exist:**
174
+
175
+ Check if `.docs/wiki/wiki-readme.md` exists. If it does NOT exist, generate it
176
+ from the wiki-readme template (`${CLAUDE_SKILL_DIR}/templates/wiki-readme.xml`).
177
+
178
+ Read the template's `<template>` section and write the markdown content to
179
+ `.docs/wiki/wiki-readme.md`. This is a mostly-static meta-document — fill it
180
+ directly without spawning an agent:
181
+ - Directory Structure section: use as-is from template (canonical layout)
182
+ - Document Types tables: use as-is from template
183
+ - How to Use sections: use as-is from template
184
+ - Creating New Documents section: use as-is from template
185
+ - Keeping Current section: use as-is from template
186
+ - Subsystems table: leave with placeholder rows will be populated when
187
+ `/ace:map-subsystem` runs
188
+
189
+ If `.docs/wiki/wiki-readme.md` already exists, skip do not overwrite.
190
+
191
+ Continue to step 4.
192
+ </step>
193
+
194
+ <!-- ══════════════════════════════════════════════════════════════════ -->
195
+ <!-- STEP 4: SYSTEM STRUCTURE -->
196
+ <!-- ══════════════════════════════════════════════════════════════════ -->
197
+
198
+ <step name="system-structure" order="4">
199
+ Skip this step if system-structure action is `skip`.
200
+
201
+ **If action is `scaffold` (greenfield):**
202
+
203
+ Create an empty file:
204
+
205
+ ```bash
206
+ touch .docs/wiki/system-wide/system-structure.md
207
+ ```
208
+
209
+ It will be filled by `/ace:map-system` once source code exists.
210
+
211
+ **If action is `create` or `recreate`:**
212
+
213
+ Spawn ace-wiki-mapper agent:
214
+
215
+ ```
216
+ Task(
217
+ prompt="Focus: system-structure
218
+
219
+ Analyze this codebase and produce the system-wide structure document.
220
+
221
+ **Template:** Read ${CLAUDE_SKILL_DIR}/templates/system-structure.xml
222
+ **Output:** Write to .docs/wiki/system-wide/system-structure.md
223
+
224
+ Follow the template structure. Fill every section with real data from the codebase.
225
+ Identify all subsystems (microservices, monolith modules, or library packages).
226
+
227
+ Return confirmation only — do NOT return document contents.",
228
+ subagent_type="ace-wiki-mapper",
229
+ model="{MAPPER_MODEL}",
230
+ description="Map system structure"
231
+ )
232
+ ```
233
+
234
+ **If action is `update`:**
235
+
236
+ Spawn ace-wiki-mapper agent with existing content as context:
237
+
238
+ ```
239
+ Task(
240
+ prompt="Focus: system-structure
241
+
242
+ UPDATE the existing system structure document.
243
+
244
+ **Current document:** Read .docs/wiki/system-wide/system-structure.md
245
+ **Template:** Read ${CLAUDE_SKILL_DIR}/templates/system-structure.xml
246
+
247
+ Compare the current document against the actual codebase state.
248
+ Update sections that are stale. Add new subsystems or shared directories
249
+ that were added since the document was written. Remove entries for
250
+ deleted subsystems or directories.
251
+
252
+ Preserve accurate content. Only change what's actually stale.
253
+
254
+ Write the updated file to .docs/wiki/system-wide/system-structure.md
255
+ Return confirmation only — do NOT return document contents.",
256
+ subagent_type="ace-wiki-mapper",
257
+ model="{MAPPER_MODEL}",
258
+ description="Update system structure"
259
+ )
260
+ ```
261
+
262
+ Continue to step 5.
263
+ </step>
264
+
265
+ <!-- ══════════════════════════════════════════════════════════════════ -->
266
+ <!-- STEP 5: TESTING FRAMEWORK -->
267
+ <!-- ══════════════════════════════════════════════════════════════════ -->
268
+
269
+ <step name="testing-framework" order="5">
270
+ Skip this step if testing-framework action is `skip`.
271
+
272
+ **NOTE:** This step can run IN PARALLEL with step 4 (system-structure) if both
273
+ need agent work. Use `run_in_background=true` for the agents in steps 4 and 5,
274
+ then collect results before step 6.
275
+
276
+ **If action is `scaffold` (greenfield):**
277
+
278
+ Create an empty file:
279
+
280
+ ```bash
281
+ touch .docs/wiki/system-wide/testing-framework.md
282
+ ```
283
+
284
+ It will be filled by `/ace:map-system` once tests exist.
285
+
286
+ **If action is `create` or `recreate`:**
287
+
288
+ Spawn ace-wiki-mapper agent:
289
+
290
+ ```
291
+ Task(
292
+ prompt="Focus: testing-framework
293
+
294
+ Analyze this codebase and produce the testing framework document.
295
+
296
+ **Template:** Read ${CLAUDE_SKILL_DIR}/templates/testing-framework.xml
297
+ **Output:** Write to .docs/wiki/system-wide/testing-framework.md
298
+
299
+ Check package.json/config files for test runner and scripts.
300
+ Read 3-5 existing test files for patterns.
301
+ Look for test utilities, fixtures, factories.
302
+ If NO tests exist, write a minimal document noting 'No tests found'
303
+ instead of a document full of placeholders.
304
+
305
+ Return confirmation only do NOT return document contents.",
306
+ subagent_type="ace-wiki-mapper",
307
+ model="{MAPPER_MODEL}",
308
+ description="Map testing framework"
309
+ )
310
+ ```
311
+
312
+ **If action is `update`:**
313
+
314
+ Spawn ace-wiki-mapper agent with update instructions:
315
+
316
+ ```
317
+ Task(
318
+ prompt="Focus: testing-framework
319
+
320
+ UPDATE the existing testing framework document.
321
+
322
+ **Current document:** Read .docs/wiki/system-wide/testing-framework.md
323
+ **Template:** Read ${CLAUDE_SKILL_DIR}/templates/testing-framework.xml
324
+
325
+ Compare against current codebase state. Update stale sections only.
326
+ Check for new test runner config, new test patterns, changed coverage settings.
327
+
328
+ Write the updated file to .docs/wiki/system-wide/testing-framework.md
329
+ Return confirmation only — do NOT return document contents.",
330
+ subagent_type="ace-wiki-mapper",
331
+ model="{MAPPER_MODEL}",
332
+ description="Update testing framework"
333
+ )
334
+ ```
335
+
336
+ Continue to step 6 (wait for parallel agents from steps 4-5 if applicable).
337
+ </step>
338
+
339
+ <!-- ══════════════════════════════════════════════════════════════════ -->
340
+ <!-- STEP 5.5: COLLECT PARALLEL RESULTS -->
341
+ <!-- ══════════════════════════════════════════════════════════════════ -->
342
+
343
+ <step name="collect-parallel" order="5.5">
344
+ If steps 4 and 5 spawned background agents, wait for both to complete.
345
+ Read each agent's output to collect confirmations.
346
+
347
+ If any agent failed, note the failure and inform the user.
348
+ Do NOT re-attempt — let the user decide.
349
+
350
+ Continue to step 6.
351
+ </step>
352
+
353
+ <!-- ══════════════════════════════════════════════════════════════════ -->
354
+ <!-- STEP 6: SYSTEM ARCHITECTURE -->
355
+ <!-- ══════════════════════════════════════════════════════════════════ -->
356
+
357
+ <step name="system-architecture" order="6">
358
+ Skip this step if system-architecture action is `skip`.
359
+
360
+ <!-- ── 6a: BROWNFIELD CREATE / RECREATE ──────────────────────── -->
361
+
362
+ **If action is `create` or `recreate` AND `is_brownfield`:**
363
+
364
+ Spawn ace-wiki-mapper agent directly (codebase provides all the answers):
365
+
366
+ ```
367
+ Task(
368
+ prompt="Focus: system-architecture
369
+
370
+ Analyze this codebase and produce the system-wide architecture document.
371
+
372
+ **Template:** Read ${CLAUDE_SKILL_DIR}/templates/system-architecture.xml
373
+ **Output:** Write to .docs/wiki/system-wide/system-architecture.md
374
+
375
+ **Also read (if it exists):** .docs/wiki/system-wide/system-structure.md
376
+ — use the subsystem index from the structure doc to inform the L2 container diagram
377
+ and subsystem responsibility matrix. Do NOT duplicate content.
378
+
379
+ Follow the template structure. Fill every section with real data.
380
+ Generate C4 L1 and L2 Mermaid diagrams.
381
+ Trace 1-2 core flows as sequence diagrams.
382
+ Catalog the tech stack from actual dependency files (versions from lock files).
383
+
384
+ Return confirmation only do NOT return document contents.",
385
+ subagent_type="ace-wiki-mapper",
386
+ model="{MAPPER_MODEL}",
387
+ description="Map system architecture"
388
+ )
389
+ ```
390
+
391
+ <!-- ── 6b: BROWNFIELD UPDATE ─────────────────────────────────── -->
392
+
393
+ **If action is `update`:**
394
+
395
+ Spawn ace-wiki-mapper agent with update instructions:
396
+
397
+ ```
398
+ Task(
399
+ prompt="Focus: system-architecture
400
+
401
+ UPDATE the existing system architecture document.
402
+
403
+ **Current document:** Read .docs/wiki/system-wide/system-architecture.md
404
+ **Template:** Read ${CLAUDE_SKILL_DIR}/templates/system-architecture.xml
405
+ **Also read (if it exists):** .docs/wiki/system-wide/system-structure.md
406
+
407
+ Compare against current codebase state. Check:
408
+ - New subsystems or removed subsystems?
409
+ - New external integrations?
410
+ - Tech stack changes (new frameworks, version bumps)?
411
+ - Core flow shape changes?
412
+
413
+ Update only stale sections. Preserve accurate content.
414
+
415
+ Write the updated file to .docs/wiki/system-wide/system-architecture.md
416
+ Return confirmation only do NOT return document contents.",
417
+ subagent_type="ace-wiki-mapper",
418
+ model="{MAPPER_MODEL}",
419
+ description="Update system architecture"
420
+ )
421
+ ```
422
+
423
+ <!-- ── 6c: GREENFIELD — DEEP QUESTIONING ─────────────────────── -->
424
+
425
+ **If action is `create_with_interview` (greenfield):**
426
+
427
+ Architecture cannot be inferred from code that doesn't exist yet.
428
+ Conduct a deep questioning session to gather architecture decisions.
429
+
430
+ Follow the questioning guide from `questioning.xml`. You are a thinking partner
431
+ helping the user articulate their system architecture.
432
+
433
+ **Opening:**
434
+ ```
435
+ ┌──────────────────────────────────────────────────┐
436
+ │ ACE > Map System > Architecture Interview │
437
+ └──────────────────────────────────────────────────┘
438
+
439
+ This is a greenfield project — no codebase to analyze.
440
+ I need to understand your architecture plans to create
441
+ the system-architecture document.
442
+ ```
443
+
444
+ **Key areas to explore (adapt based on conversation, don't checklist):**
445
+
446
+ 1. **System purpose**
447
+ "In 2-3 sentences, what does this system do and who uses it?"
448
+
449
+ 2. **Subsystem breakdown**
450
+ "What are the major components/services/modules?"
451
+ Use AskUserQuestion:
452
+ - header: "Topology"
453
+ - question: "What's your deployment topology?"
454
+ - options:
455
+ - "Monolith" Single deployable with internal modules
456
+ - "Microservices" — Multiple independently deployed services
457
+ - "Monorepo packages" — Multiple packages in one repo
458
+ - "Hybrid" Mix of approaches
459
+
460
+ 3. **External integrations**
461
+ "What external systems will this integrate with?"
462
+ (databases, auth providers, third-party APIs, message brokers)
463
+
464
+ 4. **Communication patterns**
465
+ If multiple subsystems: "How will they communicate?"
466
+ - Sync (HTTP/gRPC) vs Async (events/queues) vs Hybrid
467
+
468
+ 5. **Tech stack**
469
+ "What technologies are you using?"
470
+ Use AskUserQuestion:
471
+ - header: "Backend"
472
+ - question: "What's your primary backend technology?"
473
+ - options: (adapt to context, e.g., "Node.js/TypeScript", "C#/.NET", "Python", "Go")
474
+
475
+ Follow up for: frontend, database, cache, messaging if applicable.
476
+
477
+ 6. **Key architectural decisions**
478
+ "Any architectural patterns you're committed to?"
479
+ (Clean Architecture, CQRS, Event Sourcing, etc.)
480
+
481
+ **Decision gate:**
482
+ When you understand the architecture:
483
+ - header: "Ready?"
484
+ - question: "I have enough to create your architecture document. Ready to generate?"
485
+ - options:
486
+ - "Generate" — Create the document
487
+ - "Keep exploring" I have more to share
488
+
489
+ Loop until "Generate" selected.
490
+
491
+ **Then prepare a context brief (300-500 words) that distills:**
492
+ - System purpose and users
493
+ - Subsystem breakdown (names, responsibilities)
494
+ - External integrations (what, direction, protocol)
495
+ - Communication patterns between subsystems
496
+ - Tech stack with expected versions
497
+ - Key architectural decisions
498
+
499
+ **Spawn the ace-wiki-mapper agent with the interview context:**
500
+
501
+ ```
502
+ Task(
503
+ prompt="Focus: system-architecture
504
+
505
+ Create the system-wide architecture document for a GREENFIELD project.
506
+
507
+ **Architecture brief from user interview:**
508
+ {paste the context brief here}
509
+
510
+ **Template:** Read ${CLAUDE_SKILL_DIR}/templates/system-architecture.xml
511
+ **Output:** Write to .docs/wiki/system-wide/system-architecture.md
512
+
513
+ **Also read (if it exists):** .docs/wiki/system-wide/system-structure.md
514
+
515
+ Follow the template structure. Generate Mermaid C4 diagrams based on the
516
+ interview data. For greenfield, subsystem boxes in L2 may be planned but
517
+ not yet implemented — that's fine, document the intended architecture.
518
+
519
+ Return confirmation only — do NOT return document contents.",
520
+ subagent_type="ace-wiki-mapper",
521
+ model="{MAPPER_MODEL}",
522
+ description="Write system architecture (greenfield)"
523
+ )
524
+ ```
525
+
526
+ Continue to step 7.
527
+ </step>
528
+
529
+ <!-- ══════════════════════════════════════════════════════════════════ -->
530
+ <!-- STEP 7: CLAUDE.MD INSTRUCTIONS -->
531
+ <!-- ══════════════════════════════════════════════════════════════════ -->
532
+
533
+ <step name="claude-md-instructions" order="7">
534
+ **Add wiki maintenance instructions to CLAUDE.md** so that future code changes
535
+ trigger wiki updates.
536
+
537
+ Check if `CLAUDE.md` exists at project root. If not, create it.
538
+ If it exists, append the wiki section only if it's not already present.
539
+
540
+ Search for "Wiki Maintenance" in CLAUDE.md. If found, skip this step.
541
+
542
+ **Content to add:**
543
+
544
+ ```markdown
545
+
546
+ ## Wiki Maintenance
547
+
548
+ When adding, removing, or renaming files or directories:
549
+ - Update `.docs/wiki/system-wide/system-structure.md` if the change affects subsystem boundaries, shared directories, or root config files.
550
+ - Update `.docs/wiki/subsystems/[subsystem-name]/structure.md` for any subsystem where files changed.
551
+
552
+ When adding a new subsystem, external integration, or changing communication patterns:
553
+ - Update `.docs/wiki/system-wide/system-architecture.md`.
554
+
555
+ When changing test framework, runner, mocking approach, or coverage config:
556
+ - Update `.docs/wiki/system-wide/testing-framework.md`.
557
+ ```
558
+
559
+ Continue to step 8.
560
+ </step>
561
+
562
+ <!-- ══════════════════════════════════════════════════════════════════ -->
563
+ <!-- STEP 8: VERIFY AND COMMIT -->
564
+ <!-- ══════════════════════════════════════════════════════════════════ -->
565
+
566
+ <step name="verify-and-commit" order="8">
567
+ **Verify all expected documents exist and are non-empty:**
568
+
569
+ For each document where the action was NOT `skip`:
570
+ - Check file exists
571
+ - Check file has content (>5 lines for scaffold, >20 lines for create/update/recreate)
572
+
573
+ If any document is missing or empty, warn the user.
574
+
575
+ **Security scan** before commit — use the Grep tool (NOT bash grep):
576
+
577
+ ```
578
+ Grep(
579
+ pattern="(sk-[a-zA-Z0-9]{20,}|sk_live_|sk_test_|ghp_[a-zA-Z0-9]{36}|AKIA[A-Z0-9]{16}|-----BEGIN.*PRIVATE KEY)",
580
+ path=".docs/wiki/system-wide/",
581
+ glob="*.md",
582
+ output_mode="content"
583
+ )
584
+ ```
585
+
586
+ If matches found: SECRETS_FOUND — pause and alert user.
587
+ If no matches: CLEAN.
588
+
589
+ If SECRETS_FOUND: pause and alert user before committing.
590
+
591
+ **Commit** (if `commit_docs` is true):
592
+
593
+ ```bash
594
+ git add .docs/wiki/system-wide/
595
+ ```
596
+
597
+ If wiki-readme.md was created in step 3:
598
+ ```bash
599
+ git add .docs/wiki/wiki-readme.md
600
+ ```
601
+
602
+ If CLAUDE.md was created or updated:
603
+ ```bash
604
+ git add CLAUDE.md
605
+ ```
606
+
607
+ ```bash
608
+ git commit -m "docs: map system-wide wiki documents"
609
+ ```
610
+
611
+ Continue to step 9.
612
+ </step>
613
+
614
+ <!-- ══════════════════════════════════════════════════════════════════ -->
615
+ <!-- STEP 9: COMPLETION -->
616
+ <!-- ══════════════════════════════════════════════════════════════════ -->
617
+
618
+ <step name="completion" order="9">
619
+ Display completion banner and next steps.
620
+
621
+ ```
622
+ ╔══════════════════════════════════════════════════╗
623
+ ║ ACE > System Mapped ║
624
+ ╚══════════════════════════════════════════════════╝
625
+
626
+ Documents:
627
+ ──────────
628
+ [For each document, show action taken and line count]
629
+ + wiki-readme.md ([N] lines) — [created | already exists]
630
+ + system-structure.md ([N] lines) — [created/updated/recreated/scaffolded]
631
+ + testing-framework.md ([N] lines) — [created/updated/recreated/scaffolded]
632
+ + system-architecture.md ([N] lines) — [created/updated/recreated/scaffolded]
633
+ - [document] skipped
634
+
635
+ i Wiki maintenance rules added to CLAUDE.md.
636
+
637
+ Next > `/clear` first for a fresh context window, then:
638
+
639
+ /ace:map-subsystems
640
+ Map individual subsystem internals.
641
+
642
+ Also available (`/clear` first):
643
+ - /ace:init-coding-standards — Define coding standards
644
+ - /ace:map-system — Re-run this command to refresh
645
+ - Review files in .docs/wiki/system-wide/
646
+ ```
647
+
648
+ End workflow.
649
+ </step>
650
+
651
+ </process>
652
+
653
+ <success_criteria>
654
+ - Init function executed (brownfield/greenfield detected, document existence checked)
655
+ - wiki-readme.md created at .docs/wiki/wiki-readme.md if it did not already exist
656
+ - Each document triaged independently (create/update/recreate/scaffold/skip)
657
+ - Greenfield: structure and testing scaffolded, architecture created via interview
658
+ - Brownfield: all documents created/updated by ace-wiki-mapper agents
659
+ - Agents spawned in parallel where possible (structure + testing)
660
+ - CLAUDE.md updated with wiki maintenance instructions
661
+ - All created documents verified for content (non-empty, non-placeholder for brownfield)
662
+ - Security scan passed (no secrets in generated docs)
663
+ - Documents committed to .docs/wiki/system-wide/ (and .docs/wiki/wiki-readme.md)
664
+ - User sees clear completion summary and next steps
665
+ </success_criteria>
666
+
667
+ </workflow>