Skip to content

feat: add --effort support via model[:effort] syntax#285

Merged
umputun merged 2 commits intomasterfrom
task-model-effort
Apr 16, 2026
Merged

feat: add --effort support via model[:effort] syntax#285
umputun merged 2 commits intomasterfrom
task-model-effort

Conversation

@umputun
Copy link
Copy Markdown
Owner

@umputun umputun commented Apr 16, 2026

Extends task_model / review_model (and their CLI flags) to carry Claude's --effort level alongside the model, using model[:effort] syntax. Single flag, both knobs.

Examples:

task_model = opus:high
review_model = sonnet:medium
ralphex --task-model=opus:high docs/plans/foo.md
ralphex --review-model=:medium  # effort only

Effort levels: low, medium, high, xhigh, max. Either part is optional: opus, opus:high, :medium, opus:, all work.

Changes:

  • ClaudeExecutor.Effort field; injects --effort <val> alongside existing --model, with the same dedupe treatment (handles --effort=val and bare --effort)
  • ParseModelEffort helper in pkg/processor (exported for external test package)
  • Runner.New compares parsed (model, effort) tuples when deciding whether to build a separate review executor — so opus and opus: don't produce redundant executors
  • TestRunner_New_ModelEffortWiring covers 7 spec combinations, including the same-model-different-effort case (the main feature motivation)
  • Docs updated: docs/custom-providers.md command template now shows --effort; README, CLAUDE.md, llms.txt, config defaults, field godoc all mention the new syntax

Not in a release yet, so no compat shim.

Extends task_model/review_model config and --task-model/--review-model CLI
flags to carry Claude's --effort level using model[:effort] syntax (e.g.,
opus:high, :medium). Both parts are optional and independently usable.

- ClaudeExecutor gains Effort field; --effort is injected alongside --model
  and deduped from claude_args (handles --effort=val and bare --effort)
- ParseModelEffort helper splits spec on first colon; exported for external
  test package access
- Runner.New compares parsed (model, effort) tuples when deciding whether
  to build a separate review executor, so "opus" and "opus:" don't produce
  redundant executors
- Integration test verifies New wiring across 7 spec combinations, including
  same-model-different-effort (the main feature motivation)
- docs/custom-providers.md command template updated to show --effort
- Updated README, CLAUDE.md, llms.txt, config defaults, field godoc
Copilot AI review requested due to automatic review settings April 16, 2026 23:23
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 16, 2026

Deploying ralphex with  Cloudflare Pages  Cloudflare Pages

Latest commit: 70fb73a
Status:⚡️  Build in progress...

View logs

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for carrying Claude “reasoning effort” alongside the selected model by extending task_model / review_model (and corresponding CLI flags) to accept model[:effort], then wiring that into ClaudeExecutor so --effort <level> is injected next to --model <model>.

Changes:

  • Introduces ClaudeExecutor.Effort and injects/dedupes --effort in the generated Claude CLI args.
  • Adds processor.ParseModelEffort and updates runner construction to compare parsed (model, effort) tuples (avoids redundant review executors for equivalent specs like opus vs opus:).
  • Extends tests and updates docs/config defaults/README/CLAUDE.md/llms.txt to document the new syntax and behavior.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/processor/runner.go Parses model[:effort] and wires model/effort into task + review executors (tuple comparison for reuse).
pkg/processor/runner_test.go Adds tests for parsing and runner wiring across model/effort combinations.
pkg/processor/export_test.go Adds test-only accessors to inspect chosen executors from external tests.
pkg/executor/executor.go Adds Effort field and --effort injection with dedupe behavior.
pkg/executor/executor_test.go Adds coverage for --effort injection and dedupe (including --effort=... form).
pkg/config/defaults/config Documents model[:effort] syntax and effort levels in embedded defaults.
pkg/config/config.go Updates config field doc comments to reflect model[:effort].
cmd/ralphex/main.go Updates CLI flag descriptions to reflect model[:effort].
docs/custom-providers.md Updates provider command template and explains --model/--effort injection + stripping.
README.md Updates CLI/config docs tables to document model[:effort] and effort levels.
CLAUDE.md Updates user-facing documentation for model/effort configuration and wiring.
llms.txt Updates configuration documentation and examples to include effort.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/executor/executor.go
Comment on lines +251 to +256
// inject --effort flag if an effort override is configured;
// strip any existing --effort from args to avoid duplicate/conflicting flags
if e.Effort != "" {
args = stripFlag(args, "--effort")
args = append(args, "--effort", e.Effort)
}
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stripFlag is used here to remove any pre-existing --effort before injecting the override, but its current implementation always skips the token following --effort when it appears as a standalone arg. If a user (or wrapper) has a bare --effort followed by another flag (e.g. --effort --verbose), stripFlag will incorrectly drop --verbose too. Consider updating stripFlag to only skip the next token when it’s a value (e.g., next token doesn’t start with -), so the documented “bare --effort” case is handled safely.

Copilot uses AI. Check for mistakes.
addresses copilot inline review on PR #285: stripFlag was too aggressive when
encountering a bare flag in the middle of args — it always consumed the next
token as a value, eating unrelated flags like "--effort --verbose". now only
consumes the next token when it doesn't start with a dash.
@umputun umputun merged commit 3011efe into master Apr 16, 2026
2 of 3 checks passed
@umputun umputun deleted the task-model-effort branch April 16, 2026 23:29
@pySilver
Copy link
Copy Markdown

@umputun whats your personal preferences on this with opus 4.7?

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.

3 participants