Skip to content

filterCLIEnv strips CLAUDE_CODE_EFFORT_LEVEL and CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING — no per-agent effort control #886

@henkedk

Description

@henkedk

Bug

filterCLIEnv in internal/providers/claude_cli_session.go strips all CLAUDE_* env vars (except CLAUDE_CODE_OAUTH_TOKEN) before launching claude-cli subprocesses. This was a deliberate defensive measure to prevent session identity vars from leaking into child processes.

However, it also strips behavioral tuning vars:

  • CLAUDE_CODE_EFFORT_LEVEL — controls adaptive reasoning depth (low/medium/high/max)
  • CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING — disables dynamic thinking allocation

These are not session identity vars — they're performance/cost tuning knobs. Stripping them means:

  1. No way to control thinking depth per agent
  2. All agents run at the same global default regardless of task complexity
  3. Significant token waste on simple tasks (e.g. Scout doing lookups at full thinking depth)

Additionally, ClaudeCLIProvider doesn't wire the existing reasoning config (OptThinkingLevel) into --effort CLI flags, so the DB-level per-agent effort config is dead code for claude-cli agents.

Expected Behavior

  • Behavioral tuning env vars should pass through to claude-cli
  • Per-agent effort level from DB config should map to --effort CLI flag
  • When explicit --effort is set, CLAUDE_CODE_EFFORT_LEVEL env should be stripped to avoid precedence ambiguity

Versions Affected

Present since claude-cli provider was introduced (the original filterCLIEnv stripped everything).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions