Skip to content

feat(cli): run the main session and the agents on a chosen provider's models - #1119

Open
alexsoyes wants to merge 4 commits into
nextfrom
feat/agent-models
Open

alexsoyes wants to merge 4 commits into
nextfrom
feat/agent-models

Conversation

@alexsoyes

@alexsoyes alexsoyes commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🎯 What & why

Builds on #1142 (machine-wide install), now merged into next.

The main session and the framework's sub-agents (explorer, executor, validator, reviewer) run on whatever model the IDE uses. This lets a team pick one provider and get a model per role:

aidd setup --ide opencode --provider mistral   # main session and agents on Mistral models
aidd setup --ide opencode --provider none      # back to the IDE's model
aidd setup --global --ide codex,opencode --plugins all --provider openai
Tier Runs openai anthropic mistral
smart reviewer gpt-6.1-sol claude-opus-5-5 mistral-large-4
standard main session gpt-6.1-terra claude-sonnet-5-5 mistral-large-4
light explorer, executor, validator gpt-6-luna claude-haiku-5-5 mistral-small-latest

🛠️ How it works

  • agent-models.json maps the main session and each role to a tier, and each tier to a model and effort per provider, in each host's own ids.
  • The provider is recorded per IDE for the whole machine (~/.config/aidd/agent-models.json). Every install build applies it to the agents' frontmatter; it is part of the built tree's cache key. Setting it re-installs the plugins already installed, in this project and machine-wide (feat(cli): install the framework for every project with setup --global #1142); --global also drives the native activation of Claude Code, Codex and Copilot machine-wide.
  • The main session's model goes in the IDE's own user settings, machine-wide like the provider: Claude Code's settings.json under CLAUDE_CONFIG_DIR or ~/.claude (model, effortLevel), and ~/.config/opencode/opencode.json, or opencode.jsonc when only that exists (model). A file holding comments is skipped and reported, never rewritten. What each key held is recorded in ~/.config/aidd/main-model.json, so --provider none restores it. No project file is touched: writing the project's opencode.json, which aidd tracks, made doctor report drift and sync fail.
  • The command ends with a report, per IDE: the main session's model and where it was written, each role's model, the plugins it updated, or that agents installed later get these models when there were none.

🧪 How to verify

  • cd cli && pnpm typecheck && pnpm test.
  • In an empty HOME holding Claude Code's "model": "opus": --provider anthropic writes Sonnet there and in OpenCode's user config, doctor stays healthy; a later run with --provider openai failing on --plugins nope leaves the provider, the agents and both settings files as they were; --provider none gives back opus and deletes the OpenCode file it created.
  • aidd setup --ide opencode --plugins aidd-orchestrator --provider mistral writes .opencode/agents/aidd-orchestrator-reviewer.md with mistral/mistral-large-4#high and ~/.config/opencode/opencode.json with mistral/mistral-large-4; --provider none removes both (cli/tests/e2e/agent-models.e2e.test.ts).
  • In a scratch project with OpenCode and Claude Code, --provider anthropic then doctor reports a healthy installation and sync passes.

⚠️ Heads-up

  • Model ids checked on 2026-11-04 against OpenAI's and Mistral's model pages. Mistral has no current Medium: mistral-medium-latest is Medium 3.5, deprecated on 2026-10-31 with Large 4 as its replacement, and mistral-large-latest is not an alias of Large 4, so both upper tiers run mistral-large-4, still in Public Preview.
  • The main model is machine-wide: --provider in one project changes the IDE's model for every project, and the report says where. Other projects follow at their next install; agents they already have need aidd setup --provider … there, none included; the report says so.
  • Nothing changes until the install has succeeded: the provider, this project's rebuilt agents and the main model are set in one step after it. Codex, Copilot, Cursor and Kilo keep the model picked in the IDE.
  • One provider per run: Claude Code runs only anthropic and Codex only openai, so --ide claude,codex --provider … is refused before anything is built.
  • aidd clean --global --force forgets the provider and restores every main session's model; a project's aidd clean leaves these machine-wide choices.

✅ I certify

  • I DO CERTIFY I READ EACH LINE OF THE PULL REQUEST BECAUSE I AM A SOFTWARE ENGINEER, NOT A AI PUPPY.

Comment thread cli/scripts/smoke-tools.sh Resolved
Comment thread cli/README.md Resolved
Comment thread cli/README.md Resolved
Comment thread docs/SUBAGENTS.md Resolved
Comment thread docs/SUBAGENTS.md Resolved
@alexsoyes

Copy link
Copy Markdown
Contributor Author

Review loop summary

7 fils traités et résolus (b64b56f, 16495b4) : aidd agents supprimé au profit de aidd setup --provider (none pour défaire), smoke et wiring alignés, message --global reformulé pour cursor/opencode, tableau « où ça atterrit » dans le README, SUBAGENTS.md raccourci.

FAQ: your call

  1. rebuild dans plugin-update-use-case (fil) : garder (nécessaire pour qu'un changement de provider s'applique à version égale) ou retirer et documenter « bump la version ou réinstalle » ?
  2. Nom mainModels (fil) : garder (ce n'est que la session principale) ou renommer, par ex. mainSettings ?
  3. Supprimer des tests (fil) : garder les tests actuels (seuils de mutation tenus de justesse) ou en retirer et baisser les seuils ?
  4. claude → claude-code (fil) : PR dédiée après celle-ci (recommandé) ou dans cette PR ?

Base automatically changed from feature/sub-agents to next October 29, 2026 09:03
@alexsoyes alexsoyes changed the title feat(cli): set each IDE's agent models with aidd agents set-model feat(cli): choose the agents' provider and install the framework machine-wide Nov 2, 2026
@alexsoyes
alexsoyes force-pushed the feat/agent-models branch 2 times, most recently from 15c6a8b to 4740582 Compare November 3, 2026 01:00
@alexsoyes alexsoyes changed the title feat(cli): choose the agents' provider and install the framework machine-wide feat(cli): run the agents on a chosen provider's models Nov 3, 2026
@alexsoyes
alexsoyes changed the base branch from next to feat/global-install November 3, 2026 01:57
@alexsoyes
alexsoyes force-pushed the feat/agent-models branch 9 times, most recently from 8e3a402 to 739d974 Compare November 4, 2026 23:28

@alexsoyes alexsoyes left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revue Alex


- Registers the shared local source; native machine-wide activation requires verified current host source/ref proof. Unsupported Copilot versions refuse it.
- Writes nothing under `projectRoot`: no content, no plugin prompt, no gitignore touch.
- `--plugins all|recommended|<names>` picks plugins from the shared source's catalog. A tool with native activation gets them through `MarketplaceSyncSettingsOptions.enablePlugins`; a tool declaring `PluginsCapability.machineFiles` (opencode's skills and agents, codex's agents) gets them copied into its user directory as `scope: "user"` plugins, written by `UserPluginFileUpdater`, so `sync --scope user` rebuilds them and `clean --scope user` removes them. An interactive pick is refused (`UserScopePluginModeError`).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c'est quoi cette histoire de plugin ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ce fichier est la décision qui décrit la source partagée du framework. Le passage sur les plugins dit que setup --global --plugins all|recommended|<noms> les choisit dans le catalogue de cette source. Ce changement vient de #1142 : il apparaissait ici parce que cette PR est empilée dessus.

Comment thread docs/SUBAGENTS.md
@@ -60,13 +60,33 @@ aidd sync --global # after a framework update

## 🧠 Models

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧭 Which agent for which task

il manque une colonne avec le tier

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Colonne « Tier » ajoutée dans 8f765ba : light pour Explorer, Executor et Validator, smart pour Reviewer.

@alexsoyes
alexsoyes force-pushed the feat/agent-models branch 3 times, most recently from b2ce0f6 to 368547b Compare November 5, 2026 01:57
@alexsoyes alexsoyes changed the title feat(cli): run the agents on a chosen provider's models feat(cli): run the main session and the agents on a chosen provider's models Nov 5, 2026
@alexsoyes
alexsoyes marked this pull request as ready for review November 5, 2026 03:47
@alexsoyes
alexsoyes requested a review from a team as a code owner November 5, 2026 03:47
@alexsoyes

Copy link
Copy Markdown
Contributor Author

Revue OpenCode

Commit examiné : 8f765bab8271728ebe1898ccf2726d639a1d3f49 ; la PR peut avoir évolué depuis.

La revue est partielle ; les fichiers restants seront réessayés.

Lot 1

Verdict: changes-requested

  • Major — Preserve restoration records until settings writes succeed. In cli/src/contexts/framework/application/agents/set-agent-model-use-case.ts:134-138, removal deletes the saved record before saveMainModels runs at line 158 and before the settings file is restored at lines 159–161. If that write or deletion fails, a retry no longer knows the original model, leaving the AIDD model in the user’s settings. Keep each record until its corresponding restoration succeeds, with recovery for interrupted writes.

  • Major — Roll back partially rebuilt agents when a provider change fails. In cli/src/contexts/framework/application/agents/set-agent-model-use-case.ts:91-99, a failed reinstall restores only the provider store. reinstall updates user plugins, then project plugins, then native activation (:202-231); a failure in a later step can therefore leave earlier agents on the new provider while the stored provider and main model remain on the old one. Stage the updates or restore already-updated installations on failure. The existing failure test fails before any update succeeds and does not cover this case.

Limits: Review was read-only; runtime behavior and the supplied verification claims were not independently run.

Verdict de ce lot : changes-requested

@alexsoyes

Copy link
Copy Markdown
Contributor Author

Revue OpenCode

Commit examiné : 8f765bab8271728ebe1898ccf2726d639a1d3f49 ; la PR peut avoir évolué depuis.

Lot 1

Verdict: approve — No actionable findings in the supplied files.

The review covered code, functional, and relevancy concerns. Runtime behavior was not verified; the review was read-only.

Verdict de ce lot : approve

@alexsoyes

Copy link
Copy Markdown
Contributor Author

Revue OpenCode

Commit examiné : f6a229078e1517a955fe92bd1d5a98caeb67e710 ; la PR peut avoir évolué depuis.

Lot 1

Verdict: changes requested

Findings

  • Major — Restoration records are discarded before settings are restored. In cli/src/contexts/framework/application/agents/set-agent-model-use-case.ts:134-138, removal deletes the host’s record, and lines 159–162 save that deletion before writing or deleting the settings file. If that file operation fails or the process stops, a subsequent --provider none or global reset no longer knows the original values, leaving AIDD’s model in place. Persist removal of each record only after its settings change succeeds; retain enough state to retry failures.

  • Major — A failed rebuild can leave agents on the new provider. set-agent-model-use-case.ts:91-98 restores only the provider store on failure. reinstall() can already have updated user plugins before the project update or activation fails (:203-229), so the command fails while some installed agents remain rebuilt with the new provider. Stage the rebuild and activation transactionally, or roll back the already updated installations as well as the provider store.

  • Major — Unsetting can delete a user-edited schema. cli/src/contexts/tools/domain/formats/main-model-config.ts:88-95 deletes an AIDD-created file when its only remaining key is $schema, regardless of that key’s value. If a user changes the schema while the model is set, --provider none deletes their change. Record or verify the schema AIDD created and preserve the file when the schema has changed.

Limits

Review was based on the supplied diffs and PR snapshot. Checks were not run.

Verdict de ce lot : changes-requested

@alexsoyes

Copy link
Copy Markdown
Contributor Author

@blafourcade Faut d'abord valider la PR sur l'installation global CLI ça va se merger dedans ensuite on peut blast radius next 🐉

Base automatically changed from feat/global-install to next November 7, 2026 04:57
alexsoyes and others added 4 commits November 7, 2026 07:10
OpenCode loads opencode.json then opencode.jsonc, so a model written to
the .json was hidden whenever both existed. Prefer opencode.jsonc, create
it with $schema on a fresh install, and keep using opencode.json when it
is the only file.

Edit settings through jsonc-parser so comments and trailing commas
survive, instead of refusing such files.
@blafourcade

Copy link
Copy Markdown
Contributor

@blafourcade Faut d'abord valider la PR sur l'installation global CLI ça va se merger dedans ensuite on peut blast radius next 🐉

J4ai rebase si tu penses qu'on peut merge go @alexsoyes

@blafourcade blafourcade assigned alexsoyes and unassigned alexsoyes and blafourcade Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants