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,190 @@
1
+ <story-wiki>
2
+
3
+ <purpose>
4
+ Template for the `## Relevant Wiki` section that gets APPENDED to the story file
5
+ (`.ace/artifacts/product/&lt;id-epic_name&gt;/&lt;id-feature_name&gt;/&lt;id-story_name&gt;/&lt;id-story_name&gt;.md`)
6
+ and optionally updated in the GitHub issue body.
7
+
8
+ This is pass 2 of the story specification pipeline (see story.xml composition).
9
+ It runs AFTER sections 1-8 (business requirements) are complete.
10
+
11
+ A research agent reads the User Story, Description, and Acceptance Criteria from pass 1,
12
+ then scans the `.docs/wiki/` directory to select documents that are relevant for
13
+ designing a good technical solution for this story.
14
+
15
+ The output is written directly INTO the story file — replacing or populating the
16
+ `## Relevant Wiki` section placeholder left by pass 1.
17
+
18
+ This section is consumed by pass 5 (technical solution) as the primary reference
19
+ for which wiki documents to load when designing the implementation approach.
20
+ </purpose>
21
+
22
+ <output-format>
23
+
24
+ <section name="relevant-wiki">
25
+ ## Relevant Wiki
26
+
27
+ &lt;!-- Pass 2. Populated by research-story-wiki workflow.
28
+ A research agent reads the User Story, Description, and AC,
29
+ then scans `.docs/wiki/` to select documents relevant to
30
+ designing a good technical solution for this story.
31
+
32
+ Group references by wiki document type. Only include documents that
33
+ directly inform implementation — do not list tangentially related docs.
34
+ Each entry: relative path + one-line reason why it's relevant. --&gt;
35
+
36
+ ### System-Wide
37
+
38
+ &lt;!-- MANDATORY — all four system-wide docs are always included.
39
+ These are mandatory context for every story — no reason needed. --&gt;
40
+
41
+ - `.docs/wiki/system-wide/system-structure.md` — Mandatory system-wide context
42
+ - `.docs/wiki/system-wide/system-architecture.md` — Mandatory system-wide context
43
+ - `.docs/wiki/system-wide/coding-standards.md` — Mandatory system-wide context
44
+ - `.docs/wiki/system-wide/testing-framework.md` — Mandatory system-wide context
45
+
46
+ ### Systems
47
+ - [`.docs/wiki/subsystems/[name]/systems/[system].md`] — [Why this system is relevant to this story]
48
+
49
+ ### Patterns
50
+ - [`.docs/wiki/subsystems/[name]/patterns/[pattern].md`] — [Why this pattern applies to this story]
51
+
52
+ ### Cross-Cutting Concerns
53
+ - [`.docs/wiki/subsystems/[name]/cross-cutting/[concern].md`] — [Why this concern matters for this story]
54
+
55
+ ### Guides
56
+ - [`.docs/wiki/subsystems/[name]/guides/[guide].md`] — [Why this guide is useful for this story]
57
+
58
+ ### Decisions
59
+ - [`.docs/wiki/subsystems/[name]/decisions/[decision].md`] — [Why this ADR constrains or informs this story]
60
+
61
+ ### Architecture
62
+ - [`.docs/wiki/subsystems/[name]/architecture.md`] — [Why this subsystem's architecture doc is relevant]
63
+
64
+ &lt;!-- Omit any subsystem category header that has no relevant documents.
65
+ The System-Wide section is NEVER omitted — it is always present.
66
+
67
+ Example:
68
+
69
+ ### System-Wide
70
+ - `.docs/wiki/system-wide/system-structure.md` — Locates auth subsystem boundaries and shared middleware
71
+ - `.docs/wiki/system-wide/system-architecture.md` — Documents API gateway routing to auth service
72
+ - `.docs/wiki/system-wide/coding-standards.md` — Error handling conventions for API responses
73
+ - `.docs/wiki/system-wide/testing-framework.md` — Integration test setup for auth endpoints
74
+
75
+ ### Systems
76
+ - `.docs/wiki/subsystems/auth/systems/oauth-provider.md` — Implements the provider abstraction this story extends
77
+ - `.docs/wiki/subsystems/auth/systems/session-manager.md` — Manages tokens created by the OAuth flow
78
+
79
+ ### Patterns
80
+ - `.docs/wiki/subsystems/auth/patterns/strategy-pattern.md` — Each OAuth provider is a strategy; new provider must follow this
81
+
82
+ ### Decisions
83
+ - `.docs/wiki/subsystems/auth/decisions/adr-003-jwt-over-sessions.md` — Constrains token format to JWT
84
+ --&gt;
85
+ </section>
86
+
87
+ </output-format>
88
+
89
+ <selection-criteria>
90
+
91
+ <include-when>
92
+ A wiki document should be INCLUDED if it:
93
+ - Describes a system this story will modify or extend
94
+ - Documents a pattern this story must follow
95
+ - Covers a cross-cutting concern this story must respect (auth, logging, error handling, etc.)
96
+ - Contains a guide for a task this story requires (e.g., "how to add an API endpoint")
97
+ - Records an ADR that constrains design choices for this story
98
+ - Describes the structure or architecture of a subsystem this story touches
99
+ </include-when>
100
+
101
+ <exclude-when>
102
+ A wiki document should be EXCLUDED if it:
103
+ - Is only tangentially related (same subsystem but different concern)
104
+ - Describes something the story reads from but does not modify
105
+ - Would be "nice to know" but does not change the implementation approach
106
+ - Duplicates information already in a system-wide doc
107
+ </exclude-when>
108
+
109
+ <reason-quality>
110
+ Each entry MUST have a one-line reason explaining WHY that document is relevant
111
+ to THIS specific story. Generic reasons like "related to auth" are NOT acceptable.
112
+ The reason must explain what the implementing agent should look for or learn from
113
+ that document.
114
+
115
+ Good: "Defines the provider strategy interface this story must implement"
116
+ Bad: "Related to OAuth"
117
+ </reason-quality>
118
+
119
+ </selection-criteria>
120
+
121
+ <guidelines>
122
+
123
+ <guideline name="system-wide-mandatory">
124
+ The four system-wide documents are ALWAYS included in the output:
125
+ - system-structure.md
126
+ - system-architecture.md
127
+ - coding-standards.md
128
+ - testing-framework.md
129
+
130
+ These are mandatory context for every story. Do NOT read them during wiki research —
131
+ the implementing agent (pass 5) will read them directly. Just list them in the output.
132
+ </guideline>
133
+
134
+ <guideline name="subsystem-depth">
135
+ For each affected subsystem, the research agent must READ the subsystem's wiki
136
+ documents to assess relevance — not just list them based on directory names.
137
+ Only include documents that directly inform the implementation of THIS story.
138
+ </guideline>
139
+
140
+ <guideline name="feature-relevant-wiki-hint">
141
+ If a `relevant-wiki.md` file exists at the feature level
142
+ (`.ace/artifacts/product/&lt;id-epic_name&gt;/&lt;id-feature_name&gt;/relevant-wiki.md`),
143
+ use it as a STARTING POINT to identify which subsystems to investigate.
144
+ This file may not exist — proceed without it if missing.
145
+ </guideline>
146
+
147
+ <guideline name="parallel-subsystem-research">
148
+ When multiple subsystems need investigation, spawn parallel ace-wiki-mapper
149
+ agents to read and assess each subsystem's docs concurrently. Each agent returns
150
+ a list of relevant files with reasons — the orchestrator compiles the final section.
151
+ </guideline>
152
+
153
+ <guideline name="conciseness">
154
+ The Relevant Wiki section should be scannable. No prose paragraphs.
155
+ Just categorized file references with one-line reasons.
156
+ Omit empty category headers — if no patterns are relevant, don't show ### Patterns.
157
+ The System-Wide section is the only exception — it is always present.
158
+ </guideline>
159
+
160
+ <guideline name="github-compatibility">
161
+ The output must render cleanly in both markdown files and GitHub issue bodies.
162
+ Use standard markdown — no HTML, no custom formatting.
163
+ Backtick-formatted file paths for readability.
164
+ </guideline>
165
+
166
+ </guidelines>
167
+
168
+ <evolution>
169
+
170
+ **Creation (research-story-wiki — pass 2):**
171
+ This pass runs after sections 1-8 are complete. It reads the story requirements
172
+ and scans the wiki to populate the Relevant Wiki section. A single run produces
173
+ the complete section.
174
+
175
+ **Consumption (story-technical-solution — pass 5):**
176
+ The technical solution pass reads this section to know which wiki documents to load
177
+ as context when designing the implementation approach. Every file listed here
178
+ will be read by the implementing agent.
179
+
180
+ **Re-research (exception, not norm):**
181
+ Only when story scope changes significantly (AC rewritten, new subsystems involved).
182
+ Re-running overwrites the existing Relevant Wiki section.
183
+
184
+ **This section IS part of the story file.**
185
+ It replaces the placeholder left by pass 1 in the story.xml template.
186
+ It is also synced to the GitHub issue body when GitHub integration is enabled.
187
+
188
+ </evolution>
189
+
190
+ </story-wiki>
@@ -0,0 +1,451 @@
1
+ <story>
2
+
3
+ <purpose>
4
+ Template for `.ace/artifacts/product/&lt;id-epic_name&gt;/&lt;id-feature_name&gt;/&lt;id-story_name&gt;/&lt;id-story_name&gt;.md` —
5
+ a story specification document that describes a single implementable unit of work,
6
+ its INVEST-compliant user story statement, Gherkin acceptance criteria, definition of done,
7
+ scope boundaries, and relevant wiki references for technical solution design.
8
+ This document defines EXACTLY what will be built — no more, no less.
9
+
10
+ The acceptance criteria are the SINGLE SOURCE OF TRUTH for story scope.
11
+ If a behavior is not captured in a named scenario, it is not in scope.
12
+
13
+ This is the COMPOSITION ROOT for the story specification pipeline.
14
+ The full story document is built incrementally across up to 3 passes
15
+ that write sections into the story file, plus up to 2 external research
16
+ artifacts that feed into the technical solution but live outside the story:
17
+
18
+ Pass 1 — Business Requirements (this template, sections 1-8)
19
+ Pass 2 — Wiki Research (story-wiki.xml) — appended to story
20
+ Pass 3 — External Analysis (external-solution.xml) — OPTIONAL, external artifact
21
+ Pass 4 — Integration Analysis (integration-solution.xml) — external artifact
22
+ Pass 5 — Technical Solution (story-technical-solution.xml) — appended to story
23
+
24
+ Passes 3 and 4 produce separate research artifacts in the story directory.
25
+ They are consumed as inputs by pass 5 but are NOT embedded in the story file.
26
+ The pipeline is sequential — earlier passes are inputs to later passes.
27
+
28
+ This document serves as both a local markdown file and a GitHub issue description.
29
+ All formatting must render cleanly in GitHub issue bodies.
30
+ </purpose>
31
+
32
+ <composition>
33
+ &lt;!-- The story specification pipeline. Passes 1, 2, 5 write into the story file.
34
+ Passes 3, 4 produce external artifacts in the story directory that feed pass 5.
35
+
36
+ Story directory: .ace/artifacts/product/&lt;epic&gt;/&lt;feature&gt;/&lt;story&gt;/
37
+ Story file: &lt;story&gt;.md
38
+ External artifacts: external-analysis.md, integration-analysis.md --&gt;
39
+
40
+ <pass order="1" template="story.xml" output="story-file" required="true">
41
+ Business Requirements — sections 1-8 (header through DoD).
42
+ Input: plain-text story seed from parent feature document.
43
+ </pass>
44
+ <pass order="2" template="story-wiki.xml" output="story-file" required="true">
45
+ Wiki Research — relevant-wiki section.
46
+ Input: User Story + Description + AC from pass 1.
47
+ Agent scans `.docs/wiki/` for documents relevant to technical solution.
48
+ </pass>
49
+ <pass order="3" template="external-solution.xml" output="external-analysis.md" required="false">
50
+ External Analysis — analyze reference implementations or external systems.
51
+ Input: story requirements + wiki refs from passes 1-2 + external code/docs.
52
+ OPTIONAL: only when the story or feature references external systems.
53
+ Output: separate artifact in story directory, NOT appended to story file.
54
+ </pass>
55
+ <pass order="4" template="integration-solution.xml" output="integration-analysis.md" required="true">
56
+ Integration Analysis — analyze our own codebase for integration points.
57
+ Input: story requirements + wiki refs + optional external analysis.
58
+ Agent reads relevant wiki docs and explores codebase to map affected code.
59
+ Output: separate artifact in story directory, NOT appended to story file.
60
+ </pass>
61
+ <pass order="5" template="story-technical-solution.xml" output="story-file" required="true">
62
+ Technical Solution — design the implementation approach.
63
+ Input: ALL prior passes (story file + external artifacts).
64
+ Produces the technical-solution section appended to the story file.
65
+ </pass>
66
+
67
+ &lt;!-- Execution passes (written by /ace:execute-story, not /ace:plan-story) --&gt;
68
+ <pass order="E1" populated-by="execute-story" output="story-file" required="false">
69
+ Summary &amp; State — execution results, commit log, deviations, code review.
70
+ Written after implementation is complete and user approves.
71
+ </pass>
72
+ <pass order="E2" populated-by="execute-story" output="story-file" required="false">
73
+ Wiki Updates — table of wiki documents updated/created during implementation.
74
+ Written after wiki mapper completes post-implementation.
75
+ </pass>
76
+ </composition>
77
+
78
+ <output-format>
79
+
80
+ <section name="header">
81
+ # [ID]: [Story Title]
82
+
83
+ **Feature**: [Feature ID] [Feature Title] | **Epic**: [Epic ID] [Epic Title]
84
+ **Status**: [Status] | **Size**: [Size] | **Sprint**: [Sprint] | **Link**: [Link]
85
+
86
+ &lt;!-- Example:
87
+ # S3: Display OAuth Provider Buttons
88
+ **Feature**: F3 OAuth2 Login Flow | **Epic**: #45 User Authentication
89
+ **Status**: Refined | **Size**: 3 | **Sprint**: Sprint 2 | **Link**: [#95](https://github.com/owner/repo/issues/95)
90
+ --&gt;
91
+ </section>
92
+
93
+ <section name="user-story">
94
+ ## User Story
95
+
96
+ &gt; As a [persona/role],
97
+ &gt; I want [action/capability],
98
+ &gt; so that [benefit/value].
99
+
100
+ &lt;!-- The user story MUST follow the As/I want/So that format exactly.
101
+ - Persona must match a persona defined in the product vision.
102
+ - Action describes observable user behavior, not system internals.
103
+ - Benefit ties to the parent feature's benefit hypothesis.
104
+ Example:
105
+ "As a returning customer, I want to click a Google or GitHub login button,
106
+ so that I can authenticate without remembering a site-specific password."
107
+ --&gt;
108
+ </section>
109
+
110
+ <section name="description">
111
+ ## Description
112
+
113
+ [What this story delivers and why it matters within the parent feature. 2-4 sentences.
114
+ Describe observable user behavior — what the user can do when this story is done.
115
+ How this story relates to adjacent stories in the feature (what it builds on, what it enables).
116
+ Focus on WHAT and WHY, not HOW.]
117
+ </section>
118
+
119
+ <section name="acceptance-criteria">
120
+ ## Acceptance Criteria
121
+
122
+ &lt;!-- Gherkin scenarios are the SINGLE SOURCE OF TRUTH for this story's scope.
123
+ If a behavior is not captured in a named scenario, it is NOT in scope.
124
+ Do not implement or test behaviors not defined here.
125
+
126
+ Minimum coverage: happy path + at least one edge case + at least one error path.
127
+ Each scenario must be independent — no scenario depends on another's state.
128
+ If more than 6-8 scenarios are needed, the story is likely too large — split it. --&gt;
129
+
130
+ ### Scenario: [Short descriptive name]
131
+
132
+ **Given** [precondition — the starting state]
133
+ **When** [action — what the user or system does]
134
+ **Then** [expected outcome — observable result]
135
+
136
+ ### Scenario: [Short descriptive name]
137
+
138
+ **Given** [precondition]
139
+ **When** [action]
140
+ **Then** [expected outcome]
141
+
142
+ &lt;!-- Example:
143
+ ### Scenario: Successful Google login
144
+
145
+ **Given** the user is on the login page and has a valid Google account
146
+ **When** they click the "Sign in with Google" button and complete Google's OAuth flow
147
+ **Then** they are redirected to the dashboard and see their Google profile name
148
+
149
+ ### Scenario: Provider unavailable
150
+
151
+ **Given** the user is on the login page and the Google OAuth service is unreachable
152
+ **When** they click the "Sign in with Google" button
153
+ **Then** they see an error message "Login service temporarily unavailable. Please try again."
154
+ --&gt;
155
+ </section>
156
+
157
+ <section name="out-of-scope">
158
+ ## Out of Scope
159
+
160
+ &lt;!-- Explicitly excluded items to prevent scope creep. Only list things that someone
161
+ might reasonably assume are included but are NOT part of this story.
162
+ Do not list everything in the universe — only meaningful exclusions. --&gt;
163
+
164
+ - [Excluded item — brief reason why it is not part of this story]
165
+ - [Excluded item — brief reason why it is not part of this story]
166
+ </section>
167
+
168
+ <section name="dependencies">
169
+ ## Dependencies
170
+
171
+ ### Blocked By
172
+ &lt;!-- Stories, features, or external items that must be completed before this story can start. --&gt;
173
+ - [Story ID or item — brief reason for the dependency]
174
+
175
+ ### Blocks
176
+ &lt;!-- Stories or items that cannot start until this story is complete. --&gt;
177
+ - [Story ID or item — what it needs from this story]
178
+
179
+ ### External
180
+ &lt;!-- Third-party services, APIs, approvals, or infrastructure needed. --&gt;
181
+ - [External dependency — current status]
182
+ </section>
183
+
184
+ <section name="definition-of-done">
185
+ ## Definition of Done
186
+
187
+ - [ ] All acceptance criteria scenarios pass
188
+ - [ ] Code reviewed and approved
189
+ - [ ] Tests written and passing
190
+ - [ ] CI pipeline green
191
+ - [ ] Documentation updated (if applicable)
192
+ - [ ] Product Owner verified
193
+ </section>
194
+
195
+ <section name="relevant-wiki" pass="2" template="story-wiki.xml">
196
+ ## Relevant Wiki
197
+
198
+ &lt;!-- Pass 2. Populated by story-wiki.xml template.
199
+ A research agent reads the User Story, Description, and AC,
200
+ then scans `.docs/wiki/` to select documents relevant to
201
+ designing a good technical solution for this story.
202
+ See story-wiki.xml for full section structure and selection criteria. --&gt;
203
+ </section>
204
+
205
+ <section name="technical-solution" pass="5" template="story-technical-solution.xml">
206
+ ## Technical Solution
207
+
208
+ &lt;!-- Pass 5. Populated by story-technical-solution.xml template.
209
+ Consumes ALL prior passes as input:
210
+ - Story file (sections 1-8 + relevant wiki)
211
+ - external-analysis.md (if it exists in story directory)
212
+ - integration-analysis.md (from story directory)
213
+ See story-technical-solution.xml for full section structure. --&gt;
214
+ </section>
215
+
216
+ <section name="summary-and-state" populated-by="execute-story">
217
+ ## Summary &amp; State
218
+
219
+ &lt;!-- Populated by /ace:execute-story after implementation.
220
+ Contains: status, execution date, duration, commit log,
221
+ implementation summary, deviations, and code review results.
222
+ Do NOT edit manually — this section is written by the execution workflow. --&gt;
223
+ </section>
224
+
225
+ <section name="wiki-updates" populated-by="execute-story">
226
+ ## Wiki Updates
227
+
228
+ &lt;!-- Populated by /ace:execute-story after wiki mapping.
229
+ Contains: table of wiki documents updated/created during implementation.
230
+ Do NOT edit manually — this section is written by the execution workflow. --&gt;
231
+ </section>
232
+
233
+ <section name="metadata">
234
+ ---
235
+ *Created: [date] | Last refined: [date] | Refinements: [count]*
236
+ *Feature: [relative path to parent feature.md]*
237
+ </section>
238
+
239
+ </output-format>
240
+
241
+ <field-definitions>
242
+
243
+ <field name="ID">
244
+ S[number] for local stories, #[issue_number] for GitHub-linked.
245
+ Sequential within the parent feature. IDs are stable — never renumber after assignment.
246
+ When a local story gets a GitHub issue, ID changes from S[N] to #[issue_number]
247
+ and the parent feature's story index table is updated.
248
+ </field>
249
+
250
+ <field name="Status">
251
+ <allowed-values>
252
+ <value name="Todo">Story seed exists in feature doc, not yet formally specified</value>
253
+ <value name="Refined">Formal spec complete — user story, AC, DoD all defined and clear</value>
254
+ <value name="In Progress">Implementation has started</value>
255
+ <value name="Done">All AC scenarios verified, DoD met, story closed</value>
256
+ </allowed-values>
257
+ </field>
258
+
259
+ <field name="Size">
260
+ <allowed-values>
261
+ <value name="1">Trivial — a few hours of work</value>
262
+ <value name="2">Small — about a day</value>
263
+ <value name="3">Medium — 2-3 days</value>
264
+ <value name="5">Large — most of a sprint</value>
265
+ <value name="8">Very large — full sprint (1 dev / 10 days OR 1 AI agent - 1 day)</value>
266
+ </allowed-values>
267
+ Fibonacci relative sizing (NOT x10 like features).
268
+ If a story exceeds 8 points, it MUST be split into smaller stories.
269
+ </field>
270
+
271
+ <field name="Priority">
272
+ <allowed-values>
273
+ <value name="Critical">Blocks other work or has external deadline</value>
274
+ <value name="High">Core functionality, high user impact</value>
275
+ <value name="Medium">Important but not blocking</value>
276
+ <value name="Low">Nice to have, can be deferred</value>
277
+ </allowed-values>
278
+ </field>
279
+
280
+ <field name="Persona">
281
+ Must match a persona defined in the product vision document.
282
+ Do not introduce new personas at story level — update the product vision first.
283
+ </field>
284
+
285
+ </field-definitions>
286
+
287
+ <guidelines>
288
+
289
+ <guideline name="invest-compliance">
290
+ Every story MUST pass the INVEST checklist before it can move to "Refined" status:
291
+ - **Independent**: Can be developed without requiring another in-progress story
292
+ - **Negotiable**: Scope is defined by AC, not hardcoded implementation details
293
+ - **Valuable**: User story statement describes real user benefit
294
+ - **Estimable**: Can be sized in Fibonacci points (1, 2, 3, 5, 8)
295
+ - **Small**: Completable within a single sprint
296
+ - **Testable**: AC scenarios have clear pass/fail conditions
297
+
298
+ If any INVEST criterion fails, the story is not ready to be refined.
299
+ </guideline>
300
+
301
+ <guideline name="acceptance-criteria-as-scope">
302
+ Acceptance criteria define 100% of this story's scope.
303
+ No behavior should be implemented or tested unless it is captured in a named scenario.
304
+
305
+ - If it's not in the AC, it's OUT OF SCOPE
306
+ - If it's implied but not stated, it's OUT OF SCOPE
307
+ - If it would be "nice to have", it's OUT OF SCOPE
308
+ - ONLY build what the AC scenarios explicitly describe
309
+
310
+ This is the primary scope control mechanism. Adding requirements beyond the AC
311
+ causes scope creep. Extra features = extra work = missed deadlines.
312
+ </guideline>
313
+
314
+ <guideline name="gherkin-quality">
315
+ Gherkin scenarios must follow these rules:
316
+ - **Given**: Describes state or precondition — NEVER an action
317
+ - **When**: Describes exactly ONE action — the trigger being tested
318
+ - **Then**: Describes an observable outcome — NEVER internal system state
319
+ (Bad: "Then the database has a new row" — Good: "Then the user sees a confirmation message")
320
+ - Scenarios MUST be independent — no scenario depends on another scenario's state
321
+ - Use **And** for additional conditions within Given/When/Then, not separate steps
322
+
323
+ Bad: "Given the user clicks login" (action, not state)
324
+ Good: "Given the user is on the login page"
325
+ </guideline>
326
+
327
+ <guideline name="story-sizing">
328
+ Stories use Fibonacci sizing: 1, 2, 3, 5, 8 (NOT x10 like features).
329
+ If a story is estimated at more than 8 points, it MUST be split.
330
+ If a story requires more than 6-8 AC scenarios, it is likely too large — split it.
331
+
332
+ AC scenario count is a reliable proxy for complexity:
333
+ - 1-2 scenarios: likely a 1-2 point story
334
+ - 3-4 scenarios: likely a 3 point story
335
+ - 5-6 scenarios: likely a 5 point story
336
+ - 7-8 scenarios: likely an 8 point story; above 8 consider splitting
337
+ </guideline>
338
+
339
+ <guideline name="github-compatibility">
340
+ The entire story document must render cleanly as a GitHub issue body.
341
+ - Mermaid diagrams are supported and encouraged — GitHub renders them natively
342
+ in issue bodies and markdown files via ```mermaid fenced code blocks
343
+ - No HTML tables (use markdown tables only - make sure titles are aligned with columns)
344
+ - No custom CSS or HTML styling
345
+ - Named scenario H3 headers render as distinct sections in GitHub
346
+ - Blockquote (&gt;) for the user story statement renders correctly
347
+ </guideline>
348
+
349
+ <guideline name="github-identity">
350
+ - GitHub-linked stories: ID = #[issue_number], Title = EXACT GitHub issue title
351
+ - Local stories: ID = S[N], sequential within the parent feature
352
+ - IDs are stable — never renumber after assignment
353
+ - When a story gets a GitHub issue, ID changes from S[N] to #[issue_number]
354
+ - The parent feature's story index table must be updated to reflect the new ID
355
+ </guideline>
356
+
357
+ <guideline name="definition-of-done">
358
+ The inline DoD checklist must stay compact: 5-10 items maximum.
359
+ It covers the universal quality bar for any story. Items are:
360
+ - Acceptance criteria verified (functional correctness)
361
+ - Code quality (review, tests, CI)
362
+ - Documentation (only when applicable)
363
+ - Product validation (PO sign-off)
364
+
365
+ Story-specific DoD items may be added when genuinely unique to that story
366
+ (e.g., "PCI compliance reviewed" for a payment story), but the default
367
+ checklist should suffice for most stories.
368
+ </guideline>
369
+
370
+ <guideline name="relevant-wiki-selection">
371
+ The Relevant Wiki section is populated by pass 2 using story-wiki.xml.
372
+ It runs AFTER sections 1-8 are complete.
373
+ See story-wiki.xml for detailed selection/exclusion criteria and section structure.
374
+ </guideline>
375
+
376
+ <guideline name="completeness">
377
+ Every run of plan-story should produce a COMPLETE story specification —
378
+ user story, description, all AC scenarios, out-of-scope, dependencies, DoD.
379
+ Do not defer sections to "later passes."
380
+
381
+ Re-running plan-story on the same story is supported for scope changes
382
+ or AC gaps, but is the exception, not the workflow.
383
+ When re-running, increment the metadata refinement count and update
384
+ the "Last refined" date.
385
+ </guideline>
386
+
387
+ </guidelines>
388
+
389
+ <evolution>
390
+
391
+ **Pass 1 — Business Requirements (story.xml → story file):**
392
+ The plan-story command takes the plain-text story seed from the parent feature
393
+ document and fills sections 1-8 (header through DoD).
394
+ All business requirements sections are complete after this pass.
395
+
396
+ **Pass 2 — Wiki Research (story-wiki.xml → story file):**
397
+ A research agent reads the User Story, Description, and AC from pass 1,
398
+ then scans `.docs/wiki/` to populate the Relevant Wiki section with documents
399
+ that inform the technical solution.
400
+
401
+ **Pass 3 — External Analysis (external-solution.xml → external-analysis.md) — OPTIONAL:**
402
+ When the story or feature references external systems, libraries, or reference
403
+ implementations, an agent analyzes that external code/documentation for insights.
404
+ Output is a separate artifact in the story directory — NOT part of the story file.
405
+ Skipped when no external references exist.
406
+
407
+ **Pass 4 — Integration Analysis (integration-solution.xml → integration-analysis.md):**
408
+ An agent reads the wiki references from pass 2 (and external analysis from pass 3
409
+ if present), then explores our own codebase to map affected files, existing APIs,
410
+ code patterns, and architectural constraints for this story.
411
+ Output is a separate artifact in the story directory — NOT part of the story file.
412
+
413
+ **Pass 5 — Technical Solution (story-technical-solution.xml → story file):**
414
+ Consumes ALL prior outputs: story file (requirements + wiki) plus the external
415
+ artifacts (external-analysis.md and integration-analysis.md from story directory).
416
+ Designs the implementation approach and appends the Technical Solution section
417
+ to the story file.
418
+ Story status moves from "Todo" to "Refined" in the parent feature's story index.
419
+
420
+ **Refinement (re-run any pass — exception, not norm):**
421
+ Only when scope changes, new information surfaces, or gaps are found.
422
+ Re-running an earlier pass may invalidate later passes — downstream passes
423
+ and their artifacts should be re-evaluated.
424
+ Updates metadata refinement count and "Last refined" date.
425
+
426
+ **During implementation (/ace:execute-story):**
427
+ Story status moves from Refined to In Progress.
428
+ Claude Code Plan Mode creates an execution plan from the Technical Solution.
429
+ Implementation proceeds (solo or agent teams mode).
430
+ Code review runs (ace-code-reviewer agent).
431
+ NO intermediary commits — changes accumulate until user approval.
432
+
433
+ **Execution Pass E1 — Summary &amp; State (execute-story → story file):**
434
+ After user approves implementation, the Summary &amp; State section is written
435
+ with: status, execution date, duration, commit log, implementation summary,
436
+ deviations from plan, and code review results.
437
+
438
+ **Execution Pass E2 — Wiki Updates (execute-story → story file):**
439
+ After wiki mapper completes, the Wiki Updates section is written with a table
440
+ of wiki documents updated/created during implementation. Tech debt discovered
441
+ during code review is integrated into wiki subsystem docs.
442
+
443
+ **Completion:**
444
+ All AC scenarios verified. DoD checklist complete. Story status moves to Done.
445
+ Parent feature's story index updated. Product backlog updated.
446
+ If GitHub-linked, the issue body is updated with full story content.
447
+ If all stories in the feature are Done, the feature status also moves to Done.
448
+
449
+ </evolution>
450
+
451
+ </story>