Skip to content

feat: per-phase Claude model configuration (claude_model + review_model) #271

@dwilberger

Description

@dwilberger

Problem

Ralphex uses Claude Code's default model for all phases (task execution, review, finalize). There is no way to use different models for different phases. This means users pay Opus-level costs for review iterations where Sonnet would suffice, or can't use Opus for tasks without also using it for the 5-7 parallel review agents.

Proposed Solution

Add two new config parameters:

# model for task execution (empty = CLI default)
claude_model = opus

# model for review phases: first review, fix loops, codex eval, finalize
# falls back to claude_model if not set
review_model = sonnet

Plus corresponding CLI flags: --claude-model and --review-model.

Implementation Details

  • Add Model field to ClaudeExecutor, injecting --model <value> into the CLI args when set
  • Create a separate review executor in runner.New() when review_model differs from claude_model
  • Review phases (runClaudeReview, runClaudeReviewLoop, external review eval, finalize) use the review executor
  • Task phase and plan mode continue using the primary executor
  • Empty values preserve current behavior (no --model flag passed)
  • Agent frontmatter model: field continues to work independently (controls subagent model via prompt text)

Precedence

CLI flags > local config (.ralphex/) > global config (~/.config/ralphex/) > embedded defaults > empty (CLI default)

Use Case

Running with claude_model = opus and review_model = sonnet significantly reduces cost on review-heavy runs (where 5+ parallel review agents iterate multiple times), while keeping task quality high.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions