ai-consultants 4.0.3 → 4.0.4

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 (69) hide show
  1. package/.env.example +7 -10
  2. package/CLAUDE.md +8 -1
  3. package/README.md +11 -116
  4. package/SKILL.md +7 -3
  5. package/docs/COST_RATES.md +1 -1
  6. package/docs/JSON_SCHEMA.md +1 -1
  7. package/docs/SETUP.md +10 -25
  8. package/docs/SMART_ROUTING.md +8 -50
  9. package/docs/cost_rates.json +1 -1
  10. package/package.json +2 -1
  11. package/scripts/config.sh +5 -18
  12. package/scripts/consult_all.sh +3 -3
  13. package/scripts/doctor.sh +4 -4
  14. package/scripts/install.sh +2 -2
  15. package/scripts/lib/api.sh +0 -55
  16. package/scripts/lib/cache.sh +0 -24
  17. package/scripts/lib/code_optimizer.sh +0 -53
  18. package/scripts/lib/common.sh +1 -57
  19. package/scripts/lib/costs.sh +0 -17
  20. package/scripts/lib/personas.sh +0 -18
  21. package/scripts/lib/reliability.sh +0 -23
  22. package/scripts/lib/routing.sh +18 -119
  23. package/scripts/lib/session.sh +0 -81
  24. package/docs/releases/v2.10.1.md +0 -84
  25. package/docs/releases/v2.10.2.md +0 -40
  26. package/docs/releases/v2.10.3.md +0 -63
  27. package/docs/releases/v2.10.4.md +0 -63
  28. package/docs/releases/v2.10.5.md +0 -57
  29. package/docs/releases/v2.10.6.md +0 -59
  30. package/docs/releases/v2.10.7.md +0 -53
  31. package/docs/releases/v2.10.8.md +0 -58
  32. package/docs/releases/v2.10.9.md +0 -123
  33. package/docs/releases/v2.11.0.md +0 -163
  34. package/docs/releases/v2.12.0.md +0 -182
  35. package/docs/releases/v2.13.0.md +0 -179
  36. package/docs/releases/v2.13.1.md +0 -133
  37. package/docs/releases/v2.14.0.md +0 -124
  38. package/docs/releases/v2.14.1.md +0 -70
  39. package/docs/releases/v2.14.2.md +0 -77
  40. package/docs/releases/v2.15.0.md +0 -72
  41. package/docs/releases/v2.15.1.md +0 -80
  42. package/docs/releases/v2.16.0.md +0 -71
  43. package/docs/releases/v2.17.0.md +0 -62
  44. package/docs/releases/v2.17.1.md +0 -46
  45. package/docs/releases/v2.17.2.md +0 -51
  46. package/docs/releases/v2.18.0.md +0 -63
  47. package/docs/releases/v2.19.0.md +0 -66
  48. package/docs/releases/v2.19.1.md +0 -44
  49. package/docs/releases/v2.19.2.md +0 -54
  50. package/docs/releases/v2.20.0.md +0 -65
  51. package/docs/releases/v2.21.0.md +0 -65
  52. package/docs/releases/v2.21.1.md +0 -84
  53. package/docs/releases/v2.22.0.md +0 -82
  54. package/docs/releases/v2.23.0.md +0 -75
  55. package/docs/releases/v2.24.0.md +0 -88
  56. package/docs/releases/v2.25.0.md +0 -101
  57. package/docs/releases/v2.25.1.md +0 -77
  58. package/docs/releases/v2.25.2.md +0 -53
  59. package/docs/releases/v3.0.0.md +0 -71
  60. package/docs/releases/v3.1.0.md +0 -95
  61. package/docs/releases/v3.1.1.md +0 -54
  62. package/docs/releases/v3.2.0.md +0 -96
  63. package/docs/releases/v3.3.0.md +0 -80
  64. package/docs/releases/v3.4.0.md +0 -102
  65. package/docs/releases/v3.5.0.md +0 -129
  66. package/docs/releases/v4.0.0.md +0 -107
  67. package/docs/releases/v4.0.1.md +0 -57
  68. package/docs/releases/v4.0.2.md +0 -98
  69. package/docs/releases/v4.0.3.md +0 -62
package/.env.example CHANGED
@@ -335,15 +335,12 @@ ENABLE_RELIABILITY_TRACKING=true
335
335
  # SESSION MANAGEMENT
336
336
  # =============================================================================
337
337
 
338
- SESSION_CLEANUP_DAYS=7 # Auto-cleanup sessions older than N days
338
+ SESSION_CLEANUP_DAYS=7 # Deprecated no-op; retained for v4.x compatibility
339
339
  # SESSION_DIR=/custom/state/sessions
340
340
 
341
- # =============================================================================
342
- # INTERACTIVE MODE
343
- # =============================================================================
344
-
345
- ENABLE_PROGRESS_BARS=true # Show progress bars during consultation
346
- ENABLE_EARLY_TERMINATION=true # Allow Ctrl+C to stop with partial results
341
+ # Deprecated no-ops; retained for v4.x compatibility
342
+ ENABLE_PROGRESS_BARS=true
343
+ ENABLE_EARLY_TERMINATION=true
347
344
 
348
345
  # =============================================================================
349
346
  # PRE-FLIGHT CHECKS
@@ -383,10 +380,10 @@ INCLUDE_CRITICAL_COMMENTS=true
383
380
  MAX_BODY_SUMMARY_LINES=3
384
381
  MIN_IDENTIFIER_LENGTH=8
385
382
  PRESERVE_EXPORTS=true
386
- USE_COMPACT_PROMPTS=true
383
+ USE_COMPACT_PROMPTS=true # Deprecated no-op; retained for v4.x compatibility
387
384
  FORCE_PROJECT_TREE=false
388
- ENABLE_SELECTIVE_CONTEXT=false
389
- MAX_FILES_PER_CONSULTANT=5
385
+ ENABLE_SELECTIVE_CONTEXT=false # Deprecated no-op; retained for v4.x compatibility
386
+ MAX_FILES_PER_CONSULTANT=5 # Deprecated no-op; retained for v4.x compatibility
390
387
 
391
388
  # =============================================================================
392
389
  # REPORTING & STORAGE
package/CLAUDE.md CHANGED
@@ -6,7 +6,7 @@ AI Consultants is a multi-model coverage system that queries up to 10 AI consult
6
6
 
7
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**: 4.0.3
9
+ **Version**: 4.0.4
10
10
 
11
11
  ## Distribution
12
12
 
@@ -760,6 +760,13 @@ curl -fsSL https://raw.githubusercontent.com/matteoscurati/ai-consultants/main/s
760
760
 
761
761
  ## Changelog
762
762
 
763
+ ### v4.0.4
764
+
765
+ - **Housekeeping now removes dead implementation without removing public compatibility.** The cleanup deletes uncalled API, cache, optimizer, common, cost, persona, reliability, routing-summary, and session-display helpers, plus the stale README changelog and redundant npm ignore file. The documented `get_routing_mode`, `get_recommended_count`, and `get_category_timeout` helpers stay available and are regression-tested. Six historic config keys that had no runtime reader remain accepted as explicitly deprecated no-ops through v4.x: `SESSION_CLEANUP_DAYS`, `ENABLE_PROGRESS_BARS`, `ENABLE_EARLY_TERMINATION`, `USE_COMPACT_PROMPTS`, `ENABLE_SELECTIVE_CONTEXT`, and `MAX_FILES_PER_CONSULTANT`.
766
+ - **All Bash test suites now share one assertion framework.** `scripts/lib/test_helpers.sh` owns counters, pass/fail/skip rendering, regex/string/numeric/JSON/exit assertions, section rendering, and both concise and detailed summaries. `test_suite.sh` retains compatibility adapters for its established assertion call sites while delegating all mechanics; its summary fails on zero assertions or any failure. The previously excluded `test_functions.sh` is replaced by auto-discovered `test_common.sh`, which keeps regression coverage for diagnosed failures, quorum, health probes, feature-flag recognition, Kimi stream extraction, fenced/bare JSON normalization, confidence preservation, and both detailed-summary failure gates.
767
+ - **The package and active guidance are smaller and truthful.** `package.json#files` is the sole npm allowlist; the package excludes the GitHub release-note archive, tests, fixtures, and maintainer release tooling while retaining active docs. The manifest moves 107 → 61 files, packed bytes 340,662 → 268,831, and unpacked bytes 1,145,406 → 929,330. Setup/CI instructions use `doctor` and `configure`, examples use XDG consultation paths, and routing documentation describes real affinity selection rather than an inert routing-mode/timeout path.
768
+ - **Verification is wholly offline for this patch.** No consultant adapter, model, host transport, roster, cost rate, or synthesis behavior changed, so no billable live smoke was needed. Hermetic `npm test` passed 24/24 suites; core 447 assertions, configure 94 checks, installer/package 51 checks, common-helper 38 checks, Bash 3.2 syntax, ShellCheck, `npm ci --dry-run`, markdown links, and two rounds of cross-family cleanup review are green. PR #16 merged with its merge commit and all final CI checks passed.
769
+
763
770
  ### v4.0.3
764
771
 
765
772
  - **GLM's active catalog target moves from `glm-5.3` to `glm-5.3-flash` without changing transport or tier semantics.** `scripts/config.sh:189` changes the clean-install default, and the maximum/premium/standard branches at `scripts/config.sh:626-656` select the same exact provider ID. `max_quality` still supplies `GLM_REASONING_EFFORT=max`; economy deliberately remains `glm-4-flash`.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # AI Consultants v4.0.3
1
+ # AI Consultants v4.0.4
2
2
 
3
3
  > **Coverage, not a single guess.** A panel of up to 10 frontier models from different vendors fans out on your question in parallel and hands you the *union* of what they collectively see — the risks, edge cases, and approaches a single model misses.
4
4
 
