Skip to content

feat(claude_code): per-agent reasoning effort via claudeConfig#283

Open
vprudnikoff wants to merge 1 commit into
awslabs:mainfrom
vprudnikoff:feat/claude-config
Open

feat(claude_code): per-agent reasoning effort via claudeConfig#283
vprudnikoff wants to merge 1 commit into
awslabs:mainfrom
vprudnikoff:feat/claude-config

Conversation

@vprudnikoff

Copy link
Copy Markdown
Contributor

What

Adds a claudeConfig field to the agent profile, the Claude Code analog of codexConfig (PR #278) for the codex provider. The claude_code provider maps it to Claude Code CLI flags at launch:

claudeConfig key Claude Code flag
effort --effort <level>
fallback_model --fallback-model <model>

The top-level model field still maps to --model (unchanged), mirroring how codex keeps model separate from codexConfig.

Why

Today the only lever for a claude_code agent's reasoning effort is the machine-global effortLevel in ~/.claude/settings.json (or the CLAUDE_CODE_EFFORT_LEVEL env var, which the provider already preserves). That silently differs between machines: an orchestrator profile meant to run at xhigh falls back to the Claude Code default (high) on any host where the global setting is absent. codexConfig already solves the equivalent problem per-agent for codex; this brings parity to claude_code.

Example

name: cto
provider: claude_code
claudeConfig:
  effort: xhigh

Tests

test/providers/test_claude_code_unit.py::TestClaudeCodeProviderClaudeConfig: effort flag emitted when set, fallback-model emitted when set, no flag when claudeConfig is absent. Docs updated in docs/agent-profile.md.

Add a `claudeConfig` field to the agent profile, the Claude Code analog of
`codexConfig` for the codex provider. The claude_code provider maps it to
Claude Code CLI flags at launch:

  - effort         -> --effort <level>
  - fallback_model -> --fallback-model <model>

This lets a profile set per-agent reasoning effort (e.g. an orchestrator at
xhigh) without relying on the machine-global `effortLevel` in
~/.claude/settings.json, which silently differs between machines. The
top-level `model` field still maps to `--model`.
@codecov-commenter

codecov-commenter commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@1224cd0). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #283   +/-   ##
=======================================
  Coverage        ?   92.15%           
=======================================
  Files           ?       70           
  Lines           ?     7115           
  Branches        ?        0           
=======================================
  Hits            ?     6557           
  Misses          ?      558           
  Partials        ?        0           
Flag Coverage Δ
unittests 92.15% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds per-agent Claude Code launch overrides by introducing a claudeConfig map on AgentProfile, and mapping selected keys to Claude Code CLI flags when building the claude command. This brings profile-level control over reasoning effort / fallback model without relying on machine-global ~/.claude/settings.json settings.

Changes:

  • Add claudeConfig to AgentProfile and document it in docs/agent-profile.md.
  • Update ClaudeCodeProvider._build_claude_command() to emit --effort and --fallback-model when profile.claudeConfig is set.
  • Add unit tests ensuring the flags are emitted/omitted as expected.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/cli_agent_orchestrator/providers/claude_code.py Map profile.claudeConfig entries to claude CLI flags during command construction.
src/cli_agent_orchestrator/models/agent_profile.py Extend the agent profile schema with the new optional claudeConfig field.
test/providers/test_claude_code_unit.py Add unit tests covering claudeConfig → CLI flag behavior.
docs/agent-profile.md Document the new claudeConfig profile field and its flag mappings.

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

Comment on lines +123 to +128
# Apply Claude Code-only per-agent knobs from claudeConfig:
# effort -> --effort <level>
# fallback_model -> --fallback-model <model>
# Claude analog of codexConfig: per-agent reasoning effort without
# depending on the machine-global effortLevel in
# ~/.claude/settings.json.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For context: codexConfig is introduced by the sibling PR #278 (feat/codex-agent-config). This launch-override comment intentionally mirrors that field — claudeConfig is the claude_code analog — so it resolves once both PRs merge. If reviewers prefer this PR to stand alone regardless of merge order, I'm happy to drop the codexConfig mention and describe the behavior on its own.

