ai-consultants 4.0.3 → 5.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 (76) hide show
  1. package/.env.example +8 -11
  2. package/CLAUDE.md +19 -1
  3. package/README.md +60 -146
  4. package/SKILL.md +55 -6
  5. package/bin/ai-consultants +16 -4
  6. package/docs/COST_RATES.md +1 -1
  7. package/docs/JSON_SCHEMA.md +64 -2
  8. package/docs/SETUP.md +10 -25
  9. package/docs/SMART_ROUTING.md +8 -50
  10. package/docs/cost_rates.json +1 -1
  11. package/package.json +2 -1
  12. package/references/details.md +31 -20
  13. package/scripts/config.sh +87 -63
  14. package/scripts/consult_all.sh +151 -72
  15. package/scripts/doctor.sh +15 -4
  16. package/scripts/generate_public_docs.sh +112 -0
  17. package/scripts/install.sh +2 -2
  18. package/scripts/lib/api.sh +0 -55
  19. package/scripts/lib/cache.sh +0 -24
  20. package/scripts/lib/code_optimizer.sh +0 -53
  21. package/scripts/lib/common.sh +91 -57
  22. package/scripts/lib/costs.sh +0 -17
  23. package/scripts/lib/coverage_integrity.sh +150 -0
  24. package/scripts/lib/personas.sh +0 -18
  25. package/scripts/lib/reliability.sh +0 -23
  26. package/scripts/lib/routing.sh +18 -119
  27. package/scripts/lib/schema.json +36 -0
  28. package/scripts/lib/session.sh +0 -81
  29. package/scripts/public_registry.sh +190 -0
  30. package/scripts/synthesize.sh +116 -8
  31. package/docs/releases/v2.10.1.md +0 -84
  32. package/docs/releases/v2.10.2.md +0 -40
  33. package/docs/releases/v2.10.3.md +0 -63
  34. package/docs/releases/v2.10.4.md +0 -63
  35. package/docs/releases/v2.10.5.md +0 -57
  36. package/docs/releases/v2.10.6.md +0 -59
  37. package/docs/releases/v2.10.7.md +0 -53
  38. package/docs/releases/v2.10.8.md +0 -58
  39. package/docs/releases/v2.10.9.md +0 -123
  40. package/docs/releases/v2.11.0.md +0 -163
  41. package/docs/releases/v2.12.0.md +0 -182
  42. package/docs/releases/v2.13.0.md +0 -179
  43. package/docs/releases/v2.13.1.md +0 -133
  44. package/docs/releases/v2.14.0.md +0 -124
  45. package/docs/releases/v2.14.1.md +0 -70
  46. package/docs/releases/v2.14.2.md +0 -77
  47. package/docs/releases/v2.15.0.md +0 -72
  48. package/docs/releases/v2.15.1.md +0 -80
  49. package/docs/releases/v2.16.0.md +0 -71
  50. package/docs/releases/v2.17.0.md +0 -62
  51. package/docs/releases/v2.17.1.md +0 -46
  52. package/docs/releases/v2.17.2.md +0 -51
  53. package/docs/releases/v2.18.0.md +0 -63
  54. package/docs/releases/v2.19.0.md +0 -66
  55. package/docs/releases/v2.19.1.md +0 -44
  56. package/docs/releases/v2.19.2.md +0 -54
  57. package/docs/releases/v2.20.0.md +0 -65
  58. package/docs/releases/v2.21.0.md +0 -65
  59. package/docs/releases/v2.21.1.md +0 -84
  60. package/docs/releases/v2.22.0.md +0 -82
  61. package/docs/releases/v2.23.0.md +0 -75
  62. package/docs/releases/v2.24.0.md +0 -88
  63. package/docs/releases/v2.25.0.md +0 -101
  64. package/docs/releases/v2.25.1.md +0 -77
  65. package/docs/releases/v2.25.2.md +0 -53
  66. package/docs/releases/v3.0.0.md +0 -71
  67. package/docs/releases/v3.1.0.md +0 -95
  68. package/docs/releases/v3.1.1.md +0 -54
  69. package/docs/releases/v3.2.0.md +0 -96
  70. package/docs/releases/v3.3.0.md +0 -80
  71. package/docs/releases/v3.4.0.md +0 -102
  72. package/docs/releases/v3.5.0.md +0 -129
  73. package/docs/releases/v4.0.0.md +0 -107
  74. package/docs/releases/v4.0.1.md +0 -57
  75. package/docs/releases/v4.0.2.md +0 -98
  76. package/docs/releases/v4.0.3.md +0 -62
package/.env.example CHANGED
@@ -250,7 +250,7 @@ MINIMAX_FORMAT=openai
250
250
  # =============================================================================
251
251
 
252
252
  # Defaults used when --preset / --strategy are omitted
253
- DEFAULT_PRESET=balanced
253
+ # DEFAULT_PRESET=balanced
254
254
  DEFAULT_STRATEGY=coverage
255
255
 
256
256
  # The invoking integration normally sets this per run for self-exclusion.
@@ -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**: 5.0.0
10
10
 
11
11
  ## Distribution
12
12
 
@@ -760,6 +760,24 @@ curl -fsSL https://raw.githubusercontent.com/matteoscurati/ai-consultants/main/s
760
760
 
761
761
  ## Changelog
762
762
 
763
+ ### v5.0.0
764
+
765
+ - **Coverage claims are now locally auditable instead of resting on synthesis prose.** `scripts/lib/coverage_integrity.sh` normalizes successful structured envelopes into deterministic `<consultant-slug>:<index>` findings, overwriting any provider-supplied IDs. `scripts/synthesize.sh` asks the synthesizer to cite those IDs, then independently compares expected and represented IDs. Missing/duplicate/non-normalizable sources produce `DEGRADED`; unknown IDs and structural failures produce `FAILED`; invented IDs are removed from published coverage. The legacy `coverage`, `weighted_recommendation`, risk, action, and individual-response fields remain present.
766
+ - **Truncation can no longer hide evidence loss.** Coverage/union prompts receive complete atomic findings. Only non-normalizable fallback context is capped, at Unicode code-point boundaries, and local `coverage_input_truncated` / `truncated_consultants` values overwrite model output in normal, local-fallback, and failed-closed artifacts. The report renders status, audited fields, truncation, and the affected consultants. The first Ubuntu CI run exposed an jq-expression compatibility gap; the final form uses jq 1.6-compatible string slicing and passed the release runner.
767
+ - **Presets are host-aware and fail closed.** `get_effective_preset_panel_size` and `select_preset_consultants` preserve the advertised panel after self-exclusion by filling from the canonical roster using static transport evidence only. `max_quality` is ten in the catalog and nine for a canonical host. Insufficient capacity now aborts with promised/selected/missing counts, and health-gate pruning is rechecked before Round 1. Custom agents can satisfy capacity; explicit per-consultant false values remain fallback opt-outs.
768
+ - **Public modes and their documentation have one executable source of truth.** `scripts/public_registry.sh` owns `fast-check -> fast/coverage`, `coverage-review -> balanced/coverage`, `max-coverage -> max_quality/coverage`, every existing preset/alias, and every strategy/default. `scripts/generate_public_docs.sh --check` renders and verifies README, SKILL, and reference tables. CLI conflict/override/unknown diagnostics run before user config, output directories, health checks, or adapters. `doctor --suggest-preset` downgrades to runnable `minimal` when only two effective transports remain.
769
+ - **The v5 release path was exercised end to end within the preregistered cap.** One no-retry `coverage-review` smoke dispatched Gemini, Mistral, and Kimi once each, then synthesized once with Claude: four dispatches total, 3/3 consultant responses, `coverage_integrity=MET` with 12/12 source IDs, and no truncation. The release gate passed 27/27 suites, ShellCheck, Bash 3.2 syntax, generated-doc drift, packaging, and sentinel isolation.
770
+ - **Development safety record.** An early P0.5 mode-registry lookup returned only the mode name, left the preset empty, and caused a local test to invoke ambient adapter auth/capability gates. Gemini/Codex were fixtures; the other adapters returned missing-key/auth/capability diagnostics. The retained transcript does not establish a network/provider request and no successful provider response was observed. The lookup was fixed, all later local release gates used provider/curl sentinels, and the final stub-only mode smoke recorded zero non-fixture adapter calls.
771
+
772
+ Deliberately retained: every v4 preset/alias, advanced configuration key, smart routing, custom agents, self-exclusion, and legacy JSON fields. Not claimed: semantic verification that a synthesized sentence faithfully paraphrases the cited atom; v5.0 verifies attribution-set integrity, not natural-language entailment.
773
+
774
+ ### v4.0.4
775
+
776
+ - **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`.
777
+ - **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.
778
+ - **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.
779
+ - **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.
780
+
763
781
  ### v4.0.3
764
782
 
765
783
  - **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 v5.0.0
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-5.0.0-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:**
@@ -455,6 +455,7 @@ Choose the right balance of quality, speed, and cost with model quality tiers.
455
455
 
456
456
  A preset only chooses the **consultant set and model tier** — every run then fans out in
457
457
  parallel and returns the coverage union.
458
+ Preset panels use statically configured transports only (a CLI on `PATH`, or selected API mode with its key). Host self-exclusion is fail-closed; lost canonical slots are filled from `ALL_CONSULTANTS` in canonical order. If the effective target cannot be met, including after an enabled health gate prunes the panel, the run stops with promised/selected/missing-capacity guidance. Configured custom API agents are appended and may satisfy capacity, so a full preset can exceed its advertised count. `max_quality` still advertises 10 consultants, with an effective target of 9 for a canonical invoking host.
458
459
  For `max_quality`, Grok, GLM, and DeepSeek are also pinned to their highest
459
460
  accepted reasoning effort: Grok Build uses `xhigh`, while GLM and DeepSeek use
460
461
  `max`. Unsupported transport capabilities fail explicitly instead of reducing
@@ -468,9 +469,15 @@ likewise receives a 16,384-token completion budget in the maximum tier and a
468
469
  provider-specific compact Markdown contract through mmx's native system channel.
469
470
  Provider output is tagged `structured`, `fallback`, or `error`;
470
471
  malformed/truncated JSON fails
471
- closed, while usable prose remains available to synthesis with its quality
472
- disclosed. Synthesis excludes error envelopes and retains bounded response
473
- detail instead of reducing every consultant to its summary.
472
+ closed. In coverage/union mode, only locally atomized `summary`, `pros`,
473
+ `cons`, `alternatives`, `caveats`, and `references` can be source-attributed;
474
+ fallback prose remains context-only for manual review. `synthesis.json` records
475
+ `coverage_integrity`: `MET` applies only to those audited fields, while
476
+ `DEGRADED`/`FAILED` must not be read as comprehensive coverage. It also records
477
+ locally authoritative `coverage_input_truncated` and `truncated_consultants`:
478
+ only non-normalizable fallback context is capped (at Unicode code-point
479
+ boundaries), never atomic findings; a truncated coverage input is disclosed
480
+ and cannot support a comprehensive coverage claim.
474
481
 
475
482
  ### Models by Tier
476
483
 
@@ -525,39 +532,47 @@ apply_model_tier "economy" # Set all to economy models
525
532
 
526
533
  ## Configuration
527
534
 
528
- ### Presets
535
+ <!-- ai-consultants:public-registry:start -->
536
+ <!-- ai-consultants:default-synthesis-strategy=coverage -->
537
+ ### Public Modes
538
+
539
+ | Mode | Preset | Default strategy | Use case |
540
+ |---|---|---|---|
541
+ | `fast-check` | `fast` | `coverage` | Fast economy panel for a quick coverage check |
542
+ | `coverage-review` | `balanced` | `coverage` | Balanced panel for a general coverage review |
543
+ | `max-coverage` | `max_quality` | `coverage` | Maximum-quality panel for the broadest coverage |
544
+
545
+ ### Configuration Presets
546
+
547
+ | Preset | Alias | Target | Tier | Use case |
548
+ |---|---|---:|---|---|
549
+ | `minimal` | — | 2 | base | Quick questions |
550
+ | `balanced` | — | 3 | base | Standard coverage |
551
+ | `thorough` | — | 3 | base | Comprehensive analysis |
552
+ | `high-stakes` | — | 4 | premium | Critical decisions |
553
+ | `security` | — | 3 | base | Security reviews |
554
+ | `cost-capped` | — | 3 | economy | Budget-conscious options |
555
+ | `max_quality` | `max-quality` | 10 | maximum | Maximum coverage for critical decisions |
556
+ | `medium` | — | 3 | standard | General questions |
557
+ | `fast` | — | 2 | economy | Quick checks |
529
558
 
530
- Choose how many consultants to use:
559
+ ### Synthesis Strategies
531
560
 
532
- | Preset | Consultants | Tier | Use Case |
533
- |--------|-------------|------|----------|
534
- | `max_quality` | All 10 | Maximum + max effort | Critical decisions |
535
- | `medium` | 3 | Standard | General questions |
536
- | `fast` | 2 | Economy | Quick checks |
537
- | `minimal` | 2 (Gemini + Codex) | Default | Quick questions, low cost |
538
- | `balanced` | 3 (+ Mistral) | Default | Standard consultations |
539
- | `thorough` | 3 | Default | Comprehensive analysis |
540
- | `high-stakes` | Expanded panel (4 of 10) | Default | Critical decisions |
541
- | `security` | Security-focused (3) | Default | Security reviews |
542
- | `cost-capped` | Budget-conscious | Default | Minimal API costs |
561
+ | Strategy | Description |
562
+ |---|---|
563
+ | `coverage` | Union of every distinct point across the panel **Default** |
564
+ | `compare_only` | Present each consultant side-by-side, without a synthesized union |
565
+ | `majority` | Produce one blended recommendation, weighting all equally |
566
+ | `risk_averse` | Weight conservative responses higher |
567
+ | `security_first` | Prioritize security-focused insights |
568
+ | `cost_capped` | Prefer cheaper consultant opinions within budget |
569
+ <!-- ai-consultants:public-registry:end -->
543
570
 
544
571
  **Bash:**
545
572
  ```bash
546
573
  ./scripts/consult_all.sh --preset balanced "Question"
547
574
  ```
548
575
 
549
- ### Synthesis Strategies
550
-
551
- Control how responses are combined:
552
-
553
- | Strategy | Description |
554
- |----------|-------------|
555
- | `majority` | Most common answer wins (default) |
556
- | `risk_averse` | Weight conservative responses higher |
557
- | `security_first` | Prioritize security considerations |
558
- | `cost_capped` | Prefer simpler, cheaper solutions |
559
- | `compare_only` | No recommendation, just comparison |
560
-
561
576
  **Bash:**
562
577
  ```bash
563
578
  ./scripts/consult_all.sh --strategy risk_averse "Question"
@@ -691,22 +706,30 @@ Classify -> Route -> Fan out (parallel) -> Coverage synthesis
691
706
  1. **Classify** the question into a category.
692
707
  2. **Route** (optional, `ENABLE_SMART_ROUTING`) to the consultants with the best category affinity (`references/affinity.json`).
693
708
  3. **Fan out** to every selected consultant in parallel — one shot each, no serial rounds.
694
- 4. **Synthesize** the **coverage union**: the deduplicated set of every distinct point, recommendation, risk, and edge case raised by any consultant. Override with `--strategy compare_only` (side-by-side) or `majority` (a single blended recommendation).
709
+ 4. **Synthesize** the **coverage union** over auditable normalized fields. Read
710
+ `coverage_integrity` before treating it as complete: `MET` means every local
711
+ atomic source ID is represented once; `DEGRADED` and `FAILED` are explicitly
712
+ non-comprehensive. Override with `--strategy compare_only` (side-by-side) or
713
+ `majority` (a single blended recommendation).
695
714
 
