feat: per-story model selection for Claude Code#124
Open
crywolfe wants to merge 1 commit intosnarktank:mainfrom
Open
feat: per-story model selection for Claude Code#124crywolfe wants to merge 1 commit intosnarktank:mainfrom
crywolfe wants to merge 1 commit intosnarktank:mainfrom
Conversation
When using --tool claude, ralph.sh now reads an optional "model" field from the next incomplete story in prd.json and passes --model to the Claude CLI. This allows using cheaper models (sonnet) for simple stories and reserving opus for complex ones. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
--tool claude, ralph.sh now reads an optionalmodelfield from the next incomplete story in prd.json--model <value>to the Claude CLI, allowing per-story model controlmodelfield use the default model (no behavior change)This enables cost optimization across a run: use sonnet for straightforward stories and reserve opus for complex ones.
Changes
modelfield from the firstpasses: falsestory using jq. Passes--modelflag toclaudeCLI if set.modelfield to example story schemaExample prd.json
{ "id": "US-008", "title": "Complex table reconstruction", "model": "opus", "priority": 8, "passes": false }Valid model values:
sonnet,opus,haiku, or full IDs likeclaude-opus-4-6.Test plan
./ralph.sh --tool claude 2with a prd.json containing stories with and withoutmodelfield"model": "opus"shows "Story US-XXX requests model: opus" in output--modelflag passed)--tool ampis unaffected (model field ignored for amp)🤖 Generated with Claude Code