feat(agent): add thinking/reasoning level control per message#4332
Merged
SimianAstronaut7 merged 2 commits intoMar 28, 2026
Conversation
Add ThinkingLevel enum (Off, Minimal, Low, Medium, High, Max) that
controls how deeply the model reasons per message, trading speed for
depth.
- New `src/agent/thinking.rs` module with:
- ThinkingLevel enum with serde/JsonSchema support
- ThinkingConfig with configurable default_level
- parse_thinking_directive() to parse `/think:<level>` from messages
- apply_thinking_level() returning temperature/token/prompt adjustments
- resolve_thinking_level() with priority hierarchy:
inline directive > session override > agent config > global default
- Comprehensive tests for parsing, application, and resolution
- Wired into all three agent paths in loop_.rs:
- Single-shot CLI path (run with message)
- Interactive REPL path (with per-turn system prompt restoration)
- Channel/daemon path (process_message)
- Added ThinkingConfig to AgentConfig in schema.rs (`[agent.thinking]`)
- Added /think:<level> to interactive /help output
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The rebase conflict resolution doubled the `base_` prefix. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
DCPRevere
pushed a commit
to DCPRevere/opsclaw
that referenced
this pull request
Apr 8, 2026
…aw-labs#4332) * feat(agent): add thinking/reasoning level control per message Add ThinkingLevel enum (Off, Minimal, Low, Medium, High, Max) that controls how deeply the model reasons per message, trading speed for depth. - New `src/agent/thinking.rs` module with: - ThinkingLevel enum with serde/JsonSchema support - ThinkingConfig with configurable default_level - parse_thinking_directive() to parse `/think:<level>` from messages - apply_thinking_level() returning temperature/token/prompt adjustments - resolve_thinking_level() with priority hierarchy: inline directive > session override > agent config > global default - Comprehensive tests for parsing, application, and resolution - Wired into all three agent paths in loop_.rs: - Single-shot CLI path (run with message) - Interactive REPL path (with per-turn system prompt restoration) - Channel/daemon path (process_message) - Added ThinkingConfig to AgentConfig in schema.rs (`[agent.thinking]`) - Added /think:<level> to interactive /help output Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: correct base_system_prompt variable name in thinking-level restore The rebase conflict resolution doubled the `base_` prefix. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: rareba <rareba@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Risk
src/agent/**behavior changeTest plan