696
715
  ### Output
697
716
 
698
717
  Each consultation generates:
699
718
 
700
719
  ```
701
- /tmp/ai_consultations/TIMESTAMP/
720
+ ${XDG_CACHE_HOME:-$HOME/.cache}/ai-consultants/consultations/TIMESTAMP/
721
+ ├── context.md # Built consultation context
702
722
  ├── gemini.json # Individual responses
703
723
  ├── codex.json # with confidence scores
704
724
  ├── mistral.json
705
725
  ├── grok.json
706
- ├── synthesis.json # Coverage union
726
+ ├── synthesis.json # Coverage union plus coverage_integrity/audited_fields
727
+ ├── optimization_metrics.json
707
728
  └── report.md # Human-readable report
708
729
  ```
709
730
 
731
+ The command prints the exact output directory as its final stdout line.
732
+
710
733
  ---
711
734
 
712
735
  ## Best Practices
@@ -736,7 +759,8 @@ enough — the panel adds little.
736
759
 
737
760
  - **Never** include credentials or API keys in queries
738
761
  - Review and redact sensitive code before sending it to any external consultant
739
- - Files in `/tmp` are automatically cleaned up
762
+ - Private query and context-staging files are removed automatically; generated
763
+ reports remain in the XDG cache directory until you remove them
740
764
 
741
765
  ---
742
766
 
@@ -748,121 +772,11 @@ enough — the panel adds little.
748
772
  - [Smart Routing](docs/SMART_ROUTING.md) - Category-based routing
