olympus-ai 4.5.13 → 4.5.14

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 (49) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dist/cli/index.js +63 -27
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/hooks/olympus-hooks.cjs +257 -257
  5. package/dist/installer/hooks.d.ts +47 -14
  6. package/dist/installer/hooks.d.ts.map +1 -1
  7. package/dist/installer/hooks.js +45 -77
  8. package/dist/installer/hooks.js.map +1 -1
  9. package/dist/installer/index.d.ts +8 -7
  10. package/dist/installer/index.d.ts.map +1 -1
  11. package/dist/installer/index.js +49 -46
  12. package/dist/installer/index.js.map +1 -1
  13. package/package.json +1 -1
  14. package/resources/config/risk-keywords.json +5 -5
  15. package/resources/rules/common/ascii-diagram-standards.md +115 -115
  16. package/resources/rules/common/content-validation.md +131 -131
  17. package/resources/rules/common/error-handling.md +430 -430
  18. package/resources/rules/common/markdown-formatting.md +170 -170
  19. package/resources/rules/common/overconfidence-prevention.md +100 -100
  20. package/resources/rules/common/pathway-behaviors.json +60 -60
  21. package/resources/rules/common/pathway-behaviors.md +100 -100
  22. package/resources/rules/common/process-overview.md +157 -157
  23. package/resources/rules/common/terminal-formatting.md +161 -161
  24. package/resources/rules/common/terminology.md +189 -189
  25. package/resources/rules/common/welcome-message.md +118 -118
  26. package/resources/rules/common/workflow-changes.md +285 -285
  27. package/resources/rules/construction/bolt-planning.md +153 -153
  28. package/resources/rules/construction/bolt-review.md +143 -143
  29. package/resources/rules/construction/build-and-test.md +527 -527
  30. package/resources/rules/construction/code-generation.md +414 -414
  31. package/resources/rules/construction/documentation.md +201 -201
  32. package/resources/rules/construction/functional-design.md +135 -135
  33. package/resources/rules/construction/infrastructure-design.md +110 -110
  34. package/resources/rules/construction/nfr-design.md +106 -106
  35. package/resources/rules/construction/nfr-requirements.md +118 -118
  36. package/resources/rules/construction/test-generation.md +112 -112
  37. package/resources/rules/core-workflow.md +196 -196
  38. package/resources/rules/inception/application-design.md +195 -195
  39. package/resources/rules/inception/bolt-planning.md +588 -588
  40. package/resources/rules/inception/reverse-engineering.md +354 -354
  41. package/resources/rules/inception/units-generation.md +505 -505
  42. package/resources/rules/inception/user-stories.md +527 -527
  43. package/resources/rules/inception/workspace-detection.md +82 -82
  44. package/resources/rules/operations/operations.md +19 -19
  45. package/resources/skills/brief/templates/ai-dlc-intent-brief-template.md +149 -149
  46. package/resources/skills/getting-started/SKILL.md +79 -79
  47. package/resources/templates/construction/bolt-spec-template.md +270 -270
  48. package/resources/templates/inception/unit-brief-template.md +188 -188
  49. package/resources/templates/inception/units-template.md +99 -99
