agile-context-engineering 0.3.0 → 0.5.0

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 (147) hide show
  1. package/.claude-plugin/plugin.json +10 -0
  2. package/LICENSE +51 -51
  3. package/README.md +332 -324
  4. package/agents/ace-product-owner.md +1 -1
  5. package/agents/ace-research-synthesizer.md +228 -228
  6. package/agents/ace-wiki-mapper.md +449 -445
  7. package/bin/install.js +60 -64
  8. package/hooks/ace-check-update.js +70 -62
  9. package/hooks/ace-statusline.js +89 -89
  10. package/package.json +5 -4
  11. package/shared/lib/ace-core.js +308 -0
  12. package/shared/lib/ace-core.test.js +308 -0
  13. package/shared/lib/ace-github.js +753 -0
  14. package/shared/lib/ace-story.js +400 -0
  15. package/shared/lib/ace-story.test.js +250 -0
  16. package/{agile-context-engineering → shared}/utils/questioning.xml +110 -110
  17. package/{agile-context-engineering → shared}/utils/ui-formatting.md +299 -299
  18. package/skills/execute-story/SKILL.md +110 -0
  19. package/skills/execute-story/script.js +305 -0
  20. package/skills/execute-story/script.test.js +261 -0
  21. package/skills/execute-story/walkthrough-template.xml +255 -0
  22. package/{agile-context-engineering/workflows/execute-story.xml → skills/execute-story/workflow.xml} +1219 -1219
  23. package/skills/help/SKILL.md +69 -0
  24. package/skills/help/script.js +318 -0
  25. package/skills/help/script.test.js +183 -0
  26. package/{agile-context-engineering/workflows/help.xml → skills/help/workflow.xml} +540 -540
  27. package/skills/init-coding-standards/SKILL.md +72 -0
  28. package/skills/init-coding-standards/script.js +59 -0
  29. package/skills/init-coding-standards/script.test.js +70 -0
  30. package/{agile-context-engineering/workflows/init-coding-standards.xml → skills/init-coding-standards/workflow.xml} +381 -386
  31. package/skills/map-cross-cutting/SKILL.md +89 -0
  32. package/{agile-context-engineering/templates/wiki → skills/map-cross-cutting}/system-cross-cutting.xml +197 -197
  33. package/skills/map-cross-cutting/workflow.xml +330 -0
  34. package/skills/map-guide/SKILL.md +89 -0
  35. package/{agile-context-engineering/templates/wiki → skills/map-guide}/guide.xml +137 -137
  36. package/skills/map-guide/workflow.xml +320 -0
  37. package/skills/map-pattern/SKILL.md +89 -0
  38. package/{agile-context-engineering/templates/wiki → skills/map-pattern}/pattern.xml +159 -159
  39. package/skills/map-pattern/workflow.xml +331 -0
  40. package/skills/map-story/SKILL.md +127 -0
  41. package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/decizions.xml +115 -115
  42. package/skills/map-story/templates/guide.xml +137 -0
  43. package/skills/map-story/templates/pattern.xml +159 -0
  44. package/skills/map-story/templates/system-cross-cutting.xml +197 -0
  45. package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/system.xml +381 -381
  46. package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/walkthrough.xml +255 -255
  47. package/{agile-context-engineering/workflows/map-story.xml → skills/map-story/workflow.xml} +1046 -1046
  48. package/skills/map-subsystem/SKILL.md +111 -0
  49. package/skills/map-subsystem/script.js +60 -0
  50. package/skills/map-subsystem/script.test.js +68 -0
  51. package/skills/map-subsystem/templates/decizions.xml +115 -0
  52. package/skills/map-subsystem/templates/guide.xml +137 -0
  53. package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/module-discovery.xml +174 -174
  54. package/skills/map-subsystem/templates/pattern.xml +159 -0
  55. package/skills/map-subsystem/templates/system-cross-cutting.xml +197 -0
  56. package/skills/map-subsystem/templates/system.xml +381 -0
  57. package/skills/map-subsystem/templates/walkthrough.xml +255 -0
  58. package/{agile-context-engineering/workflows/map-subsystem.xml → skills/map-subsystem/workflow.xml} +15 -20
  59. package/skills/map-sys-doc/SKILL.md +90 -0
  60. package/skills/map-sys-doc/system.xml +381 -0
  61. package/skills/map-sys-doc/workflow.xml +336 -0
  62. package/skills/map-system/SKILL.md +85 -0
  63. package/skills/map-system/script.js +84 -0
  64. package/skills/map-system/script.test.js +73 -0
  65. package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/system-architecture.xml +254 -254
  66. package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/wiki-readme.xml +296 -296
  67. package/{agile-context-engineering/workflows/map-system.xml → skills/map-system/workflow.xml} +11 -16
  68. package/skills/map-walkthrough/SKILL.md +92 -0
  69. package/skills/map-walkthrough/walkthrough.xml +255 -0
  70. package/skills/plan-backlog/SKILL.md +75 -0
  71. package/{agile-context-engineering/templates/product/product-backlog.xml → skills/plan-backlog/product-backlog-template.xml} +231 -231
  72. package/skills/plan-backlog/script.js +136 -0
  73. package/skills/plan-backlog/script.test.js +83 -0
  74. package/{agile-context-engineering/workflows/plan-backlog.xml → skills/plan-backlog/workflow.xml} +13 -21
  75. package/skills/plan-feature/SKILL.md +76 -0
  76. package/skills/plan-feature/script.js +148 -0
  77. package/skills/plan-feature/script.test.js +80 -0
  78. package/{agile-context-engineering/workflows/plan-feature.xml → skills/plan-feature/workflow.xml} +1487 -1495
  79. package/skills/plan-product-vision/SKILL.md +75 -0
  80. package/skills/plan-product-vision/script.js +60 -0
  81. package/skills/plan-product-vision/script.test.js +69 -0
  82. package/{agile-context-engineering/workflows/plan-product-vision.xml → skills/plan-product-vision/workflow.xml} +4 -9
  83. package/skills/plan-story/SKILL.md +116 -0
  84. package/skills/plan-story/script.js +326 -0
  85. package/skills/plan-story/script.test.js +240 -0
  86. package/skills/plan-story/story-template.xml +451 -0
  87. package/{agile-context-engineering/workflows/plan-story.xml → skills/plan-story/workflow.xml} +1285 -944
  88. package/skills/research-external-solution/SKILL.md +107 -0
  89. package/skills/research-external-solution/script.js +238 -0
  90. package/skills/research-external-solution/script.test.js +134 -0
  91. package/{agile-context-engineering/workflows/research-external-solution.xml → skills/research-external-solution/workflow.xml} +4 -6
  92. package/skills/research-integration-solution/SKILL.md +98 -0
  93. package/skills/research-integration-solution/script.js +231 -0
  94. package/skills/research-integration-solution/script.test.js +134 -0
  95. package/{agile-context-engineering/workflows/research-integration-solution.xml → skills/research-integration-solution/workflow.xml} +3 -5
  96. package/skills/research-story-wiki/SKILL.md +92 -0
  97. package/skills/research-story-wiki/script.js +231 -0
  98. package/skills/research-story-wiki/script.test.js +138 -0
  99. package/{agile-context-engineering/workflows/research-story-wiki.xml → skills/research-story-wiki/workflow.xml} +3 -5
  100. package/skills/research-technical-solution/SKILL.md +103 -0
  101. package/skills/research-technical-solution/script.js +231 -0
  102. package/skills/research-technical-solution/script.test.js +134 -0
  103. package/{agile-context-engineering/workflows/research-technical-solution.xml → skills/research-technical-solution/workflow.xml} +3 -5
  104. package/skills/review-story/SKILL.md +100 -0
  105. package/skills/review-story/script.js +257 -0
  106. package/skills/review-story/script.test.js +169 -0
  107. package/skills/review-story/story-template.xml +451 -0
  108. package/{agile-context-engineering/workflows/review-story.xml → skills/review-story/workflow.xml} +279 -281
  109. package/skills/update/SKILL.md +53 -0
  110. package/{agile-context-engineering/workflows/update.xml → skills/update/workflow.xml} +12 -13
  111. package/agile-context-engineering/src/ace-tools.js +0 -2881
  112. package/agile-context-engineering/src/ace-tools.test.js +0 -1089
  113. package/agile-context-engineering/templates/_command.md +0 -54
  114. package/agile-context-engineering/templates/_workflow.xml +0 -17
  115. package/agile-context-engineering/templates/config.json +0 -0
  116. package/agile-context-engineering/templates/product/integration-solution.xml +0 -0
  117. package/commands/ace/execute-story.md +0 -138
  118. package/commands/ace/help.md +0 -93
  119. package/commands/ace/init-coding-standards.md +0 -83
  120. package/commands/ace/map-story.md +0 -165
  121. package/commands/ace/map-subsystem.md +0 -140
  122. package/commands/ace/map-system.md +0 -92
  123. package/commands/ace/map-walkthrough.md +0 -127
  124. package/commands/ace/plan-backlog.md +0 -83
  125. package/commands/ace/plan-feature.md +0 -89
  126. package/commands/ace/plan-product-vision.md +0 -81
  127. package/commands/ace/plan-story.md +0 -159
  128. package/commands/ace/research-external-solution.md +0 -138
  129. package/commands/ace/research-integration-solution.md +0 -135
  130. package/commands/ace/research-story-wiki.md +0 -116
  131. package/commands/ace/research-technical-solution.md +0 -147
  132. package/commands/ace/review-story.md +0 -109
  133. package/commands/ace/update.md +0 -56
  134. /package/{agile-context-engineering/templates/product/story.xml → skills/execute-story/story-template.xml} +0 -0
  135. /package/{agile-context-engineering/templates/wiki/coding-standards.xml → skills/init-coding-standards/coding-standards-template.xml} +0 -0
  136. /package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/tech-debt-index.xml +0 -0
  137. /package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/subsystem-architecture.xml +0 -0
  138. /package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/subsystem-structure.xml +0 -0
  139. /package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/system-structure.xml +0 -0
  140. /package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/testing-framework.xml +0 -0
  141. /package/{agile-context-engineering/workflows/map-walkthrough.xml → skills/map-walkthrough/workflow.xml} +0 -0
  142. /package/{agile-context-engineering/templates/product/feature.xml → skills/plan-feature/feature-template.xml} +0 -0
  143. /package/{agile-context-engineering/templates/product/product-vision.xml → skills/plan-product-vision/product-vision-template.xml} +0 -0
  144. /package/{agile-context-engineering/templates/product/external-solution.xml → skills/research-external-solution/external-solution-template.xml} +0 -0
  145. /package/{agile-context-engineering/templates/product/story-integration-solution.xml → skills/research-integration-solution/integration-solution-template.xml} +0 -0
  146. /package/{agile-context-engineering/templates/product/story-wiki.xml → skills/research-story-wiki/story-wiki-template.xml} +0 -0
  147. /package/{agile-context-engineering/templates/product/story-technical-solution.xml → skills/research-technical-solution/technical-solution-template.xml} +0 -0
