Skip to content

feat: per-story model selection for Claude Code#124

Open
crywolfe wants to merge 1 commit intosnarktank:mainfrom
crywolfe:feat/per-story-model-selection
Open

feat: per-story model selection for Claude Code#124
crywolfe wants to merge 1 commit intosnarktank:mainfrom
crywolfe:feat/per-story-model-selection

Conversation

@crywolfe
Copy link
Copy Markdown

Summary

  • When using --tool claude, ralph.sh now reads an optional model field from the next incomplete story in prd.json
  • Passes --model <value> to the Claude CLI, allowing per-story model control
  • Stories without a model field 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

  • ralph.sh: Before each iteration, reads the model field from the first passes: false story using jq. Passes --model flag to claude CLI if set.
  • prd.json.example: Added model field to example story schema
  • README.md: Documented per-story model selection feature

Example prd.json

{
  "id": "US-008",
  "title": "Complex table reconstruction",
  "model": "opus",
  "priority": 8,
  "passes": false
}

Valid model values: sonnet, opus, haiku, or full IDs like claude-opus-4-6.

Test plan

  • Run ./ralph.sh --tool claude 2 with a prd.json containing stories with and without model field
  • Verify story with "model": "opus" shows "Story US-XXX requests model: opus" in output
  • Verify story without model field uses default (no --model flag passed)
  • Verify --tool amp is unaffected (model field ignored for amp)

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant