# Source audit: model-roles

Decision: copy-after-audit, active settings-backed compatibility wrapper. The current extension exposes `models` as the primary command and legacy `model-roles status` as a read-only alias. `/models` and `/models select [query]` select a temporary session model through `ctx.ui.select` and `ctx.setModel`; `/models status` lists the available models; `/models assign <role> [query]` writes OMP-native `modelRoles`; `/models use <role>` resolves that setting through the current model registry and applies thinking level when present. Provider registration, legacy JSON mutation, and carousel cycling stay disabled until the full OMP selector is ported.

OMP source evidence:
- `/tmp/oh-my-pi-review/packages/coding-agent/src/modes/components/model-selector.ts`
- `/tmp/oh-my-pi-review/packages/coding-agent/src/config/model-registry.ts`
- `/tmp/oh-my-pi-review/packages/coding-agent/src/config/model-resolver.ts`
- `/tmp/oh-my-pi-review/packages/coding-agent/src/cli/list-models.ts`
- `/tmp/oh-my-pi-review/packages/coding-agent/src/config/settings-schema.ts`
- `/tmp/oh-my-pi-review/docs/models.md`
- `/tmp/oh-my-pi-review/LICENSE`

License note: OMP checkout is MIT-licensed. No OMP selector/settings implementation code was copied into the local model-selection wrapper; the listed files are source evidence for the imported semantics.

Retained contract:
- Primary command is `models`; it opens temporary interactive selection by default.
- Model list is model-first, shows provider tab labels, accepts a query argument, and shows role tags with thinking levels for assignments imported from existing legacy config files.
- `/models status` keeps the list/status view explicit.
- `/models select [query]` uses the current model registry plus `ctx.ui.select` and `ctx.setModel` for OMP-style temporary model selection. It does not write role/default settings.
- `/models assign <role> [query]` uses the current model registry plus `ctx.ui.select`, then writes the selected `provider/model` selector into `ctx.settings.set("modelRoles", ...)`.
- `/models use <role>` resolves `ctx.settings.get("modelRoles")` first, falls back to legacy read-only config, then calls `ctx.setModel` and `ctx.setThinkingLevel` when the stored selector has a thinking suffix.
- Legacy `/model-roles status` remains a read-only compatibility view for old config files.
- `/models cycle`, `/model-roles set`, `/model-roles inherit`, `/model-roles use`, and `/model-roles cycle` fail closed.

Known gaps:
- Local UI lacks interactive OMP provider tab switching, canonical model grouping, fuzzy search scoring, context menu, scoped models, and rich thinking metadata.
- Interactive OMP context menu, provider tab switching, canonical model grouping, and carousel cycling remain unported.
- Existing old `~/.pi/agent/model-roles/config.json` and `.pi/model-roles/config.json` files are read only; the extension no longer writes them or registers providers from them.