Comment on lines +55 to +61
# Claude Code-only. Per-agent Claude Code knobs mapped to CLI flags at
# launch: {"effort": "<low|medium|high|xhigh>"} -> `--effort <level>` and
# {"fallback_model": "<model>"} -> `--fallback-model <model>`. Lets a
# profile set per-agent reasoning effort without relying on the
# machine-global `effortLevel` in ~/.claude/settings.json. This is the
# Claude analog of codexConfig for the codex provider; the top-level
# `model` field still maps to `--model`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For context: codexConfig is added by the sibling PR #278 (feat/codex-agent-config). claudeConfig here is the deliberate claude_code analog of that field, so this comment cross-references it on purpose; it becomes accurate once both PRs merge. If you'd rather keep this PR independent of merge order, I can drop the codexConfig reference and just describe claudeConfig on its own.

Comment thread docs/agent-profile.md
- `model` (string): AI model to use
- `permissionMode` (string, `claude_code` only): One of `"default"`, `"acceptEdits"`, `"plan"`, `"auto"`, `"bypassPermissions"`. When set, the `claude_code` provider passes `--permission-mode <value>` instead of `--dangerously-skip-permissions`. `cao launch --yolo` overrides this and forces bypass. See [Claude Code permission modes](https://code.claude.com/docs/en/permission-modes).
- `native_agent` (string, `claude_code` only): Name of a native Claude Code agent (`~/.claude/agents/`). When set, the provider passes `--agent <name>` directly and skips system prompt / MCP config decomposition (thin-wrapper mode). See [Claude Code native agent routing](claude-code.md#native-agent-routing).
- `claudeConfig` (object, `claude_code` only): Per-agent Claude Code knobs mapped to CLI flags at launch. `{"effort": "<low|medium|high|xhigh>"}` adds `--effort <level>` and `{"fallback_model": "<model>"}` adds `--fallback-model <model>`. Lets a profile set per-agent reasoning effort without relying on the machine-global `effortLevel` in `~/.claude/settings.json`. The Claude analog of `codexConfig`; the top-level `model` field still maps to `--model`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Context: codexConfig is introduced by the sibling PR #278 (feat/codex-agent-config). These two are a pair — per-agent provider config: codexConfig for the codex provider, claudeConfig for claude_code — so the cross-reference is intentional and resolves once both land. If you'd prefer each PR to read as fully self-contained regardless of merge order, I'm happy to drop the codexConfig mention here.

@haofeif haofeif added the enhancement New feature or request label Jun 12, 2026
@haofeif

haofeif commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

@vprudnikoff great PR. I think this needs one behavior fix before approval.

The new claudeConfig.effort emits --effort, but the provider still preserves CLAUDE_CODE_EFFORT_LEVEL in the spawned Claude environment. Claude's model-config docs say the environment variable takes precedence over the other effort mechanisms, so a host-level CLAUDE_CODE_EFFORT_LEVEL can silently override the profile's per-agent effort. That undercuts the PR's stated goal of avoiding machine-global effort drift.

Could we make claudeConfig.effort win explicitly, either by unsetting CLAUDE_CODE_EFFORT_LEVEL when a profile effort is present or by setting it to the same profile value, and add a regression test for that command construction?

On the existing codexConfig comments: I saw your note that #278 is the paired PR. That is fine if #283 is intentionally sequenced after #278, but if this PR may merge independently I would still drop the codexConfig references so the docs are accurate on current main.

One smaller compatibility note: local Claude Code 2.1.181 help says --fallback-model only works with --print, while CAO launches interactive sessions. The public docs no longer show that limitation, so I would just verify/document the minimum Claude Code behavior for that field.


## Checks Run

```bash
git fetch origin main
git -C /tmp/cao-pr283 fetch origin pull/283/head
git -C /tmp/cao-pr283-merge reset --hard origin/main
git -C /tmp/cao-pr283-merge merge --no-commit --no-ff pr-283
git diff --check
uv run pytest test/providers/test_claude_code_unit.py -q
claude -v
claude --claude-help
curl -L https://code.claude.com/docs/en/model-config.md
curl -L https://code.claude.com/docs/en/env-vars.md
curl -L https://code.claude.com/docs/en/cli-reference.md

Results:

  • git diff --check: passed
  • test/providers/test_claude_code_unit.py: 111 passed
  • Local Claude Code: 2.1.181

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants