agileflow 2.77.0 → 2.79.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 (128) hide show
  1. package/README.md +6 -6
  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 +88 -64
  6. package/scripts/auto-self-improve.js +23 -45
  7. package/scripts/check-update.js +35 -42
  8. package/scripts/damage-control/bash-tool-damage-control.js +257 -0
  9. package/scripts/damage-control/edit-tool-damage-control.js +279 -0
  10. package/scripts/damage-control/patterns.yaml +227 -0
  11. package/scripts/damage-control/write-tool-damage-control.js +274 -0
  12. package/scripts/damage-control-bash.js +232 -0
  13. package/scripts/damage-control-edit.js +243 -0
  14. package/scripts/damage-control-write.js +243 -0
  15. package/scripts/obtain-context.js +22 -3
  16. package/scripts/ralph-loop.js +191 -63
  17. package/scripts/screenshot-verifier.js +213 -0
  18. package/scripts/session-manager.js +12 -33
  19. package/src/core/agents/accessibility.md +124 -53
  20. package/src/core/agents/adr-writer.md +192 -52
  21. package/src/core/agents/analytics.md +139 -60
  22. package/src/core/agents/api.md +173 -63
  23. package/src/core/agents/ci.md +139 -57
  24. package/src/core/agents/compliance.md +159 -68
  25. package/src/core/agents/configuration/damage-control.md +356 -0
  26. package/src/core/agents/configuration-damage-control.md +248 -0
  27. package/src/core/agents/database.md +162 -61
  28. package/src/core/agents/datamigration.md +179 -66
  29. package/src/core/agents/design.md +179 -57
  30. package/src/core/agents/devops.md +160 -3
  31. package/src/core/agents/documentation.md +204 -60
  32. package/src/core/agents/epic-planner.md +147 -55
  33. package/src/core/agents/integrations.md +197 -69
  34. package/src/core/agents/mentor.md +158 -57
  35. package/src/core/agents/mobile.md +159 -67
  36. package/src/core/agents/monitoring.md +154 -65
  37. package/src/core/agents/multi-expert.md +115 -43
  38. package/src/core/agents/orchestrator.md +77 -24
  39. package/src/core/agents/performance.md +130 -75
  40. package/src/core/agents/product.md +151 -55
  41. package/src/core/agents/qa.md +162 -74
  42. package/src/core/agents/readme-updater.md +178 -76
  43. package/src/core/agents/refactor.md +148 -95
  44. package/src/core/agents/research.md +143 -72
  45. package/src/core/agents/security.md +154 -65
  46. package/src/core/agents/testing.md +176 -97
  47. package/src/core/agents/ui.md +170 -79
  48. package/src/core/commands/adr/list.md +171 -0
  49. package/src/core/commands/adr/update.md +235 -0
  50. package/src/core/commands/adr/view.md +252 -0
  51. package/src/core/commands/adr.md +207 -50
  52. package/src/core/commands/agent.md +16 -0
  53. package/src/core/commands/assign.md +148 -44
  54. package/src/core/commands/auto.md +18 -1
  55. package/src/core/commands/babysit.md +391 -38
  56. package/src/core/commands/baseline.md +14 -0
  57. package/src/core/commands/blockers.md +170 -51
  58. package/src/core/commands/board.md +144 -66
  59. package/src/core/commands/changelog.md +15 -0
  60. package/src/core/commands/ci.md +179 -69
  61. package/src/core/commands/compress.md +18 -0
  62. package/src/core/commands/configure.md +16 -0
  63. package/src/core/commands/context/export.md +193 -4
  64. package/src/core/commands/context/full.md +191 -18
  65. package/src/core/commands/context/note.md +248 -4
  66. package/src/core/commands/debt.md +17 -0
  67. package/src/core/commands/deploy.md +208 -65
  68. package/src/core/commands/deps.md +15 -0
  69. package/src/core/commands/diagnose.md +16 -0
  70. package/src/core/commands/docs.md +196 -64
  71. package/src/core/commands/epic/list.md +170 -0
  72. package/src/core/commands/epic/view.md +242 -0
  73. package/src/core/commands/epic.md +192 -69
  74. package/src/core/commands/feedback.md +191 -71
  75. package/src/core/commands/handoff.md +162 -48
  76. package/src/core/commands/help.md +9 -0
  77. package/src/core/commands/ideate.md +446 -0
  78. package/src/core/commands/impact.md +16 -0
  79. package/src/core/commands/metrics.md +141 -37
  80. package/src/core/commands/multi-expert.md +77 -0
  81. package/src/core/commands/packages.md +16 -0
  82. package/src/core/commands/pr.md +161 -67
  83. package/src/core/commands/readme-sync.md +16 -0
  84. package/src/core/commands/research/analyze.md +568 -0
  85. package/src/core/commands/research/ask.md +345 -20
  86. package/src/core/commands/research/import.md +562 -19
  87. package/src/core/commands/research/list.md +173 -5
  88. package/src/core/commands/research/view.md +181 -8
  89. package/src/core/commands/retro.md +135 -48
  90. package/src/core/commands/review.md +219 -47
  91. package/src/core/commands/session/end.md +209 -0
  92. package/src/core/commands/session/history.md +210 -0
  93. package/src/core/commands/session/init.md +116 -0
  94. package/src/core/commands/session/new.md +296 -0
  95. package/src/core/commands/session/resume.md +166 -0
  96. package/src/core/commands/session/status.md +166 -0
  97. package/src/core/commands/setup/visual-e2e.md +462 -0
  98. package/src/core/commands/skill/create.md +115 -17
  99. package/src/core/commands/skill/delete.md +117 -0
  100. package/src/core/commands/skill/edit.md +104 -0
  101. package/src/core/commands/skill/list.md +128 -0
  102. package/src/core/commands/skill/test.md +135 -0
  103. package/src/core/commands/skill/upgrade.md +542 -0
  104. package/src/core/commands/sprint.md +17 -1
  105. package/src/core/commands/status.md +133 -21
  106. package/src/core/commands/story/list.md +176 -0
  107. package/src/core/commands/story/view.md +265 -0
  108. package/src/core/commands/story-validate.md +101 -1
  109. package/src/core/commands/story.md +204 -51
  110. package/src/core/commands/template.md +16 -1
  111. package/src/core/commands/tests.md +226 -64
  112. package/src/core/commands/update.md +17 -1
  113. package/src/core/commands/validate-expertise.md +16 -0
  114. package/src/core/commands/velocity.md +140 -36
  115. package/src/core/commands/verify.md +14 -0
  116. package/src/core/commands/whats-new.md +30 -0
  117. package/src/core/skills/_learnings/README.md +91 -0
  118. package/src/core/skills/_learnings/_template.yaml +106 -0
  119. package/src/core/skills/_learnings/code-review.yaml +118 -0
  120. package/src/core/skills/_learnings/commit.yaml +69 -0
  121. package/src/core/skills/_learnings/story-writer.yaml +71 -0
  122. package/src/core/templates/damage-control-patterns.yaml +234 -0
  123. package/src/core/templates/skill-template.md +53 -11
  124. package/tools/cli/commands/start.js +180 -0
  125. package/tools/cli/installers/ide/claude-code.js +127 -0
  126. package/tools/cli/tui/Dashboard.js +66 -0
  127. package/tools/cli/tui/StoryList.js +69 -0
  128. package/tools/cli/tui/index.js +16 -0
@@ -0,0 +1,171 @@
1
+ ---
2
+ description: List all Architecture Decision Records
3
+ argument-hint: [STATUS=<status>]
4
+ ---
5
+
6
+ # /agileflow:adr:list
7
+
8
+ Display all Architecture Decision Records with status and quick actions.
9
+
10
+ ---
11
+
12
+ ## Purpose
13
+
14
+ Shows all ADRs from `docs/03-decisions/` with:
15
+ - Status (proposed, accepted, deprecated, superseded)
16
+ - Date created
17
+ - Summary
18
+ - Quick action options
19
+
20
+ **This is a read-only command** - no files are written.
21
+
22
+ ---
23
+
24
+ <!-- COMPACT_SUMMARY_START -->
25
+ ## Compact Summary
26
+
27
+ **Command**: `/agileflow:adr:list [STATUS=<status>]`
28
+ **Purpose**: Display ADRs with filters and offer quick actions
29
+
30
+ ### Flow
31
+ 1. Read docs/03-decisions/ directory
32
+ 2. Parse ADR frontmatter for status/date
33
+ 3. Display formatted table
34
+ 4. Offer actions: view details, create new, update status
35
+
36
+ ### Critical Rules
37
+ - **Read-only**: No file writes
38
+ - **Always offer actions**: End with AskUserQuestion for next steps
39
+ - **Show status clearly**: Color-code by status
40
+ <!-- COMPACT_SUMMARY_END -->
41
+
42
+ ---
43
+
44
+ ## Arguments
45
+
46
+ | Argument | Required | Description |
47
+ |----------|----------|-------------|
48
+ | STATUS | No | Filter by status (proposed, accepted, deprecated, superseded) |
49
+
50
+ ---
51
+
52
+ ## IMMEDIATE ACTIONS
53
+
54
+ Upon invocation, execute these steps:
55
+
56
+ ### Step 1: Read ADR Directory
57
+
58
+ ```bash
59
+ ls docs/03-decisions/adr-*.md
60
+ ```
61
+
62
+ ### Step 2: Parse Each ADR
63
+
64
+ For each ADR file, extract from frontmatter:
65
+ - number
66
+ - title
67
+ - date
68
+ - status
69
+ - tags (if present)
70
+
71
+ ### Step 3: Apply Filters
72
+
73
+ If STATUS provided, show only ADRs with that status.
74
+
75
+ ### Step 4: Display ADRs
76
+
77
+ Format output as table sorted by number:
78
+
79
+ ```markdown
80
+ ## Architecture Decision Records
81
+
82
+ | # | Title | Status | Date | Tags |
83
+ |---|-------|--------|------|------|
84
+ | 0003 | Use PostgreSQL for persistence | accepted | 2024-12-28 | database, architecture |
85
+ | 0002 | Session management approach | accepted | 2024-12-25 | auth, sessions |
86
+ | 0001 | AgileFlow agent system | accepted | 2024-12-20 | agents, architecture |
87
+
88
+ ---
89
+ **Summary**: 3 ADRs (3 accepted, 0 proposed, 0 deprecated)
90
+
91
+ Statuses:
92
+ - **proposed**: Under discussion, not yet decided
93
+ - **accepted**: Decision made and in effect
94
+ - **deprecated**: No longer applies (superseded or obsolete)
95
+ - **superseded**: Replaced by a newer ADR
96
+ ```
97
+
98
+ ### Step 5: Offer Actions
99
+
100
+ ```xml
101
+ <invoke name="AskUserQuestion">
102
+ <parameter name="questions">[{
103
+ "question": "What would you like to do?",
104
+ "header": "Actions",
105
+ "multiSelect": false,
106
+ "options": [
107
+ {"label": "View ADR details", "description": "Read full ADR with context and consequences"},
108
+ {"label": "Create new ADR", "description": "Document a new architecture decision"},
109
+ {"label": "Update ADR status", "description": "Change status of existing ADR"},
110
+ {"label": "Done", "description": "Exit"}
111
+ ]
112
+ }]</parameter>
113
+ </invoke>
114
+ ```
115
+
116
+ **If "View ADR details"**:
117
+ ```xml
118
+ <invoke name="AskUserQuestion">
119
+ <parameter name="questions">[{
120
+ "question": "Which ADR would you like to view?",
121
+ "header": "Select",
122
+ "multiSelect": false,
123
+ "options": [
124
+ {"label": "ADR-0003: Use PostgreSQL for persistence", "description": "accepted - 2024-12-28"},
125
+ {"label": "ADR-0002: Session management approach", "description": "accepted - 2024-12-25"},
126
+ {"label": "ADR-0001: AgileFlow agent system", "description": "accepted - 2024-12-20"}
127
+ ]
128
+ }]</parameter>
129
+ </invoke>
130
+ ```
131
+
132
+ Then invoke: `/agileflow:adr:view NUMBER=<selected>`
133
+
134
+ **If "Create new ADR"**:
135
+ Invoke: `/agileflow:adr`
136
+
137
+ **If "Update ADR status"**:
138
+ Invoke: `/agileflow:adr:update`
139
+
140
+ ---
141
+
142
+ ## Example Usage
143
+
144
+ ```bash
145
+ # List all ADRs
146
+ /agileflow:adr:list
147
+
148
+ # List only proposed ADRs
149
+ /agileflow:adr:list STATUS=proposed
150
+
151
+ # List only accepted ADRs
152
+ /agileflow:adr:list STATUS=accepted
153
+ ```
154
+
155
+ ---
156
+
157
+ ## Rules
158
+
159
+ - **Read-only**: No file writes
160
+ - **Parse frontmatter**: Extract status, date, tags from YAML
161
+ - **Show summary**: Include counts by status at the bottom
162
+ - **Always offer actions**: End with next step options
163
+
164
+ ---
165
+
166
+ ## Related Commands
167
+
168
+ - `/agileflow:adr:view` - View full ADR details
169
+ - `/agileflow:adr` - Create new ADR
170
+ - `/agileflow:adr:update` - Update ADR status
171
+ - `/agileflow:research:analyze` - Analyze research that may lead to ADR
@@ -0,0 +1,235 @@
1
+ ---
2
+ description: Update ADR status or content
3
+ argument-hint: NUMBER=<4-digit> [STATUS=<status>] [REASON=<text>]
4
+ ---
5
+
6
+ # /agileflow:adr:update
7
+
8
+ Update an existing ADR's status or add amendments.
9
+
10
+ ---
11
+
12
+ ## Purpose
13
+
14
+ Allows you to:
15
+ - Change ADR status (proposed → accepted, accepted → deprecated, etc.)
16
+ - Add amendment notes explaining status changes
17
+ - Mark an ADR as superseded by a newer ADR
18
+ - Reactivate deprecated ADRs
19
+
20
+ ---
21
+
22
+ <!-- COMPACT_SUMMARY_START -->
23
+ ## Compact Summary
24
+
25
+ **Command**: `/agileflow:adr:update NUMBER=<4-digit> [STATUS=<status>] [REASON=<text>]`
26
+ **Purpose**: Update ADR status with optional reason/amendment
27
+
28
+ ### Flow
29
+ 1. Read existing ADR
30
+ 2. Ask for new status if not provided
31
+ 3. Require reason for status change
32
+ 4. Show preview of changes
33
+ 5. Update file if confirmed
34
+ 6. Offer next actions
35
+
36
+ ### Critical Rules
37
+ - **Require reason**: Every status change needs a reason documented
38
+ - **Show preview**: Display changes before writing
39
+ - **Link superseding ADRs**: If superseded, require link to new ADR
40
+ <!-- COMPACT_SUMMARY_END -->
41
+
42
+ ---
43
+
44
+ ## Arguments
45
+
46
+ | Argument | Required | Description |
47
+ |----------|----------|-------------|
48
+ | NUMBER | Yes | ADR number to update (e.g., 0042) |
49
+ | STATUS | No | New status (proposed, accepted, deprecated, superseded) |
50
+ | REASON | No | Reason for the status change |
51
+ | SUPERSEDED_BY | No | If superseding, the new ADR number |
52
+
53
+ ---
54
+
55
+ ## IMMEDIATE ACTIONS
56
+
57
+ Upon invocation, execute these steps:
58
+
59
+ ### Step 1: Validate and Read ADR
60
+
61
+ ```bash
62
+ cat docs/03-decisions/adr-<NUMBER>-*.md
63
+ ```
64
+
65
+ If file not found, show error and suggest `/agileflow:adr:list`.
66
+
67
+ ### Step 2: Ask for New Status (if not provided)
68
+
69
+ ```xml
70
+ <invoke name="AskUserQuestion">
71
+ <parameter name="questions">[{
72
+ "question": "What should the new status be for ADR-<NUMBER>?",
73
+ "header": "Status",
74
+ "multiSelect": false,
75
+ "options": [
76
+ {"label": "accepted", "description": "Decision approved and in effect"},
77
+ {"label": "deprecated", "description": "No longer applies (but not replaced)"},
78
+ {"label": "superseded", "description": "Replaced by a newer ADR"},
79
+ {"label": "proposed", "description": "Back to discussion phase"}
80
+ ]
81
+ }]</parameter>
82
+ </invoke>
83
+ ```
84
+
85
+ ### Step 3: Get Reason for Change
86
+
87
+ Always require a reason:
88
+
89
+ ```xml
90
+ <invoke name="AskUserQuestion">
91
+ <parameter name="questions">[{
92
+ "question": "Why is this ADR being changed to '<STATUS>'?",
93
+ "header": "Reason",
94
+ "multiSelect": false,
95
+ "options": [
96
+ {"label": "Provide reason", "description": "Enter in 'Other' field (required)"}
97
+ ]
98
+ }]</parameter>
99
+ </invoke>
100
+ ```
101
+
102
+ ### Step 4: If Superseded, Get Replacement ADR
103
+
104
+ ```xml
105
+ <invoke name="AskUserQuestion">
106
+ <parameter name="questions">[{
107
+ "question": "Which ADR supersedes this one?",
108
+ "header": "Replacement",
109
+ "multiSelect": false,
110
+ "options": [
111
+ {"label": "ADR-0045 (latest)", "description": "Most recent ADR"},
112
+ {"label": "ADR-0044", "description": "Previous ADR"},
113
+ {"label": "Create new ADR", "description": "I need to create the replacement first"}
114
+ ]
115
+ }]</parameter>
116
+ </invoke>
117
+ ```
118
+
119
+ If "Create new ADR": Run `/agileflow:adr` first, then return to update this one.
120
+
121
+ ### Step 5: Preview Changes
122
+
123
+ Show what will be updated:
124
+
125
+ ```markdown
126
+ ## ADR-0042 Update Preview
127
+
128
+ **Current Status**: accepted
129
+ **New Status**: superseded
130
+
131
+ **Changes to file:**
132
+
133
+ ```diff
134
+ - status: accepted
135
+ + status: superseded
136
+
137
+ + ## Amendment - 2024-12-30
138
+ +
139
+ + **Status changed**: accepted → superseded
140
+ + **Reason**: New requirements made this approach obsolete.
141
+ + **Superseded by**: [ADR-0045](adr-0045-new-approach.md)
142
+ ```
143
+
144
+ ### Step 6: Confirm Update
145
+
146
+ ```xml
147
+ <invoke name="AskUserQuestion">
148
+ <parameter name="questions">[{
149
+ "question": "Apply this update to ADR-<NUMBER>?",
150
+ "header": "Confirm",
151
+ "multiSelect": false,
152
+ "options": [
153
+ {"label": "Yes, update ADR", "description": "Apply changes to file"},
154
+ {"label": "No, cancel", "description": "Discard changes"}
155
+ ]
156
+ }]</parameter>
157
+ </invoke>
158
+ ```
159
+
160
+ ### Step 7: Update File
161
+
162
+ If confirmed:
163
+ 1. Update frontmatter status
164
+ 2. Append Amendment section with:
165
+ - Date
166
+ - Status change (from → to)
167
+ - Reason
168
+ - Superseded by link (if applicable)
169
+
170
+ ### Step 8: Offer Next Actions
171
+
172
+ ```xml
173
+ <invoke name="AskUserQuestion">
174
+ <parameter name="questions">[{
175
+ "question": "ADR-<NUMBER> updated. What would you like to do next?",
176
+ "header": "Next Steps",
177
+ "multiSelect": false,
178
+ "options": [
179
+ {"label": "View updated ADR", "description": "See the changes with /agileflow:adr:view"},
180
+ {"label": "Update another ADR", "description": "Change status of a different ADR"},
181
+ {"label": "View all ADRs", "description": "Return to /agileflow:adr:list"},
182
+ {"label": "Done", "description": "Exit"}
183
+ ]
184
+ }]</parameter>
185
+ </invoke>
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Status Transitions
191
+
192
+ | From | To | Common Reasons |
193
+ |------|-----|----------------|
194
+ | proposed | accepted | Team approved, ready to implement |
195
+ | proposed | rejected | Alternative chosen, not viable |
196
+ | accepted | deprecated | No longer relevant, context changed |
197
+ | accepted | superseded | Better approach found, replaced by new ADR |
198
+ | deprecated | accepted | Reconsidered, still valid |
199
+ | superseded | accepted | Replacement didn't work out |
200
+
201
+ ---
202
+
203
+ ## Example Usage
204
+
205
+ ```bash
206
+ # Mark ADR as accepted
207
+ /agileflow:adr:update NUMBER=0042 STATUS=accepted REASON="Team approved after review"
208
+
209
+ # Mark ADR as superseded
210
+ /agileflow:adr:update NUMBER=0042 STATUS=superseded SUPERSEDED_BY=0045 REASON="New requirements"
211
+
212
+ # Deprecate an ADR
213
+ /agileflow:adr:update NUMBER=0042 STATUS=deprecated REASON="Context no longer applies"
214
+
215
+ # Interactive (no arguments)
216
+ /agileflow:adr:update NUMBER=0042
217
+ ```
218
+
219
+ ---
220
+
221
+ ## Rules
222
+
223
+ - **Require reason**: Every status change must have documented reason
224
+ - **Show preview**: Always display changes before writing
225
+ - **Link superseding ADRs**: If superseded, must link to replacement
226
+ - **Preserve history**: Never delete content, always append amendments
227
+ - **Update timestamps**: Set updated date in frontmatter
228
+
229
+ ---
230
+
231
+ ## Related Commands
232
+
233
+ - `/agileflow:adr:view` - View ADR details
234
+ - `/agileflow:adr:list` - View all ADRs
235
+ - `/agileflow:adr` - Create new ADR
@@ -0,0 +1,252 @@
1
+ ---
2
+ description: View ADR details with contextual actions
3
+ argument-hint: NUMBER=<4-digit>
4
+ ---
5
+
6
+ # /agileflow:adr:view
7
+
8
+ View full ADR details and take contextual actions based on ADR status.
9
+
10
+ ---
11
+
12
+ ## Purpose
13
+
14
+ Displays complete ADR information and offers **context-aware actions** based on the ADR's current status:
15
+ - **proposed** → Accept, reject, request changes
16
+ - **accepted** → Create implementation stories, supersede, deprecate
17
+ - **deprecated** → View history, reactivate if needed
18
+ - **superseded** → View replacement ADR, understand evolution
19
+
20
+ ---
21
+
22
+ <!-- COMPACT_SUMMARY_START -->
23
+ ## Compact Summary
24
+
25
+ **Command**: `/agileflow:adr:view NUMBER=<4-digit>`
26
+ **Purpose**: View ADR details with context-aware action suggestions
27
+
28
+ ### Flow
29
+ 1. Read ADR file from docs/03-decisions/
30
+ 2. Display full ADR content
31
+ 3. Offer actions based on current status
32
+ 4. Execute selected action
33
+
34
+ ### Critical Rules
35
+ - **Context-aware actions**: Different options based on ADR status
36
+ - **Show everything**: Context, decision, consequences, links
37
+ - **Always offer next steps**: End with relevant AskUserQuestion
38
+ <!-- COMPACT_SUMMARY_END -->
39
+
40
+ ---
41
+
42
+ ## Arguments
43
+
44
+ | Argument | Required | Description |
45
+ |----------|----------|-------------|
46
+ | NUMBER | Yes | ADR number (e.g., 0042) |
47
+
48
+ ---
49
+
50
+ ## IMMEDIATE ACTIONS
51
+
52
+ Upon invocation, execute these steps:
53
+
54
+ ### Step 1: Validate Input
55
+
56
+ If NUMBER not provided, list recent ADRs:
57
+
58
+ ```xml
59
+ <invoke name="AskUserQuestion">
60
+ <parameter name="questions">[{
61
+ "question": "Which ADR would you like to view?",
62
+ "header": "Select",
63
+ "multiSelect": false,
64
+ "options": [
65
+ {"label": "ADR-0003: Latest ADR", "description": "accepted"},
66
+ {"label": "ADR-0002: Previous ADR", "description": "accepted"},
67
+ {"label": "Show all ADRs", "description": "View full ADR list"}
68
+ ]
69
+ }]</parameter>
70
+ </invoke>
71
+ ```
72
+
73
+ ### Step 2: Read ADR File
74
+
75
+ ```bash
76
+ cat docs/03-decisions/adr-<NUMBER>-*.md
77
+ ```
78
+
79
+ If file not found, show error and suggest `/agileflow:adr:list`.
80
+
81
+ ### Step 3: Display ADR Content
82
+
83
+ ```markdown
84
+ ## ADR-0042: Use PostgreSQL for Persistence
85
+
86
+ **Status**: accepted
87
+ **Date**: 2024-12-28
88
+ **Tags**: database, architecture
89
+
90
+ ---
91
+
92
+ ### Context
93
+
94
+ We need a reliable database with ACID guarantees for user data.
95
+ The application handles financial transactions requiring strong consistency.
96
+ Current SQLite implementation cannot scale to multiple servers.
97
+
98
+ ---
99
+
100
+ ### Decision
101
+
102
+ We will use PostgreSQL as our primary database because:
103
+ - Mature, well-tested ACID compliance
104
+ - Excellent tooling and ecosystem
105
+ - Team has existing experience
106
+ - Supports advanced features (JSONB, full-text search)
107
+
108
+ ---
109
+
110
+ ### Consequences
111
+
112
+ **Positive:**
113
+ - Strong data integrity guarantees
114
+ - Better performance at scale
115
+ - Rich query capabilities
116
+
117
+ **Negative:**
118
+ - Requires managed database service or self-hosting
119
+ - Team needs PostgreSQL-specific training
120
+ - Migration effort from SQLite
121
+
122
+ ---
123
+
124
+ ### Related
125
+
126
+ - [Research: Database Selection](../10-research/20241225-database-selection.md)
127
+ - [US-0050: Database migration story](../06-stories/EP-0005/US-0050.md)
128
+ - Supersedes: ADR-0010 (Use SQLite)
129
+ ```
130
+
131
+ ### Step 4: Offer Context-Aware Actions
132
+
133
+ **Based on ADR status, show different options:**
134
+
135
+ #### If STATUS = proposed
136
+
137
+ ```xml
138
+ <invoke name="AskUserQuestion">
139
+ <parameter name="questions">[{
140
+ "question": "This ADR is proposed. What would you like to do?",
141
+ "header": "Actions",
142
+ "multiSelect": false,
143
+ "options": [
144
+ {"label": "Accept this ADR", "description": "Mark as accepted and in effect"},
145
+ {"label": "Request changes", "description": "Add comments or modify the proposal"},
146
+ {"label": "Reject this ADR", "description": "Mark as rejected with reason"},
147
+ {"label": "Back to ADR list", "description": "Return to /agileflow:adr:list"}
148
+ ]
149
+ }]</parameter>
150
+ </invoke>
151
+ ```
152
+
153
+ **If "Accept"**:
154
+ - Run `/agileflow:adr:update NUMBER=<NUMBER> STATUS=accepted`
155
+ - Ask: "Create implementation stories for this decision?"
156
+
157
+ #### If STATUS = accepted
158
+
159
+ ```xml
160
+ <invoke name="AskUserQuestion">
161
+ <parameter name="questions">[{
162
+ "question": "This ADR is accepted and in effect. What would you like to do?",
163
+ "header": "Actions",
164
+ "multiSelect": false,
165
+ "options": [
166
+ {"label": "Create implementation stories (Recommended)", "description": "Turn this decision into actionable work"},
167
+ {"label": "Supersede with new ADR", "description": "Replace with updated decision"},
168
+ {"label": "Deprecate this ADR", "description": "Mark as no longer applicable"},
169
+ {"label": "View related research", "description": "See research that led to this decision"}
170
+ ]
171
+ }]</parameter>
172
+ </invoke>
173
+ ```
174
+
175
+ **If "Create implementation stories"**:
176
+ 1. Analyze the ADR's consequences and decision
177
+ 2. Ask: "This decision suggests the following work:"
178
+ 3. Present potential stories/epic
179
+ 4. If confirmed, run `/agileflow:epic` or `/agileflow:story`
180
+
181
+ **If "Supersede"**:
182
+ - Ask for reason/context for new decision
183
+ - Create new ADR referencing this one
184
+ - Update this ADR status to "superseded"
185
+ - Add link to new ADR
186
+
187
+ #### If STATUS = deprecated
188
+
189
+ ```xml
190
+ <invoke name="AskUserQuestion">
191
+ <parameter name="questions">[{
192
+ "question": "This ADR is deprecated. What would you like to do?",
193
+ "header": "Actions",
194
+ "multiSelect": false,
195
+ "options": [
196
+ {"label": "View deprecation history", "description": "See why this was deprecated"},
197
+ {"label": "Reactivate this ADR", "description": "Mark as accepted again"},
198
+ {"label": "View replacement ADR", "description": "See what superseded this"},
199
+ {"label": "Back to ADR list", "description": "Return to /agileflow:adr:list"}
200
+ ]
201
+ }]</parameter>
202
+ </invoke>
203
+ ```
204
+
205
+ #### If STATUS = superseded
206
+
207
+ ```xml
208
+ <invoke name="AskUserQuestion">
209
+ <parameter name="questions">[{
210
+ "question": "This ADR was superseded. What would you like to do?",
211
+ "header": "Actions",
212
+ "multiSelect": false,
213
+ "options": [
214
+ {"label": "View replacement ADR", "description": "See the ADR that replaced this one"},
215
+ {"label": "View decision evolution", "description": "See how this decision evolved over time"},
216
+ {"label": "Back to ADR list", "description": "Return to /agileflow:adr:list"}
217
+ ]
218
+ }]</parameter>
219
+ </invoke>
220
+ ```
221
+
222
+ ---
223
+
224
+ ## Example Usage
225
+
226
+ ```bash
227
+ # View specific ADR
228
+ /agileflow:adr:view NUMBER=0042
229
+
230
+ # Will prompt for selection if no number
231
+ /agileflow:adr:view
232
+ ```
233
+
234
+ ---
235
+
236
+ ## Rules
237
+
238
+ - **Context-aware**: Actions must match current ADR status
239
+ - **Show everything**: Context, decision, consequences, links
240
+ - **Always offer next steps**: End with relevant action options
241
+ - **Connect to related commands**: Link to stories, research, other ADRs
242
+
243
+ ---
244
+
245
+ ## Related Commands
246
+
247
+ - `/agileflow:adr:list` - View all ADRs
248
+ - `/agileflow:adr` - Create new ADR
249
+ - `/agileflow:adr:update` - Update ADR status
250
+ - `/agileflow:story` - Create implementation story
251
+ - `/agileflow:epic` - Create implementation epic
252
+ - `/agileflow:research:view` - View related research