agileflow 3.3.0 → 3.4.1

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 (210) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +6 -6
  3. package/lib/skill-loader.js +0 -1
  4. package/package.json +1 -1
  5. package/scripts/agileflow-statusline.sh +81 -0
  6. package/scripts/agileflow-welcome.js +79 -0
  7. package/scripts/claude-tmux.sh +90 -23
  8. package/scripts/claude-watchdog.sh +225 -0
  9. package/scripts/generators/agent-registry.js +14 -1
  10. package/scripts/generators/inject-babysit.js +22 -9
  11. package/scripts/generators/inject-help.js +19 -9
  12. package/scripts/lib/ac-test-matcher.js +452 -0
  13. package/scripts/lib/audit-cleanup.js +250 -0
  14. package/scripts/lib/audit-registry.js +304 -0
  15. package/scripts/lib/configure-features.js +35 -0
  16. package/scripts/lib/feature-catalog.js +3 -3
  17. package/scripts/lib/gate-enforcer.js +295 -0
  18. package/scripts/lib/model-profiles.js +118 -0
  19. package/scripts/lib/quality-gates.js +163 -0
  20. package/scripts/lib/signal-detectors.js +44 -1
  21. package/scripts/lib/skill-catalog.js +557 -0
  22. package/scripts/lib/skill-recommender.js +311 -0
  23. package/scripts/lib/status-writer.js +255 -0
  24. package/scripts/lib/story-claiming.js +128 -45
  25. package/scripts/lib/task-sync.js +32 -38
  26. package/scripts/lib/tdd-phase-manager.js +455 -0
  27. package/scripts/lib/team-events.js +34 -3
  28. package/scripts/lib/tmux-audit-monitor.js +611 -0
  29. package/scripts/lib/tmux-group-colors.js +113 -0
  30. package/scripts/lib/tool-registry.yaml +241 -0
  31. package/scripts/lib/tool-shed.js +441 -0
  32. package/scripts/messaging-bridge.js +209 -1
  33. package/scripts/native-team-observer.js +219 -0
  34. package/scripts/obtain-context.js +14 -0
  35. package/scripts/ralph-loop.js +30 -5
  36. package/scripts/smart-detect.js +21 -0
  37. package/scripts/spawn-audit-sessions.js +877 -0
  38. package/scripts/team-manager.js +56 -16
  39. package/scripts/tmux-close-windows.sh +180 -0
  40. package/src/core/agents/a11y-analyzer-aria.md +155 -0
  41. package/src/core/agents/a11y-analyzer-forms.md +162 -0
  42. package/src/core/agents/a11y-analyzer-keyboard.md +175 -0
  43. package/src/core/agents/a11y-analyzer-semantic.md +153 -0
  44. package/src/core/agents/a11y-analyzer-visual.md +158 -0
  45. package/src/core/agents/a11y-consensus.md +248 -0
  46. package/src/core/agents/ads-audit-budget.md +181 -0
  47. package/src/core/agents/ads-audit-compliance.md +169 -0
  48. package/src/core/agents/ads-audit-creative.md +164 -0
  49. package/src/core/agents/ads-audit-google.md +226 -0
  50. package/src/core/agents/ads-audit-meta.md +183 -0
  51. package/src/core/agents/ads-audit-tracking.md +197 -0
  52. package/src/core/agents/ads-consensus.md +396 -0
  53. package/src/core/agents/ads-generate.md +145 -0
  54. package/src/core/agents/ads-performance-tracker.md +197 -0
  55. package/src/core/agents/api-quality-analyzer-conventions.md +148 -0
  56. package/src/core/agents/api-quality-analyzer-docs.md +176 -0
  57. package/src/core/agents/api-quality-analyzer-errors.md +183 -0
  58. package/src/core/agents/api-quality-analyzer-pagination.md +171 -0
  59. package/src/core/agents/api-quality-analyzer-versioning.md +143 -0
  60. package/src/core/agents/api-quality-consensus.md +214 -0
  61. package/src/core/agents/arch-analyzer-circular.md +148 -0
  62. package/src/core/agents/arch-analyzer-complexity.md +171 -0
  63. package/src/core/agents/arch-analyzer-coupling.md +146 -0
  64. package/src/core/agents/arch-analyzer-layering.md +151 -0
  65. package/src/core/agents/arch-analyzer-patterns.md +162 -0
  66. package/src/core/agents/arch-consensus.md +227 -0
  67. package/src/core/agents/brainstorm-analyzer-features.md +169 -0
  68. package/src/core/agents/brainstorm-analyzer-growth.md +161 -0
  69. package/src/core/agents/brainstorm-analyzer-integration.md +172 -0
  70. package/src/core/agents/brainstorm-analyzer-market.md +147 -0
  71. package/src/core/agents/brainstorm-analyzer-ux.md +167 -0
  72. package/src/core/agents/brainstorm-consensus.md +237 -0
  73. package/src/core/agents/completeness-consensus.md +5 -5
  74. package/src/core/agents/perf-consensus.md +2 -2
  75. package/src/core/agents/security-consensus.md +2 -2
  76. package/src/core/agents/seo-analyzer-content.md +167 -0
  77. package/src/core/agents/seo-analyzer-images.md +187 -0
  78. package/src/core/agents/seo-analyzer-performance.md +206 -0
  79. package/src/core/agents/seo-analyzer-schema.md +176 -0
  80. package/src/core/agents/seo-analyzer-sitemap.md +172 -0
  81. package/src/core/agents/seo-analyzer-technical.md +144 -0
  82. package/src/core/agents/seo-consensus.md +289 -0
  83. package/src/core/agents/test-consensus.md +2 -2
  84. package/src/core/commands/adr.md +1 -0
  85. package/src/core/commands/ads/audit.md +375 -0
  86. package/src/core/commands/ads/budget.md +97 -0
  87. package/src/core/commands/ads/competitor.md +112 -0
  88. package/src/core/commands/ads/creative.md +85 -0
  89. package/src/core/commands/ads/generate.md +238 -0
  90. package/src/core/commands/ads/google.md +112 -0
  91. package/src/core/commands/ads/health.md +327 -0
  92. package/src/core/commands/ads/landing.md +119 -0
  93. package/src/core/commands/ads/linkedin.md +112 -0
  94. package/src/core/commands/ads/meta.md +91 -0
  95. package/src/core/commands/ads/microsoft.md +115 -0
  96. package/src/core/commands/ads/plan.md +321 -0
  97. package/src/core/commands/ads/test-plan.md +317 -0
  98. package/src/core/commands/ads/tiktok.md +129 -0
  99. package/src/core/commands/ads/track.md +288 -0
  100. package/src/core/commands/ads/youtube.md +124 -0
  101. package/src/core/commands/ads.md +140 -0
  102. package/src/core/commands/assign.md +1 -0
  103. package/src/core/commands/audit.md +43 -6
  104. package/src/core/commands/babysit.md +315 -1266
  105. package/src/core/commands/baseline.md +1 -0
  106. package/src/core/commands/blockers.md +1 -0
  107. package/src/core/commands/board.md +1 -0
  108. package/src/core/commands/changelog.md +1 -0
  109. package/src/core/commands/choose.md +1 -0
  110. package/src/core/commands/ci.md +1 -0
  111. package/src/core/commands/code/accessibility.md +347 -0
  112. package/src/core/commands/code/api.md +297 -0
  113. package/src/core/commands/code/architecture.md +297 -0
  114. package/src/core/commands/{audit → code}/completeness.md +72 -25
  115. package/src/core/commands/{audit → code}/legal.md +63 -16
  116. package/src/core/commands/{audit → code}/logic.md +64 -16
  117. package/src/core/commands/{audit → code}/performance.md +67 -20
  118. package/src/core/commands/{audit → code}/security.md +69 -19
  119. package/src/core/commands/{audit → code}/test.md +67 -20
  120. package/src/core/commands/configure.md +1 -0
  121. package/src/core/commands/council.md +1 -0
  122. package/src/core/commands/deploy.md +1 -0
  123. package/src/core/commands/diagnose.md +1 -0
  124. package/src/core/commands/docs.md +1 -0
  125. package/src/core/commands/epic/edit.md +213 -0
  126. package/src/core/commands/epic.md +1 -0
  127. package/src/core/commands/export.md +238 -0
  128. package/src/core/commands/help.md +16 -1
  129. package/src/core/commands/{discovery → ideate}/brief.md +12 -12
  130. package/src/core/commands/{discovery/new.md → ideate/discover.md} +20 -16
  131. package/src/core/commands/ideate/features.md +496 -0
  132. package/src/core/commands/ideate/new.md +158 -124
  133. package/src/core/commands/impact.md +1 -0
  134. package/src/core/commands/learn/explain.md +118 -0
  135. package/src/core/commands/learn/glossary.md +135 -0
  136. package/src/core/commands/learn/patterns.md +138 -0
  137. package/src/core/commands/learn/tour.md +126 -0
  138. package/src/core/commands/migrate/codemods.md +151 -0
  139. package/src/core/commands/migrate/plan.md +131 -0
  140. package/src/core/commands/migrate/scan.md +114 -0
  141. package/src/core/commands/migrate/validate.md +119 -0
  142. package/src/core/commands/multi-expert.md +1 -0
  143. package/src/core/commands/pr.md +1 -0
  144. package/src/core/commands/review.md +1 -0
  145. package/src/core/commands/seo/audit.md +373 -0
  146. package/src/core/commands/seo/competitor.md +174 -0
  147. package/src/core/commands/seo/content.md +107 -0
  148. package/src/core/commands/seo/geo.md +229 -0
  149. package/src/core/commands/seo/hreflang.md +140 -0
  150. package/src/core/commands/seo/images.md +96 -0
  151. package/src/core/commands/seo/page.md +198 -0
  152. package/src/core/commands/seo/plan.md +163 -0
  153. package/src/core/commands/seo/programmatic.md +131 -0
  154. package/src/core/commands/seo/references/cwv-thresholds.md +64 -0
  155. package/src/core/commands/seo/references/eeat-framework.md +110 -0
  156. package/src/core/commands/seo/references/quality-gates.md +91 -0
  157. package/src/core/commands/seo/references/schema-types.md +102 -0
  158. package/src/core/commands/seo/schema.md +183 -0
  159. package/src/core/commands/seo/sitemap.md +97 -0
  160. package/src/core/commands/seo/technical.md +100 -0
  161. package/src/core/commands/seo.md +107 -0
  162. package/src/core/commands/skill/list.md +68 -212
  163. package/src/core/commands/skill/recommend.md +216 -0
  164. package/src/core/commands/sprint.md +1 -0
  165. package/src/core/commands/status/undo.md +191 -0
  166. package/src/core/commands/status.md +1 -0
  167. package/src/core/commands/story/edit.md +204 -0
  168. package/src/core/commands/story/view.md +29 -7
  169. package/src/core/commands/story-validate.md +1 -0
  170. package/src/core/commands/story.md +1 -0
  171. package/src/core/commands/tdd-next.md +238 -0
  172. package/src/core/commands/tdd.md +211 -0
  173. package/src/core/commands/team/start.md +10 -6
  174. package/src/core/commands/tests.md +1 -0
  175. package/src/core/commands/verify.md +27 -1
  176. package/src/core/commands/workflow.md +2 -0
  177. package/src/core/experts/_core-expertise.yaml +105 -0
  178. package/src/core/experts/analytics/expertise.yaml +5 -99
  179. package/src/core/experts/codebase-query/expertise.yaml +3 -72
  180. package/src/core/experts/compliance/expertise.yaml +6 -72
  181. package/src/core/experts/database/expertise.yaml +9 -52
  182. package/src/core/experts/documentation/expertise.yaml +7 -140
  183. package/src/core/experts/integrations/expertise.yaml +7 -127
  184. package/src/core/experts/mentor/expertise.yaml +8 -35
  185. package/src/core/experts/monitoring/expertise.yaml +7 -49
  186. package/src/core/experts/performance/expertise.yaml +1 -26
  187. package/src/core/experts/security/expertise.yaml +9 -34
  188. package/src/core/experts/ui/expertise.yaml +6 -36
  189. package/src/core/knowledge/ads/ad-audit-checklist-scoring.md +424 -0
  190. package/src/core/knowledge/ads/ad-optimization-logic.md +590 -0
  191. package/src/core/knowledge/ads/ad-technical-specifications.md +385 -0
  192. package/src/core/knowledge/ads/definitive-advertising-reference-2026.md +506 -0
  193. package/src/core/knowledge/ads/paid-advertising-research-2026.md +445 -0
  194. package/src/core/teams/backend.json +41 -0
  195. package/src/core/teams/frontend.json +41 -0
  196. package/src/core/teams/qa.json +41 -0
  197. package/src/core/teams/solo.json +35 -0
  198. package/src/core/templates/agileflow-metadata.json +20 -1
  199. package/tools/cli/commands/setup.js +85 -3
  200. package/tools/cli/commands/update.js +42 -0
  201. package/tools/cli/installers/ide/_base-ide.js +42 -5
  202. package/tools/cli/installers/ide/claude-code.js +71 -3
  203. package/tools/cli/lib/content-injector.js +160 -12
  204. package/tools/cli/lib/docs-setup.js +1 -1
  205. package/src/core/commands/skill/create.md +0 -698
  206. package/src/core/commands/skill/delete.md +0 -316
  207. package/src/core/commands/skill/edit.md +0 -359
  208. package/src/core/commands/skill/test.md +0 -394
  209. package/src/core/commands/skill/upgrade.md +0 -552
  210. package/src/core/templates/skill-template.md +0 -117
