feat: Task-specific model switching with auto-restore#1
Draft
feat: Task-specific model switching with auto-restore#1
Conversation
- Add scripts/model.ts for switching between Claude models - Support task-specific model overrides that auto-restore - Save/restore original model state via .model-state.json - Restrict to authorized ships via SKILL.md authorization field - Support aliases: sonnet, opus, haiku, gemini, gemini-flash - Update SKILL.md with usage documentation - Add authorization section explaining ship-based restrictions Workflow: 1. Switch to model for task (saves original) 2. Complete task with requested model 3. Auto-restore original model after completion Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Remove hardcoded model names that may not exist - Read aliases directly from clawdbot.json config - More flexible ModelAlias interface (index signature only) - Fallback to Claude models if config read fails - Prevents errors from misconfigured/non-existent models Fixes issue where Gemini model names in config don't match actual Google API model names.
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.
Summary
Adds task-specific model switching capability that automatically saves and restores the original model after task completion.
Features
1. Model Switching Script (
scripts/model.ts)~/.clawdbot/.model-state.jsonmodel.ts [model]- Switch model (saves original)model.ts restore- Restore original modelmodel.ts state- Check if override is active2. Authorization
authorization.ships: ["~your-ship"]3. Workflow
Usage
For Bot Operators:
Configure authorized ships in SKILL.md:
For Users:
Request model for specific task:
Bot automatically handles save/restore cycle.
Implementation Details
~/.clawdbot/.model-state.jsonopus→anthropic/claude-opus-4-5)Testing
Documentation
Updated SKILL.md with:
🤖 Generated with Claude Sonnet 4.5