agileflow 3.4.2 → 3.4.3

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 (37) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +2 -2
  3. package/lib/drivers/claude-driver.ts +1 -1
  4. package/lib/lazy-require.js +1 -1
  5. package/package.json +1 -1
  6. package/scripts/agent-loop.js +290 -230
  7. package/scripts/check-sessions.js +116 -0
  8. package/scripts/lib/quality-gates.js +35 -8
  9. package/scripts/lib/signal-detectors.js +0 -13
  10. package/scripts/lib/team-events.js +1 -1
  11. package/scripts/lib/tmux-audit-monitor.js +2 -1
  12. package/src/core/commands/ads/audit.md +19 -3
  13. package/src/core/commands/code/accessibility.md +22 -6
  14. package/src/core/commands/code/api.md +22 -6
  15. package/src/core/commands/code/architecture.md +22 -6
  16. package/src/core/commands/code/completeness.md +22 -6
  17. package/src/core/commands/code/legal.md +22 -6
  18. package/src/core/commands/code/logic.md +22 -6
  19. package/src/core/commands/code/performance.md +22 -6
  20. package/src/core/commands/code/security.md +22 -6
  21. package/src/core/commands/code/test.md +22 -6
  22. package/src/core/commands/ideate/features.md +5 -4
  23. package/src/core/commands/ideate/new.md +8 -7
  24. package/src/core/commands/seo/audit.md +21 -5
  25. package/lib/claude-cli-bridge.js +0 -215
  26. package/lib/dashboard-automations.js +0 -130
  27. package/lib/dashboard-git.js +0 -254
  28. package/lib/dashboard-inbox.js +0 -64
  29. package/lib/dashboard-protocol.js +0 -605
  30. package/lib/dashboard-server.js +0 -1296
  31. package/lib/dashboard-session.js +0 -136
  32. package/lib/dashboard-status.js +0 -72
  33. package/lib/dashboard-terminal.js +0 -354
  34. package/lib/dashboard-websocket.js +0 -88
  35. package/scripts/dashboard-serve.js +0 -336
  36. package/src/core/commands/serve.md +0 -127
  37. package/tools/cli/commands/serve.js +0 -492
@@ -10,6 +10,8 @@ compact_context:
10
10
  - "CRITICAL: Confidence scoring: CONFIRMED (2+ agree), LIKELY (1 with evidence), INVESTIGATE (1 weak)"
11
11
  - "MUST parse arguments: TARGET (file/dir), DEPTH (quick/deep/ultradeep), FOCUS (edge/invariant/flow/type/race/all)"
12
12
  - "Pass consensus all analyzer outputs, let it synthesize the final report"
13
+ - "DEPTH GATE: ultradeep/extreme MUST spawn tmux sessions via spawn-audit-sessions.js — NEVER deploy in-process"
14
+ - "Use check-sessions.js to monitor spawned tmux sessions — NEVER write custom polling scripts"
13
15
  state_fields:
14
16
  - target_path
15
17
  - depth
@@ -71,7 +73,7 @@ Deploy multiple specialized logic analyzers in parallel to find bugs, then synth
71
73
  | Argument | Values | Default | Description |
72
74
  |----------|--------|---------|-------------|
73
75
  | TARGET | file/directory | `.` | What to analyze |
74
- | DEPTH | quick, deep, ultradeep | quick | quick = high-impact only, deep = comprehensive, ultradeep = separate tmux sessions |
76
+ | DEPTH | quick, deep, ultradeep, extreme | quick | quick = high-impact only, deep = comprehensive, ultradeep = separate tmux sessions, extreme = partitioned tmux sessions |
75
77
  | FOCUS | edge,invariant,flow,type,race,all | all | Which analyzers to deploy |
76
78
  | MODEL | haiku, sonnet, opus | haiku | Model for analyzer subagents. Default preserves existing behavior. |
77
79
 
@@ -100,12 +102,12 @@ FOCUS = all (default) or comma-separated list
100
102
  Parse the JSON output to get `traceId`. Example: `{"ok":true,"traceId":"abc123ef",...}`
101
103
  4. Wait for all analyzers to complete:
102
104
  ```bash
103
- node .agileflow/scripts/lib/tmux-audit-monitor.js wait TRACE_ID --timeout=1800
105
+ node .agileflow/scripts/check-sessions.js wait TRACE_ID --timeout=1800
104
106
  ```
105
107
  - Exit 0 = all complete (JSON results on stdout)
