Fix my tool model preset switching

This commit is contained in:
chengyongru
2026-06-18 00:03:13 +08:00
committed by Xubin Ren
parent bdf21c932b
commit ef6da0a94e
5 changed files with 84 additions and 9 deletions
+3 -1
View File
@@ -36,7 +36,8 @@ always: true
| Situation | Command |
|-----------|---------|
| Large codebase analysis | `my(action="set", key="context_window_tokens", value=131072)` |
| Repetitive simple tasks | `my(action="set", key="model", value="<fast-model>")` |
| Switch to a named model preset | `my(action="set", key="model_preset", value="<preset-name>")` |
| Repetitive simple tasks without a preset | `my(action="set", key="model", value="<fast-model>")` |
| Long multi-step task | `my(action="set", key="max_iterations", value=80)` |
**Tradeoff:** Bias toward stability. Only set when defaults are genuinely insufficient.
@@ -58,6 +59,7 @@ always: true
## Constraints
- All modifications in-memory only — restart resets everything
- Prefer `model_preset` for configured model choices. Direct `model` changes clear the active preset and should only be used when no preset exists.
- Protected params have type/range validation: `max_iterations` (1100), `context_window_tokens` (40961M), `model` (non-empty str)
- If `tools.my.allow_set` is false, check only
+10 -1
View File
@@ -24,6 +24,8 @@ Concrete scenarios showing when and how to use the my tool effectively.
```
→ my(action="check", key="model")
→ 'anthropic/claude-sonnet-4-20250514'
→ my(action="check", key="model_preset")
→ 'deep'
```
## Adaptive Behavior
@@ -37,7 +39,14 @@ Concrete scenarios showing when and how to use the my tool effectively.
→ "I've expanded my context window to handle this large codebase."
```
### Switching to a faster model for repetitive tasks
### Switching to a configured model preset
```
→ my(action="set", key="model_preset", value="fast")
→ "Set model_preset = 'fast' (was 'deep'); model is now 'openai/gpt-4.1-mini'"
→ "Switched to the fast preset for these batch tasks."
```
### Switching to a raw model when no preset exists
```
→ my(action="set", key="model", value="anthropic/claude-haiku-4-5-20251001")
→ "Set model = 'anthropic/claude-haiku-4-5-20251001' (was 'anthropic/claude-sonnet-4-20250514')"