agileflow 2.77.0 → 2.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/README.md +3 -3
  2. package/package.json +6 -1
  3. package/scripts/agileflow-configure.js +174 -2
  4. package/scripts/agileflow-statusline.sh +171 -78
  5. package/scripts/agileflow-welcome.js +79 -2
  6. package/scripts/damage-control-bash.js +232 -0
  7. package/scripts/damage-control-edit.js +243 -0
  8. package/scripts/damage-control-write.js +243 -0
  9. package/src/core/agents/accessibility.md +124 -53
  10. package/src/core/agents/adr-writer.md +192 -52
  11. package/src/core/agents/analytics.md +139 -60
  12. package/src/core/agents/api.md +173 -63
  13. package/src/core/agents/ci.md +139 -57
  14. package/src/core/agents/compliance.md +159 -68
  15. package/src/core/agents/configuration/damage-control.md +356 -0
  16. package/src/core/agents/database.md +162 -61
  17. package/src/core/agents/datamigration.md +179 -66
  18. package/src/core/agents/design.md +179 -57
  19. package/src/core/agents/devops.md +160 -3
  20. package/src/core/agents/documentation.md +204 -60
  21. package/src/core/agents/epic-planner.md +147 -55
  22. package/src/core/agents/integrations.md +197 -69
  23. package/src/core/agents/mentor.md +158 -57
  24. package/src/core/agents/mobile.md +159 -67
  25. package/src/core/agents/monitoring.md +154 -65
  26. package/src/core/agents/multi-expert.md +115 -43
  27. package/src/core/agents/orchestrator.md +77 -24
  28. package/src/core/agents/performance.md +130 -75
  29. package/src/core/agents/product.md +151 -55
  30. package/src/core/agents/qa.md +162 -74
  31. package/src/core/agents/readme-updater.md +178 -76
  32. package/src/core/agents/refactor.md +148 -95
  33. package/src/core/agents/research.md +143 -72
  34. package/src/core/agents/security.md +154 -65
  35. package/src/core/agents/testing.md +176 -97
  36. package/src/core/agents/ui.md +170 -79
  37. package/src/core/commands/adr/list.md +171 -0
  38. package/src/core/commands/adr/update.md +235 -0
  39. package/src/core/commands/adr/view.md +252 -0
  40. package/src/core/commands/adr.md +207 -50
  41. package/src/core/commands/agent.md +16 -0
  42. package/src/core/commands/assign.md +148 -44
  43. package/src/core/commands/auto.md +18 -1
  44. package/src/core/commands/babysit.md +361 -36
  45. package/src/core/commands/baseline.md +14 -0
  46. package/src/core/commands/blockers.md +170 -51
  47. package/src/core/commands/board.md +144 -66
  48. package/src/core/commands/changelog.md +15 -0
  49. package/src/core/commands/ci.md +179 -69
  50. package/src/core/commands/compress.md +18 -0
  51. package/src/core/commands/configure.md +16 -0
  52. package/src/core/commands/context/export.md +193 -4
  53. package/src/core/commands/context/full.md +191 -18
  54. package/src/core/commands/context/note.md +248 -4
  55. package/src/core/commands/debt.md +17 -0
  56. package/src/core/commands/deploy.md +208 -65
  57. package/src/core/commands/deps.md +15 -0
  58. package/src/core/commands/diagnose.md +16 -0
  59. package/src/core/commands/docs.md +196 -64
  60. package/src/core/commands/epic/list.md +170 -0
  61. package/src/core/commands/epic/view.md +242 -0
  62. package/src/core/commands/epic.md +192 -69
  63. package/src/core/commands/feedback.md +191 -71
  64. package/src/core/commands/handoff.md +162 -48
  65. package/src/core/commands/help.md +9 -0
  66. package/src/core/commands/ideate.md +446 -0
  67. package/src/core/commands/impact.md +16 -0
  68. package/src/core/commands/metrics.md +141 -37
  69. package/src/core/commands/multi-expert.md +77 -0
  70. package/src/core/commands/packages.md +16 -0
  71. package/src/core/commands/pr.md +161 -67
  72. package/src/core/commands/readme-sync.md +16 -0
  73. package/src/core/commands/research/analyze.md +568 -0
  74. package/src/core/commands/research/ask.md +345 -20
  75. package/src/core/commands/research/import.md +562 -19
  76. package/src/core/commands/research/list.md +173 -5
  77. package/src/core/commands/research/view.md +181 -8
  78. package/src/core/commands/retro.md +135 -48
  79. package/src/core/commands/review.md +219 -47
  80. package/src/core/commands/session/end.md +209 -0
  81. package/src/core/commands/session/history.md +210 -0
  82. package/src/core/commands/session/init.md +116 -0
  83. package/src/core/commands/session/new.md +296 -0
  84. package/src/core/commands/session/resume.md +166 -0
  85. package/src/core/commands/session/status.md +166 -0
  86. package/src/core/commands/skill/create.md +115 -17
  87. package/src/core/commands/skill/delete.md +117 -0
  88. package/src/core/commands/skill/edit.md +104 -0
  89. package/src/core/commands/skill/list.md +128 -0
  90. package/src/core/commands/skill/test.md +135 -0
  91. package/src/core/commands/skill/upgrade.md +542 -0
  92. package/src/core/commands/sprint.md +17 -1
  93. package/src/core/commands/status.md +133 -21
  94. package/src/core/commands/story/list.md +176 -0
  95. package/src/core/commands/story/view.md +265 -0
  96. package/src/core/commands/story-validate.md +101 -1
  97. package/src/core/commands/story.md +204 -51
  98. package/src/core/commands/template.md +16 -1
  99. package/src/core/commands/tests.md +226 -64
  100. package/src/core/commands/update.md +17 -1
  101. package/src/core/commands/validate-expertise.md +16 -0
  102. package/src/core/commands/velocity.md +140 -36
  103. package/src/core/commands/verify.md +14 -0
  104. package/src/core/commands/whats-new.md +30 -0
  105. package/src/core/skills/_learnings/README.md +91 -0
  106. package/src/core/skills/_learnings/_template.yaml +106 -0
  107. package/src/core/skills/_learnings/commit.yaml +69 -0
  108. package/src/core/templates/damage-control-patterns.yaml +234 -0
  109. package/src/core/templates/skill-template.md +53 -11
  110. package/tools/cli/commands/start.js +180 -0
  111. package/tools/cli/tui/Dashboard.js +66 -0
  112. package/tools/cli/tui/StoryList.js +69 -0
  113. package/tools/cli/tui/index.js +16 -0
@@ -1,9 +1,26 @@
1
1
  ---
2
2
  description: Create an Architecture Decision Record
3
3
  argument-hint: NUMBER=<4-digit> TITLE=<text> CONTEXT=<text> DECISION=<text> CONSEQUENCES=<text> [LINKS=<text>]
4
+ compact_context:
5
+ priority: medium
6
+ preserve_rules:
7
+ - "NUMBER is REQUIRED - must be 4-digit sequentially (0001, 0002, etc.)"
8
+ - "TITLE, CONTEXT, DECISION, CONSEQUENCES all REQUIRED"
9
+ - "Create ADR file in docs/03-decisions/adr-<NUMBER>-<slug>.md"
10
+ - "Always show preview FIRST, wait for YES/NO confirmation BEFORE writing"
11
+ - "Document BOTH positive and negative consequences"
12
+ - "Keep ADRs concise: 1-2 pages max"
13
+ - "Link related ADRs and stories in Related section"
14
+ - "Use template from @packages/cli/src/core/templates/adr-template.md"
15
+ state_fields:
16
+ - adr_number
17
+ - adr_title
18
+ - context
19
+ - decision
20
+ - consequences
4
21
  ---
5
22
 
6
- # adr-new
23
+ # adr
7
24
 
8
25
  Create a new Architecture Decision Record.
9
26
 
@@ -14,35 +31,56 @@ node .agileflow/scripts/obtain-context.js adr
14
31
  ```
15
32
 
16
33
  <!-- COMPACT_SUMMARY_START -->
17
- ## Compact Summary
18
34
 
19
- **Command**: `adr` - Create Architecture Decision Records (ADRs) documenting architectural choices
35
+ ## ⚠️ COMPACT SUMMARY - /agileflow:adr IS ACTIVE
20
36
 
21
- **Quick Usage**:
22
- ```
23
- /agileflow:adr NUMBER=0042 TITLE="Use PostgreSQL for persistence" CONTEXT="Need reliable ACID database" DECISION="PostgreSQL chosen over MongoDB" CONSEQUENCES="Better data integrity, steeper learning curve"
24
- ```
37
+ **CRITICAL**: You are creating Architecture Decision Records (ADRs) that document architectural choices made in the project.
25
38
 
26
- **What It Does**: Parse inputs → Create ADR file → Show preview → Write if approved
39
+ **ROLE**: ADR Writer
27
40
 
28
- ### Tool Usage Examples
41
+ ---
29
42
 
30
- **TodoWrite** (to track ADR creation):
31
- ```xml
32
- <invoke name="TodoWrite">
33
- <parameter name="content">1. Parse inputs (NUMBER, TITLE, CONTEXT, DECISION, CONSEQUENCES, LINKS)
34
- 2. Create docs/03-decisions/adr-<NUMBER>-<slug>.md from template
35
- 3. Show preview and wait for YES/NO confirmation</parameter>
36
- <parameter name="status">in-progress</parameter>
37
- <parameter name="activeForm">1</parameter>
38
- </invoke>
39
- ```
43
+ ### 🚨 RULE #1: ALL INPUTS REQUIRED
40
44
 
41
- **Write** (to create ADR file):
42
- ```xml
43
- <invoke name="Write">
44
- <parameter name="file_path">/full/path/to/docs/03-decisions/adr-0042-postgresql.md</parameter>
45
- <parameter name="content">---
45
+ Always require these inputs. Ask if missing:
46
+
47
+ | Input | Required? | Example |
48
+ |-------|-----------|---------|
49
+ | NUMBER | YES | `NUMBER=0042` (4-digit, sequential) |
50
+ | TITLE | YES | `TITLE="Use PostgreSQL for persistence"` |
51
+ | CONTEXT | YES | `CONTEXT="Need reliable ACID database..."` |
52
+ | DECISION | YES | `DECISION="PostgreSQL chosen over MongoDB"` |
53
+ | CONSEQUENCES | YES | `CONSEQUENCES="Better integrity, learning curve"` |
54
+ | LINKS | NO | `LINKS="ADR-0041, US-0055"` |
55
+
56
+ ❌ WRONG: Create ADR without CONTEXT or DECISION
57
+ ✅ RIGHT: Ask for missing inputs, then proceed
58
+
59
+ ---
60
+
61
+ ### 🚨 RULE #2: SEQUENTIAL NUMBERING
62
+
63
+ ADRs MUST be numbered sequentially (0001, 0002, 0003, etc.):
64
+
65
+ 1. Check existing ADRs in docs/03-decisions/
66
+ 2. Find highest number (e.g., 0041)
67
+ 3. Next ADR should be 0042
68
+ 4. Never skip numbers or reuse numbers
69
+
70
+ ❌ WRONG: Create ADR-0100 when only 0042 exists
71
+ ✅ RIGHT: Find next sequential number and use it
72
+
73
+ ---
74
+
75
+ ### 🚨 RULE #3: ADR FILE STRUCTURE
76
+
77
+ Create file at: `docs/03-decisions/adr-<NUMBER>-<slug>.md`
78
+
79
+ Example: `docs/03-decisions/adr-0042-postgresql.md`
80
+
81
+ Use template from `@packages/cli/src/core/templates/adr-template.md`:
82
+ ```markdown
83
+ ---
46
84
  number: 0042
47
85
  title: Use PostgreSQL for persistence
48
86
  date: 2025-12-22
@@ -53,42 +91,112 @@ tags: [database, architecture]
53
91
  # ADR-0042: Use PostgreSQL for persistence
54
92
 
55
93
  ## Context
56
- We need a reliable database with ACID guarantees for user data...
94
+ [Why this decision - explain the problem/constraints]
57
95
 
58
96
  ## Decision
59
- We will use PostgreSQL as our primary database...
97
+ [What was chosen and why - be specific]
60
98
 
61
99
  ## Consequences
62
- - Better data integrity and reliability
63
- - Team needs PostgreSQL training
64
- - Slightly higher operational complexity than NoSQL
100
+ ### Positive
101
+ - Better data integrity
102
+ - ACID guarantees
103
+
104
+ ### Negative
105
+ - Team needs training
106
+ - Operational complexity
65
107
 
66
108
  ## Related
67
- - [ADR-0041: Database selection process](adr-0041-db-selection.md)
68
- - [US-0055: Database migration](../06-stories/US-0055.md)</parameter>
69
- </invoke>
109
+ - [ADR-0041](adr-0041-db-selection.md)
110
+ - [US-0055](../06-stories/US-0055.md)
70
111
  ```
71
112
 
72
- **AskUserQuestion** (for confirmation):
73
- ```xml
74
- <invoke name="AskUserQuestion">
75
- <parameter name="questions">[{"question": "Create this ADR?", "header": "Preview", "multiSelect": false, "options": [{"label": "Yes, create ADR", "description": "Write ADR-0042 to docs/03-decisions/"}, {"label": "No, abort", "description": "Cancel without creating"}]}]</parameter>
76
- </invoke>
77
- ```
113
+ ---
114
+
115
+ ### 🚨 RULE #4: CONTEXT BEFORE DECISION
116
+
117
+ **ALWAYS explain the "why" in Context section:**
118
+
119
+ ❌ WRONG: "We use PostgreSQL because it's good"
120
+ ✅ RIGHT: "Need ACID guarantees for financial transactions. Considered MongoDB (eventual consistency risk), Redis (in-memory limits). PostgreSQL best fit for requirements."
121
+
122
+ Good context helps future readers understand the trade-offs.
123
+
124
+ ---
125
+
126
+ ### 🚨 RULE #5: DOCUMENT BOTH POSITIVE AND NEGATIVE
127
+
128
+ **ALWAYS document consequences honestly:**
129
+
130
+ | Type | Examples |
131
+ |------|----------|
132
+ | **Positive** | Performance, maintenance, guarantees |
133
+ | **Negative** | Learning curve, cost, migration effort |
78
134
 
79
- **Template Structure**:
80
- - Frontmatter (number, title, date, status, tags)
81
- - Context section (why decision needed)
82
- - Decision section (what was chosen)
83
- - Consequences section (trade-offs and impacts)
84
- - Optional links to related docs
135
+ Both are important - readers need full trade-off picture.
85
136
 
86
- **Best Practices**:
87
- - Number ADRs sequentially (0001, 0002, etc.)
88
- - Write context before decision (explain the "why")
89
- - Document both positive and negative consequences
90
- - Keep concise (1-2 pages max)
91
- - Link related ADRs and stories
137
+ ---
138
+
139
+ ### 🚨 RULE #6: DIFF-FIRST, YES/NO PATTERN
140
+
141
+ **ALWAYS follow this pattern:**
142
+
143
+ 1. Generate ADR content (don't write yet)
144
+ 2. Show preview/diff to user
145
+ 3. Ask: "Create this ADR? (YES/NO)"
146
+ 4. Only write file if user says YES
147
+
148
+ ---
149
+
150
+ ### ANTI-PATTERNS (DON'T DO THESE)
151
+
152
+ ❌ Create ADR with only DECISION (no CONTEXT)
153
+ ❌ Reuse or skip ADR numbers
154
+ ❌ Write vague consequences ("pros and cons")
155
+ ❌ Create multi-page ADRs (keep concise)
156
+ ❌ Write ADR without showing preview
157
+ ❌ Document only positive consequences
158
+
159
+ ### DO THESE INSTEAD
160
+
161
+ ✅ Explain CONTEXT (the "why") thoroughly
162
+ ✅ Use sequential numbering
163
+ ✅ Document positive AND negative consequences
164
+ ✅ Keep to 1-2 pages max
165
+ ✅ Show preview before creating
166
+ ✅ Honest about trade-offs
167
+
168
+ ---
169
+
170
+ ### WORKFLOW
171
+
172
+ 1. **Input Validation**: Ensure all inputs (ask if missing)
173
+ 2. **Check Number**: Verify next sequential ADR
174
+ 3. **Generate ADR**: Create from template
175
+ 4. **Show Preview**: Display to user
176
+ 5. **Confirm**: Ask "Create this ADR? (YES/NO)"
177
+ 6. **Write**: Only if approved
178
+ 7. **Done**: Show success message
179
+
180
+ ---
181
+
182
+ ### KEY FILES TO REMEMBER
183
+
184
+ | File | Purpose |
185
+ |------|---------|
186
+ | `docs/03-decisions/adr-<NUMBER>-<slug>.md` | ADR file location |
187
+ | `@packages/cli/src/core/templates/adr-template.md` | ADR template |
188
+
189
+ ---
190
+
191
+ ### REMEMBER AFTER COMPACTION
192
+
193
+ - `/agileflow:adr` IS ACTIVE - creating ADRs
194
+ - All inputs required (NUMBER, TITLE, CONTEXT, DECISION, CONSEQUENCES)
195
+ - NUMBER must be sequential 4-digit
196
+ - Always explain CONTEXT (the "why")
197
+ - Document positive AND negative consequences
198
+ - Keep 1-2 pages max
199
+ - Show preview, wait for YES/NO before writing
92
200
 
93
201
  <!-- COMPACT_SUMMARY_END -->
94
202
 
@@ -120,3 +228,52 @@ ACTIONS
120
228
  2) Create docs/03-decisions/adr-<NUMBER>-<slug>.md from template
121
229
  3) Show diff and wait for YES/NO confirmation
122
230
  4) Write file if approved
231
+
232
+ ---
233
+
234
+ ## POST-CREATION ACTIONS
235
+
236
+ After successfully creating the ADR, offer next steps:
237
+
238
+ ```xml
239
+ <invoke name="AskUserQuestion">
240
+ <parameter name="questions">[{
241
+ "question": "ADR-<NUMBER> created! What would you like to do next?",
242
+ "header": "Next Steps",
243
+ "multiSelect": false,
244
+ "options": [
245
+ {"label": "Create implementation stories (Recommended)", "description": "Turn this decision into actionable work"},
246
+ {"label": "Link to existing research", "description": "Connect to research that led to this decision"},
247
+ {"label": "Create another ADR", "description": "Document another architecture decision"},
248
+ {"label": "View all ADRs", "description": "See full list with /agileflow:adr:list"}
249
+ ]
250
+ }]</parameter>
251
+ </invoke>
252
+ ```
253
+
254
+ **If "Create implementation stories"**:
255
+ 1. Analyze the ADR's decision and consequences
256
+ 2. Suggest potential stories/epic based on the decision
257
+ 3. If confirmed, run `/agileflow:epic` or `/agileflow:story`
258
+
259
+ **If "Link to existing research"**:
260
+ 1. Run `/agileflow:research:list` to show available research
261
+ 2. Select research note
262
+ 3. Add reference to ADR: `**Research**: See [Research Title](../10-research/...)`
263
+
264
+ **If "Create another ADR"**:
265
+ - Re-run `/agileflow:adr` with next number
266
+
267
+ **If "View all ADRs"**:
268
+ - Run `/agileflow:adr:list`
269
+
270
+ ---
271
+
272
+ ## Related Commands
273
+
274
+ - `/agileflow:adr:list` - View all ADRs with status
275
+ - `/agileflow:adr:view` - View ADR details with contextual actions
276
+ - `/agileflow:adr:update` - Update ADR status
277
+ - `/agileflow:research:analyze` - Analyze research that may lead to ADR
278
+ - `/agileflow:epic` - Create implementation epic
279
+ - `/agileflow:story` - Create implementation story
@@ -1,6 +1,22 @@
1
1
  ---
2
2
  description: Onboard a new agent with profile and contract
3
3
  argument-hint: AGENT_ID=<id> ROLE=<role> [TOOLS=<list>] [SCOPE=<dirs>]
4
+ compact_context:
5
+ priority: high
6
+ preserve_rules:
7
+ - "ACTIVE COMMAND: /agileflow:agent - Agent onboarding with profiles and contracts"
8
+ - "CRITICAL: Create agent profile markdown file at docs/02-practices/prompts/agents/agent-{AGENT_ID}.md"
9
+ - "CRITICAL: Update roster.yaml at docs/09-agents/roster.yaml with agent metadata"
10
+ - "MUST include System Prompt (contract) with scope boundaries, commit rules, test requirements"
11
+ - "MUST use diff-first approach: show preview, get YES/NO confirmation before writing"
12
+ - "Agent IDs must be descriptive (AG-UI, AG-API, AG-CI) not generic (AG-001)"
13
+ - "Profile includes: role, tools, scope directories, story tags, contract rules"
14
+ state_fields:
15
+ - agent_id
16
+ - role
17
+ - tools_list
18
+ - scope_directories
19
+ - scope_story_tags
4
20
  ---
5
21
 
6
22
  # agent-new
@@ -1,6 +1,22 @@
1
1
  ---
2
2
  description: Assign or reassign a story to an owner
3
3
  argument-hint: STORY=<US-ID> NEW_OWNER=<id> [NEW_STATUS=<status>] [NOTE=<text>]
4
+ compact_context:
5
+ priority: high
6
+ preserve_rules:
7
+ - "ACTIVE COMMAND: /agileflow:assign - Story assigner and owner changer"
8
+ - "MUST update story frontmatter (owner, status, updated timestamp)"
9
+ - "MUST update docs/09-agents/status.json using jq or Edit tool"
10
+ - "MUST validate JSON after modification"
11
+ - "MUST append assign event to docs/09-agents/bus/log.jsonl"
12
+ - "MUST use AskUserQuestion for user confirmation (YES/NO format)"
13
+ - "MUST show diff preview before confirming (diff-first pattern)"
14
+ - "Status values: ready|in-progress|blocked|in-review|done"
15
+ state_fields:
16
+ - story_id
17
+ - current_owner
18
+ - new_owner
19
+ - new_status
4
20
  ---
5
21
 
6
22
  # assign
@@ -14,59 +30,134 @@ node .agileflow/scripts/obtain-context.js assign
14
30
  ```
15
31
 
16
32
  <!-- COMPACT_SUMMARY_START -->
17
- ## Compact Summary
18
33
 
19
- **Command**: `assign`
20
- **Purpose**: Assign or reassign stories to owners with status updates
34
+ ## ⚠️ COMPACT SUMMARY - /agileflow:assign IS ACTIVE
21
35
 
22
- **Quick Usage**:
36
+ **CRITICAL**: You assign/reassign stories to owners. This modifies two files + bus log.
37
+
38
+ ---
39
+
40
+ ### 🚨 RULE #1: ALWAYS Update Both Story File AND status.json
41
+
42
+ **Two-part update required**:
43
+ 1. Update story frontmatter (owner, status, updated timestamp)
44
+ 2. Update docs/09-agents/status.json (using jq or Edit tool)
45
+
46
+ ### 🚨 RULE #2: ALWAYS Use jq or Edit Tool (NEVER echo/cat >)
47
+
48
+ **REQUIRED**:
49
+ - ALWAYS use jq for status.json updates (prevents corruption)
50
+ - ALWAYS validate after modification:
51
+ ```bash
52
+ if ! jq empty docs/09-agents/status.json 2>/dev/null; then
53
+ echo "❌ ERROR: status.json is now invalid JSON!"
54
+ exit 1
55
+ fi
56
+ ```
57
+
58
+ ### 🚨 RULE #3: ALWAYS Show Diff Preview Before Confirming
59
+
60
+ **Workflow**:
61
+ 1. Parse inputs (STORY, NEW_OWNER, NEW_STATUS, NOTE)
62
+ 2. Prepare story frontmatter update
63
+ 3. Prepare status.json update
64
+ 4. Show unified DIFF preview (story + status.json)
65
+ 5. Ask YES/NO confirmation
66
+ 6. Only on YES: Execute all updates + append bus message
67
+
68
+ ### 🚨 RULE #4: VALID STATUS TRANSITIONS
69
+
70
+ Status can transition:
71
+ - `ready` → `in-progress` (starting work)
72
+ - `in-progress` → `blocked` (hit blocker)
73
+ - `in-progress` → `in-review` (finished, ready for review)
74
+ - `blocked` → `in-progress` (blocker resolved)
75
+ - `in-review` → `done` (review complete)
76
+ - Any → `ready` (reset story)
77
+
78
+ ---
79
+
80
+ ## Key Files & Actions
81
+
82
+ **Input Parameters**:
83
+ ```
84
+ STORY=<US-ID> # e.g., US-0042 (required)
85
+ NEW_OWNER=<id> # New owner (required)
86
+ NEW_STATUS=<status> # ready|in-progress|blocked|in-review|done (optional)
87
+ NOTE=<text> # Brief note for bus message (optional)
23
88
  ```
24
- /agileflow:assign STORY=US-0042 NEW_OWNER=AG-UI NEW_STATUS=in-progress NOTE="Starting work on login form"
89
+
90
+ **Files Updated**:
91
+ 1. docs/06-stories/<EPIC>/<STORY>-<slug>.md (frontmatter)
92
+ 2. docs/09-agents/status.json (story entry)
93
+ 3. docs/09-agents/bus/log.jsonl (appended event)
94
+
95
+ **Story Frontmatter Update**:
96
+ ```yaml
97
+ owner: AG-UI
98
+ status: in-progress
99
+ updated: 2025-10-22T14:30:00Z
25
100
  ```
26
101
 
27
- **What It Does**:
28
- 1. Updates story frontmatter (owner, status, updated timestamp) in `docs/06-stories/**/<STORY>*.md`
29
- 2. Updates `docs/09-agents/status.json` (owner, status, last_update) using jq or Edit tool
30
- 3. Validates JSON after modification (prevents corruption)
31
- 4. Appends "assign" event to `docs/09-agents/bus/log.jsonl`
32
-
33
- **Status Values**:
34
- - `ready` - Story ready to start
35
- - `in-progress` - Currently being worked on
36
- - `blocked` - Waiting on dependency
37
- - `in-review` - Code review in progress
38
- - `done` - Completed and verified
39
-
40
- **JSON Safety Protocol**:
41
- - **ALWAYS** use jq or Edit tool for JSON operations
42
- - **NEVER** use echo/cat > status.json (can corrupt JSON)
43
- - **VALIDATE** after modification:
44
- ```bash
45
- if ! jq empty docs/09-agents/status.json 2>/dev/null; then
46
- echo "❌ ERROR: status.json is now invalid JSON!"
47
- exit 1
48
- fi
49
- ```
50
-
51
- **Example Workflow**:
102
+ **status.json Update**:
103
+ ```json
104
+ {
105
+ "stories": {
106
+ "US-0042": {
107
+ "owner": "AG-UI",
108
+ "status": "in-progress",
109
+ "last_update": "ISO-timestamp"
110
+ }
111
+ }
112
+ }
52
113
  ```
53
- 1. Story US-0042 created (owner: unassigned, status: ready)
54
- 2. /agileflow:assign STORY=US-0042 NEW_OWNER=AG-UI NEW_STATUS=in-progress
55
- 3. AG-UI works on story
56
- 4. /agileflow:assign STORY=US-0042 NEW_OWNER=AG-UI NEW_STATUS=in-review
57
- 5. Review complete
58
- 6. /agileflow:assign STORY=US-0042 NEW_OWNER=AG-UI NEW_STATUS=done
114
+
115
+ **Append to bus/log.jsonl**:
116
+ ```json
117
+ {"ts":"ISO-timestamp","from":"SYSTEM","type":"assign","from":"<user>","to":"<NEW_OWNER>","story":"<STORY>","status":"<NEW_STATUS>","text":"<NOTE>"}
59
118
  ```
60
119
 
61
- **Best Practices**:
62
- - Always preview changes before confirming (diff-first)
63
- - Include NOTE for context on status changes
64
- - Validate JSON after every update
65
- - Use appropriate status transitions (ready → in-progress → in-review → done)
120
+ ---
121
+
122
+ ## Anti-Patterns & Correct Usage
123
+
124
+ **DON'T**:
125
+ - Update story file without updating status.json
126
+ - Use echo or cat for JSON changes
127
+ - Skip validation after JSON updates
128
+ - Forget to show diff before confirming
129
+ - Use invalid status values
130
+
131
+ ✅ **DO**:
132
+ - Update story frontmatter AND status.json together
133
+ - Use jq for JSON operations
134
+ - Validate with `jq empty` after every write
135
+ - Show diff preview before confirmation
136
+ - Use only valid status values
137
+
138
+ ---
66
139
 
67
- **Tool Usage Examples**:
140
+ ## Confirmation Flow
68
141
 
69
- AskUserQuestion:
142
+ 1. **Show diff preview**:
143
+ ```
144
+ Story: docs/06-stories/EP-0010/US-0042-login-form.md
145
+ -owner: unassigned
146
+ +owner: AG-UI
147
+ -status: ready
148
+ +status: in-progress
149
+
150
+ Status: docs/09-agents/status.json
151
+ "US-0042": {
152
+ -"owner": "unassigned",
153
+ +"owner": "AG-UI",
154
+ -"status": "ready",
155
+ +"status": "in-progress",
156
+ +"last_update": "ISO-timestamp"
157
+ }
158
+ ```
159
+
160
+ 2. **Ask confirmation**:
70
161
  ```xml
