agileflow 2.99.0 → 2.99.2

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 (127) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +3 -3
  3. package/lib/dashboard-protocol.js +38 -0
  4. package/lib/dashboard-server.js +197 -7
  5. package/lib/feedback.js +36 -9
  6. package/lib/git-operations.js +4 -1
  7. package/lib/merge-operations.js +25 -0
  8. package/lib/progress.js +7 -6
  9. package/lib/session-operations.js +611 -0
  10. package/lib/session-switching.js +191 -0
  11. package/lib/template-loader.js +4 -2
  12. package/lib/worktree-operations.js +5 -25
  13. package/package.json +1 -1
  14. package/scripts/agileflow-configure.js +13 -0
  15. package/scripts/agileflow-welcome.js +11 -6
  16. package/scripts/batch-pmap-loop.js +11 -4
  17. package/scripts/claude-tmux.sh +186 -103
  18. package/scripts/damage-control-bash.js +33 -3
  19. package/scripts/damage-control-edit.js +33 -3
  20. package/scripts/damage-control-write.js +33 -3
  21. package/scripts/lib/configure-features.js +10 -7
  22. package/scripts/lib/configure-repair.js +12 -2
  23. package/scripts/lib/process-cleanup.js +197 -15
  24. package/scripts/obtain-context.js +5 -0
  25. package/scripts/session-manager.js +156 -932
  26. package/scripts/spawn-parallel.js +15 -11
  27. package/src/core/agents/configuration/archival.md +2 -1
  28. package/src/core/agents/configuration/attribution.md +2 -1
  29. package/src/core/agents/configuration/ci.md +2 -1
  30. package/src/core/agents/configuration/damage-control.md +2 -1
  31. package/src/core/agents/configuration/git-config.md +2 -1
  32. package/src/core/agents/configuration/hooks.md +2 -1
  33. package/src/core/agents/configuration/precompact.md +2 -1
  34. package/src/core/agents/configuration/status-line.md +2 -1
  35. package/src/core/agents/configuration/verify.md +2 -1
  36. package/src/core/commands/adr/list.md +1 -1
  37. package/src/core/commands/adr/update.md +1 -1
  38. package/src/core/commands/adr/view.md +1 -1
  39. package/src/core/commands/adr.md +1 -1
  40. package/src/core/commands/agent.md +1 -1
  41. package/src/core/commands/api.md +1 -1
  42. package/src/core/commands/assign.md +1 -1
  43. package/src/core/commands/audit.md +1 -1
  44. package/src/core/commands/auto.md +1 -1
  45. package/src/core/commands/automate.md +1 -1
  46. package/src/core/commands/babysit.md +1 -1
  47. package/src/core/commands/baseline.md +1 -1
  48. package/src/core/commands/batch.md +1 -1
  49. package/src/core/commands/blockers.md +1 -1
  50. package/src/core/commands/board.md +1 -1
  51. package/src/core/commands/changelog.md +1 -1
  52. package/src/core/commands/choose.md +1 -1
  53. package/src/core/commands/ci.md +1 -1
  54. package/src/core/commands/compress.md +1 -1
  55. package/src/core/commands/configure.md +56 -1
  56. package/src/core/commands/context/export.md +1 -1
  57. package/src/core/commands/context/full.md +1 -1
  58. package/src/core/commands/context/note.md +1 -1
  59. package/src/core/commands/council.md +1 -1
  60. package/src/core/commands/debt.md +1 -1
  61. package/src/core/commands/deploy.md +1 -1
  62. package/src/core/commands/deps.md +1 -1
  63. package/src/core/commands/diagnose.md +1 -1
  64. package/src/core/commands/docs.md +1 -1
  65. package/src/core/commands/epic/list.md +1 -1
  66. package/src/core/commands/epic/view.md +1 -1
  67. package/src/core/commands/epic.md +1 -1
  68. package/src/core/commands/feedback.md +1 -1
  69. package/src/core/commands/handoff.md +1 -1
  70. package/src/core/commands/help.md +4 -190
  71. package/src/core/commands/ideate/history.md +1 -1
  72. package/src/core/commands/ideate/new.md +1 -1
  73. package/src/core/commands/impact.md +1 -1
  74. package/src/core/commands/install.md +1 -1
  75. package/src/core/commands/logic/audit.md +1 -1
  76. package/src/core/commands/maintain.md +1 -1
  77. package/src/core/commands/metrics.md +1 -1
  78. package/src/core/commands/multi-expert.md +1 -1
  79. package/src/core/commands/packages.md +1 -1
  80. package/src/core/commands/pr.md +1 -1
  81. package/src/core/commands/readme-sync.md +1 -1
  82. package/src/core/commands/research/analyze.md +1 -1
  83. package/src/core/commands/research/ask.md +1 -1
  84. package/src/core/commands/research/import.md +1 -1
  85. package/src/core/commands/research/list.md +1 -1
  86. package/src/core/commands/research/synthesize.md +1 -1
  87. package/src/core/commands/research/view.md +1 -1
  88. package/src/core/commands/retro.md +1 -1
  89. package/src/core/commands/review.md +1 -1
  90. package/src/core/commands/rlm.md +1 -1
  91. package/src/core/commands/roadmap/analyze.md +1 -1
  92. package/src/core/commands/rpi.md +1 -1
  93. package/src/core/commands/serve.md +127 -0
  94. package/src/core/commands/session/cleanup.md +1 -1
  95. package/src/core/commands/session/end.md +84 -23
  96. package/src/core/commands/session/history.md +1 -1
  97. package/src/core/commands/session/init.md +1 -1
  98. package/src/core/commands/session/new.md +198 -84
  99. package/src/core/commands/session/resume.md +1 -1
  100. package/src/core/commands/session/spawn.md +1 -1
  101. package/src/core/commands/session/status.md +1 -1
  102. package/src/core/commands/skill/create.md +1 -1
  103. package/src/core/commands/skill/delete.md +1 -1
  104. package/src/core/commands/skill/edit.md +1 -1
  105. package/src/core/commands/skill/list.md +1 -1
  106. package/src/core/commands/skill/test.md +1 -1
  107. package/src/core/commands/skill/upgrade.md +1 -1
  108. package/src/core/commands/sprint.md +1 -1
  109. package/src/core/commands/status.md +1 -1
  110. package/src/core/commands/story/list.md +1 -1
  111. package/src/core/commands/story/view.md +1 -1
  112. package/src/core/commands/story-validate.md +1 -1
  113. package/src/core/commands/story.md +1 -1
  114. package/src/core/commands/team/list.md +1 -1
  115. package/src/core/commands/team/start.md +1 -1
  116. package/src/core/commands/team/status.md +1 -1
  117. package/src/core/commands/team/stop.md +1 -1
  118. package/src/core/commands/template.md +1 -1
  119. package/src/core/commands/tests.md +1 -1
  120. package/src/core/commands/update.md +1 -1
  121. package/src/core/commands/validate-expertise.md +1 -1
  122. package/src/core/commands/velocity.md +1 -1
  123. package/src/core/commands/verify.md +1 -1
  124. package/src/core/commands/whats-new.md +1 -1
  125. package/src/core/commands/workflow.md +1 -1
  126. package/tools/cli/installers/ide/codex.js +12 -4
  127. package/tools/cli/lib/content-injector.js +23 -4
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: Cleanly end session with optional merge to main
3
- argument-hint: (no arguments)
3
+ argument-hint: "(no arguments)"
4
4
  compact_context:
