ai-consultants 3.4.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/.claude/commands/ai-consultants:consult.md +29 -9
  2. package/.claude/commands/ai-consultants:help.md +5 -1
  3. package/.env.example +37 -14
  4. package/CLAUDE.md +75 -79
  5. package/README.md +73 -36
  6. package/SKILL.md +65 -5
  7. package/bin/ai-consultants +4 -5
  8. package/docs/COST_RATES.md +57 -35
  9. package/docs/JSON_SCHEMA.md +14 -46
  10. package/docs/RECIPES.md +3 -2
  11. package/docs/SETUP.md +21 -22
  12. package/docs/cost_rates.json +107 -28
  13. package/docs/releases/v3.5.0.md +129 -0
  14. package/docs/releases/v4.0.0.md +107 -0
  15. package/package.json +5 -5
  16. package/references/affinity.json +0 -10
  17. package/references/configuration.md +71 -9
  18. package/references/details.md +6 -6
  19. package/scripts/build_context.sh +22 -9
  20. package/scripts/config.sh +294 -63
  21. package/scripts/configure.sh +32 -8
  22. package/scripts/consult_all.sh +161 -52
  23. package/scripts/doctor.sh +12 -12
  24. package/scripts/followup.sh +80 -15
  25. package/scripts/install.sh +2 -2
  26. package/scripts/lib/api.sh +11 -2
  27. package/scripts/lib/api_query.sh +122 -27
  28. package/scripts/lib/common.sh +159 -32
  29. package/scripts/lib/costs.sh +37 -17
  30. package/scripts/lib/personas.sh +7 -7
  31. package/scripts/lib/progress.sh +2 -2
  32. package/scripts/lib/routing.sh +1 -1
  33. package/scripts/lib/schema.json +17 -40
  34. package/scripts/query_claude.sh +66 -9
  35. package/scripts/query_codex.sh +14 -2
  36. package/scripts/query_gemini.sh +42 -3
  37. package/scripts/query_glm.sh +1 -1
  38. package/scripts/query_grok.sh +80 -21
  39. package/scripts/query_kimi.sh +17 -9
  40. package/scripts/query_minimax.sh +36 -9
  41. package/scripts/query_mistral.sh +83 -15
  42. package/scripts/query_qwen3.sh +23 -9
  43. package/scripts/synthesize.sh +112 -83
  44. package/scripts/update_clis.sh +0 -2
  45. package/templates/consultation_report.md +27 -265
  46. package/templates/synthesis_prompt.md +47 -87
  47. package/scripts/query_cursor.sh +0 -75
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Consult AI experts (Gemini, Codex, Mistral, Cursor, Kimi, Qwen, GLM, Grok, DeepSeek, MiniMax) for coding questions. Use when weighing trade-offs, comparing approaches, or wanting multiple expert perspectives on non-trivial decisions.
2
+ description: Consult AI experts (Gemini, Codex, Mistral, Kimi, Qwen, GLM, Grok, DeepSeek, MiniMax) for coding questions. Use when weighing trade-offs, comparing approaches, or wanting multiple expert perspectives on non-trivial decisions.
3
3
  argument-hint: <question> [file1] [file2] ...
4
4
  allowed-tools: Bash Read Glob Grep
5
5
  ---
@@ -14,6 +14,11 @@ Query multiple AI models for expert opinions on a coding question.
14
14
 
15
15
  1. If no question provided in $ARGUMENTS, ask the user what they want to consult about.
16
16
 
17
+ Separate supported consultation options from the question before running the
18
+ panel. In particular, preserve `--preset <name>` and `--strategy <name>` as
19
+ CLI arguments placed before the question; they are not part of the question
20
+ text. Reject an incomplete option instead of guessing its value.
21
+
17
22
  2. **File context handling**: Identify which strings in $ARGUMENTS refer to files the user wants the consultants to look at. Use your judgment — verify existence via `Glob` or `Bash ls` when uncertain. This replaces fragile regex detection: a `Makefile`, `Dockerfile`, dotfile, or path without a common extension is still a file; an URL or regex pattern in the question text is not.
18
23
 
19
24
  For each file you identify:
@@ -25,22 +30,35 @@ Query multiple AI models for expert opinions on a coding question.
25
30
 
26
31
  **Note (Claude only):** Do not use your `Read` tool to dump file contents into the query. `build_context.sh` handles file reading itself, without the `N\t` line-number prefix that `Read` adds.
27
32
 
28
- 3. **Run the consultation**:
33
+ 3. **Write the question safely and run the consultation**:
34
+ - With Bash, create a query file using `mktemp`, set mode 600, and write the
35
+ exact question text (with file paths and consultation options removed)
36
+ through a **single-quoted heredoc delimiter that does not occur as its own
37
+ line in the question**. Never pass raw user text as a shell argument or
38
+ through an unquoted heredoc.
39
+ - Shell-quote every context-file path as one argument.
40
+ - Install a shell trap that removes only the exact query file when the Bash
41
+ invocation exits; question text must not persist in the temp directory.
42
+ - Capture `caller_root="$PWD"` before changing directories. Pass it through
43
+ `--context-root` so regular files from the user's project are staged under
44
+ a private temp directory without widening the runtime filesystem allowlist.
45
+
29
46
  ```bash
30
- cd "${AI_CONSULTANTS_DIR:-$HOME/.claude/skills/ai-consultants}" && INVOKING_AGENT=claude ./scripts/consult_all.sh '<question>' <file1[@TAG]> <file2[@TAG]> ...
47
+ caller_root="$PWD"; cd "${AI_CONSULTANTS_DIR:-$HOME/.claude/skills/ai-consultants}" && INVOKING_AGENT=claude ./scripts/consult_all.sh [--preset <name>] [--strategy <name>] --context-root "$caller_root" --query-file "<private-question-file>" "<file1[@TAG]>" "<file2[@TAG]>" ...
31
48
  ```
32
- - `<question>` is the question text with file paths stripped. Use single quotes to prevent shell expansion.
33
49
  - Each `<fileN>` is a file path, optionally suffixed with `@PRIMARY` or `@CONTEXT`.
34
- - **If the question text exceeds ~8KB or contains awkward quoting**, write it to a tmpfile and use `--query-file <path>` instead:
35
- ```bash
36
- cd "${AI_CONSULTANTS_DIR:-$HOME/.claude/skills/ai-consultants}" && INVOKING_AGENT=claude ./scripts/consult_all.sh --query-file /tmp/question.txt <file1[@TAG]> ...
37
- ```
38
50
  - **Capture the last line of stdout** — it contains the output directory path (e.g., `/tmp/ai_consultations/20260315_143022_12345/`).
51
+ - Keep `INVOKING_AGENT=claude` exactly as shown. Never invoke
52
+ `query_claude.sh` directly and never remove self-exclusion to increase the
53
+ panel count.
39
54
 
40
55
  4. **Read the results** from the output directory captured in step 3:
41
56
  - Read `<output_dir>/report.md` using the **Read** tool
42
57
  - Read `<output_dir>/synthesis.json` using the **Read** tool (may not exist if synthesis was skipped or failed)
43
58
  - If neither exists, use the **Glob** tool with pattern `<output_dir>/*.json` to discover individual consultant response files, then read each one
59
+ - `claude.json` must not exist and `.synthesis_provider` must not be
60
+ `claude`. If either appears, report a self-exclusion failure instead of
61
+ presenting the run as valid.
44
62
 
45
63
  5. **Present the results** using this template. The panel's value is *coverage* — the
46
64
  union of distinct points across diverse models, including what only one raised — not a
@@ -87,5 +105,7 @@ Query multiple AI models for expert opinions on a coding question.
87
105
 
88
106
  For follow-up questions on the same consultation:
89
107
  ```bash
90
- cd "${AI_CONSULTANTS_DIR:-$HOME/.claude/skills/ai-consultants}" && INVOKING_AGENT=claude ./scripts/followup.sh '<follow-up question>'
108
+ cd "${AI_CONSULTANTS_DIR:-$HOME/.claude/skills/ai-consultants}" && INVOKING_AGENT=claude ./scripts/followup.sh --query-file "<private-follow-up-file>"
91
109
  ```
110
+ Create and clean the follow-up file with the same private heredoc/trap contract.
111
+ Never target Claude from a Claude-hosted follow-up.
@@ -19,9 +19,13 @@ All skill details (consultants, personas, presets, strategies, features, configu
19
19
  ```
20
20
  /ai-consultants:consult "How to optimize this SQL query?"
21
21
  /ai-consultants:consult "Review this code" src/utils.ts
22
- /ai-consultants:debate "Microservices or monolith?"
22
+ /ai-consultants:consult --preset max_quality "Microservices or monolith?"
23
23
  ```
24
24
 
25
+ When Claude invokes the panel, the command sets `INVOKING_AGENT=claude` so
26
+ Claude is excluded from both consultation and synthesis while Codex and the
27
+ other enabled providers remain available.
28
+
25
29
  Configuration (presets, strategies, features, personas, API keys) can be managed via natural language — just ask.
26
30
 
27
31
  Troubleshooting: run `./scripts/doctor.sh` or `./scripts/doctor.sh --fix`.
package/.env.example CHANGED
@@ -65,13 +65,12 @@
65
65
  # ENABLED CONSULTANTS
66
66
  # =============================================================================
67
67
  # Set to "false" to disable a consultant you haven't configured.
68
- # MINIMUM 2 consultants must be enabled for comparison/voting to work.
68
+ # MINIMUM 2 consultants must be enabled for a useful coverage panel.
69
69
 
70
70
  # CLI-based consultants (default: enabled)
71
71
  ENABLE_GEMINI=true
72
72
  ENABLE_CODEX=true
73
73
  ENABLE_MISTRAL=true
74
- ENABLE_CURSOR=true
75
74
  ENABLE_KIMI=true
76
75
  ENABLE_QWEN3=true
77
76
  ENABLE_GROK=true
@@ -113,15 +112,18 @@ ENABLE_DEEPSEEK=false
113
112
  # https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions
114
113
 
115
114
  # =============================================================================
116
- # MODEL CONFIGURATION (June 2026 premium defaults)
115
+ # MODEL CONFIGURATION (August 2026 premium defaults)
117
116
  # =============================================================================
118
117
 
119
118
  # Gemini - The Architect (CLI mode via Antigravity CLI: agy)
120
- GEMINI_MODEL="Gemini 3.1 Pro (High)"
119
+ GEMINI_MODEL="Gemini 3.7 Flash (High)"
121
120
  GEMINI_TIMEOUT=180
122
121
  GEMINI_CMD=agy
123
122
  # API-mode model ID (only used when GEMINI_USE_API=true)
124
123
  GEMINI_API_MODEL=gemini-3.1-pro-preview
124
+ # Gemini 3.1 Pro and 3.6 Flash remain valid CLI pins. API mode stays on the
125
+ # separately verified 3.1 Pro ID; gemini-3.7-flash is an API-only opt-in until
126
+ # that transport completes its own authenticated smoke.
125
127
  # Reasoning effort for the agy CLI. Passed as --effort <value>. Accepts only
126
128
  # low|medium|high; anything else is rejected by the provider and surfaces as a
127
129
  # diagnosed error (provider owns the enum — same stance as QWEN3_REASONING_EFFORT).
@@ -129,6 +131,7 @@ GEMINI_API_MODEL=gemini-3.1-pro-preview
129
131
 
130
132
  # Codex - The Pragmatist
131
133
  CODEX_MODEL=gpt-5.6-sol
134
+ CODEX_API_MAX_TOKENS=4096
132
135
  CODEX_TIMEOUT=180
133
136
  CODEX_CMD=codex
134
137
  # Reasoning effort for the codex CLI (and API mode). Passed as
@@ -137,22 +140,27 @@ CODEX_CMD=codex
137
140
  # CODEX_REASONING_EFFORT=
138
141
 
139
142
  # Mistral Vibe - The Devil's Advocate
143
+ # API model ID. Vibe uses the separate CLI alias below. Mistral Medium 3.5,
144
+ # Large 3, and Small 4 API IDs are documented opt-ins until an API smoke passes.
140
145
  MISTRAL_MODEL=mistral-large-3
146
+ MISTRAL_CLI_MODEL=mistral-medium-3.5
147
+ MISTRAL_API_MAX_TOKENS=4096
148
+ # Official API opt-ins: use mistral-medium-3-5, mistral-large-2512, or
149
+ # mistral-small-2603 for MISTRAL_MODEL after an authenticated API smoke.
141
150
  MISTRAL_TIMEOUT=180
142
151
  MISTRAL_CMD=vibe
143
-
144
- # Cursor - The Integrator
145
- CURSOR_MODEL=composer-2.5
146
- CURSOR_TIMEOUT=180
147
- CURSOR_CMD=agent
152
+ MISTRAL_MAX_TURNS=4
148
153
 
149
154
  # Kimi - The Eastern Sage (K3 via Kimi Code CLI)
150
155
  KIMI_MODEL=kimi-code/k3
156
+ # max_quality selects the inventory-probed kimi-code/k3-256k target.
151
157
  KIMI_TIMEOUT=180
152
158
  KIMI_CMD=kimi
153
159
 
154
160
  # Claude - The Synthesizer
155
161
  CLAUDE_MODEL=claude-opus-5 # ai-consultants:default
162
+ # Fable 5 is catalogued and priced but remains an explicit CLAUDE_MODEL opt-in
163
+ # after its local smoke timed out.
156
164
  CLAUDE_TIMEOUT=240
157
165
  CLAUDE_CMD=claude
158
166
  CLAUDE_API_MAX_TOKENS=16384
@@ -164,6 +172,8 @@ CLAUDE_API_MAX_TOKENS=16384
164
172
  # Qwen3 - The Analyst (CLI/API switchable v2.7)
165
173
  QWEN3_MODEL=qwen3.7-max
166
174
  QWEN3_TIMEOUT=180
175
+ QWEN3_MAX_QUALITY_TIMEOUT=600
176
+ QWEN3_API_MAX_TOKENS=16384
167
177
  QWEN3_CMD=qwen
168
178
  # Reasoning effort. API mode ONLY - the qwen CLI has no effort flag, so in CLI
169
179
  # mode this is ignored (with a warning); set model.reasoningEffort in
@@ -184,25 +194,38 @@ QWEN3_CMD=qwen
184
194
  # =============================================================================
185
195
 
186
196
  # GLM - The Methodologist
187
- GLM_MODEL=glm-5.2
197
+ GLM_MODEL=glm-5.3
188
198
  GLM_TIMEOUT=180
199
+ GLM_API_MAX_TOKENS=16384
189
200
  GLM_API_URL=https://api.z.ai/api/coding/paas/v4/chat/completions
201
+ # GLM_REASONING_EFFORT= # max_quality sets max
190
202
 
191
203
  # Grok Build CLI + xAI API fallback - The Provocateur
192
204
  GROK_CMD=grok
193
- GROK_MODEL=grok-4.5
205
+ GROK_MODEL=grok-4.6
194
206
  GROK_TIMEOUT=180
207
+ GROK_MAX_TURNS=4
208
+ GROK_API_MAX_TOKENS=4096
195
209
  GROK_API_URL=https://api.x.ai/v1/chat/completions
210
+ # GROK_REASONING_EFFORT= # max_quality sets xhigh (Grok Build maximum)
196
211
 
197
212
  # DeepSeek - The Code Specialist
198
213
  DEEPSEEK_MODEL=deepseek-v4-pro
199
214
  DEEPSEEK_TIMEOUT=180
215
+ DEEPSEEK_MAX_QUALITY_TIMEOUT=600
216
+ DEEPSEEK_API_MAX_TOKENS=16384
200
217
  DEEPSEEK_API_URL=https://api.deepseek.com/v1/chat/completions
218
+ # DEEPSEEK_REASONING_EFFORT= # max_quality sets max
201
219
 
202
220
  # MiniMax - The Pragmatic Optimizer (CLI via mmx by default, v2.21; API opt-in)
203
221
  MINIMAX_CMD=mmx
204
222
  MINIMAX_MODEL=MiniMax-M2.7
223
+ # max_quality selects the smoke-tested MiniMax-M3 target.
205
224
  MINIMAX_TIMEOUT=180
225
+ MINIMAX_API_MAX_TOKENS=4096
226
+ MINIMAX_MAX_TOKENS=4096
227
+ MINIMAX_MAX_QUALITY_TOKENS=16384
228
+ MAX_QUALITY_API_MAX_TOKENS=16384
206
229
  MINIMAX_API_URL=https://api.minimax.io/v1/chat/completions
207
230
 
208
231
  # Wire format for a consultant's API mode. Honored since v2.25 (previously
@@ -238,6 +261,9 @@ SYNTHESIS_CMD=claude
238
261
  SYNTHESIS_MODEL=
239
262
  SYNTHESIS_EXTRACT_FIELDS=true
240
263
  SYNTH_MAX=10
264
+ SYNTH_DETAIL_MAX_CHARS=4000
265
+ SYNTHESIS_TIMEOUT=240
266
+ SYNTHESIS_TOTAL_TIMEOUT=480
241
267
 
242
268
  # Health gate and quorum: validate the live panel before spending on a full run
243
269
  ENABLE_HEALTH_GATE=false # Adds one small ping per selected consultant
@@ -377,7 +403,6 @@ REPORT_MAX_JSON_LINES=50
377
403
  # GEMINI_PERSONA_ID=1
378
404
  # CODEX_PERSONA_ID=2
379
405
  # MISTRAL_PERSONA_ID=3
380
- # CURSOR_PERSONA_ID=5
381
406
  # KIMI_PERSONA_ID=20
382
407
  # CLAUDE_PERSONA_ID=18
383
408
  # QWEN3_PERSONA_ID=6
@@ -391,8 +416,6 @@ REPORT_MAX_JSON_LINES=50
391
416
  # CODEX_PERSONA_NAME=Custom persona name
392
417
  # MISTRAL_PERSONA=Custom persona instructions
393
418
  # MISTRAL_PERSONA_NAME=Custom persona name
394
- # CURSOR_PERSONA=Custom persona instructions
395
- # CURSOR_PERSONA_NAME=Custom persona name
396
419
  # KIMI_PERSONA=Custom persona instructions
397
420
  # KIMI_PERSONA_NAME=Custom persona name
398
421
  # CLAUDE_PERSONA=Custom persona instructions
package/CLAUDE.md CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  ## Project Overview
4
4
 
5
- AI Consultants is a multi-model coverage system that queries up to 11 AI consultants (Gemini, Codex, Mistral, Cursor, Kimi, Claude, Qwen3, GLM, Grok, DeepSeek, MiniMax) to obtain diverse perspectives on coding problems.
5
+ AI Consultants is a multi-model coverage system that queries up to 10 AI consultants (Gemini, Codex, Mistral, Kimi, Claude, Qwen3, GLM, Grok, DeepSeek, MiniMax) to obtain diverse perspectives on coding problems.
6
6
 
7
- **Self-Exclusion**: The invoking agent is automatically excluded from the panel to prevent self-consultation. Claude Code won't query Claude, Codex CLI won't query Codex, etc.
7
+ **Self-Exclusion**: The invoking agent is automatically excluded from both the panel and synthesis. Claude Code won't query or synthesize with Claude, Codex CLI won't query or synthesize with Codex, etc.
8
8
 
9
- **Version**: 3.4.0
9
+ **Version**: 4.0.0
10
10
 
11
11
  ## Distribution
12
12
 
@@ -176,25 +176,33 @@ Functions in `lib/common.sh`:
176
176
  - `get_self_consultant_name()` - Maps invoking agent to consultant name
177
177
  - `should_skip_consultant()` - Returns true if consultant should be excluded
178
178
  - `log_self_exclusion_status()` - Debug logging for exclusion
179
+ - `resolve_synthesis_cli()` - Refuses the invoking agent as synthesis provider
180
+
181
+ Agent hosts must set `INVOKING_AGENT` explicitly and run `consult_all.sh`
182
+ instead of individual adapters. A Claude-hosted run must produce no
183
+ `claude.json`, and its `synthesis_provider` must not be `claude`; the equivalent
184
+ invariant applies to Codex and Gemini. See `SKILL.md` for the full execution
185
+ contract.
179
186
 
180
187
  ### Configuration Presets
181
188
  ```bash
182
189
  # Quality Tier Presets (v2.5)
183
- ./scripts/consult_all.sh --preset max_quality "question" # 8 of 11 consultants + premium models + peer review
184
- ./scripts/consult_all.sh --preset medium "question" # 4 consultants + standard models
190
+ ./scripts/consult_all.sh --preset max_quality "question" # all 10 consultants + maximum tier/max effort
191
+ ./scripts/consult_all.sh --preset medium "question" # 3 consultants + standard models
185
192
  ./scripts/consult_all.sh --preset fast "question" # 2 consultants + economy models
186
193
 
187
194
  # Use Case Presets
188
195
  ./scripts/consult_all.sh --preset minimal "question" # Gemini + Codex
189
- ./scripts/consult_all.sh --preset balanced "question" # + Mistral + Cursor
190
- ./scripts/consult_all.sh --preset high-stakes "question" # All + debate
196
+ ./scripts/consult_all.sh --preset balanced "question" # + Mistral
197
+ ./scripts/consult_all.sh --preset high-stakes "question" # Broad premium panel
191
198
  ```
192
199
 
193
200
  Presets are defined in `config.sh` via `apply_preset()` function.
194
201
 
195
202
  ### Synthesis Strategies
196
203
  ```bash
197
- ./scripts/consult_all.sh --strategy majority "question" # Default
204
+ ./scripts/consult_all.sh --strategy coverage "question" # Default: union of distinct points
205
+ ./scripts/consult_all.sh --strategy majority "question" # Blended recommendation
198
206
  ./scripts/consult_all.sh --strategy risk_averse "question" # Conservative
199
207
  ./scripts/consult_all.sh --strategy security_first "question" # Security focus
200
208
  ./scripts/consult_all.sh --strategy compare_only "question" # No recommendation
@@ -210,34 +218,6 @@ Strategies are implemented in `synthesize.sh` via `get_strategy_instructions()`.
210
218
  ./scripts/doctor.sh --verbose # Detailed output
211
219
  ```
212
220
 
213
- ### Panic Button Mode
214
- Automatically adds rigor when uncertainty detected:
215
- - Average confidence below `PANIC_CONFIDENCE_THRESHOLD` (default: 5)
216
- - Uncertainty keywords detected in responses
217
-
218
- Configuration in `config.sh`:
219
- - `ENABLE_PANIC_MODE` - "auto", "always", or "never"
220
- - `PANIC_CONFIDENCE_THRESHOLD` - Trigger threshold
221
- - `PANIC_EXTRA_DEBATE_ROUNDS` - Additional debate rounds
222
-
223
- ### Confidence Intervals
224
- Functions in `lib/voting.sh`:
225
- - `calculate_confidence_stddev()` - Returns stddev scaled by 10
226
- - `calculate_confidence_interval()` - Returns JSON with mean, stddev, interval
227
- - `has_high_confidence_variance()` - Returns 0 if variance > 2.0
228
- - `format_confidence_range()` - Returns "7 ± 1.5" format
229
-
230
- ### Anonymous Peer Review
231
- ```bash
232
- ./scripts/peer_review.sh <responses_dir> <output_dir>
233
- ```
234
-
235
- Process:
236
- 1. Anonymize all responses (remove consultant names)
237
- 2. Each consultant ranks and critiques responses
238
- 3. Aggregate peer scores to identify strongest arguments
239
- 4. De-anonymize in final report
240
-
241
221
  ## v2.9 Features
242
222
 
243
223
  ### Kimi CLI Support
@@ -288,7 +268,7 @@ npm install -g @qwen-code/qwen-code@latest
288
268
  ## v2.6 Features
289
269
 
290
270
  ### CLI/API Mode Switching
291
- Six consultants can now switch between CLI and API mode: **Gemini, Codex, Claude, Mistral, Qwen3, MiniMax**.
271
+ Seven consultants can switch between CLI and API mode: **Gemini, Codex, Claude, Mistral, Qwen3, Grok, MiniMax**.
292
272
 
293
273
  When API mode is enabled for an agent, CLI mode is disabled (mutual exclusivity).
294
274
 
@@ -325,6 +305,7 @@ New environment variables in `config.sh`:
325
305
  | `CLAUDE_USE_API` | false | Use Anthropic API instead of claude CLI |
326
306
  | `MISTRAL_USE_API` | false | Use Mistral API instead of vibe CLI |
327
307
  | `QWEN3_USE_API` | false | Use DashScope API instead of qwen CLI (v2.7) |
308
+ | `GROK_USE_API` | auto | Use xAI API when Grok Build is unavailable |
328
309
  | `MINIMAX_USE_API` | false | Use MiniMax API instead of the mmx CLI (v2.21) |
329
310
  | `GEMINI_API_URL` | https://generativelanguage.googleapis.com/v1beta/models | Google AI endpoint |
330
311
  | `CODEX_API_URL` | https://api.openai.com/v1/chat/completions | OpenAI endpoint |
@@ -364,13 +345,14 @@ The `doctor.sh` script now shows CLI/API mode status:
364
345
  ## v2.5 Features
365
346
 
366
347
  ### Model Quality Tiers
367
- Three tiers of models are available for each consultant, configurable via `apply_model_tier()`:
348
+ Three normal tiers plus a `maximum` tier are configurable via `apply_model_tier()`:
368
349
 
369
350
  | Tier | Description | Example Models |
370
351
  |------|-------------|----------------|
371
- | **premium** | Latest flagship models | claude-opus-5, Gemini 3.1 Pro (High), gpt-5.6-sol |
372
- | **standard** | Good quality at reasonable cost | claude-sonnet-5, Gemini 3.6 Flash (High), gpt-5.6-terra |
373
- | **economy** | Optimized for speed and low cost | claude-haiku-4-5, Gemini 3.6 Flash (Low), gpt-5.6-luna |
352
+ | **premium** | Latest flagship models | claude-opus-5, Gemini 3.7 Flash (High), gpt-5.6-sol |
353
+ | **maximum** | All 10 consultants; maximum targets and highest provider effort | K3-256k, Qwen3.8-Max, MiniMax M3; Grok xhigh, GLM/DeepSeek max |
354
+ | **standard** | Good quality at reasonable cost | claude-sonnet-5, Gemini 3.7 Flash (High), gpt-5.6-terra |
355
+ | **economy** | Optimized for speed and low cost | claude-haiku-4-5, Gemini 3.7 Flash (Low), gpt-5.6-luna |
374
356
 
375
357
  **Default models are now premium tier** for maximum quality.
376
358
 
@@ -378,11 +360,12 @@ Three tiers of models are available for each consultant, configurable via `apply
378
360
  # Programmatic usage
379
361
  source scripts/config.sh
380
362
  apply_model_tier "premium" # Set all consultants to premium models
363
+ apply_model_tier "maximum" # max_quality-only / separate-plan models
381
364
  apply_model_tier "standard" # Set all consultants to standard models
382
365
  apply_model_tier "economy" # Set all consultants to economy models
383
366
 
384
367
  # Get model for a specific consultant and tier (v2.8.1)
385
- get_model_for_tier "gemini" "premium" # → Gemini 3.1 Pro (High)
368
+ get_model_for_tier "gemini" "premium" # → Gemini 3.7 Flash (High) on agy
386
369
  get_model_for_tier "claude" "economy" # → claude-haiku-4-5
387
370
  ```
388
371
 
@@ -390,29 +373,28 @@ get_model_for_tier "claude" "economy" # → claude-haiku-4-5
390
373
  Three new presets leverage the model tiers:
391
374
 
392
375
  ```bash
393
- # Maximum quality - all premium models + debate + peer review
376
+ # Maximum quality - all consultants + maximum models and provider effort
394
377
  ./scripts/consult_all.sh --preset max_quality "critical architecture decision"
395
378
 
396
- # Balanced quality - standard models, 4 consultants, light debate
379
+ # Balanced quality - standard models, 3 consultants
397
380
  ./scripts/consult_all.sh --preset medium "general coding question"
398
381
 
399
- # Super fast - economy models, 2 consultants, no debate
382
+ # Super fast - economy models, 2 consultants
400
383
  ./scripts/consult_all.sh --preset fast "quick syntax question"
401
384
  ```
402
385
 
403
- ### Premium Model Defaults (July 2026)
386
+ ### Premium Model Defaults (August 2026)
404
387
  All consultants now use premium models by default:
405
388
 
406
389
  | Consultant | Default Model |
407
390
  |------------|---------------|
408
391
  | Claude | claude-opus-5 |
409
- | Gemini | Gemini 3.1 Pro (High) (via agy CLI) |
392
+ | Gemini | Gemini 3.7 Flash (High) (via agy CLI); API: gemini-3.1-pro-preview |
410
393
  | Codex | gpt-5.6-sol |
411
- | Mistral | mistral-large-3 |
412
- | Cursor | composer-2.5 |
394
+ | Mistral | CLI: mistral-medium-3.5; API: mistral-large-3 |
413
395
  | DeepSeek | deepseek-v4-pro |
414
- | GLM | glm-5.2 |
415
- | Grok | grok-4.5 |
396
+ | GLM | glm-5.3 |
397
+ | Grok | grok-4.6 |
416
398
  | Qwen3 | qwen3.7-max |
417
399
  | Kimi | kimi-code/k3 |
418
400
  | MiniMax | MiniMax-M2.7 |
@@ -420,7 +402,7 @@ All consultants now use premium models by default:
420
402
  Override with environment variables: `CLAUDE_MODEL`, `GEMINI_MODEL`, `CODEX_MODEL`, `KIMI_MODEL`, etc.
421
403
 
422
404
  Grok is CLI-first through the official Grok Build `grok` command, with
423
- `grok-4.5` passed explicitly in headless mode. The prompt is delivered with
405
+ `grok-4.6` passed explicitly in headless mode. The prompt is delivered with
424
406
  `--prompt-file`; HOME and CWD are isolated, built-in/MCP tools are denied, and
425
407
  the strict sandbox prevents user or project extensions from joining the
426
408
  consultation. The xAI Chat Completions path is retained only when the CLI is
@@ -428,6 +410,20 @@ missing, cannot launch, or lacks usable authentication and `GROK_API_KEY` is
428
410
  available. A timeout, model error, empty response, or other post-launch failure
429
411
  is surfaced and never silently rerouted to the API.
430
412
 
413
+ The live full-panel smoke defines the `max_quality` runtime envelope, not just
414
+ the model names. Mistral and Grok receive four bounded advisory turns plus an
415
+ explicit no-tools/workspace instruction. Qwen3.8-Max gets a 600-second Token
416
+ Plan timeout; DeepSeek V4 Pro/max gets 600 seconds and 16,384 completion tokens;
417
+ GLM gets 16,384; MiniMax M3 gets 16,384 plus a compact Markdown contract in
418
+ mmx's native system channel. OpenAI-compatible
419
+ `finish_reason=length` is an error. Every
420
+ response records `metadata.response_quality=structured|fallback|error`:
421
+ malformed JSON-looking output fails closed, while real markdown/prose is kept
422
+ as an explicit fallback. Synthesis filters error envelopes and includes bounded
423
+ detail from structured and fallback responses. Claude CLI consultations are
424
+ preflighted, stateless (`--no-session-persistence`), setting-source-free,
425
+ tool-free, and MCP-free; a hung/help/auth probe fails before a paid dispatch.
426
+
431
427
  ## v2.4 Features
432
428
 
433
429
  ### Budget Enforcement (Opt-in)
@@ -447,8 +443,7 @@ BUDGET_ACTION=warn # or "stop"
447
443
  **Enforcement Points:**
448
444
  1. Before Round 1 - Check estimated cost vs budget
449
445
  2. After Round 1 - Check actual cost vs warning threshold
450
- 3. Before Debate - Check cumulative + debate estimate
451
- 4. Before Synthesis - Check cumulative + synthesis estimate
446
+ 3. Before Synthesis - Check cumulative + synthesis estimate
452
447
 
453
448
  Functions in `lib/costs.sh`:
454
449
  - `is_budget_enabled()` - Check if budget enforcement is enabled
@@ -521,22 +516,6 @@ Functions in `lib/routing.sh`:
521
516
  - `get_premium_model()` - Returns premium model for consultant
522
517
  - `get_escalation_summary()` - Returns escalation info as JSON
523
518
 
524
- ### Debate Optimization (Opt-in)
525
- Skips debate if confidence spread is low (all consultants agree).
526
-
527
- ```bash
528
- ENABLE_DEBATE_OPTIMIZATION=false # Default: false (opt-in per quality review)
529
- DEBATE_CONFIDENCE_SPREAD_THRESHOLD=3 # Min spread to trigger debate
530
- DEBATE_USE_SUMMARIES=true # Use summaries in debate rounds
531
- ```
532
-
533
- **Category Exceptions**: SECURITY and ARCHITECTURE always trigger debate regardless of confidence spread.
534
-
535
- Functions in `debate_round.sh`:
536
- - `is_mandatory_debate_category()` - Returns true for SECURITY/ARCHITECTURE
537
- - `should_skip_debate()` - Returns true if debate can be skipped
538
- - `extract_compact_summary()` - Token-optimized summary for debates
539
-
540
519
  ### Quality Monitoring
541
520
  Logs optimization metrics and saves to output directory.
542
521
 
@@ -553,12 +532,9 @@ Output file `optimization_metrics.json`:
553
532
  "cache_hits": 2,
554
533
  "response_limits_enabled": false,
555
534
  "cost_aware_routing": false,
556
- "debate_optimization": false,
557
535
  "compact_report": true
558
536
  },
