Skip to content

feat: expose Claude thinking/reasoning controls via ASKCC_CLAUDE_* env vars and CLI flags - #79

Merged
monkut merged 6 commits into
mainfrom
feature/78-thinking-controls
Apr 16, 2026
Merged

feat: expose Claude thinking/reasoning controls via ASKCC_CLAUDE_* env vars and CLI flags#79
monkut merged 6 commits into
mainfrom
feature/78-thinking-controls

Conversation

@monkut

@monkut monkut commented Apr 16, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #78

  • Add ASKCC_CLAUDE_EFFORT_LEVEL, ASKCC_CLAUDE_MAX_THINKING_TOKENS, ASKCC_CLAUDE_DISABLE_THINKING, ASKCC_CLAUDE_DISABLE_ADAPTIVE_THINKING env vars in askcc/settings.py
  • Add --effort, --max-thinking-tokens, --disable-thinking, --disable-adaptive-thinking / --no-disable-adaptive-thinking top-level CLI flags in askcc/cli.py
  • Wire all options through ClaudeRunner.run() in askcc/runners.py--effort as a CLI flag, the rest as subprocess env vars
  • Precedence: CLI flag > ASKCC_CLAUDE_* env var > Claude Code default
  • Invalid ASKCC_CLAUDE_EFFORT_LEVEL values log a warning and fall through to Claude Code defaults
  • ASKCC_CLAUDE_DISABLE_ADAPTIVE_THINKING defaults to true (adaptive thinking disabled)
  • DEFAULT_MAX_THINKING_TOKENS = 21000 (~5% of Max5 plan daily budget)

Settings Defaults

Setting Default Valid Values Claude Code Env Var
ASKCC_CLAUDE_EFFORT_LEVEL None (Claude Code decides) low, medium, high, max passed as --effort CLI flag
ASKCC_CLAUDE_MAX_THINKING_TOKENS 21000 positive integer MAX_THINKING_TOKENS
ASKCC_CLAUDE_DISABLE_THINKING False 1, true (truthy) CLAUDE_CODE_DISABLE_THINKING
ASKCC_CLAUDE_DISABLE_ADAPTIVE_THINKING True 0, false to enable CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING

Key Flows

CLI Flag Defaults

CLI Flag Default Env Var Override
--effort None (Claude Code decides) ASKCC_CLAUDE_EFFORT_LEVEL
--max-thinking-tokens 21000 ASKCC_CLAUDE_MAX_THINKING_TOKENS
--disable-thinking False ASKCC_CLAUDE_DISABLE_THINKING
--disable-adaptive-thinking True (disabled) ASKCC_CLAUDE_DISABLE_ADAPTIVE_THINKING

Precedence & Resolution

flowchart TD
    A[CLI invocation] --> B{--effort flag?}
    B -- yes --> C[use CLI value]
    B -- no --> D{ASKCC_CLAUDE_EFFORT_LEVEL set?}
    D -- valid --> C
    D -- invalid --> E[log warning, skip]
    D -- unset --> E
    C --> F[pass --effort to claude subprocess]
    E --> F

    G[Settings resolved] --> H[ClaudeRunner.run]
    H --> I[Build cmd + env]
    I --> J{effort_level?}
    J -- yes --> K[cmd += --effort level]
    J -- no --> L[skip]
    I --> M{max_thinking_tokens?}
    M -- yes --> N[env MAX_THINKING_TOKENS=21000]
    I --> O{disable_thinking?}
    O -- yes --> P[env CLAUDE_CODE_DISABLE_THINKING=1]
    I --> Q{disable_adaptive_thinking?}
    Q -- yes --> R[env CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1]
Loading

Verification

  • uv run pytest tests/ -v — passed (153 tests)
  • uv run ruff check — passed (no issues)
  • uv run pyright — passed (0 errors)

Test plan

  • --effort high passes effort_level="high" to runner
  • --effort turbo rejected by argparse (exit code 2)
  • --max-thinking-tokens 50000 passes to runner
  • --disable-thinking passes disable_thinking=True to runner
  • --disable-adaptive-thinking / --no-disable-adaptive-thinking toggle works
  • CLI flag overrides env var default for effort level
  • Invalid ASKCC_CLAUDE_EFFORT_LEVEL env var logged and ignored
  • Runner sets MAX_THINKING_TOKENS, CLAUDE_CODE_DISABLE_THINKING, CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING env vars correctly
  • Runner appends --effort to claude CLI command
  • No thinking env vars leak when runner called with defaults

…rs and CLI flags (#78)

Add env var defaults in settings.py and matching CLI flags on the
top-level parser so they apply to every subcommand. Precedence:
CLI flag > ASKCC_CLAUDE_* env var > Claude Code default.

Settings: ASKCC_CLAUDE_EFFORT_LEVEL, ASKCC_CLAUDE_MAX_THINKING_TOKENS,
ASKCC_CLAUDE_DISABLE_THINKING, ASKCC_CLAUDE_DISABLE_ADAPTIVE_THINKING.

CLI flags: --effort, --max-thinking-tokens, --disable-thinking,
--disable-adaptive-thinking / --no-disable-adaptive-thinking.
Comment thread askcc/cli.py Outdated
"--effort",
choices=VALID_EFFORT_LEVELS,
default=settings.ASKCC_CLAUDE_EFFORT_LEVEL,
help="Claude thinking effort level. Env default: ASKCC_CLAUDE_EFFORT_LEVEL.",

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

update the help text to DISPLAY the default value as well.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Updated: help text now uses f-string to display the resolved settings.ASKCC_CLAUDE_EFFORT_LEVEL value.

Comment thread askcc/cli.py Outdated
"--max-thinking-tokens",
type=int,
default=settings.ASKCC_CLAUDE_MAX_THINKING_TOKENS,
help="Thinking token budget (default: 21000). Env default: ASKCC_CLAUDE_MAX_THINKING_TOKENS.",

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

update the help text to DISPLAY the default value from the actual value, do not hard code

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Updated: help text now uses f-string with settings.ASKCC_CLAUDE_MAX_THINKING_TOKENS instead of hardcoded 21000.

Comment thread askcc/cli.py Outdated
"--disable-thinking",
action="store_true",
default=settings.ASKCC_CLAUDE_DISABLE_THINKING,
help="Force-disable extended thinking. Env default: ASKCC_CLAUDE_DISABLE_THINKING.",

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

update the help text to DISPLAY the default value as well.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Updated: help text now uses f-string to display the resolved settings.ASKCC_CLAUDE_DISABLE_THINKING value.

Comment thread askcc/cli.py Outdated
"--disable-adaptive-thinking",
action=argparse.BooleanOptionalAction,
default=settings.ASKCC_CLAUDE_DISABLE_ADAPTIVE_THINKING,
help="Disable adaptive reasoning (Opus 4.6, Sonnet 4.6); default: true. "

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

update the help text to DISPLAY the default value from the actual value, do not hard code

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Updated: help text now uses f-string with settings.ASKCC_CLAUDE_DISABLE_ADAPTIVE_THINKING instead of hardcoded true.

monkut added 5 commits April 16, 2026 11:54
Use f-strings to show resolved settings values in --effort,
--max-thinking-tokens, --disable-thinking, and
--disable-adaptive-thinking help text.
…o 0.2.4

- Define CLAUDE_ENV_* constants in settings.py for subprocess env var names
- Eliminate double os.getenv read for MAX_THINKING_TOKENS
- Use constants in runners.py and tests instead of string literals
- Bump version to 0.2.4
- Add EffortLevel StrEnum replacing VALID_EFFORT_LEVELS tuple
- Default effort level to EffortLevel.MAX when unset
- Use DEFAULT_EFFORT_LEVEL constant in tests instead of raw strings
Keep original VALID_EFFORT_LEVELS name as StrEnum class.
Use DEFAULT_EFFORT_LEVEL constant in test assertions.
@monkut
monkut merged commit eda2b64 into main Apr 16, 2026
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.

feat: expose Claude thinking/reasoning controls via ASKCC_CLAUDE_* env vars and CLI flags

1 participant