5
- [![Version](https://img.shields.io/badge/version-4.0.3-blue.svg)](https://github.com/matteoscurati/ai-consultants)
5
+ [![Version](https://img.shields.io/badge/version-4.0.4-blue.svg)](https://github.com/matteoscurati/ai-consultants)
6
6
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
7
7
  [![Claude Code Skill](https://img.shields.io/badge/Claude%20Code-Skill-orange.svg)](https://docs.anthropic.com/en/docs/claude-code/skills)
8
8
  [![GitHub stars](https://img.shields.io/github/stars/matteoscurati/ai-consultants?style=social)](https://github.com/matteoscurati/ai-consultants)
@@ -331,7 +331,7 @@ skillport status ai-consultants
331
331
  git clone https://github.com/matteoscurati/ai-consultants.git
332
332
  cd ai-consultants
333
333
  ./scripts/doctor.sh --fix
334
- ./scripts/setup_wizard.sh
334
+ ./bin/ai-consultants configure
335
335
  ```
336
336
 
337
337
  **Commands:**
@@ -698,15 +698,19 @@ Classify -> Route -> Fan out (parallel) -> Coverage synthesis
698
698
  Each consultation generates:
699
699
 
700
700
  ```
701
- /tmp/ai_consultations/TIMESTAMP/
701
+ ${XDG_CACHE_HOME:-$HOME/.cache}/ai-consultants/consultations/TIMESTAMP/
702
+ ├── context.md # Built consultation context
702
703
  ├── gemini.json # Individual responses
703
704
  ├── codex.json # with confidence scores
704
705
  ├── mistral.json
705
706
  ├── grok.json
706
707
  ├── synthesis.json # Coverage union
708
+ ├── optimization_metrics.json
707
709
  └── report.md # Human-readable report
708
710
  ```
709
711
 
712
+ The command prints the exact output directory as its final stdout line.
713
+
710
714
  ---
711
715
 
712
716
  ## Best Practices
@@ -736,7 +740,8 @@ enough — the panel adds little.
736
740
 
737
741
  - **Never** include credentials or API keys in queries
738
742
  - Review and redact sensitive code before sending it to any external consultant
739
- - Files in `/tmp` are automatically cleaned up
743
+ - Private query and context-staging files are removed automatically; generated
744
+ reports remain in the XDG cache directory until you remove them
740
745
 
741
746
  ---
742
747
 
@@ -748,121 +753,11 @@ enough — the panel adds little.
748
753
  - [Smart Routing](docs/SMART_ROUTING.md) - Category-based routing
749
754
  - [JSON Schema](docs/JSON_SCHEMA.md) - Output format specification
750
755
  - [Reference Details](references/details.md) - Presets, strategies, best practices
756
+ - [Changelog](https://github.com/matteoscurati/ai-consultants/blob/main/CHANGELOG.md) - Complete version history
751
757
  - [Contributing](CONTRIBUTING.md) - How to contribute
752
758
 
753
759
  ---
754
760
 
755
- ## Changelog
756
-
757
- ### v2.23.0
758
-
759
- - **`ENABLE_REFLECTION` and `REFLECTION_CYCLES` removed.** The self-reflection module they controlled was never called by anything, so the settings had never affected a consultation — v2.16's `converge` and `adversarial` shapes already run critique-refine off measured consensus. **If you set either key**, remove it: `configure --set ENABLE_REFLECTION=...` now exits non-zero, and both keys are dropped when an existing `.env` is rewritten.
760
- - **The release gate works again.** Two test suites failed deterministically against any real user configuration, so no release since 2.22.0 could pass its own `npm test`.
761
- - **`npm test` no longer swallows failures.** A failing assertion followed by a passing one inside the same test function was counted as a pass, across 8 of 13 test functions.
762
- - **Feature flags can no longer be enrolled as consultants.** A registry that told feature flags apart from custom API agents was 18 entries out of date; it is now complete and pinned by a test.
763
- - **Preset tables corrected** — they described a debate and peer-review depth the code has not enforced since v2.16, and called `high-stakes`/`max_quality` "all consultants" when they enable 5 and 8 of 11. See the [v2.23.0 release note](docs/releases/v2.23.0.md).
764
-
765
- ### v2.22.0
766
-
767
- - **`ai-consultants configure`**: a public automatic configurator. It detects your installed CLIs and API keys, picks CLI-first transports, and writes a private XDG config while preserving your existing settings and secrets. Drive it with repeatable `--set KEY=VALUE`, review it with `--interactive` / `--advanced`, or preview it with `--dry-run`. See the [v2.22.0 release note](docs/releases/v2.22.0.md).
768
-
769
- ### v2.21.1
770
-
771
- - **Kimi K3**: Kimi now defaults to `kimi-code/k3`, and the adapter passes the model explicitly with `--model`.
772
- - **Focused 11-consultant roster**: Kilo, Aider, Amp, and Ollama were removed end-to-end, including their adapters and configuration variables. See the [v2.21.1 release note](docs/releases/v2.21.1.md) for migration guidance.
773
-
774
- ### v2.15.1
775
-
776
- - **Gemini fixes (Antigravity CLI)**: the default model (`Gemini 3.1 Pro (High)`) wraps its JSON in a ```` ```json ```` fence; v2.15.0 didn't strip it, so every Gemini reply degraded to a generic fallback. Now de-fenced on all paths (response processing, self-reflection, synthesis).
777
- - **Works out-of-the-box for `npx`**: Gemini auto-selects API mode when `GEMINI_API_KEY` is set (the `agy` CLI can't be npm-installed and is OAuth-only), so a key-only environment no longer silently drops Gemini.
778
- - **Synthesis no longer hangs** when `agy` is the synthesizer (it was launched interactively instead of in print mode).
779
-
780
- ### v2.10.0
781
-
782
- - **MiniMax M2.5 support**: New API-based consultant with "The Pragmatic Optimizer" persona
783
- - **15 consultants total**: Gemini, Codex, Mistral, Kilo, Cursor, Aider, Amp, Kimi, Claude, Qwen3, GLM, Grok, DeepSeek, MiniMax, Ollama
784
- - **npx distribution**: `npx ai-consultants "question"` - run directly without install
785
- - **npm packaging**: `package.json` with zero dependencies, `.npmignore` for clean publishing
786
-
787
- ### v2.8.1
788
-
789
- - **Bug fixes**: Fixed `((count++))` abort under `set -e`, missing Amp in consultant map, hardcoded `claude` in synthesize.sh
790
- - **Security**: Variable name validation before `export` in escalation and cost-aware routing
791
- - **DRY refactoring**: Rewrote `query_kilo.sh` and `query_cursor.sh` using shared `process_consultant_response()`; added `get_model_for_tier()` as single source of truth
792
-
793
- ### v2.8.0
794
-
795
- - **Amp CLI support**: New consultant with "The Systems Thinker" persona
796
- - **13 consultants total**: Gemini, Codex, Mistral, Kilo, Cursor, Aider, Amp, Claude, Qwen3, GLM, Grok, DeepSeek, Ollama
797
- - **Installation**: `curl -fsSL https://ampcode.com/install.sh | bash`
798
-
799
- ### v2.7.0
800
-
801
- - **Qwen CLI support**: CLI/API mode switching for Qwen3 via qwen-code
802
- - **5 switchable agents**: Gemini, Codex, Claude, Mistral, and now Qwen3 support CLI/API mode
803
- - **CLI default**: `QWEN3_USE_API` defaults to `false` (CLI mode via qwen-code)
804
-
805
- ### v2.6.0
806
-
807
- - **CLI/API mode switching**: Gemini, Codex, Claude, and Mistral can switch between CLI and API mode
808
- - **New environment variables**: `*_USE_API` and `*_API_URL` for each switchable agent
809
- - **Unified API query module**: `lib/api_query.sh` for consistent API handling
810
-
811
- ### v2.5.0
812
-
813
- - **Model quality tiers**: Premium, standard, and economy tiers for all consultants
814
- - **New presets**: `max_quality`, `medium`, `fast` for quick tier selection
815
- - **Premium defaults**: All consultants now use premium models by default (March 2026)
816
- - **`apply_model_tier()` function**: Programmatically switch all models to a tier
817
- - **Updated models**: opus-4.6, gemini-3.1-pro-preview, gpt-5.3-codex, mistral-large-3, etc.
818
-
819
- ### v2.4.0
820
-
821
- - **Budget enforcement**: Optional budget limits with configurable actions (warn/stop)
822
- - **Budget checks**: 4 enforcement points (before/after consultation, debate, synthesis)
823
- - **Budget configuration**: Configurable via natural language or environment variables
824
-
825
- ### v2.3.0
826
-
827
- - **Semantic caching**: Cache responses to avoid redundant API calls (15-25% savings)
828
- - **Cost-aware routing**: Route simple queries to cheaper models (30-50% savings)
829
- - **Fallback escalation**: Auto-escalate to premium model if confidence < 7
830
- - **Debate optimization**: Skip debate if all consultants agree (opt-in)
831
- - **Category exceptions**: SECURITY/ARCHITECTURE always trigger debate
832
- - **Quality monitoring**: `optimization_metrics.json` tracks optimization impact
833
- - **Compact reports**: Shorter reports by default (summaries only)
834
- - **Response limits**: Per-category token limits (opt-in)
835
-
836
- ### v2.2.0
837
-
838
- - **Claude consultant**: New consultant with "The Synthesizer" persona
839
- - **Self-exclusion**: Invoking agent automatically excluded from panel
840
- - **Presets**: Quick configuration with `--preset minimal/balanced/high-stakes/security`
841
- - **Doctor command**: Diagnostic and auto-fix tool
842
- - **Synthesis strategies**: `--strategy majority/risk_averse/security_first/compare_only`
843
- - **Confidence intervals**: Statistical confidence ranges (e.g., "8 +/- 1.2")
844
- - **Anonymous peer review**: Unbiased evaluation of responses
845
- - **Ollama support**: Local model inference for privacy
846
- - **Panic mode**: Automatic rigor when uncertainty detected
847
- - **One-liner install**: `curl | bash` installation
848
-
849
- ### v2.1.0
850
-
851
- - New consultants: Aider, DeepSeek
852
- - 17 configurable personas
853
- - Token optimization with AST extraction
854
-
855
- ### v2.0.0
856
-
857
- - Persona system with 15 predefined roles
858
- - Confidence scoring (1-10) on every response
859
- - Auto-synthesis with weighted recommendations
860
- - Multi-Agent Debate (MAD)
861
- - Smart routing by question category
862
- - Session management and cost tracking
863
-
864
- ---
865
-
866
761
  ## License
867
762
 
868
763
  MIT License - see [LICENSE](LICENSE) for details.
package/SKILL.md CHANGED
@@ -5,10 +5,10 @@ license: MIT
5
5
  compatibility: Requires bash, jq, and at least 2 AI CLI tools (agy, codex, vibe, etc.). macOS and Linux.
6
6
  metadata:
7
7
  author: matteoscurati
8
- version: 4.0.3
8
+ version: 4.0.4
9
9
  ---
10
10
 
11
- # AI Consultants v4.0.3 - AI Expert Panel
11
+ # AI Consultants v4.0.4 - AI Expert Panel
12
12
 
13
13
  **Coverage, not a single guess.** Convene a panel of AI "consultants" from different vendors for coding questions: they fan out in parallel and you get the *union* of what they collectively see — the risks, edge cases, and approaches a single model misses. Each consultant has a **configurable persona** that decorrelates its analysis.
14
14
 
@@ -185,13 +185,17 @@ See [Full Configuration Reference](references/configuration.md) for all variable
185
185
  ## Output
186
186
 
187
187
  ```
188
- /tmp/ai_consultations/TIMESTAMP/
188
+ ${XDG_CACHE_HOME:-$HOME/.cache}/ai-consultants/consultations/TIMESTAMP/
189
+ ├── context.md # Built consultation context
189
190
  ├── gemini.json # Individual responses
190
191
  ├── codex.json
191
192
  ├── synthesis.json # Coverage union
193
+ ├── optimization_metrics.json
192
194
  └── report.md # Human-readable
193
195
  ```
194
196
 
197
+ The command prints the exact output directory as its final stdout line.
198
+
195
199
  ## Doctor Command
196
200
 
197
201
  Diagnose and fix issues:
@@ -1,4 +1,4 @@
1
- # Cost Rates - AI Consultants v4.0.3
1
+ # Cost Rates - AI Consultants v4.0.4
2
2
 
3
3
  This page documents the per-token rates used by the cost tracking system.
4
4
 
@@ -1,4 +1,4 @@
1
- # JSON Schema - AI Consultants v3.5
1
+ # AI Consultants JSON Schema
2
2
 
3
3
  This document describes the JSON schema used for consultant responses.
4
4
 
package/docs/SETUP.md CHANGED
@@ -1,4 +1,4 @@
1
- # Setup Guide - AI Consultants v2.21.1
1
+ # AI Consultants Setup Guide
2
2
 
3
3
  This guide walks you through installing and configuring AI Consultants for various AI coding agents.
4
4
 
@@ -688,33 +688,18 @@ Checks:
688
688
  ./scripts/doctor.sh --fix
689
689
  ```
690
690
 
691
- ### Preflight Check
692
-
693
- ```bash
694
- ./scripts/preflight_check.sh
695
- ```
696
-
697
- Expected output:
698
- ```
699
- [OK] jq installed
700
- [OK] Gemini CLI installed and authenticated
701
- [OK] Codex CLI installed and authenticated
702
- Status: Ready
703
- ```
704
-
705
- ### Setup Wizard (Bash)
691
+ ### Configuration
706
692
 
707
- Interactive configuration:
693
+ Auto-detect the available CLI and API transports:
708
694
 
709
695
  ```bash
710
- ./scripts/setup_wizard.sh
696
+ ./bin/ai-consultants configure
711
697
  ```
712
698
 
713
- The wizard will:
714
- 1. Check installed CLIs
715
- 2. Test authentication
716
- 3. Suggest configuration
717
- 4. Generate `.env` file
699
+ Use `--interactive` for a guided review, `--advanced` for every supported
700
+ parameter, or `--dry-run` to preview the generated configuration without
701
+ writing it. The deprecated `setup_wizard.sh` and `preflight_check.sh` entry
702
+ points remain compatibility forwarders but are not the maintained interface.
718
703
 
719
704
  ---
720
705
 
@@ -805,10 +790,10 @@ After setup:
805
790
  **Bash:**
806
791
  ```bash
807
792
  # Test your configuration
808
- ./scripts/consult_all.sh --preset minimal "How do I optimize a SQL query?"
793
+ output_dir=$(./scripts/consult_all.sh --preset minimal "How do I optimize a SQL query?")
809
794
 
810
795
  # View the report
811
- cat /tmp/ai_consultations/*/report.md
796
+ less "$output_dir/report.md"
812
797
  ```
813
798
 
814
799
  See [README.md](../README.md) for usage examples and full documentation.
@@ -1,4 +1,4 @@
1
- # Smart Routing - AI Consultants v2.11
1
+ # AI Consultants Smart Routing
2
2
 
3
3
  The Smart Routing system automatically selects the most suitable consultants based on the question category.
4
4
 
@@ -85,30 +85,11 @@ This is useful for:
85
85
  The matrix is loaded once per shell and cached in memory — no jq overhead
86
86
  on subsequent calls.
87
87
 
88
- ## Routing Modes
89
-
90
- The system automatically determines how many consultants to involve:
91
-
92
- | Mode | Consultants | Categories | Rationale |
93
- |------|-------------|------------|-----------|
94
- | **full** | All enabled | SECURITY, GENERAL | All for complete perspectives |
95
- | **selective** | Top 5 by affinity | CODE_REVIEW, BUG_DEBUG, ARCHITECTURE, ALGORITHM, DATABASE, API_DESIGN, TESTING | Best matches for the category |
96
- | **single** | 1 | QUICK_SYNTAX | Only the best for quick answers |
97
-
98
- ### Selection Logic
99
-
100
- ```
101
- SECURITY → full (all) # Too important to exclude anyone
102
- QUICK_SYNTAX → single (1) # A quick answer is sufficient
103
- CODE_REVIEW → selective (5) # Top 5 by affinity
104
- BUG_DEBUG → selective (5)
105
- ARCHITECTURE → selective (5)
106
- * → full (all) # Default: all enabled
107
- ```
108
-
109
88
  ## Cost-Aware Routing (v2.3+)
110
89
 
111
- When `ENABLE_COST_AWARE_ROUTING=true`, the system routes queries to cheaper models based on complexity:
90
+ When `ENABLE_COST_AWARE_ROUTING=true`, selected consultants use economy models
91
+ for simple questions and can retry low-confidence responses with their premium
92
+ model. Consultant selection itself continues to use the affinity matrix above.
112
93
 
113
94
  ```bash
114
95
  ENABLE_COST_AWARE_ROUTING=true
@@ -119,23 +100,6 @@ COMPLEXITY_THRESHOLD_MEDIUM=6 # Score 4-6 = use standard models
119
100
 
120
101
  See [COST_RATES.md](COST_RATES.md) for model pricing by tier.
121
102
 
122
- ## Timeout per Category
123
-
124
- Timeouts optimized based on category complexity:
125
-
126
- | Category | Timeout | Rationale |
127
- |----------|---------|-----------|
128
- | QUICK_SYNTAX | 60s | Short answers |
129
- | DATABASE | 120s | Medium-complexity queries |
130
- | TESTING | 120s | Test case generation |
131
- | CODE_REVIEW | 180s | Detailed analysis |
132
- | BUG_DEBUG | 180s | Investigation |
133
- | ALGORITHM | 180s | Reasoning |
134
- | API_DESIGN | 180s | Detailed design |
135
- | GENERAL | 180s | Default |
136
- | ARCHITECTURE | 240s | Complex design |
137
- | SECURITY | 240s | In-depth analysis |
138
-
139
103
  ## Supported Categories
140
104
 
141
105
  ### CODE_REVIEW
@@ -235,8 +199,8 @@ ENABLE_SMART_ROUTING=true \
235
199
 
236
200
  # Output:
237
201
  # [INFO] Category: SECURITY
238
- # [INFO] Routing mode: full (all enabled consultants)
239
- # [INFO] Timeout: 240s
202
+ # [INFO] Smart routing for category SECURITY...
203
+ # [INFO] Selected consultants: Mistral Codex ...
240
204
  ```
241
205
 
242
206
  ## API Functions
@@ -255,12 +219,6 @@ select_consultants "SECURITY" 7 # → All enabled consultants
255
219
  # Check recommendation
256
220
  is_recommended "SECURITY" "Claude" 7 && echo "Recommended"
257
221
 
258
- # Get timeout
259
- get_category_timeout "ARCHITECTURE" # → 240
260
-
261
- # Get routing mode
262
- get_routing_mode "QUICK_SYNTAX" # → single
263
-
264
- # Cost-aware selection (v2.3)
265
- select_consultants_cost_aware "QUICK_SYNTAX" 7 # → Economy model selection
222
+ # Cost-aware model selection (v2.3)
223
+ get_cost_aware_model "codex" 2 # → Economy model when enabled
266
224
  ```
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.0.3",
2
+ "version": "4.0.4",
3
3
  "updated": "2026-08-23",
4
4
  "models": {
5
5
  "_comment_units": "All rates are USD per 1,000 tokens (per-1K). lib/costs.sh computes cost as (token_count / 1000) * rate, so every value here MUST be a per-1K rate = (provider $/1M price) / 1000. Do NOT paste $/MTok figures directly.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-consultants",
3
- "version": "4.0.3",
3
+ "version": "4.0.4",
4
4
  "description": "A cross-vendor panel of up to 10 AI models that returns the coverage union of their distinct perspectives",
5
5
  "bin": {
6
6
  "ai-consultants": "bin/ai-consultants"
@@ -19,6 +19,7 @@
19
19
  "SKILL.md",
20
20
  "CLAUDE.md",
21
21
  "docs/",
22
+ "!docs/releases/",
22
23
  "references/"
23
24
  ],
24
25
  "keywords": [
package/scripts/config.sh CHANGED
@@ -304,12 +304,6 @@ CLAUDE_CMD="${CLAUDE_CMD:-claude}"
304
304
  # All available consultants (ordered by typical usage)
305
305
  ALL_CONSULTANTS=("Gemini" "Codex" "Mistral" "Kimi" "Claude" "Qwen3" "GLM" "Grok" "DeepSeek" "MiniMax")
306
306
 
307
- # CLI-based consultants (use CLI tools, some support CLI/API switching)
308
- CLI_CONSULTANTS=("Gemini" "Codex" "Mistral" "Kimi" "Claude" "Qwen3" "Grok" "MiniMax")
309
-
310
- # API-only consultants (use HTTP API directly, no CLI available)
311
- API_CONSULTANTS=("GLM" "DeepSeek")
312
-
313
307
  # =============================================================================
314
308
  # ENABLED CONSULTANTS
315
309
  # =============================================================================
@@ -435,17 +429,11 @@ BUDGET_ACTION="${BUDGET_ACTION:-warn}"
435
429
  # (persistent across reboots; sessions enable follow-up queries).
436
430
  SESSION_DIR="${SESSION_DIR:-${_AI_CONSULTANTS_XDG_STATE}/sessions}"
437
431
 
438
- # Days after which to clean old sessions
432
+ # Deprecated no-op; retained through v4.x for configuration compatibility.
439
433
  SESSION_CLEANUP_DAYS="${SESSION_CLEANUP_DAYS:-7}"
440
434
 
441
- # =============================================================================
442
- # INTERACTIVE MODE (v2.0)
443
- # =============================================================================
444
-
445
- # Enable interactive progress bars
435
+ # Deprecated no-ops; retained through v4.x for configuration compatibility.
446
436
  ENABLE_PROGRESS_BARS="${ENABLE_PROGRESS_BARS:-true}"
447
-
448
- # Enable early termination (Ctrl+C to stop with partial responses)
449
437
  ENABLE_EARLY_TERMINATION="${ENABLE_EARLY_TERMINATION:-true}"
450
438
 
451
439
  # =============================================================================
@@ -485,7 +473,7 @@ ENABLE_SEMANTIC_CHUNKING="${ENABLE_SEMANTIC_CHUNKING:-true}"
485
473
  # Maximum tokens per chunk (for chunking mode)
486
474
  CHUNK_MAX_TOKENS="${CHUNK_MAX_TOKENS:-500}"
487
475
 
488
- # Use compact prompts (shorter personas and output format)
476
+ # Deprecated no-op; retained through v4.x for configuration compatibility.
489
477
  USE_COMPACT_PROMPTS="${USE_COMPACT_PROMPTS:-true}"
490
478
 
491
479
  # Extract only essential fields for synthesis (instead of full JSON)
@@ -525,8 +513,7 @@ USE_ECONOMIC_MODELS_FOR_SIMPLE="${USE_ECONOMIC_MODELS_FOR_SIMPLE:-true}"
525
513
  COMPLEXITY_THRESHOLD_SIMPLE="${COMPLEXITY_THRESHOLD_SIMPLE:-3}"
526
514
  COMPLEXITY_THRESHOLD_MEDIUM="${COMPLEXITY_THRESHOLD_MEDIUM:-6}"
527
515
 
528
- # --- Selective Context ---
529
- # Send only relevant files to each consultant
516
+ # Deprecated no-ops; retained through v4.x for configuration compatibility.
530
517
  ENABLE_SELECTIVE_CONTEXT="${ENABLE_SELECTIVE_CONTEXT:-false}"
531
518
  MAX_FILES_PER_CONSULTANT="${MAX_FILES_PER_CONSULTANT:-5}"
532
519
 
@@ -1011,4 +998,4 @@ EOF
1011
998
  # VERSION
1012
999
  # =============================================================================
1013
1000
 
1014
- AI_CONSULTANTS_VERSION="4.0.3"
1001
+ AI_CONSULTANTS_VERSION="4.0.4"
@@ -489,12 +489,12 @@ if [[ ${#SELECTED_CONSULTANTS[@]} -eq 0 ]]; then
489
489
  exit 1
490
490
  fi
491
491
 
492
- # Minimum 2 consultants required for meaningful comparison
492
+ # Minimum 2 consultants required for a coverage panel
493
493
  if [[ ${#SELECTED_CONSULTANTS[@]} -lt 2 ]]; then
494
- log_error "At least 2 consultants required for meaningful comparison."
494
+ log_error "At least 2 consultants are required for a coverage panel."
495
495
  log_error "Currently enabled: ${#SELECTED_CONSULTANTS[@]} (${SELECTED_CONSULTANTS[*]})"
496
496
  echo "" >&2
497
- log_info "Run ./scripts/setup_wizard.sh to configure additional consultants"
497
+ log_info "Run \"$SCRIPT_DIR/../bin/ai-consultants\" configure to configure additional consultants"
498
498
  log_info "Or manually enable more:"
499
499
  log_info " ENABLE_GEMINI=true ENABLE_CODEX=true ./scripts/consult_all.sh \"query\""
500
500
  exit 1
package/scripts/doctor.sh CHANGED
@@ -413,11 +413,11 @@ check_configuration() {
413
413
  check_pass
414
414
  elif [[ $enabled_count -eq 1 ]]; then
415
415
  _print " ✗ Enabled consultants: $enabled_count (need at least 2)"
416
- add_issue "config" "Only 1 consultant enabled, need at least 2" "Run: ./scripts/setup_wizard.sh"
416
+ add_issue "config" "Only 1 consultant enabled, need at least 2" "Run: \"$SCRIPT_DIR/../bin/ai-consultants\" configure"
417
417
  check_fail
418
418
  else
419
419
  _print " ✗ Enabled consultants: 0 (need at least 2)"
420
- add_issue "config" "No consultants enabled" "Run: ./scripts/setup_wizard.sh"
420
+ add_issue "config" "No consultants enabled" "Run: \"$SCRIPT_DIR/../bin/ai-consultants\" configure"
421
421
  check_fail
422
422
  fi
423
423
 
@@ -825,8 +825,8 @@ suggest_configuration() {
825
825
  if (( available_count < 2 )); then
826
826
  echo ""
827
827
  echo "# WARNING: Less than 2 consultants available."
828
- echo "# AI Consultants requires at least 2 to deliberate."
829
- echo "# Install more CLIs or run ./scripts/setup_wizard.sh"
828
+ echo "# AI Consultants requires at least 2 for a coverage panel."
829
+ echo "# Install more CLIs or run \"$SCRIPT_DIR/../bin/ai-consultants\" configure"
830
830
  fi
831
831
  }
832
832
 
@@ -348,8 +348,8 @@ echo "━━━━━━━━━━━━━━━━━━━━━━━━
348
348
  echo ""
349
349
  log_info "Option B: Configure via Bash"
350
350
  echo ""
351
- echo " 1. Run the setup wizard:"
352
- echo " $INSTALL_DIR/scripts/setup_wizard.sh"
351
+ echo " 1. Configure available consultants:"
352
+ echo " $INSTALL_DIR/bin/ai-consultants configure"
353
353
  echo ""
354
354
  echo " 2. Run a consultation:"
355
355
  echo " $INSTALL_DIR/scripts/consult_all.sh \"Your question\""
@@ -38,46 +38,6 @@ sanitize_error_message() {
38
38
  -e 's/([a-zA-Z0-9_-]{32,})/[POSSIBLE_KEY]/g'
39
39
  }
40
40
 
41
- # =============================================================================
42
- # API KEY VALIDATION
43
- # =============================================================================
44
-
45
- # Check if an API key environment variable is set
46
- # Usage: check_api_key "QWEN3_API_KEY" "Qwen3"
47
- check_api_key() {
48
- local key_var_name="$1"
49
- local consultant_name="$2"
50
-
51
- # Get the value of the environment variable by name
52
- local key_value="${!key_var_name:-}"
53
-
54
- if [[ -z "$key_value" ]]; then
55
- log_error "[$consultant_name] API key not set: $key_var_name"
56
- log_info "Set the $key_var_name environment variable to use $consultant_name"
57
- return 1
58
- fi
59
-
60
- # Basic validation: key should be non-empty and not contain obvious placeholders
61
- if [[ "$key_value" == *"your_"* ]] || [[ "$key_value" == *"YOUR_"* ]] || [[ "$key_value" == "xxx"* ]]; then
62
- log_error "[$consultant_name] API key appears to be a placeholder: $key_var_name"
63
- return 1
64
- fi
65
-
66
- # Validate key format (minimum length, no whitespace)
67
- if [[ ${#key_value} -lt 10 ]]; then
68
- log_error "[$consultant_name] API key too short: $key_var_name"
69
- return 1
70
- fi
71
-
72
- if [[ "$key_value" =~ [[:space:]] ]]; then
73
- log_error "[$consultant_name] API key contains whitespace: $key_var_name"
74
- return 1
75
- fi
76
-
77
- log_debug "[$consultant_name] API key validated"
78
- return 0
79
- }
80
-
81
41
  # =============================================================================
82
42
  # HTTP ERROR HANDLING
83
43
  # =============================================================================
@@ -724,18 +684,3 @@ check_rate_limit() {
724
684
 
725
685
  return 0
726
686
  }
727
-
728
- # Clear rate limit state for a consultant (useful for testing)
729
- # Usage: clear_rate_limit <consultant_name>
730
- clear_rate_limit() {
731
- local consultant_name="$1"
732
- local safe_name=$(echo "$consultant_name" | tr '[:upper:]' '[:lower:]' | tr -cs '[:alnum:]' '_')
733
- local state_file="${RATE_LIMIT_DIR}/${safe_name}_ratelimit"
734
-
735
- rm -f "$state_file" 2>/dev/null || true
736
- }
737
-
738
- # Clear all rate limit state
739
- clear_all_rate_limits() {
740
- rm -rf "$RATE_LIMIT_DIR" 2>/dev/null || true
741
- }