106
108
  - Exit 1 = timeout (partial results on stdout, `missing` array shows what's left)
107
- - To check progress without blocking: `node .agileflow/scripts/lib/tmux-audit-monitor.js status TRACE_ID`
108
- - To retry stalled analyzers: `node .agileflow/scripts/lib/tmux-audit-monitor.js retry TRACE_ID`
109
+ - To check progress without blocking: `node .agileflow/scripts/check-sessions.js status TRACE_ID`
110
+ - To retry stalled analyzers: `node .agileflow/scripts/check-sessions.js retry TRACE_ID`
109
111
  5. Parse `results` array from the JSON output. Pass all findings to consensus coordinator (same as deep mode).
110
112
  6. If tmux unavailable (spawn exits code 2), fall back to `DEPTH=deep` with warning
111
113
 
@@ -122,7 +124,7 @@ Partition-based multi-agent audit. Instead of 1 analyzer per tmux window, the co
122
124
  ```bash
123
125
  node .agileflow/scripts/spawn-audit-sessions.js --audit=logic --target=TARGET --depth=extreme --partitions=dir1,dir2,dir3 --model=MODEL --json
124
126
  ```
125
- 4. Wait and collect results (same as ultradeep - use tmux-audit-monitor.js)
127
+ 4. Wait and collect results (same as ultradeep - use check-sessions.js)
126
128
  5. Run consensus on combined results from all partitions
127
129
 
128
130
  **PARTITIONS argument** (only used with DEPTH=extreme):
@@ -144,7 +146,21 @@ Partition-based multi-agent audit. Instead of 1 analyzer per tmux window, the co
144
146
  | `race` | logic-analyzer-race only |
145
147
  | `edge,type` | logic-analyzer-edge + logic-analyzer-type |
146
148
 
147
- ### STEP 2: Deploy Analyzers in Parallel
149
+ ---
150
+
151
+ ### DEPTH ROUTING GATE
152
+
153
+ | DEPTH | Route |
154
+ |-------|-------|
155
+ | `quick` or `deep` | Continue to STEP 2 below |
156
+ | `ultradeep` | STOP. Follow ULTRADEEP instructions above. Do NOT proceed to STEP 2. |
157
+ | `extreme` | STOP. Follow EXTREME instructions above. Do NOT proceed to STEP 2. |
158
+
159
+ **CRITICAL**: STEP 2 is for `quick`/`deep` ONLY. For `ultradeep`/`extreme`, the analyzers run in separate tmux sessions — NOT in-process via Task calls. If you deploy Task calls for ultradeep/extreme, you are doing it wrong. Follow the spawn-audit-sessions.js workflow above, then skip to the consensus step with the collected results.
160
+
161
+ ---
162
+
163
+ ### STEP 2: Deploy Analyzers in Parallel (quick/deep ONLY)
148
164
 
149
165
  **CRITICAL**: Deploy ALL selected analyzers in a SINGLE message with multiple Task calls.
150
166
 
@@ -10,6 +10,8 @@ compact_context:
10
10
  - "CRITICAL: Confidence scoring: CONFIRMED (2+ agree), LIKELY (1 with evidence), INVESTIGATE (1 weak)"
11
11
  - "MUST parse arguments: TARGET (file/dir), DEPTH (quick/deep/ultradeep), FOCUS (queries|rendering|memory|bundle|compute|network|caching|assets|all)"
12
12
  - "Pass consensus all analyzer outputs, let it synthesize the final report"
13
+ - "DEPTH GATE: ultradeep/extreme MUST spawn tmux sessions via spawn-audit-sessions.js — NEVER deploy in-process"
14
+ - "Use check-sessions.js to monitor spawned tmux sessions — NEVER write custom polling scripts"
13
15
  state_fields:
14
16
  - target_path
15
17
  - depth
@@ -73,7 +75,7 @@ Deploy multiple specialized performance analyzers in parallel to find bottleneck
73
75
  | Argument | Values | Default | Description |
74
76
  |----------|--------|---------|-------------|
75
77
  | TARGET | file/directory | `.` | What to analyze |
76
- | DEPTH | quick, deep, ultradeep | quick | quick = core 5, deep = all 8, ultradeep = separate tmux sessions |
78
+ | DEPTH | quick, deep, ultradeep, extreme | quick | quick = core 5, deep = all 8, ultradeep = separate tmux sessions, extreme = partitioned tmux sessions |
77
79
  | FOCUS | queries,rendering,memory,bundle,compute,network,caching,assets,all | all | Which analyzers to deploy |
78
80
  | MODEL | haiku, sonnet, opus | haiku | Model for analyzer subagents. Default preserves existing behavior. |
79
81
 
@@ -123,12 +125,12 @@ FOCUS = all (default) or comma-separated list
123
125
  Parse the JSON output to get `traceId`. Example: `{"ok":true,"traceId":"abc123ef",...}`
124
126
  4. Wait for all analyzers to complete:
125
127
  ```bash
126
- node .agileflow/scripts/lib/tmux-audit-monitor.js wait TRACE_ID --timeout=1800
128
+ node .agileflow/scripts/check-sessions.js wait TRACE_ID --timeout=1800
127
129
  ```
128
130
  - Exit 0 = all complete (JSON results on stdout)
129
131
  - Exit 1 = timeout (partial results on stdout, `missing` array shows what's left)
130
- - To check progress without blocking: `node .agileflow/scripts/lib/tmux-audit-monitor.js status TRACE_ID`
131
- - To retry stalled analyzers: `node .agileflow/scripts/lib/tmux-audit-monitor.js retry TRACE_ID`
132
+ - To check progress without blocking: `node .agileflow/scripts/check-sessions.js status TRACE_ID`
133
+ - To retry stalled analyzers: `node .agileflow/scripts/check-sessions.js retry TRACE_ID`
132
134
  5. Parse `results` array from the JSON output. Pass all findings to consensus coordinator (same as deep mode).
133
135
  6. If tmux unavailable (spawn exits code 2), fall back to `DEPTH=deep` with warning
134
136
 
@@ -145,7 +147,7 @@ Partition-based multi-agent audit. Instead of 1 analyzer per tmux window, the co
145
147
  ```bash
146
148
  node .agileflow/scripts/spawn-audit-sessions.js --audit=performance --target=TARGET --depth=extreme --partitions=dir1,dir2,dir3 --model=MODEL --json
147
149
  ```
148
- 4. Wait and collect results (same as ultradeep - use tmux-audit-monitor.js)
150
+ 4. Wait and collect results (same as ultradeep - use check-sessions.js)
149
151
  5. Run consensus on combined results from all partitions
150
152
 
151
153
  **PARTITIONS argument** (only used with DEPTH=extreme):
@@ -155,7 +157,21 @@ Partition-based multi-agent audit. Instead of 1 analyzer per tmux window, the co
155
157
  | `PARTITIONS=5` | AI creates exactly 5 partitions |
156
158
  | `PARTITIONS=src/auth,src/api,lib` | Use these exact directories |
157
159
 
158
- ### STEP 2: Deploy Analyzers in Parallel
160
+ ---
161
+
162
+ ### DEPTH ROUTING GATE
163
+
164
+ | DEPTH | Route |
165
+ |-------|-------|
166
+ | `quick` or `deep` | Continue to STEP 2 below |
167
+ | `ultradeep` | STOP. Follow ULTRADEEP instructions above. Do NOT proceed to STEP 2. |
168
+ | `extreme` | STOP. Follow EXTREME instructions above. Do NOT proceed to STEP 2. |
169
+
170
+ **CRITICAL**: STEP 2 is for `quick`/`deep` ONLY. For `ultradeep`/`extreme`, the analyzers run in separate tmux sessions — NOT in-process via Task calls. If you deploy Task calls for ultradeep/extreme, you are doing it wrong. Follow the spawn-audit-sessions.js workflow above, then skip to the consensus step with the collected results.
171
+
172
+ ---
173
+
174
+ ### STEP 2: Deploy Analyzers in Parallel (quick/deep ONLY)
159
175
 
160
176
  **CRITICAL**: Deploy ALL selected analyzers in a SINGLE message with multiple Task calls.
161
177
 
@@ -10,6 +10,8 @@ compact_context:
10
10
  - "CRITICAL: Confidence scoring: CONFIRMED (2+ agree), LIKELY (1 with evidence), INVESTIGATE (1 weak)"
11
11
  - "MUST parse arguments: TARGET (file/dir), DEPTH (quick/deep/ultradeep), FOCUS (injection|auth|authz|secrets|input|deps|infra|api|all)"
12
12
  - "Pass consensus all analyzer outputs, let it synthesize the final report"
13
+ - "DEPTH GATE: ultradeep/extreme MUST spawn tmux sessions via spawn-audit-sessions.js — NEVER deploy in-process"
14
+ - "Use check-sessions.js to monitor spawned tmux sessions — NEVER write custom polling scripts"
13
15
  state_fields:
14
16
  - target_path
15
17
  - depth
@@ -76,7 +78,7 @@ Deploy multiple specialized security vulnerability analyzers in parallel to find
76
78
  | Argument | Values | Default | Description |
77
79
  |----------|--------|---------|-------------|
78
80
  | TARGET | file/directory | `.` | What to analyze |
79
- | DEPTH | quick, deep, ultradeep | quick | quick = core 5, deep = all 8, ultradeep = separate tmux sessions |
81
+ | DEPTH | quick, deep, ultradeep, extreme | quick | quick = core 5, deep = all 8, ultradeep = separate tmux sessions, extreme = partitioned tmux sessions |
80
82
  | FOCUS | injection,auth,authz,secrets,input,deps,infra,api,all | all | Which analyzers to deploy |
81
83
  | MODEL | haiku, sonnet, opus | haiku | Model for analyzer subagents. Default preserves existing behavior. |
82
84
 
@@ -126,12 +128,12 @@ FOCUS = all (default) or comma-separated list
126
128
  Parse the JSON output to get `traceId`. Example: `{"ok":true,"traceId":"abc123ef",...}`
127
129
  4. Wait for all analyzers to complete:
128
130
  ```bash
129
- node .agileflow/scripts/lib/tmux-audit-monitor.js wait TRACE_ID --timeout=1800
131
+ node .agileflow/scripts/check-sessions.js wait TRACE_ID --timeout=1800
130
132
  ```
131
133
  - Exit 0 = all complete (JSON results on stdout)
132
134
  - Exit 1 = timeout (partial results on stdout, `missing` array shows what's left)
133
- - To check progress without blocking: `node .agileflow/scripts/lib/tmux-audit-monitor.js status TRACE_ID`
134
- - To retry stalled analyzers: `node .agileflow/scripts/lib/tmux-audit-monitor.js retry TRACE_ID`
135
+ - To check progress without blocking: `node .agileflow/scripts/check-sessions.js status TRACE_ID`
136
+ - To retry stalled analyzers: `node .agileflow/scripts/check-sessions.js retry TRACE_ID`
135
137
  5. Parse `results` array from the JSON output. Pass all findings to consensus coordinator (same as deep mode).
136
138
  6. If tmux unavailable (spawn exits code 2), fall back to `DEPTH=deep` with warning
137
139
 
@@ -148,7 +150,7 @@ Partition-based multi-agent audit. Instead of 1 analyzer per tmux window, the co
148
150
  ```bash
149
151
  node .agileflow/scripts/spawn-audit-sessions.js --audit=security --target=TARGET --depth=extreme --partitions=dir1,dir2,dir3 --model=MODEL --json
150
152
  ```
151
- 4. Wait and collect results (same as ultradeep - use tmux-audit-monitor.js)
153
+ 4. Wait and collect results (same as ultradeep - use check-sessions.js)
152
154
  5. Run consensus on combined results from all partitions
153
155
 
154
156
  **PARTITIONS argument** (only used with DEPTH=extreme):
@@ -158,7 +160,21 @@ Partition-based multi-agent audit. Instead of 1 analyzer per tmux window, the co
158
160
  | `PARTITIONS=5` | AI creates exactly 5 partitions |
159
161
  | `PARTITIONS=src/auth,src/api,lib` | Use these exact directories |
160
162
 
161
- ### STEP 2: Deploy Analyzers in Parallel
163
+ ---
164
+
165
+ ### DEPTH ROUTING GATE
166
+
167
+ | DEPTH | Route |
168
+ |-------|-------|
169
+ | `quick` or `deep` | Continue to STEP 2 below |
170
+ | `ultradeep` | STOP. Follow ULTRADEEP instructions above. Do NOT proceed to STEP 2. |
171
+ | `extreme` | STOP. Follow EXTREME instructions above. Do NOT proceed to STEP 2. |
172
+
173
+ **CRITICAL**: STEP 2 is for `quick`/`deep` ONLY. For `ultradeep`/`extreme`, the analyzers run in separate tmux sessions — NOT in-process via Task calls. If you deploy Task calls for ultradeep/extreme, you are doing it wrong. Follow the spawn-audit-sessions.js workflow above, then skip to the consensus step with the collected results.
174
+
175
+ ---
176
+
177
+ ### STEP 2: Deploy Analyzers in Parallel (quick/deep ONLY)
162
178
 
163
179
  **CRITICAL**: Deploy ALL selected analyzers in a SINGLE message with multiple Task calls.
164
180
 
@@ -10,6 +10,8 @@ compact_context:
10
10
  - "CRITICAL: Confidence scoring: CONFIRMED (2+ agree), LIKELY (1 with evidence), INVESTIGATE (1 weak)"
11
11
  - "MUST parse arguments: TARGET (file/dir), DEPTH (quick/deep/ultradeep), FOCUS (coverage|fragility|mocking|assertions|structure|integration|maintenance|patterns|all)"
12
12
  - "Pass consensus all analyzer outputs, let it synthesize the final report"
13
+ - "DEPTH GATE: ultradeep/extreme MUST spawn tmux sessions via spawn-audit-sessions.js — NEVER deploy in-process"
14
+ - "Use check-sessions.js to monitor spawned tmux sessions — NEVER write custom polling scripts"
13
15
  state_fields:
14
16
  - target_path
15
17
  - depth
@@ -73,7 +75,7 @@ Deploy multiple specialized test quality analyzers in parallel to find weaknesse
73
75
  | Argument | Values | Default | Description |
74
76
  |----------|--------|---------|-------------|
75
77
  | TARGET | file/directory | `.` | What to analyze |
76
- | DEPTH | quick, deep, ultradeep | quick | quick = core 5, deep = all 8, ultradeep = separate tmux sessions |
78
+ | DEPTH | quick, deep, ultradeep, extreme | quick | quick = core 5, deep = all 8, ultradeep = separate tmux sessions, extreme = partitioned tmux sessions |
77
79
  | FOCUS | coverage,fragility,mocking,assertions,structure,integration,maintenance,patterns,all | all | Which analyzers to deploy |
78
80
  | MODEL | haiku, sonnet, opus | haiku | Model for analyzer subagents. Default preserves existing behavior. |
79
81
 
@@ -123,12 +125,12 @@ FOCUS = all (default) or comma-separated list
123
125
  Parse the JSON output to get `traceId`. Example: `{"ok":true,"traceId":"abc123ef",...}`
124
126
  4. Wait for all analyzers to complete:
125
127
  ```bash
126
- node .agileflow/scripts/lib/tmux-audit-monitor.js wait TRACE_ID --timeout=1800
128
+ node .agileflow/scripts/check-sessions.js wait TRACE_ID --timeout=1800
127
129
  ```
128
130
  - Exit 0 = all complete (JSON results on stdout)
129
131
  - Exit 1 = timeout (partial results on stdout, `missing` array shows what's left)
130
- - To check progress without blocking: `node .agileflow/scripts/lib/tmux-audit-monitor.js status TRACE_ID`
131
- - To retry stalled analyzers: `node .agileflow/scripts/lib/tmux-audit-monitor.js retry TRACE_ID`
132
+ - To check progress without blocking: `node .agileflow/scripts/check-sessions.js status TRACE_ID`
133
+ - To retry stalled analyzers: `node .agileflow/scripts/check-sessions.js retry TRACE_ID`
132
134
  5. Parse `results` array from the JSON output. Pass all findings to consensus coordinator (same as deep mode).
133
135
  6. If tmux unavailable (spawn exits code 2), fall back to `DEPTH=deep` with warning
134
136
 
@@ -145,7 +147,7 @@ Partition-based multi-agent audit. Instead of 1 analyzer per tmux window, the co
145
147
  ```bash
146
148
  node .agileflow/scripts/spawn-audit-sessions.js --audit=test --target=TARGET --depth=extreme --partitions=dir1,dir2,dir3 --model=MODEL --json
147
149
  ```
148
- 4. Wait and collect results (same as ultradeep - use tmux-audit-monitor.js)
150
+ 4. Wait and collect results (same as ultradeep - use check-sessions.js)
149
151
  5. Run consensus on combined results from all partitions
150
152
 
151
153
  **PARTITIONS argument** (only used with DEPTH=extreme):
@@ -155,7 +157,21 @@ Partition-based multi-agent audit. Instead of 1 analyzer per tmux window, the co
155
157
  | `PARTITIONS=5` | AI creates exactly 5 partitions |
156
158
  | `PARTITIONS=src/auth,src/api,lib` | Use these exact directories |
157
159
 
158
- ### STEP 2: Deploy Analyzers in Parallel
160
+ ---
161
+
162
+ ### DEPTH ROUTING GATE
163
+
164
+ | DEPTH | Route |
165
+ |-------|-------|
166
+ | `quick` or `deep` | Continue to STEP 2 below |
167
+ | `ultradeep` | STOP. Follow ULTRADEEP instructions above. Do NOT proceed to STEP 2. |
168
+ | `extreme` | STOP. Follow EXTREME instructions above. Do NOT proceed to STEP 2. |
169
+
170
+ **CRITICAL**: STEP 2 is for `quick`/`deep` ONLY. For `ultradeep`/`extreme`, the analyzers run in separate tmux sessions — NOT in-process via Task calls. If you deploy Task calls for ultradeep/extreme, you are doing it wrong. Follow the spawn-audit-sessions.js workflow above, then skip to the consensus step with the collected results.
171
+
172
+ ---
173
+
174
+ ### STEP 2: Deploy Analyzers in Parallel (quick/deep ONLY)
159
175
 
160
176
  **CRITICAL**: Deploy ALL selected analyzers in a SINGLE message with multiple Task calls.
161
177
 
@@ -11,6 +11,7 @@ compact_context:
11
11
  - "CRITICAL: Confidence scoring: CONFIRMED (2+ agree), LIKELY (1 with evidence), SPECULATIVE (1 weak)"
12
12
  - "MUST parse arguments: TARGET (file/dir), DEPTH (quick/deep/ultradeep), FOCUS (features|ux|market|growth|integration|all), MODEL (haiku/sonnet/opus)"
13
13
  - "Pass consensus all analyzer outputs, let it synthesize the final report"
14
+ - "Use check-sessions.js to monitor spawned tmux sessions — NEVER write custom polling scripts"
14
15
  state_fields:
15
16
  - target_path
16
17
  - depth
@@ -143,12 +144,12 @@ FOCUS = all (default) or comma-separated list
143
144
  Parse the JSON output to get `traceId`. Example: `{"ok":true,"traceId":"abc123ef",...}`
144
145
  4. Wait for all analyzers to complete:
145
146
  ```bash
146
- node .agileflow/scripts/lib/tmux-audit-monitor.js wait TRACE_ID --timeout=1800
147
+ node .agileflow/scripts/check-sessions.js wait TRACE_ID --timeout=1800
147
148
  ```
148
149
  - Exit 0 = all complete (JSON results on stdout)
149
150
  - Exit 1 = timeout (partial results on stdout, `missing` array shows what's left)
150
- - To check progress without blocking: `node .agileflow/scripts/lib/tmux-audit-monitor.js status TRACE_ID`
151
- - To retry stalled analyzers: `node .agileflow/scripts/lib/tmux-audit-monitor.js retry TRACE_ID`
151
+ - To check progress without blocking: `node .agileflow/scripts/check-sessions.js status TRACE_ID`
152
+ - To retry stalled analyzers: `node .agileflow/scripts/check-sessions.js retry TRACE_ID`
152
153
  5. Parse `results` array from the JSON output. Pass all findings to consensus coordinator (same as deep mode).
153
154
  6. If tmux unavailable (spawn exits code 2), fall back to `DEPTH=deep` with warning
154
155
 
@@ -165,7 +166,7 @@ Partition-based multi-agent audit. Instead of 1 analyzer per tmux window, the co
165
166
  ```bash
166
167
  node .agileflow/scripts/spawn-audit-sessions.js --audit=brainstorm --target=TARGET --depth=extreme --partitions=dir1,dir2,dir3 --model=MODEL --json
167
168
  ```
168
- 4. Wait and collect results (same as ultradeep - use tmux-audit-monitor.js)
169
+ 4. Wait and collect results (same as ultradeep - use check-sessions.js)
169
170
  5. Run consensus on combined results from all partitions
170
171
 
171
172
  **PARTITIONS argument** (only used with DEPTH=extreme):
@@ -15,6 +15,7 @@ compact_context:
15
15
  - "MUST estimate effort for each idea: High/Medium/Low impact"
16
16
  - "MUST assign IDEA-XXXX identifiers to all ideas and update ideation index"
17
17
  - "Optional: Generate stories for HIGH-confidence items (if OUTPUT=stories or both)"
18
+ - "Use check-sessions.js to monitor spawned tmux sessions — NEVER write custom polling scripts"
18
19
  state_fields:
19
20
  - scope
20
21
  - depth
@@ -364,12 +365,12 @@ Parse the input arguments:
364
365
  Parse the JSON output to get `traceId`. Example: `{"ok":true,"traceId":"abc123ef",...}`
365
366
  4. Wait for all analyzers to complete:
366
367
  ```bash
367
- node .agileflow/scripts/lib/tmux-audit-monitor.js wait TRACE_ID --timeout=1800
368
+ node .agileflow/scripts/check-sessions.js wait TRACE_ID --timeout=1800
368
369
  ```
369
370
  - Exit 0 = all complete (JSON results on stdout)
370
371
  - Exit 1 = timeout (partial results on stdout, `missing` array shows what's left)
371
- - To check progress without blocking: `node .agileflow/scripts/lib/tmux-audit-monitor.js status TRACE_ID`
372
- - To retry stalled analyzers: `node .agileflow/scripts/lib/tmux-audit-monitor.js retry TRACE_ID`
372
+ - To check progress without blocking: `node .agileflow/scripts/check-sessions.js status TRACE_ID`
373
+ - To retry stalled analyzers: `node .agileflow/scripts/check-sessions.js retry TRACE_ID`
373
374
  5. Parse `results` array from the JSON output and proceed to STEP 4 (Synthesis).
374
375
  6. If tmux unavailable (spawn exits code 2), fall back to `DEPTH=deep` with warning
375
376
 
@@ -386,7 +387,7 @@ Partition-based multi-agent audit. Instead of 1 expert per tmux window, the code
386
387
  ```bash
387
388
  node .agileflow/scripts/spawn-audit-sessions.js --audit=ideate --target=TARGET --depth=extreme --partitions=dir1,dir2,dir3 --focus=FOCUS_KEYS --model=MODEL --json
388
389
  ```
389
- 4. Wait and collect results (same as ultradeep - use tmux-audit-monitor.js)
390
+ 4. Wait and collect results (same as ultradeep - use check-sessions.js)
390
391
  5. Run synthesis on combined results from all partitions (proceed to STEP 4)
391
392
 
392
393
  **PARTITIONS argument** (only used with DEPTH=extreme):
@@ -521,11 +522,11 @@ Each expert gets its own Claude Code tmux session with full context window. Use
521
522
 
522
523
  ```bash
523
524
  # Check completion status
524
- node .agileflow/scripts/lib/tmux-audit-monitor.js status TRACE_ID
525
+ node .agileflow/scripts/check-sessions.js status TRACE_ID
525
526
  # Wait for all to complete (blocks until done or timeout)
526
- node .agileflow/scripts/lib/tmux-audit-monitor.js wait TRACE_ID --timeout=1800
527
+ node .agileflow/scripts/check-sessions.js wait TRACE_ID --timeout=1800
527
528
  # Collect whatever results are ready
528
- node .agileflow/scripts/lib/tmux-audit-monitor.js collect TRACE_ID
529
+ node .agileflow/scripts/check-sessions.js collect TRACE_ID
529
530
  ```
530
531
 
531
532
  **For SCOPE-filtered ultradeep** (e.g., SCOPE=security):
@@ -11,6 +11,8 @@ compact_context:
11
11
  - "MUST parse arguments: URL (required), DEPTH (quick/deep/ultradeep/extreme), MAX_PAGES (default 50)"
12
12
  - "Fetch homepage FIRST to detect business type before deploying analyzers"
13
13
  - "Pass all analyzer outputs to seo-consensus for final report"
14
+ - "DEPTH GATE: ultradeep/extreme MUST spawn tmux sessions via spawn-audit-sessions.js — NEVER deploy in-process"
15
+ - "Use check-sessions.js to monitor spawned tmux sessions — NEVER write custom polling scripts"
14
16
  state_fields:
15
17
  - target_url
16
18
  - depth
@@ -112,12 +114,12 @@ MAX_PAGES = 50 (default)
112
114
  Parse the JSON output to get `traceId`. Example: `{"ok":true,"traceId":"abc123ef",...}`
113
115
  4. Wait for all analyzers to complete:
114
116
  ```bash
115
- node .agileflow/scripts/lib/tmux-audit-monitor.js wait TRACE_ID --timeout=1800
117
+ node .agileflow/scripts/check-sessions.js wait TRACE_ID --timeout=1800
116
118
  ```
117
119
  - Exit 0 = all complete (JSON results on stdout)
118
120
  - Exit 1 = timeout (partial results on stdout, `missing` array shows what's left)
119
- - To check progress without blocking: `node .agileflow/scripts/lib/tmux-audit-monitor.js status TRACE_ID`
120
- - To retry stalled analyzers: `node .agileflow/scripts/lib/tmux-audit-monitor.js retry TRACE_ID`
121
+ - To check progress without blocking: `node .agileflow/scripts/check-sessions.js status TRACE_ID`
122
+ - To retry stalled analyzers: `node .agileflow/scripts/check-sessions.js retry TRACE_ID`
121
123
  5. Parse `results` array from the JSON output. Pass all findings to consensus coordinator (same as deep mode).
122
124
  6. If tmux unavailable (spawn exits code 2), fall back to `DEPTH=deep` with warning
123
125
 
@@ -134,7 +136,7 @@ Partition-based multi-agent audit. Instead of auditing the entire site as one un
134
136
  ```bash
135
137
  node .agileflow/scripts/spawn-audit-sessions.js --audit=seo --target=URL --depth=extreme --partitions=/blog,/docs,/products --model=MODEL --json
136
138
  ```
137
- 4. Wait and collect results (same as ultradeep - use tmux-audit-monitor.js)
139
+ 4. Wait and collect results (same as ultradeep - use check-sessions.js)
138
140
  5. Run consensus on combined results from all partitions
139
141
 
140
142
  **PARTITIONS argument** (only used with DEPTH=extreme):
@@ -144,6 +146,20 @@ Partition-based multi-agent audit. Instead of auditing the entire site as one un
144
146
  | `PARTITIONS=5` | AI creates exactly 5 page groups |
145
147
  | `PARTITIONS=/blog,/docs,/products` | Use these exact URL path prefixes |
146
148
 
149
+ ---
150
+
151
+ ### DEPTH ROUTING GATE
152
+
153
+ | DEPTH | Route |
154
+ |-------|-------|
155
+ | `quick` or `deep` | Continue to STEP 2 below |
156
+ | `ultradeep` | STOP. Follow ULTRADEEP instructions above. Do NOT proceed to STEP 2. |
157
+ | `extreme` | STOP. Follow EXTREME instructions above. Do NOT proceed to STEP 2. |
158
+
159
+ **CRITICAL**: STEPs 2-4 are for `quick`/`deep` ONLY. For `ultradeep`/`extreme`, the analyzers run in separate tmux sessions — NOT in-process via Task calls. If you deploy Task calls for ultradeep/extreme, you are doing it wrong. Follow the spawn-audit-sessions.js workflow above, then skip to the consensus step with the collected results.
160
+
161
+ ---
162
+
147
163
  If URL is missing, ask:
148
164
  ```xml
149
165
  <invoke name="AskUserQuestion">
@@ -174,7 +190,7 @@ Also fetch:
174
190
  - `{URL}/robots.txt` - crawl rules, sitemap location
175
191
  - `{URL}/sitemap.xml` - page inventory
176
192
 
177
- ### STEP 3: Deploy 6 Analyzers in Parallel
193
+ ### STEP 3: Deploy 6 Analyzers in Parallel (quick/deep ONLY)
178
194
 
179
195
  **CRITICAL**: Deploy ALL 6 analyzers in a SINGLE message with multiple Task calls.
180
196
 
@@ -1,215 +0,0 @@
1
- /**
2
- * Claude CLI Bridge
3
- *
4
- * Spawns Claude Code CLI as a subprocess and bridges communication
5
- * between the dashboard and Claude.
6
- */
7
-
8
- const { spawn } = require('child_process');
9
- const readline = require('readline');
10
- const path = require('path');
11
-
12
- /**
13
- * Creates a Claude CLI bridge for a session
14
- */
15
- function createClaudeBridge(options = {}) {
16
- const {
17
- cwd = process.cwd(),
18
- onText,
19
- onToolStart,
20
- onToolResult,
21
- onError,
22
- onComplete,
23
- onInit,
24
- } = options;
25
-
26
- let claudeProcess = null;
27
- let isRunning = false;
28
-
29
- /**
30
- * Send a message to Claude and stream the response
31
- */
32
- async function sendMessage(content) {
33
- if (isRunning) {
34
- throw new Error('Claude is already processing a message');
35
- }
36
-
37
- isRunning = true;
38
-
39
- return new Promise((resolve, reject) => {
40
- // Spawn claude with streaming JSON output
41
- claudeProcess = spawn(
42
- 'claude',
43
- ['--print', '--output-format', 'stream-json', '--permission-mode', 'default', content],
44
- {
45
- cwd,
46
- env: { ...process.env },
47
- stdio: ['ignore', 'pipe', 'pipe'],
48
- }
49
- );
50
-
51
- // Parse NDJSON output line by line
52
- const rl = readline.createInterface({
53
- input: claudeProcess.stdout,
54
- crlfDelay: Infinity,
55
- });
56
-
57
- let fullResponse = '';
58
- let toolUseBuffer = new Map();
59
- let hadAssistantText = false;
60
-
61
- rl.on('line', line => {
62
- try {
63
- const event = JSON.parse(line);
64
- const result = processEvent(event, {
65
- onText,
66
- onToolStart,
67
- onToolResult,
68
- onInit,
69
- toolUseBuffer,
70
- hadAssistantText,
71
- });
72
-
73
- // Track if we've sent assistant text
74
- if (result?.sentText) {
75
- hadAssistantText = true;
76
- }
77
-
78
- // Accumulate text response
79
- if (event.type === 'assistant' && event.message?.content) {
80
- for (const block of event.message.content) {
81
- if (block.type === 'text') {
82
- fullResponse += block.text;
83
- }
84
- }
85
- }
86
- // Also accumulate from result (for slash commands)
87
- if (event.type === 'result' && event.result) {
88
- fullResponse = event.result;
89
- }
90
- } catch (err) {
91
- // Skip non-JSON lines
92
- }
93
- });
94
-
95
- claudeProcess.stderr.on('data', data => {
96
- const errorText = data.toString();
97
- if (onError) onError(errorText);
98
- });
99
-
100
- claudeProcess.on('close', code => {
101
- isRunning = false;
102
- claudeProcess = null;
103
-
104
- if (code === 0) {
105
- if (onComplete) onComplete(fullResponse);
106
- resolve(fullResponse);
107
- } else {
108
- const error = new Error(`Claude exited with code ${code}`);
109
- if (onError) onError(error.message);
110
- reject(error);
111
- }
112
- });
113
-
114
- claudeProcess.on('error', err => {
115
- isRunning = false;
116
- claudeProcess = null;
117
- if (onError) onError(err.message);
118
- reject(err);
119
- });
120
- });
121
- }
122
-
123
- /**
124
- * Cancel the current Claude operation
125
- */
126
- function cancel() {
127
- if (claudeProcess) {
128
- claudeProcess.kill('SIGINT');
129
- isRunning = false;
130
- claudeProcess = null;
131
- }
132
- }
133
-
134
- /**
135
- * Check if Claude is currently processing
136
- */
137
- function isBusy() {
138
- return isRunning;
139
- }
140
-
141
- return {
142
- sendMessage,
143
- cancel,
144
- isBusy,
145
- };
146
- }
147
-
148
- /**
149
- * Process a stream-json event from Claude CLI
150
- * @returns {{ sentText: boolean }} - Whether text was sent
151
- */
152
- function processEvent(event, handlers) {
153
- const { onText, onToolStart, onToolResult, onInit, toolUseBuffer, hadAssistantText } = handlers;
154
- let sentText = false;
155
-
156
- switch (event.type) {
157
- case 'system':
158
- if (event.subtype === 'init' && onInit) {
159
- onInit({
160
- sessionId: event.session_id,
161
- model: event.model,
162
- tools: event.tools,
163
- });
164
- }
165
- break;
166
-
167
- case 'assistant':
168
- if (event.message?.content) {
169
- for (const block of event.message.content) {
170
- if (block.type === 'text' && onText) {
171
- // Stream text
172
- onText(block.text, false);
173
- sentText = true;
174
- } else if (block.type === 'tool_use' && onToolStart) {
175
- // Tool call started
176
- toolUseBuffer.set(block.id, block);
177
- onToolStart(block.id, block.name, block.input);
178
- }
179
- }
180
- }
181
- break;
182
-
183
- case 'user':
184
- // This is a tool result coming back
185
- if (event.message?.content) {
186
- for (const block of event.message.content) {
187
- if (block.type === 'tool_result' && onToolResult) {
188
- const toolUse = toolUseBuffer.get(block.tool_use_id);
189
- onToolResult(block.tool_use_id, block.content, block.is_error, toolUse?.name);
190
- }
191
- }
192
- }
193
- break;
194
-
195
- case 'result':
196
- if (event.subtype === 'success') {
197
- // For slash commands (no assistant text), send the result text
198
- if (event.result && onText && !hadAssistantText) {
199
- onText(event.result, false);
200
- sentText = true;
201
- }
202
- // Signal completion
203
- if (onText) {
204
- onText('', true);
205
- }
206
- }
207
- break;
208
- }
209
-
210
- return { sentText };
211
- }
212
-
213
- module.exports = {
214
- createClaudeBridge,
215
- };