feat: expose Claude thinking/reasoning controls via ASKCC_CLAUDE_* env vars and CLI flags - #79
Conversation
…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.
| "--effort", | ||
| choices=VALID_EFFORT_LEVELS, | ||
| default=settings.ASKCC_CLAUDE_EFFORT_LEVEL, | ||
| help="Claude thinking effort level. Env default: ASKCC_CLAUDE_EFFORT_LEVEL.", |
There was a problem hiding this comment.
update the help text to DISPLAY the default value as well.
There was a problem hiding this comment.
Updated: help text now uses f-string to display the resolved settings.ASKCC_CLAUDE_EFFORT_LEVEL value.
| "--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.", |
There was a problem hiding this comment.
update the help text to DISPLAY the default value from the actual value, do not hard code
There was a problem hiding this comment.
Updated: help text now uses f-string with settings.ASKCC_CLAUDE_MAX_THINKING_TOKENS instead of hardcoded 21000.
| "--disable-thinking", | ||
| action="store_true", | ||
| default=settings.ASKCC_CLAUDE_DISABLE_THINKING, | ||
| help="Force-disable extended thinking. Env default: ASKCC_CLAUDE_DISABLE_THINKING.", |
There was a problem hiding this comment.
update the help text to DISPLAY the default value as well.
There was a problem hiding this comment.
Updated: help text now uses f-string to display the resolved settings.ASKCC_CLAUDE_DISABLE_THINKING value.
| "--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. " |
There was a problem hiding this comment.
update the help text to DISPLAY the default value from the actual value, do not hard code
There was a problem hiding this comment.
Updated: help text now uses f-string with settings.ASKCC_CLAUDE_DISABLE_ADAPTIVE_THINKING instead of hardcoded true.
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.
Summary
Closes #78
ASKCC_CLAUDE_EFFORT_LEVEL,ASKCC_CLAUDE_MAX_THINKING_TOKENS,ASKCC_CLAUDE_DISABLE_THINKING,ASKCC_CLAUDE_DISABLE_ADAPTIVE_THINKINGenv vars inaskcc/settings.py--effort,--max-thinking-tokens,--disable-thinking,--disable-adaptive-thinking/--no-disable-adaptive-thinkingtop-level CLI flags inaskcc/cli.pyClaudeRunner.run()inaskcc/runners.py—--effortas a CLI flag, the rest as subprocess env varsASKCC_CLAUDE_*env var > Claude Code defaultASKCC_CLAUDE_EFFORT_LEVELvalues log a warning and fall through to Claude Code defaultsASKCC_CLAUDE_DISABLE_ADAPTIVE_THINKINGdefaults totrue(adaptive thinking disabled)DEFAULT_MAX_THINKING_TOKENS= 21000 (~5% of Max5 plan daily budget)Settings Defaults
ASKCC_CLAUDE_EFFORT_LEVELNone(Claude Code decides)low,medium,high,max--effortCLI flagASKCC_CLAUDE_MAX_THINKING_TOKENS21000MAX_THINKING_TOKENSASKCC_CLAUDE_DISABLE_THINKINGFalse1,true(truthy)CLAUDE_CODE_DISABLE_THINKINGASKCC_CLAUDE_DISABLE_ADAPTIVE_THINKINGTrue0,falseto enableCLAUDE_CODE_DISABLE_ADAPTIVE_THINKINGKey Flows
CLI Flag Defaults
--effortNone(Claude Code decides)ASKCC_CLAUDE_EFFORT_LEVEL--max-thinking-tokens21000ASKCC_CLAUDE_MAX_THINKING_TOKENS--disable-thinkingFalseASKCC_CLAUDE_DISABLE_THINKING--disable-adaptive-thinkingTrue(disabled)ASKCC_CLAUDE_DISABLE_ADAPTIVE_THINKINGPrecedence & 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]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 highpasseseffort_level="high"to runner--effort turborejected by argparse (exit code 2)--max-thinking-tokens 50000passes to runner--disable-thinkingpassesdisable_thinking=Trueto runner--disable-adaptive-thinking/--no-disable-adaptive-thinkingtoggle worksASKCC_CLAUDE_EFFORT_LEVELenv var logged and ignoredMAX_THINKING_TOKENS,CLAUDE_CODE_DISABLE_THINKING,CLAUDE_CODE_DISABLE_ADAPTIVE_THINKINGenv vars correctly--effortto claude CLI command