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
@@ -0,0 +1,297 @@
1
+ ---
2
+ description: Multi-agent API design quality analysis with consensus voting for REST conventions, error handling, versioning, pagination, and documentation
3
+ argument-hint: "[file|directory] [DEPTH=quick|deep|ultradeep|extreme] [FOCUS=conventions|errors|versioning|pagination|docs|all] [MODEL=haiku|sonnet|opus]"
4
+ compact_context:
5
+ priority: high
6
+ preserve_rules:
7
+ - "ACTIVE COMMAND: /agileflow:code:api - Multi-agent API design quality analysis"
8
+ - "CRITICAL: Deploy analyzers IN PARALLEL in ONE message with multiple Task calls"
9
+ - "CRITICAL: Wait for all results before running consensus (use TaskOutput with block=true)"
10
+ - "CRITICAL: Severity scale: BREAKING | INCONSISTENT | GAP | POLISH"
11
+ - "MUST parse arguments: TARGET (file/dir), DEPTH (quick/deep/ultradeep), FOCUS (conventions|errors|versioning|pagination|docs|all)"
12
+ - "Pass consensus all analyzer outputs, let it synthesize the final report"
13
+ state_fields:
14
+ - target_path
15
+ - depth
16
+ - focus_areas
17
+ - analyzers_deployed
18
+ - findings_collected
19
+ ---
20
+
21
+ # /agileflow:code:api
22
+
23
+ Deploy multiple specialized API quality analyzers in parallel to assess API design maturity, then synthesize results through consensus voting into a prioritized API Quality Report with a maturity score.
24
+
25
+ ---
26
+
27
+ ## Quick Reference
28
+
29
+ ```
30
+ /agileflow:code:api app/api/ # Analyze API routes (quick, all 5 analyzers)
31
+ /agileflow:code:api . DEPTH=deep # Deep analysis - all severity levels
32
+ /agileflow:code:api routes/ FOCUS=conventions,errors # Focus on specific areas
33
+ /agileflow:code:api . DEPTH=deep FOCUS=all # Comprehensive full audit
34
+ /agileflow:code:api . DEPTH=ultradeep # Each analyzer in its own tmux session
35
+ /agileflow:code:api src/api/ FOCUS=pagination # Check pagination only
36
+ ```
37
+
38
+ ---
39
+
40
+ ## How It Works
41
+
42
+ ```
43
+ ┌─────────────────────────────────────────────────────────────┐
44
+ │ /agileflow:code:api │
45
+ │ │
46
+ │ 1. Parse arguments (target, depth, focus) │
47
+ │ 2. Deploy analyzers IN PARALLEL │
48
+ │ 3. Collect all findings │
49
+ │ 4. Run consensus coordinator to validate & score │
50
+ │ 5. Generate API Quality Report with maturity score │
51
+ └─────────────────────────────────────────────────────────────┘
52
+
53
+ ┌────────────┐ ┌────────┐ ┌────────────┐ ┌────────────┐ ┌──────┐
54
+ │Conventions │ │ Errors │ │ Versioning │ │ Pagination │ │ Docs │
55
+ └─────┬──────┘ └───┬────┘ └─────┬──────┘ └─────┬──────┘ └──┬───┘
56
+ │ │ │ │ │
57
+ └────────────┴────────────┼───────────────┴───────────┘
58
+
59
+ ┌──────────────────────┐
60
+ │ Consensus Coordinator│
61
+ │ (validates, scores, │
62
+ │ endpoint matrix) │
63
+ └──────────────────────┘
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Arguments
69
+
70
+ | Argument | Values | Default | Description |
71
+ |----------|--------|---------|-------------|
72
+ | TARGET | file/directory | `.` | What to analyze |
73
+ | DEPTH | quick, deep, ultradeep | quick | quick = BREAKING/INCONSISTENT only, deep = all severities, ultradeep = separate tmux |
74
+ | FOCUS | conventions,errors,versioning,pagination,docs,all | all | Which analyzers to deploy |
75
+ | MODEL | haiku, sonnet, opus | haiku | Model for analyzer subagents |
76
+
77
+ ---
78
+
79
+ ## Step-by-Step Process
80
+
81
+ ### STEP 1: Parse Arguments
82
+
83
+ ```
84
+ TARGET = first argument or current directory
85
+ DEPTH = quick (default) or deep or ultradeep
86
+ FOCUS = all (default) or comma-separated list
87
+ ```
88
+
89
+ **Analyzer Selection**:
90
+
91
+ | Condition | Analyzers Deployed |
92
+ |-----------|-------------------|
93
+ | `FOCUS=all` | All 5: conventions, errors, versioning, pagination, docs |
94
+ | `FOCUS=conventions` | api-quality-analyzer-conventions only |
95
+ | `FOCUS=errors` | api-quality-analyzer-errors only |
96
+ | `FOCUS=versioning` | api-quality-analyzer-versioning only |
97
+ | `FOCUS=pagination` | api-quality-analyzer-pagination only |
98
+ | `FOCUS=docs` | api-quality-analyzer-docs only |
99
+
100
+ **DEPTH behavior**:
101
+ - `quick` (default): Focus on BREAKING and INCONSISTENT issues only.
102
+ - `deep`: Include GAP and POLISH findings.
103
+ - `ultradeep`: Spawn each analyzer as a separate Claude Code session in tmux.
104
+
105
+ **ULTRADEEP mode** (DEPTH=ultradeep):
106
+ 1. Show cost estimate:
107
+ ```bash
108
+ node .agileflow/scripts/spawn-audit-sessions.js --audit=api --target=TARGET --focus=FOCUS --model=MODEL --dry-run
109
+ ```
110
+ 2. Confirm with user before launching
111
+ 3. Spawn sessions (use `--json` to capture trace ID):
112
+ ```bash
113
+ node .agileflow/scripts/spawn-audit-sessions.js --audit=api --target=TARGET --focus=FOCUS --model=MODEL --json
114
+ ```
115
+ Parse the JSON output to get `traceId`. Example: `{"ok":true,"traceId":"abc123ef",...}`
116
+ 4. Wait for all analyzers to complete:
117
+ ```bash
118
+ node .agileflow/scripts/lib/tmux-audit-monitor.js wait TRACE_ID --timeout=1800
119
+ ```
120
+ - Exit 0 = all complete (JSON results on stdout)
121
+ - Exit 1 = timeout (partial results on stdout, `missing` array shows what's left)
122
+ - To check progress without blocking: `node .agileflow/scripts/lib/tmux-audit-monitor.js status TRACE_ID`
123
+ - To retry stalled analyzers: `node .agileflow/scripts/lib/tmux-audit-monitor.js retry TRACE_ID`
124
+ 5. Parse `results` array from the JSON output. Pass all findings to consensus coordinator (same as deep mode).
125
+ 6. If tmux unavailable (spawn exits code 2), fall back to `DEPTH=deep` with warning
126
+
127
+ **EXTREME mode** (DEPTH=extreme):
128
+ Partition-based multi-agent audit. Instead of 1 analyzer per tmux window, the codebase is split into partitions and each partition runs ALL analyzers.
129
+ 1. Scan the target directory to understand the codebase structure:
130
+ - Use Glob to find top-level source directories
131
+ - Group related directories into 3-7 logical partitions (coherent domains: auth, api, ui, etc.)
132
+ - If user provided PARTITIONS=N (a number), split into exactly N partitions
133
+ - If user provided PARTITIONS=dir1,dir2,dir3, use those exact directories
134
+ 2. Show the partition plan and agent count to the user, confirm before launching:
135
+ Example: "5 partitions x 5 analyzers = 25 agents. Estimated cost: $X. Proceed?"
136
+ 3. Spawn sessions with partitions:
137
+ ```bash
138
+ node .agileflow/scripts/spawn-audit-sessions.js --audit=api --target=TARGET --depth=extreme --partitions=dir1,dir2,dir3 --model=MODEL --json
139
+ ```
140
+ 4. Wait and collect results (same as ultradeep - use tmux-audit-monitor.js)
141
+ 5. Run consensus on combined results from all partitions
142
+
143
+ **PARTITIONS argument** (only used with DEPTH=extreme):
144
+ | Value | Behavior |
145
+ |-------|----------|
146
+ | Not set | AI decides partitions (3-7 based on codebase size) |
147
+ | `PARTITIONS=5` | AI creates exactly 5 partitions |
148
+ | `PARTITIONS=src/auth,src/api,lib` | Use these exact directories |
149
+
150
+ ### STEP 2: Deploy Analyzers in Parallel
151
+
152
+ **CRITICAL**: Deploy ALL selected analyzers in a SINGLE message with multiple Task calls.
153
+
154
+ **Prompt template for each analyzer**:
155
+
156
+ ```
157
+ TASK: Analyze the following code for {API_DOMAIN} quality issues.
158
+
159
+ TARGET: {file_path or directory}
160
+ DEPTH: {quick|deep}
161
+
162
+ {For quick depth}: Focus on BREAKING and INCONSISTENT severity issues only. Skip polish items.
163
+ {For deep depth}: Be comprehensive. Include GAP and POLISH findings.
164
+
165
+ Read the target files and apply your analysis methodology.
166
+
167
+ OUTPUT your findings in your standard format (FINDING-N with location, severity, confidence, endpoint, code, explanation, remediation).
168
+
169
+ If no issues found, output: "No {API_DOMAIN} issues found in {TARGET}"
170
+ ```
171
+
172
+ **Deploy all 5 analyzers** using these subagent types:
173
+ - `api-quality-analyzer-conventions` - REST naming, HTTP methods, URL structure
174
+ - `api-quality-analyzer-errors` - Error format, status codes, error handling
175
+ - `api-quality-analyzer-versioning` - Breaking changes, deprecation, backward compat
176
+ - `api-quality-analyzer-pagination` - Cursor/offset, limits, totals, collections
177
+ - `api-quality-analyzer-docs` - OpenAPI coverage, examples, documentation
178
+
179
+ ### STEP 3: Collect Results
180
+
181
+ Wait for all analyzers to complete using TaskOutput with `block=true`.
182
+
183
+ ### STEP 4: Run Consensus Coordinator
184
+
185
+ Pass all analyzer outputs to the consensus coordinator:
186
+
187
+ ```xml
188
+ <invoke name="Task">
189
+ <parameter name="description">API quality audit consensus</parameter>
190
+ <parameter name="prompt">You are the API Quality Consensus Coordinator.
191
+
192
+ TARGET: {target_path}
193
+ DEPTH: {depth}
194
+
195
+ ## Analyzer Outputs
196
+
197
+ ### Conventions Analyzer Results:
198
+ {conventions_output}
199
+
200
+ ### Error Handling Analyzer Results:
201
+ {errors_output}
202
+
203
+ ### Versioning Analyzer Results:
204
+ {versioning_output}
205
+
206
+ ### Pagination Analyzer Results:
207
+ {pagination_output}
208
+
209
+ ### Documentation Analyzer Results:
210
+ {docs_output}
211
+
212
+ ---
213
+
214
+ Follow your consensus process:
215
+ 1. Detect API type (REST, GraphQL, gRPC, tRPC, Hybrid)
216
+ 2. Parse all findings into normalized structure
217
+ 3. Group related findings by endpoint
218
+ 4. Vote on confidence (CONFIRMED if 2+ agree, LIKELY if 1 with evidence)
219
+ 5. Filter by API type relevance
220
+ 6. Compute API Maturity Score (0-100)
221
+ 7. Generate endpoint matrix with quality grades
222
+ 8. Generate the final API Quality Report
223
+ 9. Save report to docs/08-project/api-audits/api-audit-{YYYYMMDD}.md
224
+ </parameter>
225
+ <parameter name="subagent_type">api-quality-consensus</parameter>
226
+ </invoke>
227
+ ```
228
+
229
+ ### STEP 5: Present Results
230
+
231
+ After consensus completes, show the report summary and offer next steps:
232
+
233
+ ```xml
234
+ <invoke name="AskUserQuestion">
235
+ <parameter name="questions">[{
236
+ "question": "API quality audit complete: Maturity Score [N]/100 ([rating]). [endpoints] endpoints analyzed. API type: [type].",
237
+ "header": "Next steps",
238
+ "multiSelect": false,
239
+ "options": [
240
+ {"label": "Fix [breaking] Breaking issues now (Recommended)", "description": "[top_issue_summary]"},
241
+ {"label": "Create stories for all findings", "description": "Track [breaking] breaking + [inconsistent] inconsistent items"},
242
+ {"label": "Re-run with DEPTH=deep", "description": "Current was quick - deep includes GAP and POLISH findings"},
243
+ {"label": "Save report and done", "description": "Report saved to docs/08-project/api-audits/"}
244
+ ]
245
+ }]</parameter>
246
+ </invoke>
247
+ ```
248
+
249
+ ---
250
+
251
+ <!-- COMPACT_SUMMARY_START -->
252
+ ## Compact Summary
253
+
254
+ **Command**: `/agileflow:code:api` - Multi-agent API design quality analysis with consensus
255
+
256
+ **Quick Usage**:
257
+ ```
258
+ /agileflow:code:api app/api/ # Quick scan (all 5 analyzers)
259
+ /agileflow:code:api . DEPTH=deep # Comprehensive analysis
260
+ /agileflow:code:api routes/ FOCUS=conventions,errors # Specific areas
261
+ ```
262
+
263
+ **What It Does**: Deploy API quality analyzers in parallel -> Each checks different API design aspects -> Consensus validates, computes maturity score, builds endpoint matrix -> API Quality Report
264
+
265
+ **Analyzers (all 5)**:
266
+ - `api-quality-analyzer-conventions` - REST naming, HTTP methods, URL structure, consistency
267
+ - `api-quality-analyzer-errors` - Error format, status codes, error handling, validation feedback
268
+ - `api-quality-analyzer-versioning` - Breaking changes, deprecation, backward compatibility
269
+ - `api-quality-analyzer-pagination` - Collection endpoints, page sizes, metadata, consistency
270
+ - `api-quality-analyzer-docs` - OpenAPI coverage, examples, request/response schemas
271
+
272
+ **Severity Levels**:
273
+ - BREAKING: Clients break or can't use the API correctly
274
+ - INCONSISTENT: Mixed patterns across endpoints
275
+ - GAP: Missing best practice or feature
276
+ - POLISH: Minor improvement opportunity
277
+
278
+ **Output**: `docs/08-project/api-audits/api-audit-{YYYYMMDD}.md`
279
+ <!-- COMPACT_SUMMARY_END -->
280
+
281
+ ---
282
+
283
+ ## Boundary Rules (No Overlap)
284
+
285
+ - **vs code:security**: No injection, auth bypass, XSS - those are security domain
286
+ - **vs code:performance**: No N+1 queries, slow endpoints - those are performance domain
287
+ - **vs code:completeness**: No missing handlers or dead endpoints - those are completeness domain
288
+ - **Focus on API design quality** - conventions, errors, versioning, pagination, documentation
289
+
290
+ ---
291
+
292
+ ## Related Commands
293
+
294
+ - `/agileflow:code:security` - Security vulnerability analysis (includes API security)
295
+ - `/agileflow:code:performance` - Performance analysis (includes query optimization)
296
+ - `/agileflow:code:completeness` - Completeness analysis (includes endpoint mismatches)
297
+ - `/agileflow:docs` - Documentation synchronization
@@ -0,0 +1,297 @@
1
+ ---
2
+ description: Multi-agent architecture health analysis with consensus voting for coupling, layering, complexity, anti-patterns, and circular dependencies
3
+ argument-hint: "[file|directory] [DEPTH=quick|deep|ultradeep|extreme] [FOCUS=coupling|layering|complexity|patterns|circular|all] [MODEL=haiku|sonnet|opus]"
4
+ compact_context:
5
+ priority: high
6
+ preserve_rules:
7
+ - "ACTIVE COMMAND: /agileflow:code:architecture - Multi-agent architecture health analysis"
8
+ - "CRITICAL: Deploy analyzers IN PARALLEL in ONE message with multiple Task calls"
9
+ - "CRITICAL: Wait for all results before running consensus (use TaskOutput with block=true)"
10
+ - "CRITICAL: Severity scale: STRUCTURAL | DEGRADED | SMELL | STYLE"
11
+ - "MUST parse arguments: TARGET (file/dir), DEPTH (quick/deep/ultradeep), FOCUS (coupling|layering|complexity|patterns|circular|all)"
12
+ - "Pass consensus all analyzer outputs, let it synthesize the final report"
13
+ state_fields:
14
+ - target_path
15
+ - depth
16
+ - focus_areas
17
+ - analyzers_deployed
18
+ - findings_collected
19
+ ---
20
+
21
+ # /agileflow:code:architecture
22
+
23
+ Deploy multiple specialized architecture analyzers in parallel to assess structural health, then synthesize results through consensus voting into a prioritized Architecture Audit Report with a health score.
24
+
25
+ ---
26
+
27
+ ## Quick Reference
28
+
29
+ ```
30
+ /agileflow:code:architecture src/ # Analyze src directory (quick, all 5 analyzers)
31
+ /agileflow:code:architecture . DEPTH=deep # Deep analysis - all severity levels
32
+ /agileflow:code:architecture src/ FOCUS=coupling,circular # Focus on specific areas
33
+ /agileflow:code:architecture . DEPTH=deep FOCUS=all # Comprehensive full audit
34
+ /agileflow:code:architecture . DEPTH=ultradeep # Each analyzer in its own tmux session
35
+ /agileflow:code:architecture lib/ FOCUS=complexity # Check complexity only
36
+ ```
37
+
38
+ ---
39
+
40
+ ## How It Works
41
+
42
+ ```
43
+ ┌─────────────────────────────────────────────────────────────┐
44
+ │ /agileflow:code:architecture │
45
+ │ │
46
+ │ 1. Parse arguments (target, depth, focus) │
47
+ │ 2. Deploy analyzers IN PARALLEL │
48
+ │ 3. Collect all findings │
49
+ │ 4. Run consensus coordinator to validate & score │
50
+ │ 5. Generate Architecture Audit Report with health score │
51
+ └─────────────────────────────────────────────────────────────┘
52
+
53
+ ┌──────────┐ ┌──────────┐ ┌────────────┐ ┌──────────┐ ┌──────────┐
54
+ │ Coupling │ │ Layering │ │ Complexity │ │ Patterns │ │ Circular │
55
+ └────┬─────┘ └────┬─────┘ └─────┬──────┘ └────┬─────┘ └────┬─────┘
56
+ │ │ │ │ │
57
+ └────────────┴─────────────┼──────────────┴────────────┘
58
+
59
+ ┌──────────────────────┐
60
+ │ Consensus Coordinator│
61
+ │ (validates, scores, │
62
+ │ generates report) │
63
+ └──────────────────────┘
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Arguments
69
+
70
+ | Argument | Values | Default | Description |
71
+ |----------|--------|---------|-------------|
72
+ | TARGET | file/directory | `.` | What to analyze |
73
+ | DEPTH | quick, deep, ultradeep | quick | quick = STRUCTURAL/DEGRADED only, deep = all severities, ultradeep = separate tmux |
74
+ | FOCUS | coupling,layering,complexity,patterns,circular,all | all | Which analyzers to deploy |
75
+ | MODEL | haiku, sonnet, opus | haiku | Model for analyzer subagents |
76
+
77
+ ---
78
+
79
+ ## Step-by-Step Process
80
+
81
+ ### STEP 1: Parse Arguments
82
+
83
+ ```
84
+ TARGET = first argument or current directory
85
+ DEPTH = quick (default) or deep or ultradeep
86
+ FOCUS = all (default) or comma-separated list
87
+ ```
88
+
89
+ **Analyzer Selection**:
90
+
91
+ | Condition | Analyzers Deployed |
92
+ |-----------|-------------------|
93
+ | `FOCUS=all` | All 5: coupling, layering, complexity, patterns, circular |
94
+ | `FOCUS=coupling` | arch-analyzer-coupling only |
95
+ | `FOCUS=layering` | arch-analyzer-layering only |
96
+ | `FOCUS=complexity` | arch-analyzer-complexity only |
97
+ | `FOCUS=patterns` | arch-analyzer-patterns only |
98
+ | `FOCUS=circular` | arch-analyzer-circular only |
99
+
100
+ **DEPTH behavior**:
101
+ - `quick` (default): Focus on STRUCTURAL and DEGRADED issues only.
102
+ - `deep`: Include SMELL and STYLE findings.
103
+ - `ultradeep`: Spawn each analyzer as a separate Claude Code session in tmux.
104
+
105
+ **ULTRADEEP mode** (DEPTH=ultradeep):
106
+ 1. Show cost estimate:
107
+ ```bash
108
+ node .agileflow/scripts/spawn-audit-sessions.js --audit=architecture --target=TARGET --focus=FOCUS --model=MODEL --dry-run
109
+ ```
110
+ 2. Confirm with user before launching
111
+ 3. Spawn sessions (use `--json` to capture trace ID):
112
+ ```bash
113
+ node .agileflow/scripts/spawn-audit-sessions.js --audit=architecture --target=TARGET --focus=FOCUS --model=MODEL --json
114
+ ```
115
+ Parse the JSON output to get `traceId`. Example: `{"ok":true,"traceId":"abc123ef",...}`
116
+ 4. Wait for all analyzers to complete:
117
+ ```bash
118
+ node .agileflow/scripts/lib/tmux-audit-monitor.js wait TRACE_ID --timeout=1800
119
+ ```
120
+ - Exit 0 = all complete (JSON results on stdout)
121
+ - Exit 1 = timeout (partial results on stdout, `missing` array shows what's left)
122
+ - To check progress without blocking: `node .agileflow/scripts/lib/tmux-audit-monitor.js status TRACE_ID`
123
+ - To retry stalled analyzers: `node .agileflow/scripts/lib/tmux-audit-monitor.js retry TRACE_ID`
124
+ 5. Parse `results` array from the JSON output. Pass all findings to consensus coordinator (same as deep mode).
125
+ 6. If tmux unavailable (spawn exits code 2), fall back to `DEPTH=deep` with warning
126
+
127
+ **EXTREME mode** (DEPTH=extreme):
128
+ Partition-based multi-agent audit. Instead of 1 analyzer per tmux window, the codebase is split into partitions and each partition runs ALL analyzers.
129
+ 1. Scan the target directory to understand the codebase structure:
130
+ - Use Glob to find top-level source directories
131
+ - Group related directories into 3-7 logical partitions (coherent domains: auth, api, ui, etc.)
132
+ - If user provided PARTITIONS=N (a number), split into exactly N partitions
133
+ - If user provided PARTITIONS=dir1,dir2,dir3, use those exact directories
134
+ 2. Show the partition plan and agent count to the user, confirm before launching:
135
+ Example: "5 partitions x 5 analyzers = 25 agents. Estimated cost: $X. Proceed?"
136
+ 3. Spawn sessions with partitions:
137
+ ```bash
138
+ node .agileflow/scripts/spawn-audit-sessions.js --audit=architecture --target=TARGET --depth=extreme --partitions=dir1,dir2,dir3 --model=MODEL --json
139
+ ```
140
+ 4. Wait and collect results (same as ultradeep - use tmux-audit-monitor.js)
141
+ 5. Run consensus on combined results from all partitions
142
+
143
+ **PARTITIONS argument** (only used with DEPTH=extreme):
144
+ | Value | Behavior |
145
+ |-------|----------|
146
+ | Not set | AI decides partitions (3-7 based on codebase size) |
147
+ | `PARTITIONS=5` | AI creates exactly 5 partitions |
148
+ | `PARTITIONS=src/auth,src/api,lib` | Use these exact directories |
149
+
150
+ ### STEP 2: Deploy Analyzers in Parallel
151
+
152
+ **CRITICAL**: Deploy ALL selected analyzers in a SINGLE message with multiple Task calls.
153
+
154
+ **Prompt template for each analyzer**:
155
+
156
+ ```
157
+ TASK: Analyze the following code for {ARCH_DOMAIN} issues.
158
+
159
+ TARGET: {file_path or directory}
160
+ DEPTH: {quick|deep}
161
+
162
+ {For quick depth}: Focus on STRUCTURAL and DEGRADED severity issues only. Skip style improvements.
163
+ {For deep depth}: Be comprehensive. Include SMELL and STYLE findings.
164
+
165
+ Read the target files and apply your analysis methodology.
166
+
167
+ OUTPUT your findings in your standard format (FINDING-N with location, severity, confidence, metric, code, explanation, remediation).
168
+
169
+ If no issues found, output: "No {ARCH_DOMAIN} issues found in {TARGET}"
170
+ ```
171
+
172
+ **Deploy all 5 analyzers** using these subagent types:
173
+ - `arch-analyzer-coupling` - Fan-in/fan-out, module independence
174
+ - `arch-analyzer-layering` - Layer violations, import direction
175
+ - `arch-analyzer-complexity` - Cyclomatic/cognitive complexity, file size
176
+ - `arch-analyzer-patterns` - God objects, feature envy, anti-patterns
177
+ - `arch-analyzer-circular` - Circular deps, import cycles
178
+
179
+ ### STEP 3: Collect Results
180
+
181
+ Wait for all analyzers to complete using TaskOutput with `block=true`.
182
+
183
+ ### STEP 4: Run Consensus Coordinator
184
+
185
+ Pass all analyzer outputs to the consensus coordinator:
186
+
187
+ ```xml
188
+ <invoke name="Task">
189
+ <parameter name="description">Architecture audit consensus</parameter>
190
+ <parameter name="prompt">You are the Architecture Consensus Coordinator.
191
+
192
+ TARGET: {target_path}
193
+ DEPTH: {depth}
194
+
195
+ ## Analyzer Outputs
196
+
197
+ ### Coupling Analyzer Results:
198
+ {coupling_output}
199
+
200
+ ### Layering Analyzer Results:
201
+ {layering_output}
202
+
203
+ ### Complexity Analyzer Results:
204
+ {complexity_output}
205
+
206
+ ### Anti-Patterns Analyzer Results:
207
+ {patterns_output}
208
+
209
+ ### Circular Dependencies Analyzer Results:
210
+ {circular_output}
211
+
212
+ ---
213
+
214
+ Follow your consensus process:
215
+ 1. Detect architecture pattern (Clean, MVC, Feature-based, etc.)
216
+ 2. Parse all findings into normalized structure
217
+ 3. Group related findings by module/area
218
+ 4. Vote on confidence (CONFIRMED if 2+ agree, LIKELY if 1 with evidence)
219
+ 5. Filter by architecture pattern relevance
220
+ 6. Compute Architecture Health Score (0-100)
221
+ 7. Generate the final Architecture Audit Report
222
+ 8. Save report to docs/08-project/arch-audits/arch-audit-{YYYYMMDD}.md
223
+ </parameter>
224
+ <parameter name="subagent_type">arch-consensus</parameter>
225
+ </invoke>
226
+ ```
227
+
228
+ ### STEP 5: Present Results
229
+
230
+ After consensus completes, show the report summary and offer next steps:
231
+
232
+ ```xml
233
+ <invoke name="AskUserQuestion">
234
+ <parameter name="questions">[{
235
+ "question": "Architecture audit complete: Health Score [N]/100 ([rating]). [N] findings across [files_count] files. Pattern: [arch_type].",
236
+ "header": "Next steps",
237
+ "multiSelect": false,
238
+ "options": [
239
+ {"label": "Fix [structural] Structural issues now (Recommended)", "description": "[top_issue_summary]"},
240
+ {"label": "Create stories for all findings", "description": "Track [structural] structural + [degraded] degraded items in backlog"},
241
+ {"label": "Re-run with DEPTH=deep", "description": "Current was quick - deep includes SMELL and STYLE findings"},
242
+ {"label": "Save report and done", "description": "Report saved to docs/08-project/arch-audits/"}
243
+ ]
244
+ }]</parameter>
245
+ </invoke>
246
+ ```
247
+
248
+ ---
249
+
250
+ <!-- COMPACT_SUMMARY_START -->
251
+ ## Compact Summary
252
+
253
+ **Command**: `/agileflow:code:architecture` - Multi-agent architecture health analysis with consensus
254
+
255
+ **Quick Usage**:
256
+ ```
257
+ /agileflow:code:architecture src/ # Quick scan (all 5 analyzers)
258
+ /agileflow:code:architecture . DEPTH=deep # Comprehensive analysis
259
+ /agileflow:code:architecture lib/ FOCUS=coupling,circular # Specific areas
260
+ ```
261
+
262
+ **What It Does**: Deploy arch analyzers in parallel -> Each checks different structural aspects -> Consensus validates, computes health score -> Architecture Audit Report
263
+
264
+ **Analyzers (all 5)**:
265
+ - `arch-analyzer-coupling` - Fan-in/fan-out, tight coupling, shared state
266
+ - `arch-analyzer-layering` - Layer violations, import direction, mixed concerns
267
+ - `arch-analyzer-complexity` - Cyclomatic complexity, file size, nesting depth
268
+ - `arch-analyzer-patterns` - God objects, feature envy, data clumps, repeated switches
269
+ - `arch-analyzer-circular` - Import cycles, barrel file cycles, initialization order
270
+
271
+ **Severity Levels**:
272
+ - STRUCTURAL: Architecture actively impeding development
273
+ - DEGRADED: Growing problems, increasing maintenance cost
274
+ - SMELL: Early warning signs
275
+ - STYLE: Convention/consistency issues
276
+
277
+ **Output**: `docs/08-project/arch-audits/arch-audit-{YYYYMMDD}.md`
278
+ <!-- COMPACT_SUMMARY_END -->
279
+
280
+ ---
281
+
282
+ ## Boundary Rules (No Overlap)
283
+
284
+ - **vs code:security**: No vulnerability analysis - that's security domain
285
+ - **vs code:logic**: No logic bugs or edge cases - that's logic domain
286
+ - **vs code:performance**: No runtime performance - that's performance domain
287
+ - **Focus on structural health** - coupling, layering, complexity, patterns, cycles
288
+
289
+ ---
290
+
291
+ ## Related Commands
292
+
293
+ - `/agileflow:code:security` - Security vulnerability analysis
294
+ - `/agileflow:code:logic` - Logic bug analysis
295
+ - `/agileflow:code:performance` - Performance bottleneck analysis
296
+ - `/agileflow:impact` - Change impact analysis
297
+ - `/agileflow:deps` - Dependency graph visualization