Skip to content

feat: raise effort automatically on more complex turns - #26

Closed
BaconDroid wants to merge 8 commits into
ian-pascoe:mainfrom
BaconDroid:feat/auto-per-turn
Closed

BaconDroid wants to merge 8 commits into
ian-pascoe:mainfrom
BaconDroid:feat/auto-per-turn

Conversation

@BaconDroid

@BaconDroid BaconDroid commented Oct 19, 2026 •

Copy link
Copy Markdown

Summary

Follow-up to #24 and #25 for the behavior discussed in #22.

autoSelect now handles later turns instead of only the first:

  • Each user turn is classified.
  • If the classified level is higher than the current one, it is applied automatically.
  • If it is lower, the current level is kept and the lower level is injected as a recommendation; the tool can apply it.
  • Short follow-ups (continue, ok, …) keep the current level.
  • An explicit variant, or a persist: true tool call, locks the level until a temporary tool call or a model change.

This keeps the mode automatic where #22 hurt (later turns staying underpowered) without reintroducing automatic downshifts that can cut reasoning in the middle of a task. Follow-up detection stays English-only. No new configuration options.

Stacked on #23, #24 and #25. Review/merge those first; the diff will shrink after they land.

Tests

  • Initial selection, automatic upshift, no automatic downshift, follow-up guard, persisted lock, explicit-variant lock.
  • pnpm verify passes (26 tests, format, lint, typecheck, build).

Repeated set_reasoning_effort calls in one turn could reset to an
intermediate level, or cancel the reset entirely when the same level was
set twice, because the baseline was re-read after the override.

Keep the first reset target, read session history once per call with a
bounded query, cache provider variants, merge guidance into an existing
system prompt, and replace Zod config parsing with a small validator.
Fall back to the cached current level when the recent history window
carries no variant, and read model identity and variants from assistant
messages too. Reuse the SDK provider type for the cached provider list.
Add an opt-in autoSelect mode. The chat.message hook classifies each
user request and writes the chosen variant onto the message, which
OpenCode persists and uses for the turn. The level is carried across
turns until the agent changes it or the model changes.
Respect a variant supplied with the request and treat image-only prompts
as no signal. Document that autoSelect classifies the first request and
carries the level instead of reclassifying every turn.
Classify each user turn and inject a specific instruction: call the
tool with the recommended level when it differs, or do not call when
the current level fits. Replace the blanket reassessment guidance with
a shorter prompt that relies on the recommendation.
Clear the recommendation on session idle, keep mid-turn reassessment in
the default guidance, and honor explicit variants as an override only in
autoSelect. Raise the changeset to minor for the default prompt change.
In autoSelect, later user turns can raise the level when the request
classifies higher. Downshifts stay recommendations, explicit variants
and persisted tool choices lock the level, and short follow-ups keep it.
@BaconDroid

Copy link
Copy Markdown
Author

Closing: depends on the classifier added in #24, which is being removed.

@BaconDroid BaconDroid closed this Oct 19, 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.

1 participant