749
773
  - [JSON Schema](docs/JSON_SCHEMA.md) - Output format specification
750
774
  - [Reference Details](references/details.md) - Presets, strategies, best practices
775
+ - [Changelog](https://github.com/matteoscurati/ai-consultants/blob/main/CHANGELOG.md) - Complete version history
751
776
  - [Contributing](CONTRIBUTING.md) - How to contribute
752
777
 
753
778
  ---
754
779
 
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
780
  ## License
867
781
 
868
782
  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: 5.0.0
9
9
  ---
10
10
 
11
- # AI Consultants v4.0.3 - AI Expert Panel
11
+ # AI Consultants v5.0.0 - 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
 
@@ -115,8 +115,14 @@ Maximum-quality transports use smoke-tested runtime budgets: four advisory
115
115
  turns for Mistral/Grok, extended Qwen/DeepSeek timeouts, and larger response
116
116
  budgets for reasoning APIs and a compact native-system Markdown contract for
117
117
  MiniMax M3. Responses carry an explicit `structured`,
118
- `fallback`, or `error` quality. Truncated JSON fails closed; usable prose is
119
- retained and disclosed, and synthesis consumes successful envelopes only.
118
+ `fallback`, or `error` quality. Truncated JSON fails closed. Coverage/union
119
+ synthesis source-attributed claims use only locally normalized atomic fields;
120
+ fallback prose remains visible as context-only manual-review material. Inspect
121
+ `coverage_integrity`: `MET` applies only to its listed `audited_fields`, while
122
+ `DEGRADED` and `FAILED` are never comprehensive coverage claims.
123
+ `synthesis.json` locally records `coverage_input_truncated` and
124
+ `truncated_consultants`; only non-normalizable fallback context can be capped
125
+ (on Unicode code-point boundaries), never normalized atomic findings.
120
126
 
121
127
  **Self-Exclusion**: The invoking agent is automatically excluded from the panel. When invoked from Claude Code, Claude is excluded; when invoked from Codex CLI, Codex is excluded, etc.
122
128
 
@@ -147,7 +153,46 @@ For detailed CLI installation instructions, see [Setup Guide](docs/SETUP.md).
147
153
  /ai-consultants:consult "What could go wrong with this design?" src/service.ts
148
154
  ```
149
155
 
150
- Presets: `minimal`, `balanced`, `thorough`, `high-stakes`, `security`, `cost-capped`, `max_quality`, `medium`, `fast`. Strategies: `coverage` (default; union of distinct points), `compare_only`, `majority`, `risk_averse`, `security_first`, `cost_capped`. See [Reference Details](references/details.md) for full tables, bash usage, and best practices.
156
+ <!-- ai-consultants:public-registry:start -->
157
+ <!-- ai-consultants:default-synthesis-strategy=coverage -->
158
+ ## Public Modes
159
+
160
+ | Mode | Preset | Default strategy | Use case |
161
+ |---|---|---|---|
162
+ | `fast-check` | `fast` | `coverage` | Fast economy panel for a quick coverage check |
163
+ | `coverage-review` | `balanced` | `coverage` | Balanced panel for a general coverage review |
164
+ | `max-coverage` | `max_quality` | `coverage` | Maximum-quality panel for the broadest coverage |
165
+
166
+ ## Configuration Presets
167
+
168
+ | Preset | Alias | Target | Tier | Use case |
169
+ |---|---|---:|---|---|
170
+ | `minimal` | — | 2 | base | Quick questions |
171
+ | `balanced` | — | 3 | base | Standard coverage |
172
+ | `thorough` | — | 3 | base | Comprehensive analysis |
173
+ | `high-stakes` | — | 4 | premium | Critical decisions |
174
+ | `security` | — | 3 | base | Security reviews |
175
+ | `cost-capped` | — | 3 | economy | Budget-conscious options |
176
+ | `max_quality` | `max-quality` | 10 | maximum | Maximum coverage for critical decisions |
177
+ | `medium` | — | 3 | standard | General questions |
178
+ | `fast` | — | 2 | economy | Quick checks |
179
+
180
+ ## Synthesis Strategies
181
+
182
+ | Strategy | Description |
183
+ |---|---|
184
+ | `coverage` | Union of every distinct point across the panel **Default** |
185
+ | `compare_only` | Present each consultant side-by-side, without a synthesized union |
186
+ | `majority` | Produce one blended recommendation, weighting all equally |
187
+ | `risk_averse` | Weight conservative responses higher |
188
+ | `security_first` | Prioritize security-focused insights |
189
+ | `cost_capped` | Prefer cheaper consultant opinions within budget |
190
+ <!-- ai-consultants:public-registry:end -->
191
+
192
+ Agents may use `--mode` instead of `--preset`; the mode chooses its mapped
193
+ preset and coverage strategy unless an explicit `--strategy` is supplied. See
194
+ [Reference Details](references/details.md) for capacity, fallback, and Bash
195
+ usage details.
151
196
 
152
197
  ## Workflow
153
198
 
@@ -185,13 +230,17 @@ See [Full Configuration Reference](references/configuration.md) for all variable
185
230
  ## Output
186
231
 
187
232
  ```
188
- /tmp/ai_consultations/TIMESTAMP/
233
+ ${XDG_CACHE_HOME:-$HOME/.cache}/ai-consultants/consultations/TIMESTAMP/
234
+ ├── context.md # Built consultation context
189
235
  ├── gemini.json # Individual responses
190
236
  ├── codex.json
191
237
  ├── synthesis.json # Coverage union
238
+ ├── optimization_metrics.json
192
239
  └── report.md # Human-readable
193
240
  ```
194
241
 
242
+ The command prints the exact output directory as its final stdout line.
243
+
195
244
  ## Doctor Command
196
245
 
197
246
  Diagnose and fix issues:
@@ -15,6 +15,17 @@ BIN_DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
15
15
  PROJECT_ROOT="$(cd -P "$BIN_DIR/.." && pwd)"
16
16
  SCRIPTS_DIR="$PROJECT_ROOT/scripts"
17
17
 
18
+ load_public_registry() {
19
+ # Keep `version` and the lightweight malformed-install diagnostic usable even
20
+ # when a partial installation lacks the optional public registry file.
21
+ if [ ! -f "$SCRIPTS_DIR/public_registry.sh" ]; then
22
+ echo "Error: public registry missing at $SCRIPTS_DIR/public_registry.sh" >&2
23
+ return 1
24
+ fi
25
+ # shellcheck source=../scripts/public_registry.sh
26
+ source "$SCRIPTS_DIR/public_registry.sh"
27
+ }
28
+
18
29
  # --- Ensure execute permissions (npm can strip them) ---
19
30
  ensure_permissions() {
20
31
  local needs_fix=false
@@ -47,11 +58,13 @@ case "${1:-}" in
47
58
  exit 0
48
59
  ;;
49
60
  help|--help|-h)
61
+ load_public_registry || exit 1
50
62
  cat <<EOF
51
63
  ai-consultants v$VERSION - Cross-vendor AI coverage panel
52
64
 
53
65
  Usage:
54
66
  ai-consultants "question" [files...] Consult AI experts
67
+ ai-consultants --mode <name> "question" Use a public mode
55
68
  ai-consultants --preset <name> "question" Use a configuration preset
56
69
  ai-consultants --strategy <name> "question" Use a synthesis strategy
57
70
  ai-consultants doctor [--fix] [--json] Run diagnostics
@@ -62,10 +75,9 @@ Usage:
62
75
  ai-consultants version Show version
63
76
  ai-consultants help Show this help
64
77
 
65
- Presets: minimal, balanced, thorough, high-stakes, security, cost-capped,
66
- max_quality, medium, fast
67
-
68
- Strategies: coverage, compare_only, majority, risk_averse, security_first, cost_capped
78
+ Modes: $(registry_mode_rows | cut -d'|' -f1 | tr '\n' ' ' | sed 's/ $//')
79
+ Presets: $(registry_preset_rows | cut -d'|' -f1 | tr '\n' ' ' | sed 's/ $//')
80
+ Strategies: $(registry_strategy_rows | cut -d'|' -f1 | tr '\n' ' ' | sed 's/ $//')
69
81
 
70
82
  Examples:
71
83
  npx ai-consultants "How to optimize this SQL query?"
@@ -1,4 +1,4 @@
1
- # Cost Rates - AI Consultants v4.0.3
1
+ # Cost Rates - AI Consultants v5.0.0
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
 
@@ -22,7 +22,10 @@ The schema is defined in `scripts/lib/schema.json` following JSON Schema Draft-0
22
22
  "cons": [...],
23
23
  "alternatives": [...],
24
24
  "caveats": [...],
25
- "references": [...]
25
+ "references": [...],
26
+ "findings": [
27
+ {"id": "gemini:1", "kind": "summary", "field": "summary", "text": "..."}
28
+ ]
26
29
  },
27
30
  "confidence": {
28
31
  "score": 8,
@@ -61,6 +64,65 @@ The schema is defined in `scripts/lib/schema.json` following JSON Schema Draft-0
61
64
 
62
65
  ## Optional Fields
63
66
 
67
+ ### response.findings
68
+
69
+ `findings` is added locally by the synthesis stage to successful consultant
70
+ responses. It preserves all legacy fields and never trusts provider-supplied
71
+ IDs. Each item has a deterministic local `id` of
72
+ `<consultant-slug>:<one-based-index>`, plus `kind`, source `field`, and the
73
+ atomically attributable `text`. The shared slug rule ASCII-lowercases the
74
+ consultant name, retains `[a-z0-9_]`, replaces other runs with `_`, trims edge
75
+ underscores, and uses `unknown` if empty. Thus the public custom name
76
+ `My_agent` has IDs such as `my_agent:1`.
77
+
78
+ The conservative normalization contract derives findings only from `summary`,
79
+ `pros`, `cons`, `alternatives`, `caveats`, and `references`; alternatives may
80
+ be meaningful strings or objects with meaningful name/reason text. Empty,
81
+ null, or whitespace alternatives create no finding. Free-form fallback prose
82
+ (`response_quality: fallback`) and successful envelopes with zero atomic
83
+ findings are retained for human review but are non-normalizable; neither can
84
+ be presented as audited coverage. Error envelopes remain excluded from
85
+ synthesis.
86
+
87
+ ## Synthesis Coverage Attribution
88
+
89
+ Each synthesized `coverage` item requires `source_ids`, containing only local
90
+ IDs from normalized findings. `scripts/lib/schema.json` defines this as
91
+ `definitions.synthesis_coverage_item`; the model prompt requests it, but the
92
+ local post-check is authoritative.
93
+
94
+ Every synthesis includes `coverage_integrity`:
95
+
96
+ | Status | Meaning |
97
+ |-------|---------|
98
+ | `MET` | Every expected normalized source ID appears exactly once, with at least one expected ID and no non-normalizable success. It applies only to the audited fields. |
99
+ | `DEGRADED` | A coverage-union source is missing or duplicated, no atomic source exists, or a successful response is non-normalizable. It is never comprehensive. |
100
+ | `FAILED` | Coverage/source attribution is structurally unusable or includes an invented source ID; do not rely on coverage. |
101
+ | `NOT_APPLICABLE` | A non-coverage strategy was selected and no attribution failure was found; it makes no coverage-union claim. |
102
+
103
+ The object contains `expected_count`, `represented_count`, `missing_ids`,
104
+ `unknown_ids`, `duplicate_ids`, `non_normalizable_consultants`,
105
+ `structural_errors`, `audited_fields`, and `normalization_version`.
106
+ `represented_count` is the count of unique expected IDs actually represented;
107
+ unknown and duplicate IDs cannot inflate it. In coverage/union mode only
108
+ `audited_fields` reach the attributable prompt. Structured `detailed` text and
109
+ fallback prose are not atomized; fallback text is context-only and must never
110
+ produce coverage items or source IDs.
111
+
112
+ Every synthesis artifact also carries locally authoritative
113
+ `coverage_input_truncated` (boolean) and `truncated_consultants` (a stable,
114
+ first-occurrence-unique array of consultant names discovered in lexically
115
+ ordered response-file order). These fields overwrite any values supplied by a
116
+ model and are present even on local fallback or failed-closed artifacts.
117
+ `SYNTH_DETAIL_MAX_CHARS` applies only to usable, non-normalizable fallback
118
+ context, never to normalized finding text. Its unit is Unicode code points:
119
+ input with exactly the limit is retained and does not set the flag; only input
120
+ with more code points is shortened to that limit, preserving complete
121
+ multibyte UTF-8 characters. When such context is truncated, coverage/union is
122
+ at least `DEGRADED` and its disclosure names the affected consultants; it is
123
+ never a comprehensive claim. A non-coverage strategy can remain
124
+ `NOT_APPLICABLE`, but still exposes this metadata and disclosure.
125
+
64
126
  ### response.code_snippets
65
127
 
66
128
  Array of code snippets: