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,672 @@
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>