package/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.4.1] - 2026-03-06
11
+
12
+ ### Added
13
+ - DEPTH=extreme audit mode, CI feedback loops, and DX quick wins
14
+
15
+ ## [3.4.0] - 2026-02-28
16
+
17
+ ### Added
18
+ - Ads audit system, SEO analysis, ultradeep concurrency controls, and domain-first command naming
19
+
10
20
  ## [3.3.0] - 2026-02-24
11
21
 
12
22
  ### Added
package/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
  </p>
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/agileflow?color=brightgreen)](https://www.npmjs.com/package/agileflow)
6
- [![Commands](https://img.shields.io/badge/commands-99-blue)](https://docs.agileflow.projectquestorg.com/docs/commands)
7
- [![Agents/Experts](https://img.shields.io/badge/agents%2Fexperts-91-orange)](https://docs.agileflow.projectquestorg.com/docs/agents)
6
+ [![Commands](https://img.shields.io/badge/commands-143-blue)](https://docs.agileflow.projectquestorg.com/docs/commands)
7
+ [![Agents/Experts](https://img.shields.io/badge/agents%2Fexperts-131-orange)](https://docs.agileflow.projectquestorg.com/docs/agents)
8
8
  [![Skills](https://img.shields.io/badge/skills-dynamic-purple)](https://docs.agileflow.projectquestorg.com/docs/features/skills)
9
9
 
10
10
  **AI-driven agile development for Claude Code, Cursor, Windsurf, OpenAI Codex, and more.** Combining Scrum, Kanban, ADRs, and docs-as-code principles into one framework-agnostic system.
@@ -54,9 +54,9 @@ Traditional project management tools create friction between planning and execut
54
54
 
55
55
  | Component | Count | Description |
56
56
  |-----------|-------|-------------|
57
- | [Commands](https://docs.agileflow.projectquestorg.com/docs/commands) | 99 | Slash commands for agile workflows |
58
- | [Agents/Experts](https://docs.agileflow.projectquestorg.com/docs/agents) | 91 | Specialized agents with self-improving knowledge bases |
59
- | [Skills](https://docs.agileflow.projectquestorg.com/docs/features/skills) | Dynamic | Generated on-demand with `/agileflow:skill:create` |
57
+ | [Commands](https://docs.agileflow.projectquestorg.com/docs/commands) | 143 | Slash commands for agile workflows |
58
+ | [Agents/Experts](https://docs.agileflow.projectquestorg.com/docs/agents) | 131 | Specialized agents with self-improving knowledge bases |
59
+ | [Skills](https://docs.agileflow.projectquestorg.com/docs/features/skills) | Dynamic | Browse and install from skills.sh marketplace via `/agileflow:skill:recommend` |
60
60
 
61
61
  ---
62
62
 
@@ -66,7 +66,7 @@ Traditional project management tools create friction between planning and execut
66
66
  |---------|-------------|------|
67
67
  | Agent Expertise | Self-improving agents that maintain domain knowledge | [Learn more](https://docs.agileflow.projectquestorg.com/docs/features/agent-expertise-system) |
68
68
  | Agent Teams | Multi-domain expert coordination with quality gates | [Learn more](https://docs.agileflow.projectquestorg.com/docs/features/agent-teams) |
69
- | Skills System | Custom AI prompts that learn from your feedback | [Learn more](https://docs.agileflow.projectquestorg.com/docs/features/skills) |
69
+ | Skills System | Browse and install skills from the skills.sh marketplace | [Learn more](https://docs.agileflow.projectquestorg.com/docs/features/skills) |
70
70
  | Parallel Sessions | Isolated workspaces with boundary protection | [Learn more](https://docs.agileflow.projectquestorg.com/docs/features/parallel-sessions) |
71
71
  | Loop Mode | Autonomous story execution until epic completion | [Learn more](https://docs.agileflow.projectquestorg.com/docs/features/loop-mode) |
72
72
  | AI Council | Three-perspective strategic decision analysis | [Learn more](https://docs.agileflow.projectquestorg.com/docs/commands/council) |
@@ -126,7 +126,6 @@ function loadSkill(skillDir) {
126
126
  path: skillDir,
127
127
  hasReferences: fs.existsSync(path.join(skillDir, 'references.md')),
128
128
  hasCookbook: fs.existsSync(path.join(skillDir, 'cookbook')),
129
- hasMcp: fs.existsSync(path.join(skillDir, '.mcp.json')),
130
129
  metadata,
131
130
  };
132
131
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agileflow",
3
- "version": "3.3.0",
3
+ "version": "3.4.1",
4
4
  "description": "AI-driven agile development system for Claude Code, Cursor, Windsurf, and more",
5
5
  "keywords": [
6
6
  "agile",
@@ -88,6 +88,7 @@ SHOW_SESSION_TIME=false
88
88
  SHOW_COST=false
89
89
  SHOW_GIT=true
90
90
  SHOW_SCALE=true
91
+ SHOW_ULTRADEEP=true
91
92
 
92
93
  # Check agileflow-metadata.json for component settings
93
94
  if [ -f "docs/00-meta/agileflow-metadata.json" ]; then
@@ -106,6 +107,7 @@ if [ -f "docs/00-meta/agileflow-metadata.json" ]; then
106
107
  SHOW_COST=$(echo "$COMPONENTS" | jq -r '.cost | if . == null then true else . end')
107
108
  SHOW_GIT=$(echo "$COMPONENTS" | jq -r '.git | if . == null then true else . end')
108
109
  SHOW_SCALE=$(echo "$COMPONENTS" | jq -r '.scale | if . == null then true else . end')
110
+ SHOW_ULTRADEEP=$(echo "$COMPONENTS" | jq -r '.ultradeep | if . == null then true else . end')
109
111
  fi
110
112
  fi
111
113
 
@@ -669,6 +671,79 @@ if [ "$SHOW_SCALE" = "true" ] && [ -f "docs/09-agents/session-state.json" ]; the
669
671
  fi
670
672
  fi
671
673
 
674
+ # ============================================================================
675
+ # Ultradeep Audit Progress Detection
676
+ # ============================================================================
677
+ ULTRADEEP_DISPLAY=""
678
+ if [ "$SHOW_ULTRADEEP" = "true" ]; then
679
+ ULTRADEEP_DIR="docs/09-agents/ultradeep"
680
+ if [ -d "$ULTRADEEP_DIR" ]; then
681
+ # Find most recent trace directory by modification time
682
+ LATEST_TRACE=$(ls -td "$ULTRADEEP_DIR"/*/ 2>/dev/null | head -1)
683
+ if [ -n "$LATEST_TRACE" ]; then
684
+ ULTRA_STATUS_FILE="${LATEST_TRACE}_status.json"
685
+ if [ -f "$ULTRA_STATUS_FILE" ]; then
686
+ ULTRA_STATUS=$(cat "$ULTRA_STATUS_FILE" 2>/dev/null)
687
+ ULTRA_AUDIT_TYPE=$(echo "$ULTRA_STATUS" | jq -r '.audit_type // empty' 2>/dev/null)
688
+ ULTRA_TOTAL=$(echo "$ULTRA_STATUS" | jq -r '.analyzers | length' 2>/dev/null)
689
+ ULTRA_COMPLETED=$(echo "$ULTRA_STATUS" | jq -r '.completed | length' 2>/dev/null)
690
+ ULTRA_STARTED=$(echo "$ULTRA_STATUS" | jq -r '.started_at // empty' 2>/dev/null)
691
+ ULTRA_LAST_CHECKED=$(echo "$ULTRA_STATUS" | jq -r '.last_checked // empty' 2>/dev/null)
692
+
693
+ # Validate we got numeric values
694
+ [[ "$ULTRA_TOTAL" =~ ^[0-9]+$ ]] || ULTRA_TOTAL=0
695
+ [[ "$ULTRA_COMPLETED" =~ ^[0-9]+$ ]] || ULTRA_COMPLETED=0
696
+
697
+ if [ "$ULTRA_TOTAL" -gt 0 ] && [ -n "$ULTRA_AUDIT_TYPE" ]; then
698
+ # Staleness check: skip if started >60 min ago and no recent activity
699
+ ULTRA_STALE=false
700
+ if [ -n "$ULTRA_STARTED" ]; then
701
+ ULTRA_START_EPOCH=$(to_epoch "$ULTRA_STARTED" 2>/dev/null)
702
+ ULTRA_NOW=$(date +%s)
703
+ if [ -n "$ULTRA_START_EPOCH" ] && [ $((ULTRA_NOW - ULTRA_START_EPOCH)) -gt 3600 ]; then
704
+ # Started over 60 min ago - check last_checked
705
+ if [ -n "$ULTRA_LAST_CHECKED" ] && [ "$ULTRA_LAST_CHECKED" != "null" ]; then
706
+ ULTRA_LC_EPOCH=$(to_epoch "$ULTRA_LAST_CHECKED" 2>/dev/null)
707
+ if [ -n "$ULTRA_LC_EPOCH" ] && [ $((ULTRA_NOW - ULTRA_LC_EPOCH)) -gt 120 ]; then
708
+ ULTRA_STALE=true
709
+ fi
710
+ else
711
+ # No last_checked at all and started >60 min ago
712
+ ULTRA_STALE=true
713
+ fi
714
+ fi
715
+ fi
716
+
717
+ if [ "$ULTRA_STALE" = "false" ]; then
718
+ # Map audit type to color and prefix
719
+ case "$ULTRA_AUDIT_TYPE" in
720
+ logic) ULTRA_COLOR="\033[38;2;122;162;247m"; ULTRA_PREFIX="Logic" ;;
721
+ security) ULTRA_COLOR="\033[38;2;247;118;142m"; ULTRA_PREFIX="Sec" ;;
722
+ performance) ULTRA_COLOR="\033[38;2;115;218;202m"; ULTRA_PREFIX="Perf" ;;
723
+ test) ULTRA_COLOR="\033[38;2;224;175;104m"; ULTRA_PREFIX="Test" ;;
724
+ completeness) ULTRA_COLOR="\033[38;2;187;154;247m"; ULTRA_PREFIX="Comp" ;;
725
+ legal) ULTRA_COLOR="\033[38;2;158;206;106m"; ULTRA_PREFIX="Legal" ;;
726
+ *) ULTRA_COLOR="$DIM"; ULTRA_PREFIX="Audit" ;;
727
+ esac
728
+
729
+ # Build display with progress coloring
730
+ if [ "$ULTRA_COMPLETED" -eq "$ULTRA_TOTAL" ]; then
731
+ # All complete - green checkmark
732
+ ULTRADEEP_DISPLAY="${ULTRA_COLOR}${ULTRA_PREFIX}${RESET} ${GREEN}${ULTRA_COMPLETED}/${ULTRA_TOTAL}✓${RESET}"
733
+ elif [ "$ULTRA_COMPLETED" -gt 0 ]; then
734
+ # In progress
735
+ ULTRADEEP_DISPLAY="${ULTRA_COLOR}${ULTRA_PREFIX}${RESET} ${ULTRA_COLOR}${ULTRA_COMPLETED}/${ULTRA_TOTAL}${RESET}"
736
+ else
737
+ # Just started (0 complete) - dim the fraction
738
+ ULTRADEEP_DISPLAY="${ULTRA_COLOR}${ULTRA_PREFIX}${RESET} ${DIM}${ULTRA_COMPLETED}/${ULTRA_TOTAL}${RESET}"
739
+ fi
740
+ fi
741
+ fi
742
+ fi
743
+ fi
744
+ fi
745
+ fi
746
+
672
747
  # ============================================================================
673
748
  # Build Status Line
674
749
  # ============================================================================
@@ -759,6 +834,12 @@ if [ "$SHOW_SCALE" = "true" ] && [ -n "$SCALE_DISPLAY" ]; then
759
834
  OUTPUT="${OUTPUT}${SCALE_DISPLAY}"
760
835
  fi
761
836
 
837
+ # Add ultradeep audit progress (if enabled and active)
838
+ if [ "$SHOW_ULTRADEEP" = "true" ] && [ -n "$ULTRADEEP_DISPLAY" ]; then
839
+ [ -n "$OUTPUT" ] && OUTPUT="${OUTPUT}${SEP}"
840
+ OUTPUT="${OUTPUT}${ULTRADEEP_DISPLAY}"
841
+ fi
842
+
762
843
  # Session health indicator (next to git branch)
763
844
  if [ "$SHOW_SESSION" = "true" ]; then
764
845
  SCRIPTS_DIR="$(dirname "$0")"
@@ -1320,6 +1320,49 @@ function getExpertiseCountFast(rootDir) {
1320
1320
  return result;
1321
1321
  }
1322
1322
 
1323
+ /**
1324
+ * Check if installed commands are in sync with source.
1325
+ * Counts .md files in three directories:
1326
+ * - .agileflow/commands/ (core install)
1327
+ * - .claude/commands/agileflow/ excluding agents/ (IDE install)
1328
+ * - packages/cli/src/core/commands/ (dogfooding source, if exists)
1329
+ * Returns { sourceCount, coreCount, ideCount, stale, staleCoreInstall } or null on error.
1330
+ */
1331
+ function checkCommandSync(rootDir) {
1332
+ try {
1333
+ const countMdFiles = dir => {
1334
+ if (!fs.existsSync(dir)) return 0;
1335
+ return fs.readdirSync(dir, { recursive: true }).filter(f => String(f).endsWith('.md')).length;
1336
+ };
1337
+
1338
+ const agileflowDir = getAgileflowDir(rootDir);
1339
+ const coreCount = countMdFiles(path.join(agileflowDir, 'commands'));
1340
+
1341
+ // IDE install: .claude/commands/agileflow/ excluding agents/ subdir
1342
+ const ideDir = path.join(rootDir, '.claude', 'commands', 'agileflow');
1343
+ let ideCount = 0;
1344
+ if (fs.existsSync(ideDir)) {
1345
+ ideCount = fs.readdirSync(ideDir, { recursive: true }).filter(f => {
1346
+ const s = String(f);
1347
+ return s.endsWith('.md') && !s.startsWith('agents/') && !s.startsWith('agents\\');
1348
+ }).length;
1349
+ }
1350
+
1351
+ // Dogfooding source (only exists in the AgileFlow repo itself)
1352
+ const sourceDir = path.join(rootDir, 'packages', 'cli', 'src', 'core', 'commands');
1353
+ const sourceCount = countMdFiles(sourceDir);
1354
+
1355
+ // Determine staleness
1356
+ const referenceCount = sourceCount > 0 ? sourceCount : coreCount;
1357
+ const stale = referenceCount > 0 && ideCount < referenceCount;
1358
+ const staleCoreInstall = sourceCount > 0 && coreCount < sourceCount;
1359
+
1360
+ return { sourceCount, coreCount, ideCount, stale, staleCoreInstall };
1361
+ } catch (e) {
1362
+ return null;
1363
+ }
1364
+ }
1365
+
1323
1366
  // Full validation function (kept for /agileflow:validate-expertise command)
1324
1367
  function validateExpertise(rootDir) {
1325
1368
  const result = { total: 0, passed: 0, warnings: 0, failed: 0, issues: [] };
@@ -1894,6 +1937,9 @@ function main() {
1894
1937
  }
1895
1938
  _mark('expertise');
1896
1939
 
1940
+ const commandSync = checkCommandSync(rootDir);
1941
+ _mark('cmdSync');
1942
+
1897
1943
  const damageControl = checkDamageControl(rootDir, cache);
1898
1944
  _mark('damageCtl');
1899
1945
 
@@ -2057,6 +2103,21 @@ function main() {
2057
2103
  );
2058
2104
  }
2059
2105
 
2106
+ // Show command sync staleness notification
2107
+ if (commandSync && commandSync.stale) {
2108
+ const ref = commandSync.sourceCount > 0 ? commandSync.sourceCount : commandSync.coreCount;
2109
+ console.log('');
2110
+ console.log(
2111
+ `${c.amber}⚠️ ${ref - commandSync.ideCount} command(s) out of sync${c.reset} ${c.dim}(IDE has ${commandSync.ideCount}/${ref})${c.reset}`
2112
+ );
2113
+ if (commandSync.staleCoreInstall) {
2114
+ console.log(
2115
+ ` ${c.dim}Core install also stale: ${commandSync.coreCount}/${commandSync.sourceCount}${c.reset}`
2116
+ );
2117
+ }
2118
+ console.log(` ${c.slate}Auto-syncing in background...${c.reset}`);
2119
+ }
2120
+
2060
2121
  // Show tmux installation notice if tmux auto-spawn is enabled but tmux not installed
2061
2122
  if (tmuxAutoSpawnEnabled && !tmuxCheck.available) {
2062
2123
  console.log('');
@@ -2141,6 +2202,24 @@ function main() {
2141
2202
 
2142
2203
  _mark('deferred');
2143
2204
 
2205
+ // Spawn background command sync if stale
2206
+ if (commandSync && commandSync.stale) {
2207
+ try {
2208
+ const isDogfooding = commandSync.sourceCount > 0;
2209
+ if (isDogfooding) {
2210
+ const cliPath = path.join(rootDir, 'packages', 'cli', 'tools', 'cli', 'agileflow-cli.js');
2211
+ if (fs.existsSync(cliPath)) {
2212
+ spawnBackground('node', [cliPath, 'update', '--force', '-d', rootDir], { cwd: rootDir });
2213
+ }
2214
+ } else {
2215
+ spawnBackground('npx', ['agileflow', 'update', '--force'], { cwd: rootDir });
2216
+ }
2217
+ } catch (e) {
2218
+ // Command sync spawn failed, non-critical
2219
+ }
2220
+ }
2221
+ _mark('cmdSyncSpawn');
2222
+
2144
2223
  // Record hook metrics
2145
2224
  if (timer && hookMetrics) {
2146
2225
  hookMetrics.recordHookMetrics(timer, 'success', null, { rootDir });
@@ -41,6 +41,7 @@ SHOW_HELP=false
41
41
  ATTACH_ONLY=false
42
42
  FORCE_NEW=false
43
43
  REFRESH_CONFIG=false
44
+ CONFIGURE_SESSION=""
44
45
  USE_RESUME=false
45
46
  RESUME_SESSION_ID=""
46
47
 
@@ -74,6 +75,10 @@ for arg in "$@"; do
74
75
  REFRESH_CONFIG=true
75
76
  shift
76
77
  ;;
78
+ --configure-session=*)
79
+ CONFIGURE_SESSION="${arg#*=}"
80
+ shift
81
+ ;;
77
82
  --help|-h)
78
83
  SHOW_HELP=true
79
84
  shift
@@ -112,6 +117,7 @@ WINDOWS:
112
117
  Alt+n/p Next/previous window
113
118
  Alt+r Rename window
114
119
  Alt+w Close window
120
+ Alt+W Batch close windows (picker)
115
121
  Alt+t Reopen closed window
116
122
 
117
123
  PANES:
@@ -121,9 +127,13 @@ PANES:
121
127
  Alt+z Zoom/unzoom pane
122
128
  Alt+x Close pane
123
129
 
130
+ FREEZE RECOVERY:
131
+ Alt+k Send Ctrl+C twice (soft unfreeze)
132
+ Alt+K Force kill Claude process (keeps tab)
133
+ Alt+R Respawn pane (fresh shell)
134
+
124
135
  OTHER:
125
- Alt+[ Scroll mode
126
- Alt+k Send Ctrl+C twice (unfreeze)
136
+ Alt+h Show keybind help panel
127
137
  EOF
128
138
  exit 0
129
139
  fi
@@ -186,19 +196,24 @@ build_tab_format() {
186
196
  # ── Inactive tab: gray text ─────────────────────────────────────────────
187
197
  # " I:" prefix = 4 visible chars (wide); " I:" = 3 chars (narrow)
188
198
  # Width = prefix + pN(name) + 1(space)
189
- local i0='#[fg=#8a8a8a] #I:#{p35:#{=35:window_name}} '
190
- local i1='#[fg=#8a8a8a] #I:#{p22:#{=22:window_name}} '
191
- local i2='#[fg=#8a8a8a] #I:#{p15:#{=15:window_name}} '
192
- local i3='#[fg=#8a8a8a] #I:#{p12:#{=12:window_name}} '
193
- local i4='#[fg=#8a8a8a] #I:#{p9:#{=9:window_name}} '
194
- local i5='#[fg=#8a8a8a] #I:#{p7:#{=7:window_name}} '
195
- local i6='#[fg=#8a8a8a] #I:#{p6:#{=6:window_name}} '
196
- local i7='#[fg=#8a8a8a] #I:#{p5:#{=5:window_name}} '
197
- local i8='#[fg=#8a8a8a] #I:#{p4:#{=4:window_name}} '
198
- local i9='#[fg=#8a8a8a] #I:#{p3:#{=3:window_name}} '
199
- local i10='#[fg=#8a8a8a] #I:#{p2:#{=2:window_name}} '
200
- local i11='#[fg=#8a8a8a] #I:#{p1:#{=1:window_name}} '
201
- local i12='#[fg=#8a8a8a] #I '
199
+ #
200
+ # Group color support: when @group_color is set on a window (e.g. by
201
+ # spawn-audit-sessions.js), show a colored dot prefix to visually
202
+ # identify grouped windows (ULTRADEEP audit tabs in main session).
203
+ local gc='#{?#{@group_color},#[fg=#{@group_color}]•,}'
204
+ local i0="${gc}"'#[fg=#8a8a8a] #I:#{p35:#{=35:window_name}} '
205
+ local i1="${gc}"'#[fg=#8a8a8a] #I:#{p22:#{=22:window_name}} '
206
+ local i2="${gc}"'#[fg=#8a8a8a] #I:#{p15:#{=15:window_name}} '
207
+ local i3="${gc}"'#[fg=#8a8a8a] #I:#{p12:#{=12:window_name}} '
208
+ local i4="${gc}"'#[fg=#8a8a8a] #I:#{p9:#{=9:window_name}} '
209
+ local i5="${gc}"'#[fg=#8a8a8a] #I:#{p7:#{=7:window_name}} '
210
+ local i6="${gc}"'#[fg=#8a8a8a] #I:#{p6:#{=6:window_name}} '
211
+ local i7="${gc}"'#[fg=#8a8a8a] #I:#{p5:#{=5:window_name}} '
212
+ local i8="${gc}"'#[fg=#8a8a8a] #I:#{p4:#{=4:window_name}} '
213
+ local i9="${gc}"'#[fg=#8a8a8a] #I:#{p3:#{=3:window_name}} '
214
+ local i10="${gc}"'#[fg=#8a8a8a] #I:#{p2:#{=2:window_name}} '
215
+ local i11="${gc}"'#[fg=#8a8a8a] #I:#{p1:#{=1:window_name}} '
216
+ local i12="${gc}"'#[fg=#8a8a8a] #I '
202
217
  local i13='#[fg=#565a6e]#I'
203
218
 
204
219
  # ── Tier selection: budget = width / windows ─────────────────────────────
@@ -241,6 +256,14 @@ configure_tmux_session() {
241
256
  # Enable mouse support
242
257
  tmux set-option -t "$target_session" mouse on
243
258
 
259
+ # Reduce escape-time from default 500ms to 10ms.
260
+ # The default causes two problems:
261
+ # 1) Arrow keys (which send \e[A etc.) get misinterpreted as Alt+[ if
262
+ # there's any delivery delay, accidentally triggering copy-mode.
263
+ # 2) Pressing Escape in Claude Code has a 500ms lag before tmux forwards it.
264
+ # 10ms is enough to detect genuine escape sequences on localhost/fast SSH.
265
+ tmux set-option -t "$target_session" escape-time 10
266
+
244
267
  # Automatically renumber windows when one is closed (no gaps)
245
268
  tmux set-option -t "$target_session" renumber-windows on
246
269
 
@@ -312,6 +335,9 @@ configure_tmux_session() {
312
335
  # Alt+w to close current window (save state for Alt+T restore, then kill)
313
336
  tmux bind-key -n M-w confirm-before -p "Close window? (y/n)" "run-shell '\"\$AGILEFLOW_SCRIPTS/tmux-save-closed-window.sh\"' ; kill-window"
314
337
 
338
+ # Alt+W (uppercase) to batch-close windows via multi-select picker
339
+ tmux bind-key -n M-W display-popup -E -w 60 -h 20 "\"$AGILEFLOW_SCRIPTS/tmux-close-windows.sh\""
340
+
315
341
  # Alt+t to restore the most recently closed window (like Ctrl+Shift+T in browsers)
316
342
  tmux bind-key -n M-t run-shell '"$AGILEFLOW_SCRIPTS/tmux-restore-window.sh"'
317
343
 
@@ -325,9 +351,6 @@ configure_tmux_session() {
325
351
  # Alt+z to zoom/unzoom pane (fullscreen toggle)
326
352
  tmux bind-key -n M-z resize-pane -Z
327
353
 
328
- # Alt+[ to enter copy mode (for scrolling)
329
- tmux bind-key -n M-[ copy-mode
330
-
331
354
  # ─── Session Creation Keybindings ──────────────────────────────────────────
332
355
  # Alt+s to create a new Claude window (starts fresh, future re-runs in same pane resume)
333
356
  # Window gets sequential name (claude-2, claude-3, ...) so windows are distinguishable
@@ -335,11 +358,31 @@ configure_tmux_session() {
335
358
 
336
359
  # ─── Freeze Recovery Keybindings ───────────────────────────────────────────
337
360
  # Alt+k to send Ctrl+C twice (soft interrupt for frozen processes)
338
- tmux bind-key -n M-k run-shell "tmux send-keys C-c; sleep 0.5; tmux send-keys C-c"
361
+ # Uses #{pane_id} to target the correct pane even if focus shifts during the sleep
362
+ tmux bind-key -n M-k run-shell "tmux send-keys -t '#{pane_id}' C-c; sleep 0.5; tmux send-keys -t '#{pane_id}' C-c"
363
+
364
+ # Alt+K (uppercase) to force kill Claude process in pane without closing tab
365
+ # Finds the claude child process under the pane's shell and kills it,
366
+ # leaving the shell prompt intact so the user can restart or continue.
367
+ # Uses ps -o pid=,args= with grep to find claude, then cuts the PID (avoids awk quoting issues in tmux run-shell).
368
+ tmux bind-key -n M-K run-shell '\
369
+ PANE_PID=$(tmux display-message -p "#{pane_pid}"); \
370
+ CLAUDE_PID=$(ps --ppid "$PANE_PID" -o pid=,args= 2>/dev/null | grep -v "watchdog" | grep "claude" | head -1 | sed "s/^[[:space:]]*//" | cut -d" " -f1); \
371
+ if [ -n "$CLAUDE_PID" ]; then \
372
+ kill -TERM "$CLAUDE_PID" 2>/dev/null; \
373
+ sleep 2; \
374
+ kill -0 "$CLAUDE_PID" 2>/dev/null && kill -KILL "$CLAUDE_PID" 2>/dev/null; \
375
+ tmux display-message "Killed Claude process (PID $CLAUDE_PID)"; \
376
+ else \
377
+ tmux display-message "No Claude process found in this pane"; \
378
+ fi'
379
+
380
+ # Alt+R to respawn pane (kills everything in the pane, starts fresh shell)
381
+ tmux bind-key -n M-R respawn-pane -k
339
382
 
340
383
  # ─── Help Panel ──────────────────────────────────────────────────────────
341
384
  # Alt+h to show all Alt keybindings in a popup
342
- tmux bind-key -n M-h display-popup -E -w 52 -h 31 "\
385
+ tmux bind-key -n M-h display-popup -E -w 52 -h 32 "\
343
386
  printf '\\n';\
344
387
  printf ' \\033[1;38;5;208mSESSIONS\\033[0m\\n';\
345
388
  printf ' Alt+s New Claude session\\n';\
@@ -352,6 +395,7 @@ configure_tmux_session() {
352
395
  printf ' Alt+n/p Next / previous window\\n';\
353
396
  printf ' Alt+r Rename window\\n';\
354
397
  printf ' Alt+w Close window\\n';\
398
+ printf ' Alt+W Batch close windows\\n';\
355
399
  printf ' Alt+t Reopen closed window\\n';\
356
400
  printf '\\n';\
357
401
  printf ' \\033[1;38;5;208mPANES\\033[0m\\n';\
@@ -360,17 +404,23 @@ configure_tmux_session() {
360
404
  printf ' Alt+arrows Navigate panes\\n';\
361
405
  printf ' Alt+z Zoom / unzoom\\n';\
362
406
  printf ' Alt+x Close pane (confirm)\\n';\
363
- printf ' Alt+K Kill pane (no confirm)\\n';\
364
- printf ' Alt+R Restart pane\\n';\
407
+ printf ' Alt+K Force kill process\\n';\
408
+ printf ' Alt+R Respawn pane (fresh)\\n';\
365
409
  printf '\\n';\
366
410
  printf ' \\033[1;38;5;208mOTHER\\033[0m\\n';\
367
- printf ' Alt+[ Scroll mode\\n';\
368
411
  printf ' Alt+k Unfreeze (Ctrl+C x2)\\n';\
369
412
  printf ' Alt+h This help\\n';\
370
413
  printf '\\n';\
371
414
  read -n 1 -s -r -p ' Press any key to close'"
372
415
  }
373
416
 
417
+ # Handle --configure-session flag — apply theme to a specific session and exit
418
+ # Used by spawn-audit-sessions.js to give audit sessions the same status bar
419
+ if [ -n "$CONFIGURE_SESSION" ]; then
420
+ configure_tmux_session "$CONFIGURE_SESSION"
421
+ exit 0
422
+ fi
423
+
374
424
  # Handle --refresh flag — re-apply config to all existing claude-* sessions
375
425
  if [ "$REFRESH_CONFIG" = true ]; then
376
426
  REFRESHED=0
@@ -378,6 +428,14 @@ if [ "$REFRESH_CONFIG" = true ]; then
378
428
  configure_tmux_session "$sid"
379
429
  # Ensure AGILEFLOW_SCRIPTS is set (needed by Alt+S keybind)
380
430
  tmux set-environment -t "$sid" AGILEFLOW_SCRIPTS "$SCRIPT_DIR" 2>/dev/null || true
431
+ # (Re)start watchdog if not running for this session
432
+ _EXISTING_WD=$(tmux show-environment -t "$sid" WATCHDOG_PID 2>/dev/null | cut -d= -f2)
433
+ if [ -z "$_EXISTING_WD" ] || ! kill -0 "$_EXISTING_WD" 2>/dev/null; then
434
+ "$SCRIPT_DIR/claude-watchdog.sh" "$sid" &
435
+ _WD_PID=$!
436
+ tmux set-environment -t "$sid" WATCHDOG_PID "$_WD_PID"
437
+ disown "$_WD_PID"
438
+ fi
381
439
  REFRESHED=$((REFRESHED + 1))
382
440
  done
383
441
  if [ "$REFRESHED" -gt 0 ]; then
@@ -650,6 +708,15 @@ if [ -n "$CLAUDE_SESSION_FLAGS" ]; then
650
708
  tmux set-environment -t "$SESSION_NAME" CLAUDE_SESSION_FLAGS "$CLAUDE_SESSION_FLAGS"
651
709
  fi
652
710
 
711
+ # Start watchdog to auto-detect and kill frozen Claude processes
712
+ EXISTING_WD=$(tmux show-environment -t "$SESSION_NAME" WATCHDOG_PID 2>/dev/null | cut -d= -f2)
713
+ if [ -z "$EXISTING_WD" ] || ! kill -0 "$EXISTING_WD" 2>/dev/null; then
714
+ "$SCRIPT_DIR/claude-watchdog.sh" "$SESSION_NAME" &
715
+ _WD_PID=$!
716
+ tmux set-environment -t "$SESSION_NAME" WATCHDOG_PID "$_WD_PID"
717
+ disown "$_WD_PID"
718
+ fi
719
+
653
720
  # Pre-seed @claude_uuid on initial pane if we found a recent conversation
654
721
  if [ "$USE_RESUME" = true ] && [ -n "$RESUME_SESSION_ID" ]; then
655
722
  tmux set-option -p -t "$SESSION_NAME" @claude_uuid "$RESUME_SESSION_ID" 2>/dev/null || true