5
5
  priority: high
6
6
  preserve_rules:
@@ -224,22 +224,33 @@ Continue to **Merge Step 2**.
224
224
 
225
225
  #### If "Commit with custom message" selected:
226
226
 
227
- First, ask for the commit message:
227
+ First, analyze changes to suggest a meaningful commit message:
228
+
229
+ ```bash
230
+ # Get changed files summary for commit message suggestion
231
+ git diff --stat HEAD
232
+ ```
233
+
234
+ Based on the files changed, generate 2-3 contextual commit message suggestions:
235
+ - Examine which directories/files changed to determine the type (feat/fix/chore/docs)
236
+ - Read the diff summary to understand what was modified
237
+ - Suggest messages that describe the "why" not just the "what"
238
+
228
239
  ```
229
240
  AskUserQuestion:
230
- question: "Enter your commit message:"
241
+ question: "Choose or customize your commit message:"
231
242
  header: "Commit message"
232
243
  multiSelect: false
233
244
  options:
234
- - label: "feat: ..."
235
- description: "New feature"
236
- - label: "fix: ..."
237
- description: "Bug fix"
238
- - label: "chore: ..."
239
- description: "Maintenance/cleanup"
245
+ # 2-3 suggestions based on git diff analysis. Examples:
246
+ # - label: "feat: add OAuth support for session auth"
247
+ # description: "Based on changes to auth/ files"
248
+ # - label: "fix: resolve merge conflict in config"
249
+ # description: "Based on config file changes"
250
+ # Always include at least one option. User can select "Other" for custom.
240
251
  ```
241
252
 
242
- The user will select "Other" to enter a custom message. Then:
253
+ The user will select a suggestion or "Other" to enter a custom message. Then:
243
254
 
244
255
  ```bash
245
256
  node .agileflow/scripts/session-manager.js commit-changes {session_id} --message="{user_message}"
@@ -342,26 +353,42 @@ From the `check-merge` response, check `hasConflicts`:
342
353
 
343
354
  If `hasConflicts: true`:
344
355
 
356
+ First, get detailed conflict info:
357
+ ```bash
358
+ # Get list of files that conflict (without actually merging)
359
+ git merge --no-commit --no-ff {branchName} 2>&1 || true
360
+ git diff --name-only --diff-filter=U
361
+ git merge --abort
362
+ ```
363
+
364
+ Display specific files with context:
345
365
  ```