@@ -0,0 +1,331 @@
1
+ <workflow>
2
+
3
+ <purpose>
4
+ Create or update a pattern document in
5
+ `.docs/wiki/subsystems/[subsystem-name]/patterns/`.
6
+
7
+ A pattern doc describes a reusable structural approach used by 2+ implementations.
8
+ It is the document an AI agent reads to ensure new code follows established
9
+ conventions — structure diagram, how it works, how to apply, current implementations.
10
+
11
+ This workflow is executed directly — NO sub-agents are spawned.
12
+ The executing agent does everything: finding implementations, extracting the
13
+ abstract pattern, and writing the document.
14
+ </purpose>
15
+
16
+ <mandatory-context>
17
+ Read all files referenced by the invoking command's execution-context before starting.
18
+ Also read any document or text passed as parameter ($ARGUMENTS) in the invoking command.
19
+ </mandatory-context>
20
+
21
+ <process>
22
+
23
+ <!-- ══════════════════════════════════════════════════════════════════ -->
24
+ <!-- STEP 1: SETUP AND VALIDATE -->
25
+ <!-- ══════════════════════════════════════════════════════════════════ -->
26
+
27
+ <step name="setup" order="1">
28
+
29
+ <substep order="1.1" name="display-banner">
30
+ Display stage banner:
31
+
32
+ ```
33
+ ╔══════════════════════════════════════════════════╗
34
+ ║ ACE > Map Pattern ║
35
+ ╚══════════════════════════════════════════════════╝
36
+ ```
37
+ </substep>
38
+
39
+ <substep order="1.2" name="parse-and-validate">
40
+ Parse $ARGUMENTS for: `text`, `subsystem`, `story-context`, `commits`.
41
+
42
+ **If `text` is missing:** Ask the user:
43
+ - header: "Pattern"
44
+ - question: "Describe the pattern to document — what structural approach is reused?\nE.g., 'Template Method pattern used by all drawing paths'"
45
+
46
+ **If `subsystem` is missing:** Ask the user:
47
+ - header: "Pattern"
48
+ - question: "Which subsystem does this pattern belong to?"
49
+ </substep>
50
+
51
+ <substep order="1.3" name="resolve-subsystem">
52
+ Resolve the subsystem. Check if `.docs/wiki/subsystems/[subsystem-name]/` exists.
53
+
54
+ **If not found:**
55
+ ```
56
+ ! No wiki found for subsystem "[subsystem]".
57
+ Run /ace:map-subsystem first to create the subsystem wiki.
58
+ ```
59
+ Exit.
60
+
61
+ Ensure patterns directory exists:
62
+ ```bash
63
+ mkdir -p .docs/wiki/subsystems/[subsystem_name]/patterns
64
+ ```
65
+ </substep>
66
+
67
+ Display:
68
+ ```
69
+ i Pattern: [text description]
70
+ Subsystem: [subsystem-name]
71
+ Story context: [path/issue, or "none"]
72
+ Commits: [value, or "search codebase directly"]
73
+ ```
74
+
75
+ Continue to step 2.
76
+ </step>
77
+
78
+ <!-- ══════════════════════════════════════════════════════════════════ -->
79
+ <!-- STEP 2: CHECK FOR EXISTING PATTERN DOC -->
80
+ <!-- ══════════════════════════════════════════════════════════════════ -->
81
+
82
+ <step name="check-existing" order="2">
83
+
84
+ Scan for existing pattern docs:
85
+
86
+ ```
87
+ Glob(pattern='*.md', path='.docs/wiki/subsystems/[subsystem_name]/patterns')
88
+ ```
89
+
90
+ **If existing pattern docs found:**
91
+ Read their titles and "The Pattern" sections. Check if any covers the same
92
+ or overlapping structural approach.
93
+
94
+ **If overlap detected:**
95
+ Use AskUserQuestion:
96
+ - header: "Pattern"
97
+ - question: "An existing pattern doc may cover a similar approach:\n\n- `[existing-file]`: [title]\n\nShould I update the existing doc or create a new one?"
98
+ - options:
99
+ - "Update existing" — set MODE = update, set TARGET_FILE = existing path
100
+ - "Create new" — set MODE = create
101
+
102
+ **If no overlap or no existing pattern docs:** Set MODE = create.
103
+
104
+ **If MODE = create:**
105
+ Derive file name from pattern name in kebab-case.
106
+ Set TARGET_FILE = `.docs/wiki/subsystems/[subsystem_name]/patterns/[pattern-name].md`
107
+
108
+ Continue to step 3.
109
+ </step>
110
+
111
+ <!-- ══════════════════════════════════════════════════════════════════ -->
112
+ <!-- STEP 3: GATHER CODE CONTEXT AND FIND IMPLEMENTATIONS -->
113
+ <!-- ══════════════════════════════════════════════════════════════════ -->
114
+
115
+ <step name="gather-context" order="3">
116
+
117
+ <substep order="3.1" name="read-story-context">
118
+ <variant condition="story-context is a path">
119
+ Read all markdown files in the story artifacts folder.
120
+ Extract: what pattern was used, what was implemented.
121
+ </variant>
122
+
123
+ <variant condition="story-context is a GitHub issue">
124
+ ```bash
125
+ gh issue view [issue-number] --json title,body,labels,comments
126
+ ```
127
+ Extract context about the pattern.
128
+ </variant>
129
+
130
+ <variant condition="no story-context">
131
+ Skip — discover pattern from codebase only.
132
+ </variant>
133
+ </substep>
134
+
135
+ <substep order="3.2" name="find-all-implementations">
136
+ <variant condition="commits provided as number N">
137
+ ```bash
138
+ git diff --name-only HEAD~[N]..HEAD
139
+ ```
140
+ Start with changed files. Read them to identify the pattern.
141
+ Then search the full codebase for other implementations of the same pattern.
142
+ </variant>
143
+
144
+ <variant condition="commits provided as SHAs">
145
+ ```bash
146
+ git diff --name-only [first-sha]^..[last-sha]
147
+ ```
148
+ Start with changed files. Read them to identify the pattern.
149
+ Then search the full codebase for other implementations.
150
+ </variant>
151
+
152
+ <variant condition="no commits — search codebase directly">
153
+ Use the `text` description to find the pattern and its implementations:
154
+
155
+ 1. Read the subsystem's structure.md and architecture.md for orientation
156
+ 2. Grep for keywords from the text description (base classes, interfaces, etc.)
157
+ 3. Find the abstract base/interface that defines the pattern
158
+ 4. Find ALL concrete implementations (use Grep for extends/implements)
159
+ 5. Read each implementation to understand the pattern mechanics
160
+ </variant>
161
+
162
+ **A pattern requires 2+ implementations.** If only 1 found, ask the user:
163
+ - header: "Pattern"
164
+ - question: "I found only 1 implementation of this pattern. Patterns typically need 2+. Should I continue documenting it as a pattern, or is there another implementation I'm missing?"
165
+ </substep>
166
+
167
+ <substep order="3.3" name="extract-pattern-structure">
168
+ From the implementations, extract the abstract pattern:
169
+
170
+ 1. What is the base class / interface contract?
171
+ 2. What factory methods / abstract methods must be overridden?
172
+ 3. What is the template method / orchestration flow?
173
+ 4. What are the extension points?
174
+ 5. What registrations/configurations are required?
175
+ 6. What are the common gotchas across implementations?
176
+
177
+ Build a complete mental model of the pattern.
178
+ </substep>
179
+
180
+ Continue to step 4.
181
+ </step>
182
+
183
+ <!-- ══════════════════════════════════════════════════════════════════ -->
184
+ <!-- STEP 4: WRITE THE PATTERN DOC -->
185
+ <!-- ══════════════════════════════════════════════════════════════════ -->
186
+
187
+ <step name="write-doc" order="4">
188
+
189
+ Read ALL existing wiki docs under `.docs/wiki/subsystems/[subsystem_name]/`
190
+ for cross-referencing.
191
+
192
+ Follow the pattern template structure exactly.
193
+
194
+ <substep order="4.1" name="write-the-pattern">
195
+ - Title: "# [Pattern Name]"
196
+ - The Pattern: ONE paragraph — what it is, when to use it.
197
+ Name the GoF/industry pattern if applicable, then explain how it
198
+ manifests in THIS codebase. Not a textbook definition.
199
+ </substep>
200
+
201
+ <substep order="4.2" name="write-structure">
202
+ Build a mermaid classDiagram showing the pattern's structure.
203
+ Show the abstract/interface hierarchy with key method signatures.
204
+ Show the pattern skeleton — not every concrete implementation.
205
+ </substep>
206
+
207
+ <substep order="4.3" name="write-how-it-works">
208
+ Numbered steps tracing the pattern's execution flow.
209
+ Every step references actual code with `file:ClassName.method`.
210
+ Focus on mechanics an agent needs to understand.
211
+ </substep>
212
+
213
+ <substep order="4.4" name="write-how-to-apply">
214
+ The MOST ACTIONABLE section. Steps for creating a new instance:
215
+ - Which files to create
216
+ - Which registrations to add
217
+ - Which factories to update
218
+ - Reference existing implementations as "copy from" targets
219
+ </substep>
220
+
221
+ <substep order="4.5" name="write-current-implementations">
222
+ Complete list of ALL known implementations with file paths.
223
+ Agent uses this as a reference gallery.
224
+ </substep>
225
+
226
+ <substep order="4.6" name="write-gotchas">
227
+ Timing issues, naming conventions, registration requirements, common mistakes.
228
+ Anything an agent would get wrong on first attempt.
229
+ </substep>
230
+
231
+ <substep order="4.7" name="write-or-update">
232
+ **If MODE = create:** Write the complete document to TARGET_FILE.
233
+ **If MODE = update:** Read the existing doc, add new implementations,
234
+ update How to Apply if changed, add new gotchas. Write to TARGET_FILE.
235
+ </substep>
236
+
237
+ Continue to step 5.
238
+ </step>
239
+
240
+ <!-- ══════════════════════════════════════════════════════════════════ -->
241
+ <!-- STEP 5: VERIFY, COMMIT, AND REPORT -->
242
+ <!-- ══════════════════════════════════════════════════════════════════ -->
243
+
244
+ <step name="verify-and-report" order="5">
245
+
246
+ <substep order="5.1" name="quality-check">
247
+ Re-read TARGET_FILE and verify:
248
+
249
+ <verification-checklist>
250
+ <check>50+ lines of substantial content</check>
251
+ <check>"The Pattern" section present (ONE paragraph, codebase-specific)</check>
252
+ <check>Mermaid classDiagram present showing pattern structure</check>
253
+ <check>"How It Works" has numbered steps with code references</check>
254
+ <check>"How to Apply" is actionable with concrete steps and "copy from" targets</check>
255
+ <check>"Current Implementations" lists ALL known implementations with file paths</check>
256
+ <check>At least 2 implementations listed (pattern requires 2+)</check>
257
+ <check>"Gotchas" section present</check>
258
+ <check>Code references use `file:Symbol` format, not line numbers</check>
259
+ <check>No textbook definitions — pattern is codebase-specific</check>
260
+ <check>No filler phrases, no generic advice</check>
261
+ </verification-checklist>
262
+
263
+ Fix any failures by editing the document directly.
264
+ </substep>
265
+
266
+ <substep order="5.2" name="security-scan">
267
+ ```
268
+ Grep(
269
+ 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)",
270
+ path="[TARGET_FILE]",
271
+ output_mode="content"
272
+ )
273
+ ```
274
+
275
+ <variant condition="matches found">SECRETS_FOUND — alert user, do NOT commit.</variant>
276
+ <variant condition="no matches">CLEAN.</variant>
277
+ </substep>
278
+
279
+ <substep order="5.3" name="commit">
280
+ ```bash
281
+ git add [TARGET_FILE]
282
+ git commit -m "docs([subsystem_name]): add pattern — [pattern-name]"
283
+ ```
284
+ </substep>
285
+
286
+ <substep order="5.4" name="report">
287
+ Display:
288
+
289
+ ```
290
+ ╔══════════════════════════════════════════════════╗
291
+ ║ ACE > Map Pattern > Complete ║
292
+ ╚══════════════════════════════════════════════════╝
293
+
294
+ + [TARGET_FILE] ([line count] lines)
295
+
296
+ Pattern: [text description]
297
+ Implementations found: [count]
298
+ Gotchas: [count]
299
+
300
+ Next > /clear first for a fresh context window, then:
301
+
302
+ /ace:map-pattern — create another pattern document
303
+ /ace:map-guide — create a guide that uses this pattern
304
+ /ace:map-sys-doc — document a system that uses this pattern
305
+ Review file at [TARGET_FILE]
306
+ ```
307
+ </substep>
308
+
309
+ End workflow.
310
+ </step>
311
+
312
+ </process>
313
+
314
+ <success_criteria>
315
+ <criterion>Pattern description parsed and subsystem validated</criterion>
316
+ <criterion>All implementations discovered (from commits or codebase search)</criterion>
317
+ <criterion>At least 2 implementations found (pattern requires 2+)</criterion>
318
+ <criterion>Abstract pattern extracted from implementations</criterion>
319
+ <criterion>Existing pattern docs checked to avoid duplication (create vs update)</criterion>
320
+ <criterion>Pattern doc follows template structure from pattern.xml</criterion>
321
+ <criterion>Mermaid classDiagram present showing pattern structure</criterion>
322
+ <criterion>"How to Apply" is actionable with concrete steps and "copy from" targets</criterion>
323
+ <criterion>All current implementations listed with file paths</criterion>
324
+ <criterion>Gotchas section present with practical warnings</criterion>
325
+ <criterion>Code references use file:Symbol format, no line numbers</criterion>
326
+ <criterion>No textbook definitions — pattern is codebase-specific</criterion>
327
+ <criterion>No filler, no generic advice, no pseudocode</criterion>
328
+ <criterion>Security scan passed, document committed</criterion>
329
+ </success_criteria>
330
+
331
+ </workflow>
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: map-story
3
+ description: Update living knowledge docs — either after a story implementation (git-based, with new subsystem detection) or for existing undocumented code (file-based, called by map-subsystem)
4
+ argument-hint: "story-context='.ace/artifacts/...' commits=3 | files='a.ts,b.ts' module-name='User Management' subsystem-name='api'"
5
+ disable-model-invocation: true
6
+ allowed-tools:
7
+ - Read
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - Write
12
+ - Edit
13
+ - Task
14
+ - AskUserQuestion
15
+ - Agent
16
+ model: opus
17
+ effort: max
18
+ ---
19
+
20
+ # Map Story
21
+
22
+ Update living knowledge docs after story implementation or for existing undocumented code.
23
+
24
+ ## When to Use
25
+
26
+ ### Story Mode (invoked by user)
27
+ - After a story is implemented and tested
28
+ - Analyzes git changes (diff) to determine what was built
29
+ - Reads story artifacts for intent context
30
+ - Detects affected subsystem(s) from changed file paths
31
+ - Creates or updates living knowledge docs to reflect the CURRENT system state
32
+ - Detects NEW subsystems not yet in system-structure.md and offers full mapping via map-subsystem
33
+
34
+ ### File Mode (invoked by map-subsystem Step 8.7)
35
+ - Called automatically during subsystem mapping
36
+ - Receives a curated file list + module metadata from module-discovery
37
+ - Documents existing undocumented code — no git diff needed
38
+ - Receives pre-curated existing documentation as additional context
39
+
40
+ ## Input
41
+
42
+ ### Mode Detection
43
+
44
+ - If `files` is provided → file mode
45
+ - If `story-context` is provided → story mode
46
+ - If neither is provided → story mode (staged + unstaged changes)
47
+
48
+ ### Story Mode Parameters
49
+
50
+ **Optional:**
51
+
52
+ - **`story-context`** (path) — Path to story artifacts folder (in `.ace/artifacts/` or legacy `documentation/features/`). Used to understand WHAT the story intended to build. If not provided, the agent relies solely on git changes.
53
+ - **`commits`** (number | comma-separated commit SHAs) — Specifies which commits to analyze. As a number: analyze the N most recent commits (e.g., commits=3). As commit SHAs: analyze specific commits (e.g., commits='abc123,def456'). When not provided: analyze staged + unstaged changes (git diff + git diff --cached).
54
+ - **`tech-debt`** (text | path) — Tech debt items discovered during code review. Can be plain text, YAML, or a path to a file containing the items. When provided, the wiki mapper integrates these items into the relevant subsystem wiki docs (## Tech Debt sections) AND updates the system-wide tech-debt-index.md.
55
+
56
+ ### File Mode Parameters
57
+
58
+ **Required:**
59
+
60
+ - **`files`** (comma-separated paths) — Source code files to document. These are the files discovered by module-discovery (Step 8.5) that together form one coherent module.
61
+ - **`module-name`** (text) — Human-readable name of the module (e.g., "User Management", "Repository Pattern").
62
+ - **`subsystem-name`** (text) — Name of the subsystem this module belongs to.
63
+
64
+ **Optional:**
65
+
66
+ - **`existing-docs`** (comma-separated paths or directories) — Pre-existing documentation relevant to this module. Accepts file paths, directory paths, or a mix of both. When a directory is provided, recursively discover all files within it. Read these FIRST for additional context about intent, decisions, and history. The actual source code remains the source of truth; existing docs provide the WHY.
67
+
68
+ ## Supporting Resources
69
+
70
+ Read ALL of these before starting the workflow:
71
+
72
+ - **Workflow**: Read [workflow.xml](workflow.xml) — complete orchestration process with all steps
73
+ - **System template**: Read [templates/system.xml](templates/system.xml) — system document format
74
+ - **Cross-cutting template**: Read [templates/system-cross-cutting.xml](templates/system-cross-cutting.xml) — cross-cutting concern format
75
+ - **Pattern template**: Read [templates/pattern.xml](templates/pattern.xml) — pattern document format
76
+ - **Guide template**: Read [templates/guide.xml](templates/guide.xml) — guide document format
77
+ - **Walkthrough template**: Read [templates/walkthrough.xml](templates/walkthrough.xml) — walkthrough format
78
+ - **Decisions template**: Read [templates/decizions.xml](templates/decizions.xml) — decisions document format
79
+ - **Tech debt index template**: Read [templates/tech-debt-index.xml](templates/tech-debt-index.xml) — tech debt index format
80
+ - **Questioning guide**: Read `${CLAUDE_SKILL_DIR}/../../shared/utils/questioning.xml` — deep questioning techniques
81
+ - **UI formatting**: Read `${CLAUDE_SKILL_DIR}/../../shared/utils/ui-formatting.md` — ACE output formatting rules
82
+
83
+ ## Process
84
+
85
+ Read all supporting resources listed above, then execute the workflow defined in [workflow.xml](workflow.xml) end-to-end. Preserve all workflow gates (validation, user questions, commits).
86
+
87
+ **Objective:** Read the provided source code files (and any existing docs for context), then autonomously create or update living knowledge documents. One call may produce multiple docs across different categories (systems/, patterns/, cross-cutting/, guides/, walkthroughs/, decisions/).
88
+
89
+ In story mode: analyze git changes to determine what was built, detect affected subsystem(s), identify NEW subsystems not yet in system-structure.md (offering full map-subsystem mapping with user approval), and update/create docs to reflect the CURRENT system state. Also suggests potential walkthroughs for complex flows discovered in the code — the user can choose to create them.
90
+
91
+ In file mode: document existing undocumented code from the provided file list.
92
+
93
+ ## Artifacts
94
+
95
+ ```
96
+ .docs/wiki/subsystems/[subsystem-name]/systems/[system-name].md
97
+ .docs/wiki/subsystems/[subsystem-name]/patterns/[pattern-name].md
98
+ .docs/wiki/subsystems/[subsystem-name]/cross-cutting/[concern-name].md
99
+ .docs/wiki/subsystems/[subsystem-name]/guides/[guide-name].md
100
+ .docs/wiki/subsystems/[subsystem-name]/walkthroughs/[flow-name].md (if user approves suggestions)
101
+ .docs/wiki/subsystems/[subsystem-name]/decisions/[decision-name].md
102
+ .docs/wiki/system-wide/system-structure.md (updated if new subsystem mapped)
103
+ .docs/wiki/system-wide/system-architecture.md (updated if new subsystem mapped)
104
+ ```
105
+
106
+ ## Example Usage
107
+
108
+ ```
109
+ # After a story implementation (staged + unstaged changes)
110
+ /ace:map-story
111
+
112
+ # After a story with specific commits
113
+ /ace:map-story story-context='.ace/artifacts/product/e1-auth/f2-login/s1-form/s1-form.md' commits=3
114
+
115
+ # For existing undocumented code (called by map-subsystem)
116
+ /ace:map-story files='a.ts,b.ts' module-name='User Management' subsystem-name='api'
117
+
118
+ # With tech debt items from code review
119
+ /ace:map-story story-context='.ace/artifacts/...' tech-debt='Missing error handling in auth flow'
120
+ ```
121
+
122
+ ## Next Steps
123
+
124
+ - `/clear` first for a fresh context window
125
+ - `/ace:map-story` — document another story or module
126
+ - `/ace:map-subsystem [subsystem]` — map or refresh an entire subsystem
127
+ - Review and edit files in `.docs/wiki/subsystems/[subsystem-name]/`