Phase 1: Model portability (tiered presets + token resolver) - #10
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every agent's frontmatter hardcodes a concrete
model:value (e.g.opencode-go/gpt-5.6-luna,ollama/deepseek-v4-flash:cloud,ollama/minimax-m3:cloud). New users without access to those exact providers/models had to hand-edit 15 files before the kit would run.What this PR adds
.opencode/models.config.json— centralized config mapping three logical tiers to concrete models per preset:TIER_REASONING— orchestrator, oracle, security, plannerTIER_CODE— code-reviewer, developer-fixer, test-engineerTIER_FAST— explorer, librarian, pc-doctor, npm-helper, build-helper, deploy-helper, writer, profilerFour presets:
opencode-go(default) — router flagship for reasoning, cloud-hosted specialists for code/fast. Matches current out-of-the-box behavior.local-ollama— fully offline:qwen2.5-coder:32b/qwen2.5-coder:14b/deepseek-coder:6.7b.commercial-api-anthropic— Claude Opus/Sonnet/Haiku viaANTHROPIC_API_KEY.commercial-api-openai— GPT-4o / GPT-4o-mini viaOPENAI_API_KEY.scripts/apply-model-preset.py— resolves{{TIER_REASONING}},{{TIER_CODE}},{{TIER_FAST}}tokens inagents/*.mdfrontmatter to the concrete IDs from a chosen preset. Supports--list,--dry-run, and--restore(revert concrete IDs back to tokens).scripts/migrate-agents-to-tokens.sh— one-time migration replacing the current hardcoded model values in all 15 agent files with the matching{{TIER_*}}token, using the exact literal values already in each file (idempotent, single-line sed replace, no other frontmatter touched).Follow-up needed before merge (manual, not included in this PR)
install.shshould call the resolver after copying agents into place. I could not safely retrieve the exact current byte content ofinstall.shthrough the tooling available in this session, so rather than risk a blind full-file rewrite of a protected script, here is the exact snippet to add by hand near the end ofinstall_into(), after thelink_or_copy "$KIT_DIR/command" "$base/command"line and before its closing}:Usage after wiring:
./install.sh project # default preset: opencode-go OPENCODE_MODEL_PRESET=local-ollama ./install.sh project OPENCODE_MODEL_PRESET=commercial-api-anthropic ./install.sh globalSuggested merge order
bash scripts/migrate-agents-to-tokens.shto tokenizeagents/*.md.python3 scripts/apply-model-preset.py --preset opencode-go --dry-runto verify round-trip resolves back to the original values.install.shsnippet above.OPENCODE_MODEL_PRESETinREADME.md/QUICKSTART.md.