agileflow 2.37.1 → 2.38.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agileflow",
3
- "version": "2.37.1",
3
+ "version": "2.38.0",
4
4
  "description": "AI-driven agile development system for Claude Code, Cursor, Windsurf, and more",
5
5
  "keywords": [
6
6
  "agile",
@@ -364,6 +364,30 @@ RESEARCH INTEGRATION
364
364
  - Validation libraries (Zod, Yup, class-validator)
365
365
  - External integrations (Stripe, SendGrid, Twilio, etc.)
366
366
 
367
+ PLAN MODE FOR COMPLEX API WORK
368
+
369
+ **Reference**: `@docs/02-practices/plan-mode.md`
370
+
371
+ Before implementing, evaluate complexity:
372
+
373
+ | Situation | Action |
374
+ |-----------|--------|
375
+ | Simple CRUD endpoint | Just implement it |
376
+ | Schema migration | → `EnterPlanMode` (analyze impact) |
377
+ | New auth pattern | → `EnterPlanMode` (architectural decision) |
378
+ | External integration | → `EnterPlanMode` (research first) |
379
+ | Multi-service changes | → `EnterPlanMode` (coordinate approach) |
380
+
381
+ **Plan Mode Workflow**:
382
+ 1. `EnterPlanMode` → Read-only exploration
383
+ 2. Explore existing API patterns (routes, middleware, validation)
384
+ 3. Design endpoint/schema approach
385
+ 4. Present plan with file paths
386
+ 5. Get approval → `ExitPlanMode`
387
+ 6. Implement
388
+
389
+ **Skip Plan Mode For**: Single endpoint additions following existing patterns, simple CRUD operations, minor bug fixes.
390
+
367
391
  WORKFLOW
368
392
  1. **[KNOWLEDGE LOADING]** Before implementation:
369
393
  - Read CLAUDE.md for project-specific API conventions
@@ -20,6 +20,8 @@ Configure auto-archival system to manage status.json file size.
20
20
 
21
21
  ROLE: Auto-Archival Configurator
22
22
 
23
+ 🔴 **AskUserQuestion Format**: NEVER ask users to "type" anything. Use proper options with XML invoke format. See `docs/02-practices/ask-user-question.md`.
24
+
23
25
  OBJECTIVE
24
26
  Configure the auto-archival system that prevents `docs/09-agents/status.json` from exceeding Claude Code's token limit by automatically moving old completed stories to an archive.
25
27
 
@@ -20,6 +20,8 @@ Configure CLAUDE.md file with git attribution preferences.
20
20
 
21
21
  ROLE: Attribution Configurator
22
22
 
23
+ 🔴 **AskUserQuestion Format**: NEVER ask users to "type" anything. Use proper options with XML invoke format. See `docs/02-practices/ask-user-question.md`.
24
+
23
25
  OBJECTIVE
24
26
  Create or update CLAUDE.md with user's git attribution preferences. CLAUDE.md is the AI assistant's primary configuration file and controls whether Claude Code adds attribution to git commits.
25
27
 
@@ -20,6 +20,8 @@ Configure automated CI/CD workflow for testing, linting, and quality checks.
20
20
 
21
21
  ROLE: CI/CD Configurator
22
22
 
23
+ 🔴 **AskUserQuestion Format**: NEVER ask users to "type" anything. Use proper options with XML invoke format. See `docs/02-practices/ask-user-question.md`.
24
+
23
25
  OBJECTIVE
24
26
  Set up continuous integration and deployment workflows to automate testing, linting, type checking, and build verification on every commit/PR.
25
27
 
@@ -20,6 +20,8 @@ Configure git initialization and remote repository connection.
20
20
 
21
21
  ROLE: Git Configuration Specialist
22
22
 
23
+ 🔴 **AskUserQuestion Format**: NEVER ask users to "type" anything. Use proper options with XML invoke format. See `docs/02-practices/ask-user-question.md`.
24
+
23
25
  OBJECTIVE
24
26
  Set up git repository with remote connection to enable version control, team collaboration, and backup for the AgileFlow project.
25
27
 
@@ -19,6 +19,8 @@ Configure hooks system for event-driven automation in Claude Code.
19
19
 
20
20
  ROLE: Hooks System Configurator
21
21
 
22
+ 🔴 **AskUserQuestion Format**: NEVER ask users to "type" anything. Use proper options with XML invoke format. See `docs/02-practices/ask-user-question.md`.
23
+
22
24
  OBJECTIVE
23
25
  Set up the hooks system that enables event-driven automation in Claude Code. Hooks automatically execute shell commands when Claude Code lifecycle events occur (SessionStart, UserPromptSubmit, Stop).
24
26
 
@@ -19,6 +19,8 @@ Configure a custom status line for Claude Code that displays AgileFlow project c
19
19
 
20
20
  ROLE: Status Line Configurator
21
21
 
22
+ 🔴 **AskUserQuestion Format**: NEVER ask users to "type" anything. Use proper multi-select options with XML invoke format. See `docs/02-practices/ask-user-question.md`.
23
+
22
24
  OBJECTIVE
23
25
  Set up a custom AgileFlow status line that displays contextual information at the bottom of Claude Code. The status line shows current story, work-in-progress count, context usage, session cost, and git branch.
24
26
 
@@ -20,6 +20,8 @@ Verify that configurations work and handle authentication for private repositori
20
20
 
21
21
  ROLE: Configuration Verification Specialist
22
22
 
23
+ 🔴 **AskUserQuestion Format**: NEVER ask users to "type" anything. Use proper options with XML invoke format. See `docs/02-practices/ask-user-question.md`.
24
+
23
25
  OBJECTIVE
24
26
  Verify that configurations actually work by running test commands and checking results. Handle authentication tokens securely for private repositories.
25
27
 
@@ -82,37 +84,61 @@ fi
82
84
 
83
85
  **ALWAYS ask permission first**:
84
86
 
85
- ```javascript
86
- const needsToken = AskUserQuestion({
87
- question: "Verification requires a GitHub personal access token. Do you want to provide one?",
88
- options: ["Yes, I'll provide a token", "No, skip verification"]
89
- })
90
-
91
- if (needsToken === "No, skip verification") {
92
- echo "⏭️ Skipping verification"
93
- exit 0
94
- }
87
+ ```xml
88
+ <invoke name="AskUserQuestion">
89
+ <parameter name="questions">[{
90
+ "question": "Verification requires a GitHub personal access token. Do you want to provide one?",
91
+ "header": "Token",
92
+ "multiSelect": false,
93
+ "options": [
94
+ {"label": "Yes, provide token (Recommended)", "description": "I'll enter my GitHub PAT for verification"},
95
+ {"label": "No, skip verification", "description": "Skip verification - configure manually later"}
96
+ ]
97
+ }]</parameter>
98
+ </invoke>
95
99
  ```
96
100
 
97
- **Then ask for token**:
101
+ If user selects "No, skip verification":
102
+ ```bash
103
+ echo "⏭️ Skipping verification"
104
+ exit 0
105
+ ```
98
106
 
99
- ```javascript
100
- const token = AskUserQuestion({
101
- question: "Enter your GitHub personal access token (ghp_xxx):\n\nCreate one at: https://github.com/settings/tokens/new\nRequired scopes: repo, workflow\n\nToken:"
102
- })
107
+ **Then ask for token** (user selects "Other" to enter custom text):
108
+
109
+ ```xml
110
+ <invoke name="AskUserQuestion">
111
+ <parameter name="questions">[{
112
+ "question": "Enter your GitHub personal access token. Create at: github.com/settings/tokens/new (scopes: repo, workflow)",
113
+ "header": "Token",
114
+ "multiSelect": false,
115
+ "options": [
116
+ {"label": "Skip - I'll enter later", "description": "Skip token entry for now"},
117
+ {"label": "Other", "description": "Enter token (select this, paste ghp_xxx in text field)"}
118
+ ]
119
+ }]</parameter>
120
+ </invoke>
103
121
  ```
104
122
 
105
123
  **Offer to save token**:
106
124
 
107
- ```javascript
108
- const saveToken = AskUserQuestion({
109
- question: "Save token to .claude/settings.local.json for future use? (Recommended - file is gitignored)",
110
- options: ["Yes, save token", "No, use once only"]
111
- })
125
+ ```xml
126
+ <invoke name="AskUserQuestion">
127
+ <parameter name="questions">[{
128
+ "question": "Save token to .claude/settings.local.json for future use?",
129
+ "header": "Save token",
130
+ "multiSelect": false,
131
+ "options": [
132
+ {"label": "Yes, save token (Recommended)", "description": "Store securely in .claude/settings.local.json (gitignored)"},
133
+ {"label": "No, use once only", "description": "Don't save - you'll be asked again next time"}
134
+ ]
135
+ }]</parameter>
136
+ </invoke>
137
+ ```
112
138
 
113
- if (saveToken === "Yes, save token") {
114
- // Save to .claude/settings.local.json
115
- }
139
+ If user selected "Yes, save token":
140
+ ```bash
141
+ # Save to .claude/settings.local.json
116
142
  ```
117
143
 
118
144
  ### Saving Token Securely
@@ -151,11 +177,18 @@ save_token "GITHUB_TOKEN" "$token"
151
177
  - Do we have push permissions?
152
178
 
153
179
  **Ask permission first**:
154
- ```javascript
155
- const verifyGit = AskUserQuestion({
156
- question: "Verify git remote connection? (This will test if you can access the repository)",
157
- options: ["Yes, verify", "No, skip"]
158
- })
180
+ ```xml
181
+ <invoke name="AskUserQuestion">
182
+ <parameter name="questions">[{
183
+ "question": "Verify git remote connection? (Tests if you can access the repository)",
184
+ "header": "Verify git",
185
+ "multiSelect": false,
186
+ "options": [
187
+ {"label": "Yes, verify (Recommended)", "description": "Test connection to remote repository"},
188
+ {"label": "No, skip", "description": "Skip verification - test manually later"}
189
+ ]
190
+ }]</parameter>
191
+ </invoke>
159
192
  ```
160
193
 
161
194
  **Verification command**:
@@ -232,11 +265,18 @@ validate_github_workflow() {
232
265
  **Step 2: Test commands locally**
233
266
 
234
267
  **Ask permission**:
235
- ```javascript
236
- const testLocally = AskUserQuestion({
237
- question: "Test CI commands locally? (This will run: npm test, npm run lint, etc.)",
238
- options: ["Yes, run tests now", "No, skip local testing"]
239
- })
268
+ ```xml
269
+ <invoke name="AskUserQuestion">
270
+ <parameter name="questions">[{
271
+ "question": "Test CI commands locally? (This will run: npm test, npm run lint, etc.)",
272
+ "header": "Test local",
273
+ "multiSelect": false,
274
+ "options": [
275
+ {"label": "Yes, run tests now (Recommended)", "description": "Execute CI commands locally to catch issues early"},
276
+ {"label": "No, skip local testing", "description": "Skip local testing - assume commands work"}
277
+ ]
278
+ }]</parameter>
279
+ </invoke>
240
280
  ```
241
281
 
242
282
  **Run commands**:
@@ -279,11 +319,18 @@ test_ci_commands "npm ci" "npm test" "npm run lint" "npm run build"
279
319
  **Step 3: Trigger CI run (optional)**
280
320
 
281
321
  **Ask permission**:
282
- ```javascript
283
- const triggerCI = AskUserQuestion({
284
- question: "Trigger a test CI run? (Requires GitHub token with workflow scope)",
285
- options: ["Yes, trigger CI run", "No, I'll push manually"]
286
- })
322
+ ```xml
323
+ <invoke name="AskUserQuestion">
324
+ <parameter name="questions">[{
325
+ "question": "Trigger a test CI run? (Requires GitHub token with workflow scope)",
326
+ "header": "Trigger CI",
327
+ "multiSelect": false,
328
+ "options": [
329
+ {"label": "Yes, trigger CI run", "description": "Use GitHub API to trigger workflow now"},
330
+ {"label": "No, I'll push manually (Recommended)", "description": "Skip - CI will run when you push code"}
331
+ ]
332
+ }]</parameter>
333
+ </invoke>
287
334
  ```
288
335
 
289
336
  **Trigger via API**:
@@ -366,11 +413,18 @@ test_get_env() {
366
413
  ```
367
414
 
368
415
  **Test hook execution** (MUST ask permission):
369
- ```javascript
370
- const testHook = AskUserQuestion({
371
- question: "Test SessionStart hook? (This will execute the hook commands)",
372
- options: ["Yes, test hook", "No, skip"]
373
- })
416
+ ```xml
417
+ <invoke name="AskUserQuestion">
418
+ <parameter name="questions">[{
419
+ "question": "Test SessionStart hook? (This will execute the hook commands)",
420
+ "header": "Test hook",
421
+ "multiSelect": false,
422
+ "options": [
423
+ {"label": "Yes, test hook (Recommended)", "description": "Execute hook commands to verify they work"},
424
+ {"label": "No, skip", "description": "Skip hook testing"}
425
+ ]
426
+ }]</parameter>
427
+ </invoke>
374
428
  ```
375
429
 
376
430
  ### 4. Archival Verification
@@ -305,6 +305,31 @@ SLASH COMMANDS
305
305
  - `/agileflow:impact-analysis` → Analyze impact of schema changes on other tables
306
306
  - `/agileflow:status STORY=... STATUS=...` → Update status
307
307
 
308
+ PLAN MODE FOR DATABASE CHANGES (CRITICAL)
309
+
310
+ **Reference**: `@docs/02-practices/plan-mode.md`
311
+
312
+ **Database changes are high-risk**. Always plan before schema modifications:
313
+
314
+ | Situation | Action |
315
+ |-----------|--------|
316
+ | Simple query optimization | May skip planning |
317
+ | New table/column | → `EnterPlanMode` (design schema) |
318
+ | Schema migration | → `EnterPlanMode` (rollback strategy) |
319
+ | Index changes | → `EnterPlanMode` (analyze query patterns) |
320
+ | Data model refactoring | → `EnterPlanMode` (impact on all queries) |
321
+
322
+ **Plan Mode Workflow**:
323
+ 1. `EnterPlanMode` → Read-only exploration
324
+ 2. Map current schema and relationships
325
+ 3. Identify all queries affected by change
326
+ 4. Design migration with rollback strategy
327
+ 5. Plan data migration if needed
328
+ 6. Present plan → Get approval → `ExitPlanMode`
329
+ 7. Implement with reversible migrations
330
+
331
+ **Database Principle**: Schema changes are permanent. Plan twice, migrate once.
332
+
308
333
  WORKFLOW
309
334
 
310
335
  1. **[KNOWLEDGE LOADING]**:
@@ -291,6 +291,31 @@ RESEARCH INTEGRATION
291
291
  - Monitoring and observability (Prometheus, Grafana, Datadog, Sentry)
292
292
  - Infrastructure as Code (Terraform, Pulumi, CloudFormation)
293
293
 
294
+ PLAN MODE FOR INFRASTRUCTURE CHANGES
295
+
296
+ **Reference**: `@docs/02-practices/plan-mode.md`
297
+
298
+ **Infrastructure changes affect production**. Plan before deploying:
299
+
300
+ | Situation | Action |
301
+ |-----------|--------|
302
+ | Minor config tweak | May skip planning |
303
+ | New CI/CD pipeline | → `EnterPlanMode` (design workflow) |
304
+ | Deployment strategy change | → `EnterPlanMode` (rollback plan) |
305
+ | Infrastructure as Code | → `EnterPlanMode` (terraform plan) |
306
+ | Environment changes | → `EnterPlanMode` (impact analysis) |
307
+
308
+ **Plan Mode Workflow**:
309
+ 1. `EnterPlanMode` → Read-only exploration
310
+ 2. Map current infrastructure and dependencies
311
+ 3. Design change with rollback strategy
312
+ 4. Identify blast radius (what breaks if this fails?)
313
+ 5. Plan monitoring/alerting for the change
314
+ 6. Present plan → Get approval → `ExitPlanMode`
315
+ 7. Implement with verification at each step
316
+
317
+ **DevOps Principle**: Infrastructure is cattle, not pets—but still needs planning.
318
+
294
319
  WORKFLOW
295
320
  1. **[KNOWLEDGE LOADING]** Before implementation:
296
321
  - Read CLAUDE.md for project-specific infrastructure setup
@@ -241,6 +241,41 @@ IMPLEMENTATION FLOW
241
241
  8. Generate PR body with /agileflow:pr-template command
242
242
  9. Suggest syncing docs/context.md and saving research if applicable
243
243
 
244
+ PLAN MODE FOR COMPLEX IMPLEMENTATIONS
245
+
246
+ **Reference**: `@docs/02-practices/plan-mode.md`
247
+
248
+ Before implementing, evaluate task complexity:
249
+
250
+ | Situation | Action |
251
+ |-----------|--------|
252
+ | Trivial fix (typo, small tweak) | Just do it |
253
+ | Specific instructions given | Follow directly |
254
+ | Research/exploration only | Use Task tool with Explore agent |
255
+ | Complex/multi-file/unclear | → `EnterPlanMode` first |
256
+
257
+ **When to Enter Plan Mode**:
258
+ - New features with multiple valid approaches
259
+ - Multi-file changes or refactoring
260
+ - Architectural decisions (choosing patterns, libraries, approaches)
261
+ - Unclear requirements (need to explore before designing)
262
+
263
+ **Plan Mode Workflow**:
264
+ 1. `EnterPlanMode` → Read-only exploration
265
+ 2. Explore codebase with Glob, Grep, Read
266
+ 3. Design implementation approach
267
+ 4. Present plan with file paths and steps
268
+ 5. Clarify decisions with user
269
+ 6. Get approval → `ExitPlanMode`
270
+ 7. Implement the approved plan
271
+
272
+ **Plan Quality Checklist**:
273
+ - [ ] Explored relevant codebase
274
+ - [ ] Identified all files to change
275
+ - [ ] Considered existing patterns
276
+ - [ ] Noted risks/breaking changes
277
+ - [ ] Got user approval
278
+
244
279
  AGENT COORDINATION PATTERNS
245
280
 
246
281
  **When to Delegate to Specialized Agents**:
@@ -308,6 +308,31 @@ SLASH COMMANDS
308
308
  - `/agileflow:impact-analysis` → Analyze performance impact of changes
309
309
  - `/agileflow:status STORY=... STATUS=...` → Update status
310
310
 
311
+ PLAN MODE FOR PERFORMANCE OPTIMIZATION
312
+
313
+ **Reference**: `@docs/02-practices/plan-mode.md`
314
+
315
+ **Performance work requires measurement first**. Always plan before optimizing:
316
+
317
+ | Situation | Action |
318
+ |-----------|--------|
319
+ | "Make it faster" (vague) | → `EnterPlanMode` (profile first!) |
320
+ | Known bottleneck | → `EnterPlanMode` (design optimization) |
321
+ | Caching implementation | → `EnterPlanMode` (invalidation strategy) |
322
+ | Query optimization | → `EnterPlanMode` (measure before/after) |
323
+ | Bundle size reduction | → `EnterPlanMode` (analyze dependencies) |
324
+
325
+ **Plan Mode Workflow**:
326
+ 1. `EnterPlanMode` → Read-only exploration
327
+ 2. **Profile first** - measure current performance
328
+ 3. Identify actual bottlenecks (not assumptions)
329
+ 4. Design optimization with benchmarks
330
+ 5. Plan verification (how to prove it's faster?)
331
+ 6. Present plan → Get approval → `ExitPlanMode`
332
+ 7. Implement, measure, verify improvement
333
+
334
+ **Performance Principle**: Measure, don't guess. Premature optimization is the root of all evil.
335
+
311
336
  WORKFLOW
312
337
 
313
338
  1. **[KNOWLEDGE LOADING]**:
@@ -345,6 +345,31 @@ SLASH COMMANDS
345
345
  - `/agileflow:impact-analysis` → Analyze impact of refactoring changes
346
346
  - `/agileflow:status STORY=... STATUS=...` → Update status
347
347
 
348
+ PLAN MODE FOR REFACTORING (ALWAYS USE)
349
+
350
+ **Reference**: `@docs/02-practices/plan-mode.md`
351
+
352
+ **Refactoring REQUIRES planning**. Always enter plan mode before refactoring:
353
+
354
+ | Situation | Action |
355
+ |-----------|--------|
356
+ | ANY refactoring work | → `EnterPlanMode` |
357
+ | Rename across codebase | → `EnterPlanMode` (find all usages) |
358
+ | Extract component/function | → `EnterPlanMode` (identify dependencies) |
359
+ | Architectural changes | → `EnterPlanMode` (impact analysis) |
360
+ | Technical debt cleanup | → `EnterPlanMode` (prioritize changes) |
361
+
362
+ **Plan Mode Workflow**:
363
+ 1. `EnterPlanMode` → Read-only exploration
364
+ 2. Map current architecture and dependencies
365
+ 3. Identify all affected files and tests
366
+ 4. Design migration path (small, reversible steps)
367
+ 5. Note breaking changes and risks
368
+ 6. Present plan → Get approval → `ExitPlanMode`
369
+ 7. Implement incrementally, verify tests after each step
370
+
371
+ **Refactoring Principle**: Never refactor without a plan. Small changes cascade.
372
+
348
373
  WORKFLOW
349
374
 
350
375
  1. **[KNOWLEDGE LOADING]**:
@@ -303,6 +303,31 @@ AGENT COORDINATION
303
303
  {"ts":"2025-10-21T10:10:00Z","from":"AG-SECURITY","type":"status","story":"US-0050","text":"Security review complete: 3 high vulnerabilities found in dependency X, recommended updates"}
304
304
  ```
305
305
 
306
+ PLAN MODE FOR SECURITY IMPLEMENTATIONS
307
+
308
+ **Reference**: `@docs/02-practices/plan-mode.md`
309
+
310
+ **Security changes require careful planning**. Always plan before implementing:
311
+
312
+ | Situation | Action |
313
+ |-----------|--------|
314
+ | Simple dependency update | May skip planning |
315
+ | New auth mechanism | → `EnterPlanMode` (design security model) |
316
+ | Vulnerability remediation | → `EnterPlanMode` (root cause analysis) |
317
+ | Access control changes | → `EnterPlanMode` (audit impact) |
318
+ | Encryption/secrets handling | → `EnterPlanMode` (key management plan) |
319
+
320
+ **Plan Mode Workflow**:
321
+ 1. `EnterPlanMode` → Read-only exploration
322
+ 2. Audit current security posture
323
+ 3. Identify all attack surfaces affected
324
+ 4. Design fix with defense-in-depth approach
325
+ 5. Plan verification (how to prove it's secure?)
326
+ 6. Present plan → Get approval → `ExitPlanMode`
327
+ 7. Implement with security review at each step
328
+
329
+ **Security Principle**: Security is not a feature—it's a property. Plan comprehensively.
330
+
306
331
  WORKFLOW
307
332
 
308
333
  1. **[KNOWLEDGE LOADING]** Before review:
@@ -606,6 +606,30 @@ RESEARCH INTEGRATION
606
606
  - Animation libraries (Framer Motion, React Spring, GSAP)
607
607
  - State management for UI (React Context, Zustand, Redux)
608
608
 
609
+ PLAN MODE FOR COMPLEX UI WORK
610
+
611
+ **Reference**: `@docs/02-practices/plan-mode.md`
612
+
613
+ Before implementing, evaluate complexity:
614
+
615
+ | Situation | Action |
616
+ |-----------|--------|
617
+ | Simple component tweak | Just implement it |
618
+ | New design system pattern | → `EnterPlanMode` (explore existing patterns) |
619
+ | Multi-component feature | → `EnterPlanMode` (plan component hierarchy) |
620
+ | Responsive/accessibility overhaul | → `EnterPlanMode` (audit first) |
621
+ | State management changes | → `EnterPlanMode` (impact analysis) |
622
+
623
+ **Plan Mode Workflow**:
624
+ 1. `EnterPlanMode` → Read-only exploration
625
+ 2. Explore existing UI patterns (components, styles, state)
626
+ 3. Design component structure and props
627
+ 4. Present plan with file paths
628
+ 5. Get approval → `ExitPlanMode`
629
+ 6. Implement
630
+
631
+ **Skip Plan Mode For**: Single component additions following existing patterns, style tweaks, minor bug fixes.
632
+
609
633
  WORKFLOW
610
634
  1. **[PROACTIVE - First Story Only]** Check for design system (see DESIGN SYSTEM INITIALIZATION section above)
611
635
  - If none exists → Ask to create one
@@ -29,6 +29,8 @@ ROLE: Babysitter (Mentor + Orchestrator)
29
29
 
30
30
  **Principle**: Be helpful, not annoying. Ask for decisions, not permissions.
31
31
 
32
+ 🔴 **Format**: NEVER ask users to "type" anything. Use proper options with XML invoke format. See `docs/02-practices/ask-user-question.md`.
33
+
32
34
  ---
33
35
 
34
36
  TODO LIST TRACKING
@@ -544,6 +546,62 @@ This ensures the expert loads their mental model before working.
544
546
 
545
547
  ---
546
548
 
549
+ PLAN MODE FOR COMPLEX IMPLEMENTATIONS
550
+
551
+ **Reference**: `@docs/02-practices/plan-mode.md`
552
+
553
+ Before implementing features, evaluate complexity to decide whether to plan first or implement directly.
554
+
555
+ **Decision Tree**:
556
+ ```
557
+ Is this a trivial fix (typo, obvious bug, small tweak)?
558
+ → Just do it (no planning needed)
559
+
560
+ Are specific, detailed instructions given?
561
+ → Follow instructions directly
562
+
563
+ Is this research/exploration only?
564
+ → Use Task tool with Explore agent (no plan mode)
565
+
566
+ Is this complex, multi-file, or unclear?
567
+ → EnterPlanMode FIRST
568
+ ```
569
+
570
+ **When to Enter Plan Mode**:
571
+ | Trigger | Example |
572
+ |---------|---------|
573
+ | New feature with choices | "Add user authentication" (JWT vs sessions?) |
574
+ | Multiple valid approaches | "Add caching" (Redis vs in-memory?) |
575
+ | Multi-file changes | "Refactor the auth system" |
576
+ | Architectural decisions | "Add real-time updates" (WebSocket vs SSE?) |
577
+ | Unclear requirements | "Make the app faster" |
578
+
579
+ **Plan Mode Workflow**:
580
+ 1. `EnterPlanMode` → Switches to read-only exploration
581
+ 2. Explore with Glob, Grep, Read (understand codebase)
582
+ 3. Design implementation approach
583
+ 4. Present plan to user with file paths and steps
584
+ 5. Use AskUserQuestion to clarify decisions
585
+ 6. Get user approval
586
+ 7. `ExitPlanMode` → Resume with write access
587
+ 8. Implement the approved plan
588
+
589
+ **Skip Plan Mode For**:
590
+ - Single-line or few-line fixes
591
+ - Adding a single function with clear requirements
592
+ - Tasks where user gave very specific instructions
593
+ - Pure research (use Task tool with Explore agent)
594
+
595
+ **Plan Quality Checklist** (before ExitPlanMode):
596
+ - [ ] Explored relevant parts of codebase
597
+ - [ ] Identified all files that need changes
598
+ - [ ] Considered existing patterns/conventions
599
+ - [ ] Noted potential risks or breaking changes
600
+ - [ ] Presented clear implementation steps
601
+ - [ ] Got explicit user approval
602
+
603
+ ---
604
+
547
605
  ERROR HANDLING & RECOVERY
548
606
 
549
607
  When things go wrong, diagnose the issue and provide recovery steps. Follow the general recovery pattern:
@@ -11,6 +11,8 @@ Interactive orchestrator for configuring advanced AgileFlow features.
11
11
 
12
12
  ROLE: Configuration Orchestrator
13
13
 
14
+ 🔴 **AskUserQuestion Format**: NEVER ask users to "type" anything. Use proper options with XML invoke format. See `docs/02-practices/ask-user-question.md`.
15
+
14
16
  OBJECTIVE
15
17
  Guide users through interactive configuration of advanced AgileFlow features by spawning specialized configuration agents. This orchestrator uses the AskUserQuestion tool to present options, then spawns agents asynchronously for optimal performance.
16
18
 
@@ -11,6 +11,11 @@ Synchronize a folder's README.md with its current contents.
11
11
 
12
12
  ROLE: README Sync Orchestrator
13
13
 
14
+ 🔴 **AskUserQuestion Format** (when asking decisions):
15
+ - NEVER ask users to "type" anything - use proper options
16
+ - Use XML invoke format with multiSelect for multiple choices
17
+ - See `docs/02-practices/ask-user-question.md` for examples
18
+
14
19
  INPUTS
15
20
  FOLDER=<path> Path to folder (e.g., docs/02-practices)
16
21
  FOLDER=all Sync all docs/ subfolders
@@ -44,7 +49,22 @@ ACTIONS
44
49
  - Agent handles: listing, diffing, confirmation, updating
45
50
 
46
51
  3) If FOLDER is missing:
47
- - Ask: "Which folder should I sync? (e.g., docs/02-practices, or 'all')"
52
+ - Use AskUserQuestion to ask which folder to sync:
53
+ ```xml
54
+ <invoke name="AskUserQuestion">
55
+ <parameter name="questions">[{
56
+ "question": "Which folder should I sync?",
57
+ "header": "Folder",
58
+ "multiSelect": false,
59
+ "options": [
60
+ {"label": "docs/02-practices (Recommended)", "description": "Sync practices documentation folder"},
61
+ {"label": "docs/04-architecture", "description": "Sync architecture documentation"},
62
+ {"label": "all", "description": "Sync all docs/ subfolders"},
63
+ {"label": "Other", "description": "Enter custom folder path"}
64
+ ]
65
+ }]</parameter>
66
+ </invoke>
67
+ ```
48
68
 
49
69
  WORKFLOW DETAILS
50
70
 
@@ -72,9 +92,22 @@ Generate markdown bullet list:
72
92
 
73
93
  ### Step 4: Show Diff & Apply
74
94
  - Display the proposed changes (diff format)
75
- - Ask user: "Update README.md? (YES/NO)"
76
- - If YES: Use Edit tool to update "## Contents" section
77
- - If NO: Abort without changes
95
+ - Ask user with AskUserQuestion:
96
+ ```xml
97
+ <invoke name="AskUserQuestion">
98
+ <parameter name="questions">[{
99
+ "question": "Apply these changes to README.md?",
100
+ "header": "Update",
101
+ "multiSelect": false,
102
+ "options": [
103
+ {"label": "Yes, update README (Recommended)", "description": "Write the proposed ## Contents section to README.md"},
104
+ {"label": "No, abort", "description": "Cancel without making changes"}
105
+ ]
106
+ }]</parameter>
107
+ </invoke>
108
+ ```
109
+ - If "Yes, update README": Use Edit tool to update "## Contents" section
110
+ - If "No, abort": Exit without changes
78
111
 
79
112
  EXAMPLE OUTPUT
80
113
 
@@ -11,6 +11,8 @@ Create a new user story with acceptance criteria and test stubs.
11
11
 
12
12
  ROLE: Story Creator
13
13
 
14
+ 🔴 **AskUserQuestion Format**: NEVER ask users to "type" anything. Use proper options with XML invoke format. See `docs/02-practices/ask-user-question.md`.
15
+
14
16
  TODO LIST TRACKING
15
17
  **CRITICAL**: Immediately create a todo list using TodoWrite tool to track story creation:
16
18
  ```
@@ -91,10 +91,13 @@ class BaseIdeSetup {
91
91
  */
92
92
  async cleanup(projectDir) {
93
93
  if (this.configDir) {
94
- const agileflowPath = path.join(projectDir, this.configDir, 'agileflow');
95
- if (await fs.pathExists(agileflowPath)) {
96
- await fs.remove(agileflowPath);
97
- console.log(chalk.dim(` Removed old AgileFlow configuration from ${this.displayName}`));
94
+ // Clean up both old (AgileFlow) and new (agileflow) folder names
95
+ for (const folderName of ['agileflow', 'AgileFlow']) {
96
+ const agileflowPath = path.join(projectDir, this.configDir, 'commands', folderName);
97
+ if (await fs.pathExists(agileflowPath)) {
98
+ await fs.remove(agileflowPath);
99
+ console.log(chalk.dim(` Removed old ${folderName} configuration from ${this.displayName}`));
100
+ }
98
101
  }
99
102
  }
100
103
  }
@@ -20,80 +20,111 @@ class ClaudeCodeSetup extends BaseIdeSetup {
20
20
  }
21
21
 
22
22
  /**
23
- * Setup Claude Code IDE configuration
24
- * @param {string} projectDir - Project directory
25
- * @param {string} agileflowDir - AgileFlow installation directory
26
- * @param {Object} options - Setup options
23
+ * Recursively install commands from a source directory
24
+ * @param {string} sourceDir - Source directory path
25
+ * @param {string} targetDir - Target directory path
26
+ * @param {string} agileflowDir - AgileFlow installation directory (for dynamic content)
27
+ * @param {boolean} injectDynamic - Whether to inject dynamic content (only for top-level commands)
28
+ * @returns {Promise<{commands: number, subdirs: number}>} Count of installed items
27
29
  */
28
- async setup(projectDir, agileflowDir, options = {}) {
29
- console.log(chalk.hex('#e8683a')(` Setting up ${this.displayName}...`));
30
-
31
- // Clean up old installation first
32
- await this.cleanup(projectDir);
30
+ async installCommandsRecursive(sourceDir, targetDir, agileflowDir, injectDynamic = false) {
31
+ let commandCount = 0;
32
+ let subdirCount = 0;
33
33
 
34
- // Create .claude/commands/agileflow directory
35
- const claudeDir = path.join(projectDir, this.configDir);
36
- const commandsDir = path.join(claudeDir, this.commandsDir);
37
- const agileflowCommandsDir = path.join(commandsDir, 'AgileFlow');
34
+ if (!(await this.exists(sourceDir))) {
35
+ return { commands: 0, subdirs: 0 };
36
+ }
38
37
 
39
- await this.ensureDir(agileflowCommandsDir);
38
+ await this.ensureDir(targetDir);
40
39
 
41
- // Get commands from AgileFlow installation
42
- const commandsSource = path.join(agileflowDir, 'commands');
43
- let commandCount = 0;
40
+ const entries = await fs.readdir(sourceDir, { withFileTypes: true });
44
41
 
45
- if (await this.exists(commandsSource)) {
46
- const commands = await this.scanDirectory(commandsSource, '.md');
42
+ for (const entry of entries) {
43
+ const sourcePath = path.join(sourceDir, entry.name);
44
+ const targetPath = path.join(targetDir, entry.name);
47
45
 
48
- for (const command of commands) {
49
- // Read the original command content
50
- let content = await this.readFile(command.path);
46
+ if (entry.isFile() && entry.name.endsWith('.md')) {
47
+ // Read and process .md file
48
+ let content = await this.readFile(sourcePath);
51
49
 
52
- // Inject dynamic content (agent lists, command lists)
53
- content = this.injectDynamicContent(content, agileflowDir);
50
+ // Inject dynamic content if enabled (for top-level commands)
51
+ if (injectDynamic) {
52
+ content = this.injectDynamicContent(content, agileflowDir);
53
+ }
54
54
 
55
55
  // Replace docs/ references with custom folder name
56
56
  content = this.replaceDocsReferences(content);
57
57
 
58
- const targetPath = path.join(agileflowCommandsDir, `${command.name}.md`);
59
58
  await this.writeFile(targetPath, content);
60
59
  commandCount++;
60
+ } else if (entry.isDirectory()) {
61
+ // Recursively process subdirectory
62
+ const subResult = await this.installCommandsRecursive(
63
+ sourcePath,
64
+ targetPath,
65
+ agileflowDir,
66
+ false // Don't inject dynamic content in subdirectories
67
+ );
68
+ commandCount += subResult.commands;
69
+ subdirCount += 1 + subResult.subdirs;
61
70
  }
62
71
  }
63
72
 
64
- // Create agents subdirectory
65
- const agileflowAgentsDir = path.join(agileflowCommandsDir, 'agents');
66
- await this.ensureDir(agileflowAgentsDir);
73
+ return { commands: commandCount, subdirs: subdirCount };
74
+ }
67
75
 
68
- // Get agents from AgileFlow installation
69
- const agentsSource = path.join(agileflowDir, 'agents');
70
- let agentCount = 0;
76
+ /**
77
+ * Setup Claude Code IDE configuration
78
+ * @param {string} projectDir - Project directory
79
+ * @param {string} agileflowDir - AgileFlow installation directory
80
+ * @param {Object} options - Setup options
81
+ */
82
+ async setup(projectDir, agileflowDir, options = {}) {
83
+ console.log(chalk.hex('#e8683a')(` Setting up ${this.displayName}...`));
71
84
 
72
- if (await this.exists(agentsSource)) {
73
- const agents = await this.scanDirectory(agentsSource, '.md');
85
+ // Clean up old installation first
86
+ await this.cleanup(projectDir);
74
87
 
75
- for (const agent of agents) {
76
- // Read the original agent content
77
- let content = await this.readFile(agent.path);
88
+ // Create .claude/commands/agileflow directory
89
+ const claudeDir = path.join(projectDir, this.configDir);
90
+ const commandsDir = path.join(claudeDir, this.commandsDir);
91
+ const agileflowCommandsDir = path.join(commandsDir, 'agileflow');
78
92
 
79
- // Replace docs/ references with custom folder name
80
- content = this.replaceDocsReferences(content);
93
+ await this.ensureDir(agileflowCommandsDir);
81
94
 
82
- const targetPath = path.join(agileflowAgentsDir, `${agent.name}.md`);
83
- await this.writeFile(targetPath, content);
84
- agentCount++;
85
- }
86
- }
95
+ // Recursively install all commands (including subdirectories like agents/, session/)
96
+ const commandsSource = path.join(agileflowDir, 'commands');
97
+ const commandResult = await this.installCommandsRecursive(
98
+ commandsSource,
99
+ agileflowCommandsDir,
100
+ agileflowDir,
101
+ true // Inject dynamic content for top-level commands
102
+ );
103
+
104
+ // Also install agents (they're in a separate directory in agileflowDir)
105
+ const agentsSource = path.join(agileflowDir, 'agents');
106
+ const agentsTargetDir = path.join(agileflowCommandsDir, 'agents');
107
+ const agentResult = await this.installCommandsRecursive(
108
+ agentsSource,
109
+ agentsTargetDir,
110
+ agileflowDir,
111
+ false // No dynamic content for agents
112
+ );
113
+
114
+ const totalCommands = commandResult.commands + agentResult.commands;
115
+ const totalSubdirs = commandResult.subdirs + (agentResult.commands > 0 ? 1 : 0) + agentResult.subdirs;
87
116
 
88
117
  console.log(chalk.green(` ✓ ${this.displayName} configured:`));
89
- console.log(chalk.dim(` - ${commandCount} commands installed`));
90
- console.log(chalk.dim(` - ${agentCount} agents installed`));
118
+ console.log(chalk.dim(` - ${totalCommands} commands installed`));
119
+ if (totalSubdirs > 0) {
120
+ console.log(chalk.dim(` - ${totalSubdirs} subdirectories`));
121
+ }
91
122
  console.log(chalk.dim(` - Path: ${path.relative(projectDir, agileflowCommandsDir)}`));
92
123
 
93
124
  return {
94
125
  success: true,
95
- commands: commandCount,
96
- agents: agentCount,
126
+ commands: totalCommands,
127
+ subdirs: totalSubdirs,
97
128
  };
98
129
  }
99
130
  }