@@ -1,527 +1,527 @@
1
- # User Stories - Detailed Steps
2
-
3
- ## Purpose
4
- **Convert requirements into user-centered stories with acceptance criteria**
5
-
6
- User Stories focus on:
7
- - Translating business requirements into user-centered narratives
8
- - Defining clear acceptance criteria for each story
9
- - Creating user personas that represent different stakeholder types
10
- - Establishing shared understanding across teams
11
- - Providing testable specifications for implementation
12
-
13
- ## Prerequisites
14
- - Workspace Detection must be complete
15
- - Requirements Analysis recommended (can reference requirements if available)
16
- - Workflow Planning must indicate User Stories stage should execute
17
-
18
- ## Per-Unit Story Creation
19
-
20
- When units exist (units-generation has completed):
21
- - For each unit, read its assigned requirements from the unit brief
22
- - Create stories scoped to that unit at `inception/units/{UNIT-NNN-slug}/stories/{S-NNN}-{slug}.md`
23
- - Each unit folder gets its own `stories/` subdirectory containing individual story files
24
- - Each story references its parent unit ID in its `unit` field
25
- - No central `stories.md` is needed — each unit brief's "Stories Assigned" table serves as the story index for that unit
26
- - After all stories are created, update each unit brief's "Stories Assigned" section with the actual story data
27
- - Generate `inception/units/unit-of-work-story-map.md` as a cross-unit story reference
28
-
29
- When units do not exist (units-generation was skipped):
30
- - Fall back to `inception/user-stories/stories.md` (flat file, backward compatibility)
31
- - Stories are not unit-scoped (the `unit` field is set to "unassigned")
32
-
33
- ## Agent Delegation Strategy
34
-
35
- **MANDATORY**: Delegate story and persona generation (Part 2) to `oracle-medium`. Do NOT generate user stories and personas directly.
36
-
37
- **Execution mode**: Foreground sequential — single coherent story generation task requiring Sonnet-level reasoning for story quality.
38
-
39
- **Delegation scope**:
40
- - **Orchestrator retains**: Part 1 (Planning) — Steps 1-15. The orchestrator performs the intelligent assessment, creates the story plan, manages Q&A, resolves ambiguities, and obtains user approval.
41
- - **Delegated to `oracle-medium`**: Part 2 (Generation) — Steps 16-19. The agent executes the approved plan to produce stories.md and personas.md following INVEST criteria.
42
-
43
- **If an agent task fails**: Follow the Agent Task Failure Recovery procedure in `error-handling.md` — retry the delegation, never silently do the work yourself.
44
-
45
- **After agent completes**: The orchestrator reviews the generated stories, presents the completion message (Step 21), and manages the approval gate (Steps 22-24).
46
-
47
- ## Intelligent Assessment Guidelines
48
-
49
- **WHEN TO EXECUTE USER STORIES**: Use this enhanced assessment before proceeding:
50
-
51
- ### High Priority Execution (ALWAYS Execute)
52
- - **New User Features**: Any new functionality users will directly interact with
53
- - **User Experience Changes**: Modifications to existing user workflows or interfaces
54
- - **Multi-Persona Systems**: Applications serving different types of users
55
- - **Customer-Facing APIs**: Services that external users or systems will consume
56
- - **Complex Business Logic**: Requirements with multiple scenarios or business rules
57
- - **Cross-Team Projects**: Work requiring shared understanding across multiple teams
58
-
59
- ### Medium Priority Execution (Assess Complexity)
60
- - **Backend User Impact**: Internal changes that indirectly affect user experience
61
- - **Performance Improvements**: Enhancements with user-visible benefits
62
- - **Integration Work**: Connecting systems that affect user workflows
63
- - **Data Changes**: Modifications affecting user data, reports, or analytics
64
- - **Security Enhancements**: Changes affecting user authentication or permissions
65
-
66
- ### Complexity Assessment Factors
67
- For medium priority cases, execute user stories if ANY of these apply:
68
- - **Scope**: Changes span multiple components or user touchpoints
69
- - **Ambiguity**: Requirements have unclear aspects that stories could clarify
70
- - **Risk**: High business impact or potential for misunderstanding
71
- - **Stakeholders**: Multiple business stakeholders involved in requirements
72
- - **Testing**: User acceptance testing will be required
73
- - **Options**: Multiple valid implementation approaches exist
74
-
75
- ### Skip Only For Simple Cases
76
- - **Pure Refactoring**: Internal code improvements with zero user impact
77
- - **Isolated Bug Fixes**: Simple, well-defined fixes with clear scope
78
- - **Infrastructure Only**: Changes with no user-facing effects
79
- - **Developer Tooling**: Build processes, CI/CD, or development environment changes
80
- - **Documentation**: Updates that don't affect functionality
81
-
82
- ### Default Decision Rule
83
- **When in doubt, include user stories AND ask clarifying questions.** The overhead of creating comprehensive stories with proper clarification is typically outweighed by the benefits of:
84
- - Clearer requirements understanding
85
- - Better team alignment
86
- - Improved testing criteria
87
- - Enhanced stakeholder communication
88
- - Reduced implementation risks
89
- - Fewer costly changes during development
90
- - Better user experience outcomes
91
-
92
- ---
93
-
94
- # PART 1: PLANNING
95
-
96
- ## Step 1: Validate User Stories Need (MANDATORY)
97
-
98
- **CRITICAL**: Before proceeding with user stories, perform this assessment:
99
-
100
- ### Assessment Process
101
- 1. **Analyze Request Context**:
102
- - Review the original user request and requirements
103
- - Identify user-facing vs internal-only changes
104
- - Assess complexity and scope of the work
105
- - Evaluate business stakeholder involvement
106
-
107
- 2. **Apply Assessment Criteria**:
108
- - Check against High Priority indicators (always execute)
109
- - Evaluate Medium Priority factors (complexity-based decision)
110
- - Confirm this isn't a simple case that should be skipped
111
-
112
- 3. **Document Assessment Decision**:
113
- - Create `aidlc-docs/inception/plans/user-stories-assessment.md`
114
- - Include reasoning for why user stories are valuable for this request
115
- - Reference specific assessment criteria that apply
116
- - Explain expected benefits (clarity, testing, stakeholder alignment)
117
-
118
- 4. **Proceed Only If Justified**:
119
- - User stories must add clear value to the project
120
- - Assessment must show concrete benefits outweigh overhead
121
- - Decision should be defensible to project stakeholders
122
-
123
- ### Assessment Documentation Template
124
- ```markdown
125
- # User Stories Assessment
126
-
127
- ## Request Analysis
128
- - **Original Request**: [Brief summary]
129
- - **User Impact**: [Direct/Indirect/None]
130
- - **Complexity Level**: [Simple/Medium/Complex]
131
- - **Stakeholders**: [List involved parties]
132
-
133
- ## Assessment Criteria Met
134
- - [ ] High Priority: [List applicable criteria]
135
- - [ ] Medium Priority: [List applicable criteria with complexity justification]
136
- - [ ] Benefits: [Expected value from user stories]
137
-
138
- ## Decision
139
- **Execute User Stories**: [Yes/No]
140
- **Reasoning**: [Detailed justification]
141
-
142
- ## Expected Outcomes
143
- - [List specific benefits user stories will provide]
144
- - [How stories will improve project success]
145
- ```
146
-
147
- ## Step 2: Create Story Plan
148
- - Assume the role of a product owner
149
- - Generate a comprehensive plan with step-by-step execution checklist for story development
150
- - Each step and sub-step should have a checkbox []
151
- - Focus on methodology and approach for converting requirements into user stories
152
-
153
- ## Step 3: Generate Context-Appropriate Questions
154
- **DIRECTIVE**: Thoroughly analyze the requirements and context to identify ALL areas where clarification would improve story quality and team understanding. Be proactive in asking questions to ensure comprehensive user story development.
155
-
156
- **CRITICAL**: Default to asking questions when there is ANY ambiguity or missing detail that could affect story quality. It's better to ask too many questions than to create incomplete or unclear stories.
157
-
158
- **See `common/question-format-guide.md` for question formatting rules**
159
-
160
- - Create a SEPARATE question file: `aidlc-docs/{workflow-id}/inception/user-stories/story-planning-questions.md`
161
- - Do NOT embed questions in the story generation plan — questions and plans are always separate files
162
- - Focus on ANY ambiguities, missing information, or areas needing clarification
163
- - Generate questions wherever user input would improve story creation decisions
164
- - **When in doubt, ask the question** - overconfidence leads to poor stories
165
-
166
- **Question categories to evaluate** (consider ALL categories):
167
- - **User Personas** - Ask about user types, roles, characteristics, and motivations
168
- - **Story Granularity** - Ask about appropriate level of detail, story size, and breakdown approach
169
- - **Story Format** - Ask about format preferences, template usage, and documentation standards
170
- - **Breakdown Approach** - Ask about organization method, prioritization, and grouping strategies
171
- - **Acceptance Criteria** - Ask about detail level, format, testing approach, and validation methods
172
- - **User Journeys** - Ask about user workflows, interaction patterns, and experience flows
173
- - **Business Context** - Ask about business goals, success metrics, and stakeholder needs
174
- - **Technical Constraints** - Ask about technical limitations, integration requirements, and system boundaries
175
-
176
- ## Step 4: Include Mandatory Story Artifacts in Plan
177
- - **ALWAYS** include these mandatory artifacts in the story plan:
178
- - [ ] Generate `stories.md` with user stories following INVEST criteria
179
- - [ ] Generate `personas.md` with user archetypes and characteristics
180
- - [ ] Ensure stories are Independent, Negotiable, Valuable, Estimable, Small, Testable
181
- - [ ] Include acceptance criteria for each story (Gherkin Given/When/Then format)
182
- - [ ] Include edge cases for non-trivial stories
183
- - [ ] Map personas to relevant user stories
184
- - [ ] **When units exist**: Generate individual story files in `inception/units/{UNIT-NNN-slug}/stories/` per-unit directories
185
- - [ ] **When units skipped, > 5 stories**: Generate individual story files in `inception/user-stories/stories/` subdirectory
186
-
187
- ### Story Naming Convention (MANDATORY)
188
-
189
- All stories MUST use `S-NNN` IDs (zero-padded to three digits, sequential within the workflow). This is consistent with `U-NNN` for units and `BOLT-NNN` for bolts.
190
-
191
- ### Story File Organization
192
-
193
- Story placement depends on whether units exist:
194
-
195
- **Per-unit (primary -- when units exist):**
196
-
197
- Stories are placed in each unit's `stories/` subdirectory as individual files:
198
-
199
- ```
200
- aidlc-docs/{workflow-id}/inception/units/{UNIT-NNN-slug}/stories/
201
- ├── S-001-{slug}.md
202
- ├── S-002-{slug}.md
203
- └── ...
204
- ```
205
-
206
- Project-wide personas always remain at:
207
-
208
- ```
209
- aidlc-docs/{workflow-id}/inception/user-stories/
210
- ├── personas.md ← always here (project-wide)
211
- ```
212
-
213
- When stories are per-unit, no central `stories.md` index is created. Each unit brief's "Stories Assigned" table serves as the story index for that unit. The cross-unit story reference is maintained in `inception/units/unit-of-work-story-map.md`.
214
-
215
- **Fallback (when units skipped):**
216
-
217
- Stories fall back to the flat file structure:
218
-
219
- ```
220
- aidlc-docs/{workflow-id}/inception/user-stories/
221
- ├── stories.md ← flat file, only when no units
222
- ├── personas.md ← always here
223
- ```
224
-
225
- **<= 5 stories (fallback only)**: All stories go in `stories.md` using the inline template below. No individual files needed.
226
-
227
- **> 5 stories (fallback only)**: `stories.md` becomes a **summary index** and individual story files are created in `inception/user-stories/stories/`.
228
-
229
- ### Stories Index Template (stories.md)
230
-
231
- When individual files exist (> 5 stories), `stories.md` serves as the overview:
232
-
233
- ```markdown
234
- # User Stories
235
-
236
- Total: {N} stories | Must: {n} | Should: {n} | Could: {n}
237
-
238
- | ID | Title | Persona | Priority | Status | Dependencies |
239
- |----|-------|---------|----------|--------|--------------|
240
- | S-001 | {title} | {persona} | must | draft | None |
241
- | S-002 | {title} | {persona} | should | draft | Requires S-001 |
242
- ```
243
-
244
- When all stories are inline (<= 5 stories), `stories.md` contains the full story details using the inline template below.
245
-
246
- ### Inline Story Template (MANDATORY for <= 5 stories)
247
-
248
- Each story in `stories.md` MUST follow this structure:
249
-
250
- ```markdown
251
- ### S-NNN: {Story Title}
252
-
253
- **Persona**: {persona name from personas.md}
254
- **Priority**: {must | should | could}
255
-
256
- > As a **{persona}**, I want **{capability}**, so that **{benefit}**.
257
-
258
- #### Acceptance Criteria
259
- - **Given** {precondition}, **when** {action}, **then** {expected result}
260
- - **Given** {precondition}, **when** {action}, **then** {expected result}
261
-
262
- #### Edge Cases
263
- | Scenario | Expected Behavior |
264
- |----------|-------------------|
265
- | {edge case} | {what should happen} |
266
-
267
- #### Dependencies
268
- - Requires: {S-NNN or "None"}
269
- - Enables: {S-NNN or "None"}
270
- ```
271
-
272
- ### Individual Story File Template (MANDATORY for per-unit stories; also used for > 5 stories in fallback mode)
273
-
274
- **Path (per-unit)**: `aidlc-docs/{workflow-id}/inception/units/{UNIT-NNN-slug}/stories/{S-NNN}-{slug}.md`
275
- **Path (fallback)**: `aidlc-docs/{workflow-id}/inception/user-stories/stories/{S-NNN}-{slug}.md`
276
-
277
- ```markdown
278
- ---
279
- id: "S-NNN"
280
- unit: "{UNIT-NNN-slug or unassigned}"
281
- title: "{Story Title}"
282
- persona: "{persona name}"
283
- priority: "{must|should|could}"
284
- status: "draft"
285
- created: "{ISO-8601}"
286
- ---
287
-
288
- # S-NNN: {Story Title}
289
-
290
- > As a **{persona}**, I want **{capability}**, so that **{benefit}**.
291
-
292
- ## Acceptance Criteria
293
- - **Given** {precondition}, **when** {action}, **then** {expected result}
294
- - **Given** {precondition}, **when** {action}, **then** {expected result}
295
-
296
- ## Edge Cases
297
- | Scenario | Expected Behavior |
298
- |----------|-------------------|
299
- | {edge case} | {what should happen} |
300
-
301
- ## Dependencies
302
- - Requires: {S-NNN or "None"}
303
- - Enables: {S-NNN or "None"}
304
-
305
- ## Technical Notes
306
- {Optional — implementation hints, API considerations, or constraints
307
- relevant to this story. Omit if not needed.}
308
- ```
309
-
310
- ### Story Rules
311
-
312
- - Every story MUST have at least one Given/When/Then acceptance criterion
313
- - Edge Cases table is MANDATORY for stories with priority `must`, optional for `should`/`could`
314
- - Dependencies track inter-story ordering — use "None" when the story is independent
315
- - Priority uses MoSCoW: `must` (required), `should` (important), `could` (nice-to-have)
316
- - Individual story files include YAML frontmatter with `status` and `unit` fields for traceability
317
- - The `unit` field links to the parent unit (set to the unit slug when per-unit, `unassigned` when units were skipped)
318
- - When per-unit stories are used, no central `stories.md` index is created. Each unit brief's "Stories Assigned" table serves as the story index for that unit. The cross-unit story reference is maintained in `inception/units/unit-of-work-story-map.md`
319
- - When individual files exist in fallback mode, `stories.md` MUST be kept in sync as the index
320
-
321
- ## Step 5: Present Story Options
322
- - Include different approaches for story breakdown in the plan document:
323
- - **User Journey-Based**: Stories follow user workflows and interactions
324
- - **Feature-Based**: Stories organized around system features and capabilities
325
- - **Persona-Based**: Stories grouped by different user types and their needs
326
- - **Domain-Based**: Stories organized around business domains or contexts
327
- - **Epic-Based**: Stories structured as hierarchical epics with sub-stories
328
- - Explain trade-offs and benefits of each approach
329
- - Allow for hybrid approaches with clear decision criteria
330
-
331
- ## Step 6: Store Story Plan
332
- - Save the story plan in `aidlc-docs/{workflow-id}/inception/plans/story-generation-plan.md`
333
- - The plan contains: overview, personas, execution steps, mandatory artifacts, story approach options
334
- - Do NOT include questions in this file — questions are in the separate `story-planning-questions.md`
335
- - Ensure plan is comprehensive and covers all story development aspects
336
-
337
- ## Step 7: Request User Input
338
- - Ask user to fill in all [Answer]: tags in the questions file (`story-planning-questions.md`)
339
- - Emphasize importance of audit trail and decision documentation
340
- - Provide clear instructions on how to fill in the [Answer]: tags
341
- - Explain that all questions must be answered before proceeding
342
-
343
- ## Step 8: Collect Answers
344
- - Wait for user to provide answers to all questions using [Answer]: tags in the document
345
- - Do not proceed until ALL [Answer]: tags are completed
346
- - Review the document to ensure no [Answer]: tags are left blank
347
-
348
- ## Step 9: ANALYZE ANSWERS (MANDATORY)
349
- Before proceeding, you MUST carefully review all user answers for:
350
- - **Vague or ambiguous responses**: "mix of", "somewhere between", "not sure", "depends", "maybe", "probably"
351
- - **Undefined criteria or terms**: References to concepts without clear definitions
352
- - **Contradictory answers**: Responses that conflict with each other
353
- - **Missing generation details**: Answers that lack specific guidance for implementation
354
- - **Answers that combine options**: Responses that merge different approaches without clear decision rules
355
- - **Incomplete explanations**: Answers that reference external factors without defining them
356
- - **Assumption-based responses**: Answers that assume knowledge not explicitly stated
357
-
358
- ## Step 10: MANDATORY Follow-up Questions
359
- If the analysis in step 9 reveals ANY ambiguous answers, you MUST:
360
- - Create a separate clarification questions file using [Answer]: tags
361
- - DO NOT proceed to approval until ALL ambiguities are completely resolved
362
- - **CRITICAL**: Be thorough - ask follow-up questions for every unclear response
363
- - Examples of required follow-ups:
364
- - "You mentioned 'mix of A and B' - what specific criteria should determine when to use A vs B?"
365
- - "You said 'somewhere between A and B' - can you define the exact middle ground approach?"
366
- - "You indicated 'not sure' - what additional information would help you decide?"
367
- - "You mentioned 'depends on complexity' - how do you define complexity levels and thresholds?"
368
- - "You chose 'hybrid approach' - what are the specific rules for when to use each method?"
369
- - "You said 'probably X' - what factors would make it definitely X vs definitely not X?"
370
- - "You referenced 'standard practice' - can you define what that standard practice is?"
371
-
372
- ## Step 11: MANDATORY: Consolidate Answers Into Plan
373
-
374
- **See `common/question-format-guide.md` Post-Answer Consolidation rules**
375
-
376
- After all answers are collected and ambiguities resolved, you MUST update the story generation plan file:
377
- 1. Read all finalized answers from `story-planning-questions.md`
378
- 2. Add a "Finalized Approach" section to `story-generation-plan.md` that synthesizes the user's decisions:
379
- - Story organization approach (with rationale from user's choice)
380
- - Acceptance criteria format
381
- - Priority system
382
- - Persona decisions
383
- - Any other methodology decisions from the Q&A
384
- 3. Update the execution steps if needed to reflect the chosen approach
385
- 4. The plan file must be self-contained — readable without cross-referencing the questions file
386
- 5. **Do NOT present for approval until the plan file contains the finalized approach**
387
-
388
- ## Step 12: Avoid Implementation Details
389
- - Focus on story creation methodology, not prioritization or development tasks
390
- - Do not discuss technical generation at this stage
391
- - Avoid creating development timelines or sprint planning
392
- - Keep focus on story structure and format decisions
393
-
394
- ## Step 13: Log Approval Prompt
395
- - Before asking for approval, log the prompt with timestamp in `aidlc-docs/audit.md`
396
- - Include the complete approval prompt text
397
- - Use ISO 8601 timestamp format
398
-
399
- ## Step 14: Wait for Explicit Approval of Plan
400
- - Do not proceed until the user explicitly approves the story approach
401
- - Approval must be clear and unambiguous
402
- - If user requests changes, update the plan and repeat the approval process
403
-
404
- ## Step 15: Record Approval Response
405
- - Log the user's approval response with timestamp in `aidlc-docs/audit.md`
406
- - Include the exact user response text
407
- - Mark the approval status clearly
408
-
409
- ---
410
-
411
- # PART 2: GENERATION
412
-
413
- ## Step 16: Load Story Generation Plan
414
- - [ ] Read the complete story plan from `aidlc-docs/{workflow-id}/inception/plans/story-generation-plan.md`
415
- - [ ] Identify the next uncompleted step (first [ ] checkbox)
416
- - [ ] Load the context and requirements for that step
417
-
418
- ## Step 17: Execute Current Step
419
- - [ ] Perform exactly what the current step describes
420
- - [ ] Generate story artifacts as specified in the plan
421
- - [ ] Follow the approved methodology and format from Planning
422
- - [ ] Use the story breakdown approach specified in the plan
423
-
424
- ## Step 18: MANDATORY: Update Progress
425
- - [ ] Mark the completed step as [x] in the story generation plan
426
- - [ ] **MANDATORY**: Update `aidlc-docs/{workflow-id}/aidlc-state.md` current status
427
- - [ ] **MANDATORY**: Update `aidlc-docs/{workflow-id}/checkpoint.json` current status
428
- - [ ] Save all generated artifacts
429
- - **Do NOT proceed without completing state updates**
430
-
431
- ## Step 19: Continue or Complete Generation
432
- - [ ] If more steps remain, return to Step 16
433
- - [ ] If all steps complete, verify stories are ready for next stage
434
- - [ ] Ensure all mandatory artifacts are generated
435
-
436
- ## Step 20: Log Approval Prompt
437
- - Before asking for approval, log the prompt with timestamp in `aidlc-docs/audit.md`
438
- - Include the complete approval prompt text
439
- - Use ISO 8601 timestamp format
440
-
441
- ### MANDATORY: Post-Generation Consistency Validation
442
-
443
- After the agent generates story artifacts (per-unit story files or fallback stories.md) and personas.md, the orchestrator MUST validate before presenting to the user:
444
-
445
- 1. **Load decision registry**: Read `aidlc-docs/{workflow-id}/inception/decisions.md` if it exists
446
- 2. **Verify acceptance criteria paths**: Grep stories for file path references. All paths must match decisions in requirements.md BRs
447
- 3. **Verify naming conventions**: Grep stories for ID formats (bolt IDs, unit IDs). All must match agreed conventions
448
- 4. **Verify state references**: Grep stories for lifecycle state names. All must match agreed state machine
449
- 5. **Cross-reference story count**: Verify persona count matches the approved plan
450
- 6. **Fix any violations** before presenting for user review
451
- 7. **Log validation results** in audit.md
452
-
453
- ## Step 21: Present Completion Message
454
- - Present completion message in this structure:
455
- 1. **Completion Announcement** (mandatory): Always start with this:
456
-
457
- ```markdown
458
- # 📚 User Stories Complete
459
- ```
460
-
461
- 2. **AI Summary** (optional): Provide structured bullet-point summary of generated stories
462
- - Format: "User stories generation has created [description]:"
463
- - List key personas generated (bullet points)
464
- - List user stories created with counts and organization
465
- - Mention story structure and compliance (INVEST criteria, acceptance criteria)
466
- - DO NOT include workflow instructions ("please review", "let me know", "proceed to next phase", "before we proceed")
467
- - Keep factual and content-focused
468
- 3. **Formatted Workflow Message** (mandatory): Always end with this exact format:
469
-
470
- ```markdown
471
- ---
472
-
473
- ⚠️ **REVIEW REQUIRED**
474
-
475
- > Please examine the user stories and personas at:
476
- > Per-unit stories: `aidlc-docs/{workflow-id}/inception/units/{UNIT-NNN-slug}/stories/`
477
- > Fallback stories: `aidlc-docs/{workflow-id}/inception/user-stories/stories.md`
478
- > Personas: `aidlc-docs/{workflow-id}/inception/user-stories/personas.md`
479
-
480
- **You may:**
481
- - 🔧 **Request Changes** — Ask for modifications to the stories or personas based on your review
482
- - ➕ **Add Skipped Stage** — Include a previously excluded stage in the workflow
483
- - ✅ **Approve & Continue** — Approve user stories and proceed to **Bolt Planning**
484
-
485
- ---
486
- ```
487
-
488
- ## Step 22: Wait for Explicit Approval of Generated Stories
489
- - Do not proceed until the user explicitly approves the generated stories
490
- - Approval must be clear and unambiguous
491
- - If user requests changes, update stories and repeat the approval process
492
-
493
- ## Step 23: Record Approval Response
494
- - Log the user's approval response with timestamp in `aidlc-docs/audit.md`
495
- - Include the exact user response text
496
- - Mark the approval status clearly
497
-
498
- ## Step 24: MANDATORY: Update State Tracking
499
- - **MANDATORY**: Update BOTH state files in the SAME interaction:
500
- 1. Mark User Stories stage complete in `aidlc-docs/{workflow-id}/aidlc-state.md`
501
- 2. Update `aidlc-docs/{workflow-id}/checkpoint.json` — set user-stories status to "completed" with completed_at timestamp, update current_inception_stage to next stage
502
- - **Do NOT proceed to the next stage without completing this step**
503
-
504
- ---
505
-
506
- # CRITICAL RULES
507
-
508
- ## Planning Phase Rules
509
- - **CONTEXT-APPROPRIATE QUESTIONS**: Only ask questions relevant to this specific context
510
- - **MANDATORY ANSWER ANALYSIS**: Always analyze answers for ambiguities before proceeding
511
- - **NO PROCEEDING WITH AMBIGUITY**: Must resolve all vague answers before generation
512
- - **EXPLICIT APPROVAL REQUIRED**: User must approve plan before generation starts
513
-
514
- ## Generation Phase Rules
515
- - **NO HARDCODED LOGIC**: Only execute what's written in the story generation plan
516
- - **FOLLOW PLAN EXACTLY**: Do not deviate from the step sequence
517
- - **UPDATE CHECKBOXES**: Mark [x] immediately after completing each step
518
- - **USE APPROVED METHODOLOGY**: Follow the story approach from Planning
519
- - **VERIFY COMPLETION**: Ensure all story artifacts are complete before proceeding
520
-
521
- ## Completion Criteria
522
- - All planning questions answered and ambiguities resolved
523
- - Story plan explicitly approved by user
524
- - All steps in story generation plan marked [x]
525
- - All story artifacts generated according to plan (per-unit story files or fallback stories.md, plus personas.md)
526
- - Generated stories explicitly approved by user
527
- - Stories verified and ready for next stage
1
+ # User Stories - Detailed Steps
2
+
3
+ ## Purpose
4
+ **Convert requirements into user-centered stories with acceptance criteria**
5
+
6
+ User Stories focus on:
7
+ - Translating business requirements into user-centered narratives
8
+ - Defining clear acceptance criteria for each story
9
+ - Creating user personas that represent different stakeholder types
10
+ - Establishing shared understanding across teams
11
+ - Providing testable specifications for implementation
12
+
13
+ ## Prerequisites
14
+ - Workspace Detection must be complete
15
+ - Requirements Analysis recommended (can reference requirements if available)
16
+ - Workflow Planning must indicate User Stories stage should execute
17
+
18
+ ## Per-Unit Story Creation
19
+
20
+ When units exist (units-generation has completed):
21
+ - For each unit, read its assigned requirements from the unit brief
22
+ - Create stories scoped to that unit at `inception/units/{UNIT-NNN-slug}/stories/{S-NNN}-{slug}.md`
23
+ - Each unit folder gets its own `stories/` subdirectory containing individual story files
24
+ - Each story references its parent unit ID in its `unit` field
25
+ - No central `stories.md` is needed — each unit brief's "Stories Assigned" table serves as the story index for that unit
26
+ - After all stories are created, update each unit brief's "Stories Assigned" section with the actual story data
27
+ - Generate `inception/units/unit-of-work-story-map.md` as a cross-unit story reference
28
+
29
+ When units do not exist (units-generation was skipped):
30
+ - Fall back to `inception/user-stories/stories.md` (flat file, backward compatibility)
31
+ - Stories are not unit-scoped (the `unit` field is set to "unassigned")
32
+
33
+ ## Agent Delegation Strategy
34
+
35
+ **MANDATORY**: Delegate story and persona generation (Part 2) to `oracle-medium`. Do NOT generate user stories and personas directly.
36
+
37
+ **Execution mode**: Foreground sequential — single coherent story generation task requiring Sonnet-level reasoning for story quality.
38
+
39
+ **Delegation scope**:
40
+ - **Orchestrator retains**: Part 1 (Planning) — Steps 1-15. The orchestrator performs the intelligent assessment, creates the story plan, manages Q&A, resolves ambiguities, and obtains user approval.
41
+ - **Delegated to `oracle-medium`**: Part 2 (Generation) — Steps 16-19. The agent executes the approved plan to produce stories.md and personas.md following INVEST criteria.
42
+
43
+ **If an agent task fails**: Follow the Agent Task Failure Recovery procedure in `error-handling.md` — retry the delegation, never silently do the work yourself.
44
+
45
+ **After agent completes**: The orchestrator reviews the generated stories, presents the completion message (Step 21), and manages the approval gate (Steps 22-24).
46
+
47
+ ## Intelligent Assessment Guidelines
48
+
49
+ **WHEN TO EXECUTE USER STORIES**: Use this enhanced assessment before proceeding:
50
+
51
+ ### High Priority Execution (ALWAYS Execute)
52
+ - **New User Features**: Any new functionality users will directly interact with
53
+ - **User Experience Changes**: Modifications to existing user workflows or interfaces
54
+ - **Multi-Persona Systems**: Applications serving different types of users
55
+ - **Customer-Facing APIs**: Services that external users or systems will consume
56
+ - **Complex Business Logic**: Requirements with multiple scenarios or business rules
57
+ - **Cross-Team Projects**: Work requiring shared understanding across multiple teams
58
+
59
+ ### Medium Priority Execution (Assess Complexity)
60
+ - **Backend User Impact**: Internal changes that indirectly affect user experience
61
+ - **Performance Improvements**: Enhancements with user-visible benefits
62
+ - **Integration Work**: Connecting systems that affect user workflows
63
+ - **Data Changes**: Modifications affecting user data, reports, or analytics
64
+ - **Security Enhancements**: Changes affecting user authentication or permissions
65
+
66
+ ### Complexity Assessment Factors
67
+ For medium priority cases, execute user stories if ANY of these apply:
68
+ - **Scope**: Changes span multiple components or user touchpoints
69
+ - **Ambiguity**: Requirements have unclear aspects that stories could clarify
70
+ - **Risk**: High business impact or potential for misunderstanding
71
+ - **Stakeholders**: Multiple business stakeholders involved in requirements
72
+ - **Testing**: User acceptance testing will be required
73
+ - **Options**: Multiple valid implementation approaches exist
74
+
75
+ ### Skip Only For Simple Cases
76
+ - **Pure Refactoring**: Internal code improvements with zero user impact
77
+ - **Isolated Bug Fixes**: Simple, well-defined fixes with clear scope
78
+ - **Infrastructure Only**: Changes with no user-facing effects
79
+ - **Developer Tooling**: Build processes, CI/CD, or development environment changes
80
+ - **Documentation**: Updates that don't affect functionality
81
+
82
+ ### Default Decision Rule
83
+ **When in doubt, include user stories AND ask clarifying questions.** The overhead of creating comprehensive stories with proper clarification is typically outweighed by the benefits of:
84
+ - Clearer requirements understanding
85
+ - Better team alignment
86
+ - Improved testing criteria
87
+ - Enhanced stakeholder communication
88
+ - Reduced implementation risks
89
+ - Fewer costly changes during development
90
+ - Better user experience outcomes
91
+
92
+ ---
93
+
94
+ # PART 1: PLANNING
95
+
96
+ ## Step 1: Validate User Stories Need (MANDATORY)
97
+
98
+ **CRITICAL**: Before proceeding with user stories, perform this assessment:
99
+
100
+ ### Assessment Process
101
+ 1. **Analyze Request Context**:
102
+ - Review the original user request and requirements
103
+ - Identify user-facing vs internal-only changes
104
+ - Assess complexity and scope of the work
105
+ - Evaluate business stakeholder involvement
106
+
107
+ 2. **Apply Assessment Criteria**:
108
+ - Check against High Priority indicators (always execute)
109
+ - Evaluate Medium Priority factors (complexity-based decision)
110
+ - Confirm this isn't a simple case that should be skipped
111
+
112
+ 3. **Document Assessment Decision**:
113
+ - Create `aidlc-docs/inception/plans/user-stories-assessment.md`
114
+ - Include reasoning for why user stories are valuable for this request
115
+ - Reference specific assessment criteria that apply
116
+ - Explain expected benefits (clarity, testing, stakeholder alignment)
117
+
118
+ 4. **Proceed Only If Justified**:
119
+ - User stories must add clear value to the project
120
+ - Assessment must show concrete benefits outweigh overhead
121
+ - Decision should be defensible to project stakeholders
122
+
123
+ ### Assessment Documentation Template
124
+ ```markdown
125
+ # User Stories Assessment
126
+
127
+ ## Request Analysis
128
+ - **Original Request**: [Brief summary]
129
+ - **User Impact**: [Direct/Indirect/None]
130
+ - **Complexity Level**: [Simple/Medium/Complex]
131
+ - **Stakeholders**: [List involved parties]
132
+
133
+ ## Assessment Criteria Met
134
+ - [ ] High Priority: [List applicable criteria]
135
+ - [ ] Medium Priority: [List applicable criteria with complexity justification]
136
+ - [ ] Benefits: [Expected value from user stories]
137
+
138
+ ## Decision
139
+ **Execute User Stories**: [Yes/No]
140
+ **Reasoning**: [Detailed justification]
141
+
142
+ ## Expected Outcomes
143
+ - [List specific benefits user stories will provide]
144
+ - [How stories will improve project success]
145
+ ```
146
+
147
+ ## Step 2: Create Story Plan
148
+ - Assume the role of a product owner
149
+ - Generate a comprehensive plan with step-by-step execution checklist for story development
150
+ - Each step and sub-step should have a checkbox []
151
+ - Focus on methodology and approach for converting requirements into user stories
152
+
153
+ ## Step 3: Generate Context-Appropriate Questions
154
+ **DIRECTIVE**: Thoroughly analyze the requirements and context to identify ALL areas where clarification would improve story quality and team understanding. Be proactive in asking questions to ensure comprehensive user story development.
155
+
156
+ **CRITICAL**: Default to asking questions when there is ANY ambiguity or missing detail that could affect story quality. It's better to ask too many questions than to create incomplete or unclear stories.
157
+
158
+ **See `common/question-format-guide.md` for question formatting rules**
159
+
160
+ - Create a SEPARATE question file: `aidlc-docs/{workflow-id}/inception/user-stories/story-planning-questions.md`
161
+ - Do NOT embed questions in the story generation plan — questions and plans are always separate files
162
+ - Focus on ANY ambiguities, missing information, or areas needing clarification
163
+ - Generate questions wherever user input would improve story creation decisions
164
+ - **When in doubt, ask the question** - overconfidence leads to poor stories
165
+
166
+ **Question categories to evaluate** (consider ALL categories):
167
+ - **User Personas** - Ask about user types, roles, characteristics, and motivations
168
+ - **Story Granularity** - Ask about appropriate level of detail, story size, and breakdown approach
169
+ - **Story Format** - Ask about format preferences, template usage, and documentation standards
170
+ - **Breakdown Approach** - Ask about organization method, prioritization, and grouping strategies
171
+ - **Acceptance Criteria** - Ask about detail level, format, testing approach, and validation methods
172
+ - **User Journeys** - Ask about user workflows, interaction patterns, and experience flows
173
+ - **Business Context** - Ask about business goals, success metrics, and stakeholder needs
174
+ - **Technical Constraints** - Ask about technical limitations, integration requirements, and system boundaries
175
+
176
+ ## Step 4: Include Mandatory Story Artifacts in Plan
177
+ - **ALWAYS** include these mandatory artifacts in the story plan:
178
+ - [ ] Generate `stories.md` with user stories following INVEST criteria
179
+ - [ ] Generate `personas.md` with user archetypes and characteristics
180
+ - [ ] Ensure stories are Independent, Negotiable, Valuable, Estimable, Small, Testable
181
+ - [ ] Include acceptance criteria for each story (Gherkin Given/When/Then format)
182
+ - [ ] Include edge cases for non-trivial stories
183
+ - [ ] Map personas to relevant user stories
184
+ - [ ] **When units exist**: Generate individual story files in `inception/units/{UNIT-NNN-slug}/stories/` per-unit directories
185
+ - [ ] **When units skipped, > 5 stories**: Generate individual story files in `inception/user-stories/stories/` subdirectory
186
+
187
+ ### Story Naming Convention (MANDATORY)
188
+
189
+ All stories MUST use `S-NNN` IDs (zero-padded to three digits, sequential within the workflow). This is consistent with `U-NNN` for units and `BOLT-NNN` for bolts.
190
+
191
+ ### Story File Organization
192
+
193
+ Story placement depends on whether units exist:
194
+
195
+ **Per-unit (primary -- when units exist):**
196
+
197
+ Stories are placed in each unit's `stories/` subdirectory as individual files:
198
+
199
+ ```
200
+ aidlc-docs/{workflow-id}/inception/units/{UNIT-NNN-slug}/stories/
201
+ ├── S-001-{slug}.md
202
+ ├── S-002-{slug}.md
203
+ └── ...
204
+ ```
205
+
206
+ Project-wide personas always remain at:
207
+
208
+ ```
209
+ aidlc-docs/{workflow-id}/inception/user-stories/
210
+ ├── personas.md ← always here (project-wide)
211
+ ```
212
+
213
+ When stories are per-unit, no central `stories.md` index is created. Each unit brief's "Stories Assigned" table serves as the story index for that unit. The cross-unit story reference is maintained in `inception/units/unit-of-work-story-map.md`.
214
+
215
+ **Fallback (when units skipped):**
216
+
217
+ Stories fall back to the flat file structure:
218
+
219
+ ```
220
+ aidlc-docs/{workflow-id}/inception/user-stories/
221
+ ├── stories.md ← flat file, only when no units
222
+ ├── personas.md ← always here
223
+ ```
224
+
225
+ **<= 5 stories (fallback only)**: All stories go in `stories.md` using the inline template below. No individual files needed.
226
+
227
+ **> 5 stories (fallback only)**: `stories.md` becomes a **summary index** and individual story files are created in `inception/user-stories/stories/`.
228
+
229
+ ### Stories Index Template (stories.md)
230
+
231
+ When individual files exist (> 5 stories), `stories.md` serves as the overview:
232
+
233
+ ```markdown
234
+ # User Stories
235
+
236
+ Total: {N} stories | Must: {n} | Should: {n} | Could: {n}
237
+
238
+ | ID | Title | Persona | Priority | Status | Dependencies |
239
+ |----|-------|---------|----------|--------|--------------|
240
+ | S-001 | {title} | {persona} | must | draft | None |
241
+ | S-002 | {title} | {persona} | should | draft | Requires S-001 |
242
+ ```
243
+
244
+ When all stories are inline (<= 5 stories), `stories.md` contains the full story details using the inline template below.
245
+
246
+ ### Inline Story Template (MANDATORY for <= 5 stories)
247
+
248
+ Each story in `stories.md` MUST follow this structure:
249
+
250
+ ```markdown
251
+ ### S-NNN: {Story Title}
252
+
253
+ **Persona**: {persona name from personas.md}
254
+ **Priority**: {must | should | could}
255
+
256
+ > As a **{persona}**, I want **{capability}**, so that **{benefit}**.
257
+
258
+ #### Acceptance Criteria
259
+ - **Given** {precondition}, **when** {action}, **then** {expected result}
260
+ - **Given** {precondition}, **when** {action}, **then** {expected result}
261
+
262
+ #### Edge Cases
263
+ | Scenario | Expected Behavior |
264
+ |----------|-------------------|
265
+ | {edge case} | {what should happen} |
266
+
267
+ #### Dependencies
268
+ - Requires: {S-NNN or "None"}
269
+ - Enables: {S-NNN or "None"}
270
+ ```
271
+
272
+ ### Individual Story File Template (MANDATORY for per-unit stories; also used for > 5 stories in fallback mode)
273
+
274
+ **Path (per-unit)**: `aidlc-docs/{workflow-id}/inception/units/{UNIT-NNN-slug}/stories/{S-NNN}-{slug}.md`
275
+ **Path (fallback)**: `aidlc-docs/{workflow-id}/inception/user-stories/stories/{S-NNN}-{slug}.md`
276
+
277
+ ```markdown
278
+ ---
279
+ id: "S-NNN"
280
+ unit: "{UNIT-NNN-slug or unassigned}"
281
+ title: "{Story Title}"
282
+ persona: "{persona name}"
283
+ priority: "{must|should|could}"
284
+ status: "draft"
285
+ created: "{ISO-8601}"
286
+ ---
287
+
288
+ # S-NNN: {Story Title}
289
+
290
+ > As a **{persona}**, I want **{capability}**, so that **{benefit}**.
291
+
292
+ ## Acceptance Criteria
293
+ - **Given** {precondition}, **when** {action}, **then** {expected result}
294
+ - **Given** {precondition}, **when** {action}, **then** {expected result}
295
+
296
+ ## Edge Cases
297
+ | Scenario | Expected Behavior |
298
+ |----------|-------------------|
299
+ | {edge case} | {what should happen} |
300
+
301
+ ## Dependencies
302
+ - Requires: {S-NNN or "None"}
303
+ - Enables: {S-NNN or "None"}
304
+
305
+ ## Technical Notes
306
+ {Optional — implementation hints, API considerations, or constraints
307
+ relevant to this story. Omit if not needed.}
308
+ ```
309
+
310
+ ### Story Rules
311
+
312
+ - Every story MUST have at least one Given/When/Then acceptance criterion
313
+ - Edge Cases table is MANDATORY for stories with priority `must`, optional for `should`/`could`
314
+ - Dependencies track inter-story ordering — use "None" when the story is independent
315
+ - Priority uses MoSCoW: `must` (required), `should` (important), `could` (nice-to-have)
316
+ - Individual story files include YAML frontmatter with `status` and `unit` fields for traceability
317
+ - The `unit` field links to the parent unit (set to the unit slug when per-unit, `unassigned` when units were skipped)
318
+ - When per-unit stories are used, no central `stories.md` index is created. Each unit brief's "Stories Assigned" table serves as the story index for that unit. The cross-unit story reference is maintained in `inception/units/unit-of-work-story-map.md`
319
+ - When individual files exist in fallback mode, `stories.md` MUST be kept in sync as the index
320
+
321
+ ## Step 5: Present Story Options
322
+ - Include different approaches for story breakdown in the plan document:
323
+ - **User Journey-Based**: Stories follow user workflows and interactions
324
+ - **Feature-Based**: Stories organized around system features and capabilities
325
+ - **Persona-Based**: Stories grouped by different user types and their needs
326
+ - **Domain-Based**: Stories organized around business domains or contexts
327
+ - **Epic-Based**: Stories structured as hierarchical epics with sub-stories
328
+ - Explain trade-offs and benefits of each approach
329
+ - Allow for hybrid approaches with clear decision criteria
330
+
331
+ ## Step 6: Store Story Plan
332
+ - Save the story plan in `aidlc-docs/{workflow-id}/inception/plans/story-generation-plan.md`
333
+ - The plan contains: overview, personas, execution steps, mandatory artifacts, story approach options
334
+ - Do NOT include questions in this file — questions are in the separate `story-planning-questions.md`
335
+ - Ensure plan is comprehensive and covers all story development aspects
336
+
337
+ ## Step 7: Request User Input
338
+ - Ask user to fill in all [Answer]: tags in the questions file (`story-planning-questions.md`)
339
+ - Emphasize importance of audit trail and decision documentation
340
+ - Provide clear instructions on how to fill in the [Answer]: tags
341
+ - Explain that all questions must be answered before proceeding
342
+
343
+ ## Step 8: Collect Answers
344
+ - Wait for user to provide answers to all questions using [Answer]: tags in the document
345
+ - Do not proceed until ALL [Answer]: tags are completed
346
+ - Review the document to ensure no [Answer]: tags are left blank
347
+
348
+ ## Step 9: ANALYZE ANSWERS (MANDATORY)
349
+ Before proceeding, you MUST carefully review all user answers for:
350
+ - **Vague or ambiguous responses**: "mix of", "somewhere between", "not sure", "depends", "maybe", "probably"
351
+ - **Undefined criteria or terms**: References to concepts without clear definitions
352
+ - **Contradictory answers**: Responses that conflict with each other
353
+ - **Missing generation details**: Answers that lack specific guidance for implementation
354
+ - **Answers that combine options**: Responses that merge different approaches without clear decision rules
355
+ - **Incomplete explanations**: Answers that reference external factors without defining them
356
+ - **Assumption-based responses**: Answers that assume knowledge not explicitly stated
357
+
358
+ ## Step 10: MANDATORY Follow-up Questions
359
+ If the analysis in step 9 reveals ANY ambiguous answers, you MUST:
360
+ - Create a separate clarification questions file using [Answer]: tags
361
+ - DO NOT proceed to approval until ALL ambiguities are completely resolved
362
+ - **CRITICAL**: Be thorough - ask follow-up questions for every unclear response
363
+ - Examples of required follow-ups:
364
+ - "You mentioned 'mix of A and B' - what specific criteria should determine when to use A vs B?"
365
+ - "You said 'somewhere between A and B' - can you define the exact middle ground approach?"
366
+ - "You indicated 'not sure' - what additional information would help you decide?"
367
+ - "You mentioned 'depends on complexity' - how do you define complexity levels and thresholds?"
368
+ - "You chose 'hybrid approach' - what are the specific rules for when to use each method?"
369
+ - "You said 'probably X' - what factors would make it definitely X vs definitely not X?"
370
+ - "You referenced 'standard practice' - can you define what that standard practice is?"
371
+
372
+ ## Step 11: MANDATORY: Consolidate Answers Into Plan
373
+
374
+ **See `common/question-format-guide.md` Post-Answer Consolidation rules**
375
+
376
+ After all answers are collected and ambiguities resolved, you MUST update the story generation plan file:
377
+ 1. Read all finalized answers from `story-planning-questions.md`
378
+ 2. Add a "Finalized Approach" section to `story-generation-plan.md` that synthesizes the user's decisions:
379
+ - Story organization approach (with rationale from user's choice)
380
+ - Acceptance criteria format
381
+ - Priority system
382
+ - Persona decisions
383
+ - Any other methodology decisions from the Q&A
384
+ 3. Update the execution steps if needed to reflect the chosen approach
385
+ 4. The plan file must be self-contained — readable without cross-referencing the questions file
386
+ 5. **Do NOT present for approval until the plan file contains the finalized approach**
387
+
388
+ ## Step 12: Avoid Implementation Details
389
+ - Focus on story creation methodology, not prioritization or development tasks
390
+ - Do not discuss technical generation at this stage
391
+ - Avoid creating development timelines or sprint planning
392
+ - Keep focus on story structure and format decisions
393
+
394
+ ## Step 13: Log Approval Prompt
395
+ - Before asking for approval, log the prompt with timestamp in `aidlc-docs/audit.md`
396
+ - Include the complete approval prompt text
397
+ - Use ISO 8601 timestamp format
398
+
399
+ ## Step 14: Wait for Explicit Approval of Plan
400
+ - Do not proceed until the user explicitly approves the story approach
401
+ - Approval must be clear and unambiguous
402
+ - If user requests changes, update the plan and repeat the approval process
403
+
404
+ ## Step 15: Record Approval Response
405
+ - Log the user's approval response with timestamp in `aidlc-docs/audit.md`
406
+ - Include the exact user response text
407
+ - Mark the approval status clearly
408
+
409
+ ---
410
+
411
+ # PART 2: GENERATION
412
+
413
+ ## Step 16: Load Story Generation Plan
414
+ - [ ] Read the complete story plan from `aidlc-docs/{workflow-id}/inception/plans/story-generation-plan.md`
415
+ - [ ] Identify the next uncompleted step (first [ ] checkbox)
416
+ - [ ] Load the context and requirements for that step
417
+
418
+ ## Step 17: Execute Current Step
419
+ - [ ] Perform exactly what the current step describes
420
+ - [ ] Generate story artifacts as specified in the plan
421
+ - [ ] Follow the approved methodology and format from Planning
422
+ - [ ] Use the story breakdown approach specified in the plan
423
+
424
+ ## Step 18: MANDATORY: Update Progress
425
+ - [ ] Mark the completed step as [x] in the story generation plan
426
+ - [ ] **MANDATORY**: Update `aidlc-docs/{workflow-id}/aidlc-state.md` current status
427
+ - [ ] **MANDATORY**: Update `aidlc-docs/{workflow-id}/checkpoint.json` current status
428
+ - [ ] Save all generated artifacts
429
+ - **Do NOT proceed without completing state updates**
430
+
431
+ ## Step 19: Continue or Complete Generation
432
+ - [ ] If more steps remain, return to Step 16
433
+ - [ ] If all steps complete, verify stories are ready for next stage
434
+ - [ ] Ensure all mandatory artifacts are generated
435
+
436
+ ## Step 20: Log Approval Prompt
437
+ - Before asking for approval, log the prompt with timestamp in `aidlc-docs/audit.md`
438
+ - Include the complete approval prompt text
439
+ - Use ISO 8601 timestamp format
440
+
441
+ ### MANDATORY: Post-Generation Consistency Validation
442
+
443
+ After the agent generates story artifacts (per-unit story files or fallback stories.md) and personas.md, the orchestrator MUST validate before presenting to the user:
444
+
445
+ 1. **Load decision registry**: Read `aidlc-docs/{workflow-id}/inception/decisions.md` if it exists
446
+ 2. **Verify acceptance criteria paths**: Grep stories for file path references. All paths must match decisions in requirements.md BRs
447
+ 3. **Verify naming conventions**: Grep stories for ID formats (bolt IDs, unit IDs). All must match agreed conventions
448
+ 4. **Verify state references**: Grep stories for lifecycle state names. All must match agreed state machine
449
+ 5. **Cross-reference story count**: Verify persona count matches the approved plan
450
+ 6. **Fix any violations** before presenting for user review
451
+ 7. **Log validation results** in audit.md
452
+
453
+ ## Step 21: Present Completion Message
454
+ - Present completion message in this structure:
455
+ 1. **Completion Announcement** (mandatory): Always start with this:
456
+
457
+ ```markdown
458
+ # 📚 User Stories Complete
459
+ ```
460
+
461
+ 2. **AI Summary** (optional): Provide structured bullet-point summary of generated stories
462
+ - Format: "User stories generation has created [description]:"
463
+ - List key personas generated (bullet points)
464
+ - List user stories created with counts and organization
465
+ - Mention story structure and compliance (INVEST criteria, acceptance criteria)
466
+ - DO NOT include workflow instructions ("please review", "let me know", "proceed to next phase", "before we proceed")
467
+ - Keep factual and content-focused
468
+ 3. **Formatted Workflow Message** (mandatory): Always end with this exact format:
469
+
470
+ ```markdown
471
+ ---
472
+
473
+ ⚠️ **REVIEW REQUIRED**
474
+
475
+ > Please examine the user stories and personas at:
476
+ > Per-unit stories: `aidlc-docs/{workflow-id}/inception/units/{UNIT-NNN-slug}/stories/`
477
+ > Fallback stories: `aidlc-docs/{workflow-id}/inception/user-stories/stories.md`
478
+ > Personas: `aidlc-docs/{workflow-id}/inception/user-stories/personas.md`
479
+
480
+ **You may:**
481
+ - 🔧 **Request Changes** — Ask for modifications to the stories or personas based on your review
482
+ - ➕ **Add Skipped Stage** — Include a previously excluded stage in the workflow
483
+ - ✅ **Approve & Continue** — Approve user stories and proceed to **Bolt Planning**
484
+
485
+ ---
486
+ ```
487
+
488
+ ## Step 22: Wait for Explicit Approval of Generated Stories
489
+ - Do not proceed until the user explicitly approves the generated stories
490
+ - Approval must be clear and unambiguous
491
+ - If user requests changes, update stories and repeat the approval process
492
+
493
+ ## Step 23: Record Approval Response
494
+ - Log the user's approval response with timestamp in `aidlc-docs/audit.md`
495
+ - Include the exact user response text
496
+ - Mark the approval status clearly
497
+
498
+ ## Step 24: MANDATORY: Update State Tracking
499
+ - **MANDATORY**: Update BOTH state files in the SAME interaction:
500
+ 1. Mark User Stories stage complete in `aidlc-docs/{workflow-id}/aidlc-state.md`
501
+ 2. Update `aidlc-docs/{workflow-id}/checkpoint.json` — set user-stories status to "completed" with completed_at timestamp, update current_inception_stage to next stage
502
+ - **Do NOT proceed to the next stage without completing this step**
503
+
504
+ ---
505
+
506
+ # CRITICAL RULES
507
+
508
+ ## Planning Phase Rules
509
+ - **CONTEXT-APPROPRIATE QUESTIONS**: Only ask questions relevant to this specific context
510
+ - **MANDATORY ANSWER ANALYSIS**: Always analyze answers for ambiguities before proceeding
511
+ - **NO PROCEEDING WITH AMBIGUITY**: Must resolve all vague answers before generation
512
+ - **EXPLICIT APPROVAL REQUIRED**: User must approve plan before generation starts
513
+
514
+ ## Generation Phase Rules
515
+ - **NO HARDCODED LOGIC**: Only execute what's written in the story generation plan
516
+ - **FOLLOW PLAN EXACTLY**: Do not deviate from the step sequence
517
+ - **UPDATE CHECKBOXES**: Mark [x] immediately after completing each step
518
+ - **USE APPROVED METHODOLOGY**: Follow the story approach from Planning
519
+ - **VERIFY COMPLETION**: Ensure all story artifacts are complete before proceeding
520
+
521
+ ## Completion Criteria
522
+ - All planning questions answered and ambiguities resolved
523
+ - Story plan explicitly approved by user
524
+ - All steps in story generation plan marked [x]
525
+ - All story artifacts generated according to plan (per-unit story files or fallback stories.md, plus personas.md)
526
+ - Generated stories explicitly approved by user
527
+ - Stories verified and ready for next stage