559
537
  "quality_metrics": {
560
- "consensus_score": 75,
561
- "consensus_level": "medium",
562
538
  "successful_responses": 4,
563
539
  "total_consultants": 4,
564
540
  "category": "ARCHITECTURE"
@@ -593,9 +569,6 @@ npm run lint
593
569
  # Test with preset
594
570
  ./scripts/consult_all.sh --preset minimal "Quick question"
595
571
 
596
- # Test with debate
597
- ENABLE_DEBATE=true ./scripts/consult_all.sh "Microservices or monolith?"
598
-
599
572
  # Test with strategy
600
573
  ./scripts/consult_all.sh --strategy risk_averse "Security question"
601
574
 
@@ -615,10 +588,11 @@ for f in scripts/*.sh scripts/lib/*.sh; do bash -n "$f" && echo "OK: $f"; done
615
588
  | `MAX_SESSION_COST` | 1.00 | Max budget ($) |
616
589
  | `CLAUDE_MODEL` | claude-opus-5 | Claude model (v2.5) |
617
590
  | `CLAUDE_API_MAX_TOKENS` | 16384 | Claude API thinking + visible-output budget |
618
- | `GEMINI_MODEL` | Gemini 3.1 Pro (High) | Gemini agy CLI model (v2.15) |
591
+ | `GEMINI_MODEL` | Gemini 3.7 Flash (High) | Gemini agy CLI model |
619
592
  | `GEMINI_API_MODEL` | gemini-3.1-pro-preview | Gemini API-mode model ID (v2.15) |
620
593
  | `CODEX_MODEL` | gpt-5.6-sol | Codex model (v2.5) |
621
594
  | `MISTRAL_MODEL` | mistral-large-3 | Mistral model (v2.5) |
595
+ | `MISTRAL_CLI_MODEL` | mistral-medium-3.5 | Vibe CLI model alias |
622
596
  | `SYNTHESIS_STRATEGY` | coverage | Synthesis strategy (coverage=union of distinct points) |
623
597
  | `ENABLE_SEMANTIC_CACHE` | true | Semantic response caching (v2.3) |
624
598
  | `CACHE_TTL_HOURS` | 24 | Cache expiration in hours (v2.3) |
@@ -643,7 +617,6 @@ for f in scripts/*.sh scripts/lib/*.sh; do bash -n "$f" && echo "OK: $f"; done
643
617
  - `agy` CLI - Antigravity CLI (Gemini consultant; successor to the deprecated Gemini CLI, v2.15)
644
618
  - `codex` CLI - OpenAI Codex
645
619
  - `vibe` CLI - Mistral Vibe
646
- - `agent` CLI - Cursor
647
620
  - `kimi` CLI - Kimi Code (v2.9)
648
621
  - `claude` CLI - Claude (v2.2, also used for synthesis)
649
622
  - `qwen` CLI - Qwen via qwen-code (v2.7, optional)
@@ -779,7 +752,7 @@ curl -fsSL https://raw.githubusercontent.com/matteoscurati/ai-consultants/main/s
779
752
  ### Guidelines
780
753
 
781
754
  - **Audience**: Developers who use the skill. Write for someone who hasn't seen the commits.
782
- - **Highlights first**: Lead with impact, not implementation. "Debate rounds no longer crash on Linux" > "Added `|| true` to `((count++))` in debate_round.sh".
755
+ - **Highlights first**: Lead with impact, not implementation. "Provider failures are now diagnosed" > "Added an error branch".
783
756
  - **Breaking changes prominent**: If any exist, they go in a dedicated section — never buried in a bullet list.
784
757
  - **Quantify when possible**: Token savings percentages, issue counts, file counts.
785
758
  - **Upgrade guide always present**: Even if the answer is "just pull", make it explicit.
@@ -787,6 +760,29 @@ curl -fsSL https://raw.githubusercontent.com/matteoscurati/ai-consultants/main/s
787
760
 
788
761
  ## Changelog
789
762
 
763
+ ### v4.0.0
764
+
765
+ - **`max_quality` now means the full ten-consultant panel at each exact transport's strongest supported effort and response budget.** GLM and DeepSeek run at `max`; Grok uses its highest supported setting. K3-256k, MiniMax M3, and Qwen3.8-Max remain confined to the maximum tier, with Qwen promoted only when the authenticated Token Plan transport is already configured.
766
+ - **Gemini 3.7 Flash High completed an authenticated exact-adapter `agy` smoke and is promoted only on that CLI transport.** It serves maximum, premium, and standard; Low serves economy. The unverified Google API transport remains on 3.1 Pro, while Fable 5 and the new Mistral API IDs remain opt-in.
767
+ - **Cursor is no longer a consultant.** The ambiguous `agent`/`cursor-agent` runtime, model tiers, presets, doctor/configuration fields, personas, costs, tests, and website card were removed. Cursor remains a supported host through SkillPort; the panel itself has 10 consultants.
768
+ - **Managed migrations are exact and pins survive.** `configure` upgrades only the historical managed Gemini 3.1 Pro CLI, GLM 5.2, and Grok 4.5 values, while removing obsolete Cursor settings. Environment/`--set` model values and any `# ai-consultants:pin` entry remain user-owned. The catalog-parity gate checks all 40 consultant/tier cells and all 16 Gemini/Mistral transport cells against `docs/cost_rates.json`, requiring every automatic target to be priced or explicitly unpriced.
769
+ - **Claude can launch the skill as a real host, not merely describe it.** `SKILL.md` carries an imperative execution contract; all host commands use a private query-file handoff, preserve preset/strategy options, pass the caller project through `--context-root`, and set `INVOKING_AGENT`; self-exclusion covers consultation, full-roster targeted follow-ups, and synthesis for Claude/Codex/Gemini. Offline E2E proves a Claude host dispatches Gemini/Codex/Mistral with no Claude artifacts. A real Claude Code/Sonnet run started from an external temp project, used `mktemp`, mode 600, a quoted heredoc, trap cleanup, `--context-root`, and `src/context.txt@CONTEXT`; Gemini 3.7 High and Codex 5.6 Sol returned (2/2), the external marker/tag reached both, no Claude artifact appeared, and the private staging directory was removed. The live run disabled synthesis; symmetric regressions prove each host is excluded there. Current runtime prompts, schemas, templates, help, and instructions are coverage-only; stale Codex/Gemini debate and roster-audit commands are removed.
770
+ - **Cross-family host review went `NO_SHIP` → `NO_SHIP` → `SHIP`.** The review found the Bash 3.2 empty-array abort, query-file/context parser conflict, caller-project path loss, unsafe/host-self follow-ups, stale live consensus output, broad uninstall glob, and active v3.0 residue. Each was fixed with executable coverage. After the `SHIP` verdict, its remaining low-severity findings were also resolved: staged files retain their original project-relative identity, fallback synthesis reports the requested strategy, follow-up context no longer rides in argv and respects disabled consultants, and remaining contributor/cost/test residue was removed.
771
+
772
+ Deliberate residuals: Vibe isolates the workspace but retains ambient HOME for its authenticated CLI state; unpriced credit/subscription models are disclosed but cannot be enforced by a dollar budget; provider/requested model substitutions are available in raw JSON but not yet summarized in the human report.
773
+
774
+ ### v3.5.0
775
+
776
+ - **The catalog now distinguishes an advisory panel's normal premium tier from subscription-only maximum targets.** `get_model_for_tier()` accepts an explicit transport, while `apply_model_tier maximum` selects K3-256k and MiniMax M3 and promotes Qwen3.8-Max only when `QWEN3_USE_API=true`, the wire is OpenAI-compatible, the endpoint is a Token Plan `/chat/completions` URL, and a key is present (`scripts/config.sh:581-737`). The Qwen effort is marked tier-managed, cleared when leaving maximum, and never overwrites a user pin. Gemini 3.7, Fable 5, and the new Mistral API IDs remain catalogued opt-ins after their exact transports failed authentication or timed out; normal runs do not inherit delegation-kit's routing gates.
777
+ - **Mistral CLI and API names are no longer conflated.** `MISTRAL_CLI_MODEL=mistral-medium-3.5` reaches Vibe through `VIBE_ACTIVE_MODEL`; `MISTRAL_MODEL` remains API-only. Vibe verifies its bounded read-only interface, runs `plan` for one turn in a mode-700 temporary workspace, and treats empty or post-launch failures as failures (`scripts/query_mistral.sh:47-143`). The current machine passed the exact Vibe smoke; no Mistral API key was available, so the new API IDs were not promoted.
778
+ - **Cursor now means Cursor.** The old `CURSOR_CMD=agent` resolved to Grok on this machine. Runtime, configure, and doctor now default to `cursor-agent`, validate the Cursor help surface, bound model-inventory calls, require Composer 2.5, and invoke `--mode ask --trust` only against an ephemeral workspace (`scripts/query_cursor.sh:33-132`, `scripts/configure.sh:322-363`). The local Cursor account is not logged in, so runtime authentication remains a user gate rather than something this release works around.
779
+ - **Model identity evidence is additive and honest.** Every envelope carries the requested ID and one of `provider-reported`, `capability-probed`, or `requested-only`; API model strings are syntax-validated before adoption (`scripts/lib/common.sh:935-1068`, `scripts/lib/api_query.sh:162-194`). `modelUsage` remains billing participation, not content identity. The shared billing resolver prefers a known effective ID, then the explicit requested ID, and uses consultant fallback only for legacy responses that lack the new metadata (`scripts/lib/costs.sh:311-430`).
780
+ - **The reliability boundary is finite.** Cursor/Gemini/Mistral capability probes and Cursor configure/doctor probes have explicit time limits. An HTTP 200 with an empty body increments the retry counter, including at the shipped `MAX_RETRIES=2`, instead of spinning indefinitely (`scripts/lib/api.sh`, `scripts/test_api_transport.sh`). Google `thinkingConfig` is emitted only for Gemini 3.7; the proven 3.1 API body remains byte-compatible.
781
+ - **Managed migrations are exact and pins survive.** `configure` upgrades only the historical managed Cursor command, GLM 5.2, and Grok 4.5 values. Environment/`--set` model values and any `# ai-consultants:pin` entry remain user-owned. The new catalog-parity gate checks all 44 consultant/tier cells and all 16 Gemini/Mistral transport cells against `docs/cost_rates.json`, requiring every automatic target to be priced or explicitly unpriced.
782
+ - **Promotion evidence is recorded without overstating it.** Exact ai-consultants smokes passed for Mistral Vibe Medium 3.5, GLM 5.3, Grok 4.6, K3-256k, Qwen3.8-Max Token Plan, and MiniMax M3. Gemini 3.7 lacked agy/API auth, Mistral API lacked a key, Fable 5 timed out, and Cursor lacked login; those stay opt-in/unverified. Cross-family Opus 5/max review first returned `NO-SHIP` with four blockers, then `SHIP` after the hermeticity, trust, probe, thinking, billing, retry, and parity findings were fixed. Final gate: 22/22 suites, 443/443 core checks, ShellCheck and npm tarball green.
783
+
784
+ Deliberate residuals: Cursor and Vibe isolate the workspace but retain ambient HOME for their authenticated CLI state; unpriced credit/subscription models are disclosed but cannot be enforced by a dollar budget; provider/requested model substitutions are available in raw JSON but not yet summarized in the human report.
785
+
790
786
  ### v3.4.0
791
787
  - **Gemini was unreachable from an SSH session, and no amount of re-authenticating helped.** `agy` picks its credential store from the environment: seeing `SSH_CLIENT`, `SSH_CONNECTION`, or `SSH_TTY` it switches to a file-based token store and never consults the macOS Keychain. A user who signed in locally therefore lost Gemini entirely over SSH, and signing in again landed the new credential in the Keychain the CLI had already decided to ignore. Reproduced live before fixing (`agy models` → "Please sign in"; the same command under `env -u SSH_CLIENT -u SSH_CONNECTION -u SSH_TTY` → full inventory), and confirmed again end to end after. Found by reading delegation-kit's 0.13.1 fix and checking whether the same failure applied here — it did, in the very session doing the work.
792
788
  - **The fix ships in two shapes on purpose** (`lib/common.sh:163-164`). `AGY_ENV_PREFIX` is an array of `env -u …` for anything that reaches `agy` through `run_with_timeout`, because GNU `timeout` execs a binary and **cannot invoke a shell function**; `agy_env` is the same-shell wrapper, defined *from* that array so the two cannot drift. Applied at every executing call site — `query_gemini.sh`, `doctor.sh`, `update_clis.sh`, and `build_synthesis_args` (which is executed directly by `synthesize.sh:304`, not through timeout, so either shape would work there — it uses the array for consistency). The remaining `${GEMINI_CMD:-agy}` hits are `command -v` probes and config-dump strings, which execute nothing.