71
162
  <invoke name="AskUserQuestion">
72
163
  <parameter name="questions">[{
@@ -74,13 +165,26 @@ AskUserQuestion:
74
165
  "header": "Confirm Assignment",
75
166
  "multiSelect": false,
76
167
  "options": [
77
- {"label": "Yes, assign", "description": "Update story and status.json"},
168
+ {"label": "Yes, assign", "description": "Update files"},
78
169
  {"label": "No, cancel", "description": "Don't assign"}
79
170
  ]
80
171
  }]</parameter>
81
172
  </invoke>
82
173
  ```
83
174
 
175
+ 3. **On YES**: Execute updates + validate JSON + append bus message
176
+ 4. **On NO**: Abort without changes
177
+
178
+ ---
179
+
180
+ ## REMEMBER AFTER COMPACTION
181
+
182
+ - Updates story frontmatter + status.json + bus log
183
+ - ALWAYS validate JSON after modification
184
+ - ALWAYS show diff before confirming
185
+ - Status values: ready, in-progress, blocked, in-review, done
186
+ - Two-part update: story file + status.json (don't forget either)
187
+
84
188
  <!-- COMPACT_SUMMARY_END -->
85
189
 
86
190
  ## Prompt
@@ -1,6 +1,23 @@
1
1
  ---
2
2
  description: Auto-generate stories from PRDs, mockups, or specs
3
- argument-hint: (no arguments)
3
+ argument-hint: SOURCE=<path|url> [EPIC=<id>] [OWNER=<agent>] [AUTO_CREATE=yes|no]
4
+ compact_context:
5
+ priority: high
6
+ preserve_rules:
7
+ - "ACTIVE COMMAND: /agileflow:auto-story - Auto-generate stories from product artifacts"
8
+ - "CRITICAL: Use TodoWrite to track 10-step generation process immediately"
9
+ - "CRITICAL: Always preview BEFORE creating (AUTO_CREATE=no default)"
10
+ - "MUST generate stories with Given/When/Then Acceptance Criteria format"
11
+ - "MUST estimate using INVEST: 0.5d (simple) | 1d (standard) | 1.5d (complex) | 2d (refactor)"
12
+ - "Stories >2d MUST be split into smaller stories"
13
+ - "MUST create story files, test stubs, update status.json, and bus log"
14
+ - "Supported sources: PRDs (.md/.pdf), mockups (Figma/PNG), API docs (OpenAPI/Swagger), flows (Mermaid)"
15
+ state_fields:
16
+ - source_file
17
+ - source_type
18
+ - epic_id
19
+ - owner_agent
20
+ - stories_generated
4
21
  ---
5
22
 
6
23
  # auto-story