346
- ⚠️ Merge conflicts detected!
366
+ ⚠️ Merge conflicts detected in {N} file(s):
347
367
 
348
- This branch has conflicts with {mainBranch}. Smart merge can attempt automatic resolution.
368
+ {file1} - Both branches modified
369
+ {file2} - Conflicting changes
370
+ {file3} - Both added content (likely auto-resolvable)
349
371
  ```
350
372
 
351
- Then show conflict options:
373
+ Analyze the conflicting files to make a smart recommendation:
374
+ - If ALL conflicts are in docs/config files → recommend "Auto-resolve"
375
+ - If conflicts include source code → recommend "Review first, then auto-resolve"
376
+ - Count files by category (docs, tests, config, source) for the description
377
+
378
+ Then present AI-recommended options:
352
379
 
353
380
  ```
354
381
  AskUserQuestion:
355
- question: "How would you like to proceed?"
356
- header: "Merge conflicts"
382
+ question: "How to handle {N} conflicting file(s)?"
383
+ header: "Conflicts"
357
384
  multiSelect: false
358
385
  options:
359
- - label: "Auto-resolve conflicts (Recommended)"
360
- description: "Smart merge will resolve based on file types automatically"
361
- - label: "Resolve manually"
362
- description: "Keep session active and resolve conflicts yourself"
363
- - label: "End session without merging"
364
- description: "Keep worktree for later resolution"
386
+ - label: "{AI recommended option} (Recommended)"
387
+ description: "{reason based on conflict analysis - e.g., 'All conflicts are in docs/config - safe to auto-resolve'}"
388
+ - label: "Auto-resolve all"
389
+ description: "Smart merge resolves by file type (docs=accept_both, source=theirs, config=ours)"
390
+ - label: "Keep session, resolve manually"
391
+ description: "Stay in session and fix conflicts yourself"
365
392
  - label: "Cancel"
366
393
  description: "Keep session as-is"
367
394
  ```
@@ -490,6 +517,29 @@ Summary:
490
517
  💡 To push your changes: git push
491
518
  ```
492
519
 
520
+ ### Post-Merge: Notify Other Sessions
521
+
522
+ After successful merge, check if in tmux and send notification:
523
+
524
+ ```bash
525
+ # Check if in tmux
526
+ echo $TMUX
527
+ ```
528
+
529
+ If in tmux:
530
+ ```bash
531
+ # Send visible notification to all windows
532
+ tmux display-message -d 5000 "Session {id} merged to {mainBranch} - changes are live"
533
+ ```
534
+
535
+ Display to user:
536
+ ```
537
+ The main branch working directory ({mainPath}) now has your merged changes.
538
+ If you have a Claude session on main, its files are already updated.
539
+
540
+ To push to remote: git push
541
+ ```
542
+
493
543
  Then proceed to **Step 4: Offer to Close Tab**.
494
544
 
495
545
  If failed:
@@ -613,7 +663,7 @@ If `reason: "uncommitted_changes"` → Show inline options (5 choices):
613
663
 
614
664
  **Step 1a: Handle uncommitted choice**
615
665
  - "Commit all": `node .agileflow/scripts/session-manager.js commit-changes {id}` → continue
616
- - "Commit custom": Ask for message → `commit-changes {id} --message="..."` → continue
666
+ - "Commit custom": Analyze `git diff --stat`, suggest 2-3 contextual messages → `commit-changes {id} --message="..."` → continue
617
667
  - "Stash": `node .agileflow/scripts/session-manager.js stash {id}` → continue (unstash after merge)
618
668
  - "Discard": `node .agileflow/scripts/session-manager.js discard-changes {id}` → continue
619
669
  - "Cancel": EXIT
@@ -625,7 +675,11 @@ node .agileflow/scripts/session-manager.js merge-preview {session_id}
625
675
  Display commits and files to be merged.
626
676
 
627
677
  **Step 3: Check conflicts**
628
- If `hasConflicts: true` → Show conflict options (auto-resolve/manual/end/cancel)
678
+ If `hasConflicts: true`:
679
+ - Get detailed file list: `git merge --no-commit --no-ff {branch}`, `git diff --name-only --diff-filter=U`, `git merge --abort`
680
+ - Display per-file conflict details
681
+ - Analyze file types to recommend best option (docs/config → auto-resolve, source → review)
682
+ - Show conflict options with AI recommendation first (auto-resolve/manual/cancel)
629
683
 
630
684
  **Step 3a: If auto-resolve selected**
631
685
  ```bash
@@ -681,6 +735,12 @@ node .agileflow/scripts/session-manager.js integrate {id} --strategy={squash|mer
681
735
  💡 To push: git push
682
736
  ```
683
737
 
738
+ **Step 7a: Notify other sessions (if in tmux)**
739
+ ```bash
740
+ tmux display-message -d 5000 "Session {id} merged to {mainBranch} - changes are live"
741
+ ```
742
+ Display: "Main branch working directory now has your merged changes."
743
+
684
744
  ---
685
745
 
686
746
  ### 🚨 RULE #4: HANDLE OTHER OPTIONS
@@ -761,6 +821,7 @@ tmux kill-window
761
821
  g. Execute integrate
762
822
  h. If stash was used → unstash on main
763
823
  i. Show success with cd command
824
+ j. If in tmux → notify other sessions via tmux display-message
764
825
  5. If end/delete → Execute and show result
765
826
  6. If in tmux → Offer to close tab
766
827
  ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: View past session history and metrics
3
- argument-hint: [DAYS=7|30|90|all]
3
+ argument-hint: "[DAYS=7|30|90|all]"
4
4
  compact_context:
5
5
  priority: medium
6
6
  preserve_rules:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: Initialize session harness with test verification
3
- argument-hint: (no arguments)
3
+ argument-hint: "(no arguments)"
4
4
  compact_context:
5
5
  priority: high
6
6
  preserve_rules:
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  description: Create a new parallel session with git worktree
3
- argument-hint: (no arguments)
3
+ argument-hint: "(no arguments)"
4
4
  compact_context:
5
5
  priority: high
6
6
  preserve_rules:
7
7
  - "ACTIVE COMMAND: /agileflow:session:new - Create parallel session with worktree"
8
8
  - "Validates git repo and prerequisites before proceeding"
9
- - "Prompts user with 3 creation options: auto-create / named / existing branch"
9
+ - "Prompts user with 4 creation options: auto-create / named / existing branch / same-directory"
10
10
  - "Each option leads to different AskUserQuestion prompt"
11
11
  - "Returns success message with `cd` command to activate new session"
12
12
  - "Worktrees created in ../project-{id} or ../project-{name} directories"
@@ -79,7 +79,96 @@ Parse the JSON output to understand current sessions.
79
79
 
80
80
  ### Step 2B: Tmux Flow (INSIDE tmux)
81
81
 
82
- When inside tmux, use the simplified add-window flow:
82
+ When inside tmux, first ask what type of session:
83
+
84
+ #### Step 2B.0: Ask Session Type
85
+
86
+ ```
87
+ AskUserQuestion:
88
+ question: "What type of session?"
89
+ header: "Session type"
90
+ multiSelect: false
91
+ options:
92
+ - label: "Parallel worktree (Recommended)"
93
+ description: "Isolated branch + directory. Safe for concurrent work."
94
+ - label: "Same directory (quick)"
95
+ description: "No worktree. Multiple Claude instances in same dir. Best for small, non-overlapping changes."
96
+ ```
97
+
98
+ **If "Same directory (quick)" selected:**
99
+
100
+ ```bash
101
+ # Get the session name (or auto-generate)
102
+ ```
103
+
104
+ Ask for a window name (simple, no worktree context needed):
105
+ ```
106
+ AskUserQuestion:
107
+ question: "Name for the new window?"
108
+ header: "Window name"
109
+ multiSelect: false
110
+ options:
111
+ - label: "Auto-name"
112
+ description: "Uses 'quick-{timestamp}' automatically"
113
+ - label: "helper"
114
+ description: "Helper session for small tasks"
115
+ ```
116
+
117
+ Then create the same-directory session:
118
+ ```bash
119
+ # Create new tmux window in current directory and run Claude
120
+ tmux new-window -c "#{pane_current_path}" -n "{name}"
121
+ tmux send-keys "claude $CLAUDE_SESSION_FLAGS" Enter
122
+ ```
123
+
124
+ Display:
125
+ ```
126
+ Created same-directory session "{name}".
127
+ Changes apply to current branch. No git isolation.
128
+
129
+ Note: Multiple AIs editing the same files can cause conflicts.
130
+ Best for non-overlapping work (e.g., tests in one, docs in another).
131
+ ```
132
+
133
+ **Done - skip remaining steps.**
134
+
135
+ **If "Parallel worktree" selected:**
136
+
137
+ Continue with the worktree flow below.
138
+
139
+ #### Step 2B.1: Ask Session Name (worktree flow)
140
+
141
+ Before presenting name options, gather context for smart suggestions:
142
+
143
+ ```bash
144
+ # Get WIP/ready stories, recent commits, and existing branches in one pass
145
+ node -e "
146
+ const fs = require('fs');
147
+ const { execFileSync } = require('child_process');
148
+ const suggestions = [];
149
+ try {
150
+ const status = JSON.parse(fs.readFileSync('docs/09-agents/status.json', 'utf8'));
151
+ const stories = Object.entries(status.stories || {});
152
+ const wip = stories.filter(([,s]) => s.status === 'in-progress' || s.status === 'ready');
153
+ wip.slice(0, 3).forEach(([id, s]) => {
154
+ const name = (s.title || id).toLowerCase().replace(/[^a-z0-9]+/g, '-').slice(0, 20);
155
+ suggestions.push({ label: name, desc: id + ': ' + (s.title || '').slice(0, 40) });
156
+ });
157
+ } catch(e) {}
158
+ try {
159
+ const log = execFileSync('git', ['log', '--oneline', '-5'], { encoding: 'utf8' }).trim().split('\n');
160
+ const topics = log.map(l => l.replace(/^[a-f0-9]+ /, '').replace(/^(feat|fix|chore|docs|refactor|test)[\(:].*?\)?:?\s*/, ''));
161
+ const seen = new Set(suggestions.map(s => s.label));
162
+ topics.slice(0, 2).forEach(t => {
163
+ const name = t.toLowerCase().replace(/[^a-z0-9]+/g, '-').slice(0, 20);
164
+ if (!seen.has(name)) { suggestions.push({ label: name, desc: 'From recent commit: ' + t.slice(0, 40) }); seen.add(name); }
165
+ });
166
+ } catch(e) {}
167
+ console.log(JSON.stringify(suggestions.slice(0, 3)));
168
+ "
169
+ ```
170
+
171
+ Use the output to generate contextual name suggestions. Present with AskUserQuestion:
83
172
 
84
173
  ```
85
174
  AskUserQuestion:
@@ -89,26 +178,34 @@ AskUserQuestion:
89
178
  options:
90
179
  - label: "Auto-generate name"
91
180
  description: "Creates parallel-{timestamp} automatically"
92
- - label: "auth"
93
- description: "Authentication work"
94
- - label: "feature"
95
- description: "New feature development"
96
- - label: "bugfix"
97
- description: "Bug fixing"
181
+ # Then 2-3 contextual suggestions from the script output above.
182
+ # Example if WIP story US-0042 "OAuth Support" exists:
183
+ # - label: "oauth-support"
184
+ # description: "US-0042: OAuth Support"
185
+ # If no context available, use descriptive generics:
186
+ # - label: "hotfix"
187
+ # description: "Quick bug fix"
188
+ # - label: "experiment"
189
+ # description: "Try something out"
98
190
  ```
99
191
 
100
- ### Step 2B.2: Ask Startup Mode (OPTIONAL but recommended)
192
+ ### Step 2B.2: Determine Startup Mode
101
193
 
102
- After getting the session name, check for configured default startup mode:
194
+ Read the startup mode configuration:
103
195
 
104
196
  ```bash
105
- # Read the default startup mode from metadata (if exists)
106
- cat docs/00-meta/agileflow-metadata.json | grep -A1 '"defaultStartupMode"' 2>/dev/null
197
+ node -e "try{const m=JSON.parse(require('fs').readFileSync('docs/00-meta/agileflow-metadata.json','utf8'));console.log(JSON.stringify({mode:m.sessions?.defaultStartupMode||'normal'}))}catch(e){console.log(JSON.stringify({mode:'normal'}))}"
107
198
  ```
108
199
 
109
200
  The `defaultStartupMode` can be: `normal`, `skip-permissions`, `accept-edits`, or `no-claude`.
110
201
 
111
- Then ask how Claude should start, putting the configured default first with "(Recommended)":
202
+ **If mode is NOT "normal":**
203
+ - Skip the question entirely. Use the configured mode directly.
204
+ - Display: `Using configured startup mode: {mode}`
205
+ - Map directly to flags and proceed to spawn (see Mode to Flag Mapping below)
206
+
207
+ **If mode IS "normal" (or not set):**
208
+ - Ask the startup mode question:
112
209
 
113
210
  ```
114
211
  AskUserQuestion:
@@ -116,8 +213,6 @@ AskUserQuestion:
116
213
  header: "Startup mode"
117
214
  multiSelect: false
118
215
  options:
119
- # Put the defaultStartupMode option FIRST with "(Recommended)" suffix
120
- # Example if defaultStartupMode is "normal":
121
216
  - label: "Normal (Recommended)"
122
217
  description: "Standard Claude with permission prompts"
123
218
  - label: "Skip permissions"
@@ -126,16 +221,6 @@ AskUserQuestion:
126
221
  description: "claude --permission-mode acceptEdits"
127
222
  - label: "Don't start Claude"
128
223
  description: "Create worktree only, start Claude manually"
129
-
130
- # Example if defaultStartupMode is "skip-permissions":
131
- # - label: "Skip permissions (Recommended)"
132
- # description: "claude --dangerously-skip-permissions (trusted mode)"
133
- # - label: "Normal"
134
- # description: "Standard Claude with permission prompts"
135
- # - label: "Accept edits only"
136
- # description: "claude --permission-mode acceptEdits"
137
- # - label: "Don't start Claude"
138
- # description: "Create worktree only, start Claude manually"
139
224
  ```
140
225
 
141
226
  **Mode to Flag Mapping:**
@@ -186,6 +271,27 @@ AskUserQuestion:
186
271
  description: "Give it a memorable name like 'auth' or 'bugfix'"
187
272
  - label: "Use existing branch"
188
273
  description: "Create session from one of your existing branches"
274
+ - label: "Same directory (no worktree)"
275
+ description: "Run another Claude here - fast for small changes, no git isolation"
276
+ ```
277
+
278
+ ### Step 4d: If "Same directory" Selected
279
+
280
+ Display the command for the user to run in a new terminal:
281
+
282
+ ```
283
+ To start another Claude instance in this directory, run in a new terminal:
284
+
285
+ cd {current_directory}
286
+ claude
287
+
288
+ Or if you want skip-permissions mode:
289
+
290
+ cd {current_directory}
291
+ claude --dangerously-skip-permissions
292
+
293
+ Note: Multiple AIs editing the same files can cause conflicts.
294
+ Best for non-overlapping work (e.g., tests in one, docs in another).
189
295
  ```
190
296
 
191
297
  ### Step 4a: If "Auto-create" Selected
@@ -215,7 +321,36 @@ Note: Worktree sessions default to "parallel" thread type. See docs/02-practices
215
321
 
216
322
  ### Step 4b: If "Name this session" Selected
217
323
 
218
- Use AskUserQuestion to get the name:
324
+ Gather context for smart name suggestions (same script as tmux flow):
325
+
326
+ ```bash
327
+ node -e "
328
+ const fs = require('fs');
329
+ const { execFileSync } = require('child_process');
330
+ const suggestions = [];
331
+ try {
332
+ const status = JSON.parse(fs.readFileSync('docs/09-agents/status.json', 'utf8'));
333
+ const stories = Object.entries(status.stories || {});
334
+ const wip = stories.filter(([,s]) => s.status === 'in-progress' || s.status === 'ready');
335
+ wip.slice(0, 3).forEach(([id, s]) => {
336
+ const name = (s.title || id).toLowerCase().replace(/[^a-z0-9]+/g, '-').slice(0, 20);
337
+ suggestions.push({ label: name, desc: id + ': ' + (s.title || '').slice(0, 40) });
338
+ });
339
+ } catch(e) {}
340
+ try {
341
+ const log = execFileSync('git', ['log', '--oneline', '-5'], { encoding: 'utf8' }).trim().split('\n');
342
+ const topics = log.map(l => l.replace(/^[a-f0-9]+ /, '').replace(/^(feat|fix|chore|docs|refactor|test)[\(:].*?\)?:?\s*/, ''));
343
+ const seen = new Set(suggestions.map(s => s.label));
344
+ topics.slice(0, 2).forEach(t => {
345
+ const name = t.toLowerCase().replace(/[^a-z0-9]+/g, '-').slice(0, 20);
346
+ if (!seen.has(name)) { suggestions.push({ label: name, desc: 'From recent commit: ' + t.slice(0, 40) }); seen.add(name); }
347
+ });
348
+ } catch(e) {}
349
+ console.log(JSON.stringify(suggestions.slice(0, 3)));
350
+ "
351
+ ```
352
+
353
+ Use AskUserQuestion with contextual suggestions from the script output:
219
354
 
220
355
  ```
221
356
  AskUserQuestion:
@@ -223,14 +358,11 @@ AskUserQuestion:
223
358
  header: "Session name"
224
359
  multiSelect: false
225
360
  options:
226
- - label: "auth"
227
- description: "Working on authentication"
228
- - label: "bugfix"
229
- description: "Fixing bugs"
230
- - label: "feature"
231
- description: "New feature work"
232
- - label: "experiment"
233
- description: "Trying something out"
361
+ # 2-3 contextual suggestions from script output above
362
+ # Example: {"label": "oauth-support", "description": "US-0042: OAuth Support"}
363
+ # If no context available, use descriptive generics:
364
+ # {"label": "hotfix", "description": "Quick bug fix"}
365
+ # {"label": "spike", "description": "Exploratory work"}
234
366
  ```
235
367
 
236
368
  Then create with nickname:
@@ -346,30 +478,22 @@ echo $TMUX
346
478
 
347
479
  ### 🚨 RULE #1B: TMUX FLOW (when in tmux)
348
480
 
349
- **Step 1: Ask for session name:**
350
- ```xml
351
- <invoke name="AskUserQuestion">
352
- <parameter name="questions">[{
353
- "question": "Name for the new session window?",
354
- "header": "New window",
355
- "multiSelect": false,
356
- "options": [
357
- {"label": "Auto-generate name", "description": "Creates parallel-{timestamp} automatically"},
358
- {"label": "auth", "description": "Authentication work"},
359
- {"label": "feature", "description": "New feature development"},
360
- {"label": "bugfix", "description": "Bug fixing"}
361
- ]
362
- }]</parameter>
363
- </invoke>
364
- ```
481
+ **Step 0: Ask session type:**
482
+ - "Parallel worktree (Recommended)" → continue to Step 1
483
+ - "Same directory (quick)" → create tmux window in current dir, run claude, display warning, DONE
484
+
485
+ **Step 1: Gather context and ask for session name:**
486
+ First run the context-gathering script to get WIP stories and recent commits for smart name suggestions.
487
+ Then present AskUserQuestion with "Auto-generate name" first, followed by 2-3 contextual suggestions.
488
+ If no context available, use descriptive generics (hotfix, experiment, spike).
365
489
 
366
- **Step 2: Read default startup mode and ask:**
490
+ **Step 2: Determine startup mode:**
367
491
  ```bash
