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
@@ -1,137 +1,137 @@
1
- <guide>
2
- <purpose>
3
- Template for `.docs/wiki/subsystems/[subsystem-name]/guides/<task-name>.md` — a step-by-step
4
- recipe for a common implementation task. Answers "How do I add/create/implement X?"
5
-
6
- Each guide combines knowledge from multiple systems, patterns, and cross-cutting concerns
7
- into one actionable recipe. It is the document an AI agent follows when performing a
8
- recurring task end-to-end.
9
-
10
- A "guide" is a task recipe for something developers do repeatedly:
11
- e.g., "How to Add a New Drawing Tool", "How to Add a New CRUD Endpoint",
12
- "How to Add a New Indicator", "How to Add a New Repository".
13
-
14
- Complements:
15
- - patterns/ docs (the structural patterns that guides reference)
16
- - systems/ docs (the domain systems where guide steps take place)
17
- - cross-cutting/ docs (the registrations and setup that guides include as steps)
18
- </purpose>
19
-
20
- <template>
21
- <title>
22
- # How to [Task]
23
- </title>
24
-
25
- <prerequisites>
26
- ## Prerequisites
27
-
28
- What you need to know or have in place before starting.
29
- - Read: [Pattern Doc](../patterns/relevant-pattern.md) — understand the structural pattern
30
- - Read: [System Doc](../systems/relevant-system.md) — understand the domain context
31
- - Read: [Cross-Cutting Doc](../cross-cutting/relevant-concern.md) — understand registrations
32
- </prerequisites>
33
-
34
- <steps>
35
- ## Steps
36
-
37
- ### 1. [First Step]
38
-
39
- What to do, where to do it, reference implementation to copy from.
40
- - Create file: `[path]`
41
- - Copy from: `file:ExistingImplementation` (closest reference)
42
- - Key changes: [what to modify from the reference]
43
-
44
- ### 2. [Second Step]
45
-
46
- ...
47
-
48
- ### 3. [Third Step]
49
-
50
- ...
51
- </steps>
52
-
53
- <verification>
54
- ## Verification
55
-
56
- How to verify the implementation works.
57
- - [ ] [Check 1]: [What to verify and how]
58
- - [ ] [Check 2]: [What to verify and how]
59
- - [ ] [Check 3]: [What to verify and how]
60
- </verification>
61
-
62
- <common-mistakes>
63
- ## Common Mistakes
64
-
65
- What people typically get wrong.
66
- - [Mistake 1]: [Why it happens and how to avoid it]
67
- - [Mistake 2]: [Why it happens and how to avoid it]
68
- </common-mistakes>
69
- </template>
70
-
71
- <guidelines>
72
-
73
- **Documentation Style:**
74
- - EXTREMELY SUCCINCT — every word must add value
75
- - NO FLUFF — direct, actionable information only
76
- - Numbered steps — the agent follows these in order
77
- - Code references as `file-path:ClassName.methodName` (not line numbers)
78
- - Inline snippets ONLY for non-obvious configuration or registration code
79
- - Every step must have a clear deliverable (a file created, a registration added, etc.)
80
-
81
- **Prerequisites:**
82
- - Link to the docs an agent should read BEFORE starting.
83
- - Don't repeat content from those docs — just link.
84
- - List any tools, dependencies, or environment requirements.
85
-
86
- **Steps:**
87
- - NUMBERED, ORDERED steps. An agent follows these sequentially.
88
- - Each step has: WHAT to do, WHERE to do it, WHAT to copy from.
89
- - Reference existing implementations as "copy from" targets — agents copy patterns, not invent.
90
- - Include ALL steps: file creation, registration, configuration, wiring.
91
- - Don't skip "obvious" steps — agents don't infer implicit requirements.
92
-
93
- **Verification:**
94
- - Checklist format. Agent runs through these after completing all steps.
95
- - Include compilation check, runtime check, and behavioral check.
96
- - Reference specific files or commands for verification.
97
-
98
- **Common Mistakes:**
99
- - Things agents (and developers) typically get wrong on first attempt.
100
- - Each mistake should include WHY it happens and HOW to avoid it.
101
- - Drawn from actual experience (gotchas from pattern and system docs).
102
-
103
- **What does NOT belong here:**
104
- - Detailed pattern explanations (link to patterns/ docs instead)
105
- - System domain knowledge (link to systems/ docs instead)
106
- - Cross-cutting mechanism details (link to cross-cutting/ docs instead)
107
- - Story numbers, sprint context, revision history
108
- - Testing strategy or test code (verification section covers basic checks only)
109
-
110
- </guidelines>
111
-
112
- <evolution>
113
-
114
- This is a LIVING document — updated when the recipe changes.
115
-
116
- **Update triggers:**
117
- - New step required (new registration, new file to create)
118
- - Step removed (registration no longer needed)
119
- - Step order changed
120
- - New common mistake discovered
121
- - Reference implementation changed (new "copy from" target)
122
- - Prerequisite docs added or removed
123
-
124
- **NOT an update trigger:**
125
- - New feature that follows the existing recipe without changes
126
- - Bug fix in one implementation that followed the guide
127
- - Internal refactoring that doesn't change the steps
128
-
129
- **Update rules:**
130
- - UPDATE steps when the recipe changes
131
- - ADD new common mistakes as they are discovered
132
- - UPDATE "copy from" references when better examples exist
133
- - Keep the guide current — an agent should be able to follow it TODAY
134
-
135
- </evolution>
136
-
137
- </guide>
1
+ <guide>
2
+ <purpose>
3
+ Template for `.docs/wiki/subsystems/[subsystem-name]/guides/<task-name>.md` — a step-by-step
4
+ recipe for a common implementation task. Answers "How do I add/create/implement X?"
5
+
6
+ Each guide combines knowledge from multiple systems, patterns, and cross-cutting concerns
7
+ into one actionable recipe. It is the document an AI agent follows when performing a
8
+ recurring task end-to-end.
9
+
10
+ A "guide" is a task recipe for something developers do repeatedly:
11
+ e.g., "How to Add a New Drawing Tool", "How to Add a New CRUD Endpoint",
12
+ "How to Add a New Indicator", "How to Add a New Repository".
13
+
14
+ Complements:
15
+ - patterns/ docs (the structural patterns that guides reference)
16
+ - systems/ docs (the domain systems where guide steps take place)
17
+ - cross-cutting/ docs (the registrations and setup that guides include as steps)
18
+ </purpose>
19
+
20
+ <template>
21
+ <title>
22
+ # How to [Task]
23
+ </title>
24
+
25
+ <prerequisites>
26
+ ## Prerequisites
27
+
28
+ What you need to know or have in place before starting.
29
+ - Read: [Pattern Doc](../patterns/relevant-pattern.md) — understand the structural pattern
30
+ - Read: [System Doc](../systems/relevant-system.md) — understand the domain context
31
+ - Read: [Cross-Cutting Doc](../cross-cutting/relevant-concern.md) — understand registrations
32
+ </prerequisites>
33
+
34
+ <steps>
35
+ ## Steps
36
+
37
+ ### 1. [First Step]
38
+
39
+ What to do, where to do it, reference implementation to copy from.
40
+ - Create file: `[path]`
41
+ - Copy from: `file:ExistingImplementation` (closest reference)
42
+ - Key changes: [what to modify from the reference]
43
+
44
+ ### 2. [Second Step]
45
+
46
+ ...
47
+
48
+ ### 3. [Third Step]
49
+
50
+ ...
51
+ </steps>
52
+
53
+ <verification>
54
+ ## Verification
55
+
56
+ How to verify the implementation works.
57
+ - [ ] [Check 1]: [What to verify and how]
58
+ - [ ] [Check 2]: [What to verify and how]
59
+ - [ ] [Check 3]: [What to verify and how]
60
+ </verification>
61
+
62
+ <common-mistakes>
63
+ ## Common Mistakes
64
+
65
+ What people typically get wrong.
66
+ - [Mistake 1]: [Why it happens and how to avoid it]
67
+ - [Mistake 2]: [Why it happens and how to avoid it]
68
+ </common-mistakes>
69
+ </template>
70
+
71
+ <guidelines>
72
+
73
+ **Documentation Style:**
74
+ - EXTREMELY SUCCINCT — every word must add value
75
+ - NO FLUFF — direct, actionable information only
76
+ - Numbered steps — the agent follows these in order
77
+ - Code references as `file-path:ClassName.methodName` (not line numbers)
78
+ - Inline snippets ONLY for non-obvious configuration or registration code
79
+ - Every step must have a clear deliverable (a file created, a registration added, etc.)
80
+
81
+ **Prerequisites:**
82
+ - Link to the docs an agent should read BEFORE starting.
83
+ - Don't repeat content from those docs — just link.
84
+ - List any tools, dependencies, or environment requirements.
85
+
86
+ **Steps:**
87
+ - NUMBERED, ORDERED steps. An agent follows these sequentially.
88
+ - Each step has: WHAT to do, WHERE to do it, WHAT to copy from.
89
+ - Reference existing implementations as "copy from" targets — agents copy patterns, not invent.
90
+ - Include ALL steps: file creation, registration, configuration, wiring.
91
+ - Don't skip "obvious" steps — agents don't infer implicit requirements.
92
+
93
+ **Verification:**
94
+ - Checklist format. Agent runs through these after completing all steps.
95
+ - Include compilation check, runtime check, and behavioral check.
96
+ - Reference specific files or commands for verification.
97
+
98
+ **Common Mistakes:**
99
+ - Things agents (and developers) typically get wrong on first attempt.
100
+ - Each mistake should include WHY it happens and HOW to avoid it.
101
+ - Drawn from actual experience (gotchas from pattern and system docs).
102
+
103
+ **What does NOT belong here:**
104
+ - Detailed pattern explanations (link to patterns/ docs instead)
105
+ - System domain knowledge (link to systems/ docs instead)
106
+ - Cross-cutting mechanism details (link to cross-cutting/ docs instead)
107
+ - Story numbers, sprint context, revision history
108
+ - Testing strategy or test code (verification section covers basic checks only)
109
+
110
+ </guidelines>
111
+
112
+ <evolution>
113
+
114
+ This is a LIVING document — updated when the recipe changes.
115
+
116
+ **Update triggers:**
117
+ - New step required (new registration, new file to create)
118
+ - Step removed (registration no longer needed)
119
+ - Step order changed
120
+ - New common mistake discovered
121
+ - Reference implementation changed (new "copy from" target)
122
+ - Prerequisite docs added or removed
123
+
124
+ **NOT an update trigger:**
125
+ - New feature that follows the existing recipe without changes
126
+ - Bug fix in one implementation that followed the guide
127
+ - Internal refactoring that doesn't change the steps
128
+
129
+ **Update rules:**
130
+ - UPDATE steps when the recipe changes
131
+ - ADD new common mistakes as they are discovered
132
+ - UPDATE "copy from" references when better examples exist
133
+ - Keep the guide current — an agent should be able to follow it TODAY
134
+
135
+ </evolution>
136
+
137
+ </guide>
@@ -0,0 +1,320 @@
1
+ <workflow>
2
+
3
+ <purpose>
4
+ Create or update a guide document in
5
+ `.docs/wiki/subsystems/[subsystem-name]/guides/`.
6
+
7
+ A guide is a step-by-step recipe for a common implementation task. It combines
8
+ knowledge from multiple systems, patterns, and cross-cutting concerns into one
9
+ actionable recipe. The document an AI agent follows when performing a recurring
10
+ task end-to-end.
11
+
12
+ This workflow is executed directly — NO sub-agents are spawned.
13
+ The executing agent does everything: finding reference implementations, reading code,
14
+ deriving the recipe, and writing the document.
15
+ </purpose>
16
+
17
+ <mandatory-context>
18
+ Read all files referenced by the invoking command's execution-context before starting.
19
+ Also read any document or text passed as parameter ($ARGUMENTS) in the invoking command.
20
+ </mandatory-context>
21
+
22
+ <process>
23
+
24
+ <!-- ══════════════════════════════════════════════════════════════════ -->
25
+ <!-- STEP 1: SETUP AND VALIDATE -->
26
+ <!-- ══════════════════════════════════════════════════════════════════ -->
27
+
28
+ <step name="setup" order="1">
29
+
30
+ <substep order="1.1" name="display-banner">
31
+ Display stage banner:
32
+
33
+ ```
34
+ ╔══════════════════════════════════════════════════╗
35
+ ║ ACE > Map Guide ║
36
+ ╚══════════════════════════════════════════════════╝
37
+ ```
38
+ </substep>
39
+
40
+ <substep order="1.2" name="parse-and-validate">
41
+ Parse $ARGUMENTS for: `text`, `subsystem`, `story-context`, `commits`.
42
+
43
+ **If `text` is missing:** Ask the user:
44
+ - header: "Guide"
45
+ - question: "Describe the recurring task this guide should teach.\nE.g., 'How to add a new drawing tool' or 'How to add a new CRUD endpoint'"
46
+
47
+ **If `subsystem` is missing:** Ask the user:
48
+ - header: "Guide"
49
+ - question: "Which subsystem does this guide belong to?"
50
+ </substep>
51
+
52
+ <substep order="1.3" name="resolve-subsystem">
53
+ Resolve the subsystem. Check if `.docs/wiki/subsystems/[subsystem-name]/` exists.
54
+
55
+ **If not found:**
56
+ ```
57
+ ! No wiki found for subsystem "[subsystem]".
58
+ Run /ace:map-subsystem first to create the subsystem wiki.
59
+ ```
60
+ Exit.
61
+
62
+ Ensure guides directory exists:
63
+ ```bash
64
+ mkdir -p .docs/wiki/subsystems/[subsystem_name]/guides
65
+ ```
66
+ </substep>
67
+
68
+ Display:
69
+ ```
70
+ i Guide: [text description]
71
+ Subsystem: [subsystem-name]
72
+ Story context: [path/issue, or "none"]
73
+ Commits: [value, or "search codebase directly"]
74
+ ```
75
+
76
+ Continue to step 2.
77
+ </step>
78
+
79
+ <!-- ══════════════════════════════════════════════════════════════════ -->
80
+ <!-- STEP 2: CHECK FOR EXISTING GUIDE -->
81
+ <!-- ══════════════════════════════════════════════════════════════════ -->
82
+
83
+ <step name="check-existing" order="2">
84
+
85
+ Scan for existing guides:
86
+
87
+ ```
88
+ Glob(pattern='*.md', path='.docs/wiki/subsystems/[subsystem_name]/guides')
89
+ ```
90
+
91
+ **If existing guides found:**
92
+ Read their titles. Check if any covers the same or overlapping task.
93
+
94
+ **If overlap detected:**
95
+ Use AskUserQuestion:
96
+ - header: "Guide"
97
+ - question: "An existing guide may cover a similar task:\n\n- `[existing-file]`: [title]\n\nShould I update the existing guide 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 guides:** Set MODE = create.
103
+
104
+ **If MODE = create:**
105
+ Derive file name from task description in kebab-case (e.g., "how-to-add-drawing-tool.md").
106
+ Set TARGET_FILE = `.docs/wiki/subsystems/[subsystem_name]/guides/[guide-name].md`
107
+
108
+ Continue to step 3.
109
+ </step>
110
+
111
+ <!-- ══════════════════════════════════════════════════════════════════ -->
112
+ <!-- STEP 3: GATHER CODE CONTEXT AND DERIVE RECIPE -->
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 was built, which files were touched, which registrations were added.
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 task and implementation.
128
+ </variant>
129
+
130
+ <variant condition="no story-context">
131
+ Skip — derive recipe from codebase patterns only.
132
+ </variant>
133
+ </substep>
134
+
135
+ <substep order="3.2" name="find-reference-implementations">
136
+ <variant condition="commits provided as number N">
137
+ ```bash
138
+ git diff --name-only HEAD~[N]..HEAD
139
+ ```
140
+ Filter to files within the subsystem. These are the most recent example.
141
+ Read each file to understand the implementation steps taken.
142
+ </variant>
143
+
144
+ <variant condition="commits provided as SHAs">
145
+ ```bash
146
+ git diff --name-only [first-sha]^..[last-sha]
147
+ ```
148
+ Filter to files within the subsystem. Read each file.
149
+ </variant>
150
+
151
+ <variant condition="no commits — search codebase directly">
152
+ Use the `text` description to find existing implementations of this task:
153
+
154
+ 1. Read the subsystem's structure.md and architecture.md for orientation
155
+ 2. Read existing system/pattern/cross-cutting docs for this subsystem
156
+ 3. Grep for keywords related to the task (class names, registrations, etc.)
157
+ 4. Find 2-3 existing implementations that followed the same recipe
158
+ 5. Read each implementation to extract the common steps
159
+ </variant>
160
+ </substep>
161
+
162
+ <substep order="3.3" name="derive-recipe">
163
+ From the reference implementations, derive the step-by-step recipe:
164
+
165
+ 1. What files need to be created? In what order?
166
+ 2. What existing files need to be modified (registrations, configurations)?
167
+ 3. What patterns must be followed (from patterns/ docs)?
168
+ 4. What cross-cutting registrations are needed (from cross-cutting/ docs)?
169
+ 5. What is the closest existing implementation to copy from?
170
+ 6. What commonly goes wrong?
171
+
172
+ Build an ordered list of steps with "copy from" references.
173
+ </substep>
174
+
175
+ Continue to step 4.
176
+ </step>
177
+
178
+ <!-- ══════════════════════════════════════════════════════════════════ -->
179
+ <!-- STEP 4: WRITE THE GUIDE -->
180
+ <!-- ══════════════════════════════════════════════════════════════════ -->
181
+
182
+ <step name="write-doc" order="4">
183
+
184
+ Read ALL existing wiki docs under `.docs/wiki/subsystems/[subsystem_name]/`
185
+ for cross-referencing in Prerequisites and linking to patterns/systems.
186
+
187
+ Follow the guide template structure exactly.
188
+
189
+ <substep order="4.1" name="write-title-and-prerequisites">
190
+ - Title: "# How to [Task]"
191
+ - Prerequisites: links to pattern docs, system docs, cross-cutting docs
192
+ that an agent should read BEFORE starting
193
+ </substep>
194
+
195
+ <substep order="4.2" name="write-steps">
196
+ Write NUMBERED, ORDERED steps. Each step must have:
197
+ - WHAT to do
198
+ - WHERE to do it (exact file path)
199
+ - WHAT to copy from (reference implementation)
200
+ - Key changes from the reference
201
+
202
+ Include ALL steps: file creation, registration, configuration, wiring.
203
+ Don't skip "obvious" steps — agents don't infer implicit requirements.
204
+ </substep>
205
+
206
+ <substep order="4.3" name="write-verification">
207
+ Write a verification checklist:
208
+ - Compilation check
209
+ - Runtime check
210
+ - Behavioral check
211
+ Reference specific files or commands.
212
+ </substep>
213
+
214
+ <substep order="4.4" name="write-common-mistakes">
215
+ List things that commonly go wrong:
216
+ - WHY each mistake happens
217
+ - HOW to avoid it
218
+ Drawn from actual gotchas in pattern/system docs and codebase analysis.
219
+ </substep>
220
+
221
+ <substep order="4.5" name="write-or-update">
222
+ **If MODE = create:** Write the complete document to TARGET_FILE.
223
+ **If MODE = update:** Read the existing guide, update steps, add new
224
+ mistakes, update "copy from" references. Write to TARGET_FILE.
225
+ </substep>
226
+
227
+ Continue to step 5.
228
+ </step>
229
+
230
+ <!-- ══════════════════════════════════════════════════════════════════ -->
231
+ <!-- STEP 5: VERIFY, COMMIT, AND REPORT -->
232
+ <!-- ══════════════════════════════════════════════════════════════════ -->
233
+
234
+ <step name="verify-and-report" order="5">
235
+
236
+ <substep order="5.1" name="quality-check">
237
+ Re-read TARGET_FILE and verify:
238
+
239
+ <verification-checklist>
240
+ <check>Title follows "# How to [Task]" format</check>
241
+ <check>Prerequisites section links to relevant docs</check>
242
+ <check>Steps are NUMBERED and ORDERED</check>
243
+ <check>Every step has WHAT, WHERE, and WHAT to copy from</check>
244
+ <check>All registrations and configurations included (no implicit steps)</check>
245
+ <check>Verification checklist present with compilation, runtime, behavioral checks</check>
246
+ <check>Common Mistakes section present with WHY and HOW</check>
247
+ <check>Code references use `file:Symbol` format, not line numbers</check>
248
+ <check>No filler phrases, no generic advice</check>
249
+ <check>An agent could follow this guide end-to-end without guessing</check>
250
+ </verification-checklist>
251
+
252
+ Fix any failures by editing the document directly.
253
+ </substep>
254
+
255
+ <substep order="5.2" name="security-scan">
256
+ ```
257
+ Grep(
258
+ 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)",
259
+ path="[TARGET_FILE]",
260
+ output_mode="content"
261
+ )
262
+ ```
263
+
264
+ <variant condition="matches found">SECRETS_FOUND — alert user, do NOT commit.</variant>
265
+ <variant condition="no matches">CLEAN.</variant>
266
+ </substep>
267
+
268
+ <substep order="5.3" name="commit">
269
+ ```bash
270
+ git add [TARGET_FILE]
271
+ git commit -m "docs([subsystem_name]): add guide — [guide-name]"
272
+ ```
273
+ </substep>
274
+
275
+ <substep order="5.4" name="report">
276
+ Display:
277
+
278
+ ```
279
+ ╔══════════════════════════════════════════════════╗
280
+ ║ ACE > Map Guide > Complete ║
281
+ ╚══════════════════════════════════════════════════╝
282
+
283
+ + [TARGET_FILE] ([line count] lines)
284
+
285
+ Guide: [text description]
286
+ Steps: [step count]
287
+ Prerequisites: [count] docs linked
288
+ Common Mistakes: [count]
289
+
290
+ Next > /clear first for a fresh context window, then:
291
+
292
+ /ace:map-guide — create another guide
293
+ /ace:map-pattern — document a pattern referenced by this guide
294
+ /ace:map-sys-doc — document a system referenced by this guide
295
+ Review file at [TARGET_FILE]
296
+ ```
297
+ </substep>
298
+
299
+ End workflow.
300
+ </step>
301
+
302
+ </process>
303
+
304
+ <success_criteria>
305
+ <criterion>Task description parsed and subsystem validated</criterion>
306
+ <criterion>Reference implementations found (from commits or codebase search)</criterion>
307
+ <criterion>Recipe derived from actual code — not invented from generic knowledge</criterion>
308
+ <criterion>Existing guides checked to avoid duplication (create vs update decision)</criterion>
309
+ <criterion>Guide follows template structure from guide.xml</criterion>
310
+ <criterion>Prerequisites link to relevant pattern/system/cross-cutting docs</criterion>
311
+ <criterion>Steps are numbered, ordered, and each has WHAT/WHERE/copy-from</criterion>
312
+ <criterion>ALL steps included — no implicit requirements</criterion>
313
+ <criterion>Verification checklist covers compilation, runtime, and behavior</criterion>
314
+ <criterion>Common Mistakes section includes WHY and HOW for each</criterion>
315
+ <criterion>Code references use file:Symbol format, no line numbers</criterion>
316
+ <criterion>No filler, no generic advice, no pseudocode</criterion>
317
+ <criterion>Security scan passed, document committed</criterion>
318
+ </success_criteria>
319
+
320
+ </workflow>