368
- # Check configured default (normal if not set)
369
- cat docs/00-meta/agileflow-metadata.json | grep '"defaultStartupMode"' 2>/dev/null
492
+ node -e "try{const m=JSON.parse(require('fs').readFileSync('docs/00-meta/agileflow-metadata.json','utf8'));console.log(JSON.stringify({mode:m.sessions?.defaultStartupMode||'normal'}))}catch(e){console.log(JSON.stringify({mode:'normal'}))}"
370
493
  ```
371
494
 
372
- Then ask with configured default first + "(Recommended)":
495
+ **If mode is NOT "normal"** → Skip question, use configured mode directly, display `Using configured startup mode: {mode}`
496
+ **If mode IS "normal"** → Ask:
373
497
  ```xml
374
498
  <invoke name="AskUserQuestion">
375
499
  <parameter name="questions">[{
@@ -377,8 +501,7 @@ Then ask with configured default first + "(Recommended)":
377
501
  "header": "Startup",
378
502
  "multiSelect": false,
379
503
  "options": [
380
- {"label": "{default} (Recommended)", "description": "Configured default"},
381
- {"label": "Normal", "description": "Standard with prompts"},
504
+ {"label": "Normal (Recommended)", "description": "Standard with prompts"},
382
505
  {"label": "Skip permissions", "description": "--dangerously-skip-permissions"},
383
506
  {"label": "Accept edits only", "description": "--permission-mode acceptEdits"},
384
507
  {"label": "Don't start Claude", "description": "Manual start later"}
@@ -386,7 +509,6 @@ Then ask with configured default first + "(Recommended)":
386
509
  }]</parameter>
387
510
  </invoke>
388
511
  ```
389
- Note: Put the defaultStartupMode FIRST with "(Recommended)", remove duplicate.
390
512
 
391
513
  **Step 3: Run with selected options:**
392
514
  ```bash
@@ -430,7 +552,7 @@ Get current session count first:
430
552
  node .agileflow/scripts/session-manager.js status
431
553
  ```
432
554
 
433
- Then show exactly these 3 options:
555
+ Then show these 4 options:
434
556
  ```xml
435
557
  <invoke name="AskUserQuestion">
436
558
  <parameter name="questions">[{
@@ -443,7 +565,9 @@ Then show exactly these 3 options:
443
565
  {"label": "Name this session",
444
566
  "description": "Give it a memorable name like 'auth' or 'bugfix'"},
445
567
  {"label": "Use existing branch",
446
- "description": "Create session from one of your existing branches"}
568
+ "description": "Create session from one of your existing branches"},
569
+ {"label": "Same directory (no worktree)",
570
+ "description": "Run another Claude here - fast, no git isolation"}
447
571
  ]
448
572
  }]</parameter>
449
573
  </invoke>
@@ -487,23 +611,11 @@ To switch to this session, run:
487
611
 
488
612
  ### 🚨 RULE #4: HANDLE OPTION #2 - NAME THIS SESSION
489
613
 
490
- If user selects "Name this session", present suggestions:
491
- ```xml
492
- <invoke name="AskUserQuestion">
493
- <parameter name="questions">[{
494
- "question": "What should this session be called?",
495
- "header": "Session name",
496
- "multiSelect": false,
497
- "options": [
498
- {"label": "auth", "description": "Working on authentication"},
499
- {"label": "bugfix", "description": "Fixing bugs"},
500
- {"label": "feature", "description": "New feature work"},
501
- {"label": "experiment", "description": "Trying something out"},
502
- {"label": "Other", "description": "Custom name"}
503
- ]
504
- }]</parameter>
505
- </invoke>
506
- ```
614
+ If user selects "Name this session", gather context for smart suggestions:
615
+ Run the context-gathering script to get WIP stories and recent commits.
616
+ Present AskUserQuestion with 2-3 contextual suggestions from the output.
617
+ If no context, use generics (hotfix, spike, experiment).
618
+ User can always select "Other" for a custom name.
507
619
 
508
620
  If user selects "Other", prompt for custom input (AskUserQuestion with text input if available).
509
621
 
@@ -665,13 +777,14 @@ To switch to this session, run:
665
777
  | Auto-create | ../project-{id} | session-{id} | create |
666
778
  | Named | ../project-{name} | session-{id}-{name} | create --nickname {name} |
667
779
  | Existing branch | ../project-{name} | {branch_name} | create --branch {branch} |
780
+ | Same directory | (current dir) | (current branch) | (just run claude) |
668
781
 
669
782
  ---
670
783
 
671
784
  ### ANTI-PATTERNS (DON'T DO THESE)
672
785
 
673
786
  ❌ Don't validate git repo in the middle of process
674
- ❌ Don't show more/fewer than 3 initial options
787
+ ❌ Don't show more/fewer than 4 initial options
675
788
  ❌ Don't create session without explicit user choice
676
789
  ❌ Don't skip error handling (directory exists, branch conflict)
677
790
  ❌ Don't show old "cd && claude" command - use /add-dir instead
@@ -680,7 +793,7 @@ To switch to this session, run:
680
793
  ### DO THESE INSTEAD
681
794
 
682
795
  ✅ Validate git first, exit if not in repo
683
- ✅ Always show exactly 3 options
796
+ ✅ Always show exactly 4 options
684
797
  ✅ Wait for user to select before creating
685
798
  ✅ Handle all error cases gracefully
686
799
  ✅ Show `/add-dir {path}` command for user to switch
@@ -692,19 +805,20 @@ To switch to this session, run:
692
805
 
693
806
  - `/agileflow:session:new` IS ACTIVE
694
807
  - **CHECK $TMUX FIRST** - determines which flow to use
695
- - **In tmux**: Use `spawn-parallel.js add-window` fast, Alt+N to switch
696
- - **Not in tmux**: Standard worktree flow → /add-dir to switch
808
+ - **In tmux**: Ask session type first (worktree vs same-dir), then `spawn-parallel.js add-window` for worktree or `tmux new-window` for same-dir
809
+ - **Not in tmux**: Standard flow with 4 options → /add-dir to switch (or same-dir instructions)
697
810
  - ALWAYS validate git repo first (for standard flow)
698
- - Present 3 options: auto-create / named / existing branch (standard flow)
811
+ - Present 4 options: auto-create / named / existing branch / same-directory (standard flow)
699
812
  - Each option leads to different flow
700
813
  - Use AskUserQuestion for user selections
701
814
  - Handle all error cases (directory, branch, git)
702
815
  - **Run `session-manager.js switch {new_id}` AFTER creating session** (enables boundary protection)
703
816
  - Show `/add-dir {path}` command for user to switch (NOT cd && claude)
704
817
  - Show tip to use /agileflow:session:resume
705
- - **STARTUP OPTIONS (tmux flow)**: After name, ask startup mode:
818
+ - **STARTUP OPTIONS (tmux flow)**: After name, check startup mode:
706
819
  - Read `defaultStartupMode` from `docs/00-meta/agileflow-metadata.json`
707
- - Put configured default FIRST with "(Recommended)" suffix
820
+ - **If mode is NOT "normal"** → Skip question, use configured mode directly
821
+ - **If mode IS "normal"** → Ask the startup mode question
708
822
  - Normal → (no extra flags)
709
823
  - Skip permissions → `--dangerous`
710
824
  - Accept edits → `--claude-args "--permission-mode acceptEdits"`
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: Pick a session to switch to or resume
3
- argument-hint: (no arguments)
3
+ argument-hint: "(no arguments)"
4
4
  compact_context:
5
5
  priority: high
6
6
  preserve_rules:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: Spawn multiple parallel Claude Code sessions in git worktrees
3
- argument-hint: [--count N | --branches a,b,c | --from-epic EP-XXX]
3
+ argument-hint: "[--count N | --branches a,b,c | --from-epic EP-XXX]"
4
4
  compact_context:
5
5
  priority: high
6
6
  preserve_rules:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: View current session state and activity
3
- argument-hint: [--kanban]
3
+ argument-hint: "[--kanban]"
4
4
  compact_context:
5
5
  priority: medium
6
6
  preserve_rules:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: Generate a custom skill with web research, cookbook pattern, and MCP integration
3
- argument-hint: [<name>]
3
+ argument-hint: "[<name>]"
4
4
  compact_context:
5
5
  priority: high
6
6
  preserve_rules:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: Remove an installed skill from .claude/skills/
3
- argument-hint: [<name>]
3
+ argument-hint: "[<name>]"
4
4
  compact_context:
5
5
  priority: medium
6
6
  preserve_rules: