Skip to content

AI-Trash/opencode-auto-effort

Repository files navigation

opencode-auto-effort

OMP-style per-prompt reasoning-effort selection for OpenCode.

The plugin adds an auto variant to reasoning models. When selected, a configurable judge agent classifies each user request as low, medium, high, or xhigh; the corresponding native model variant options are then applied to the request while the session remains on auto.

Requirements

  • OpenCode 1.17 or newer
  • A reasoning model with at least two supported effort variants
  • A dedicated judge agent using a concrete, non-reasoning variant such as none

Install

Add the GitHub package to opencode.jsonc:

{
  "plugin": [
    "@ai-trash/opencode-auto-effort"
  ]
}

For local development, clone the repository and re-export the plugin from a project plugin entry:

// .opencode/plugins/auto-effort.ts
export { AutoEffortPlugin } from "/absolute/path/to/opencode-auto-effort/src/index.ts"

Configure the judge

Define a minimal agent in opencode.jsonc:

{
  "agent": {
    "auto-judge": {
      "description": "Classifies reasoning effort only",
      "mode": "subagent",
      "model": "openai/gpt-5.6-luna",
      "variant": "none",
      "steps": 1,
      "maxTokens": 1024,
      "tools": {
        "*": false
      }
    }
  }
}

The default plugin settings are:

[
  "@ai-trash/opencode-auto-effort",
  {
    "provider": "openai",
    "judgeAgent": "auto-judge",
    "judgeVariant": "none",
    "levels": ["low", "medium", "high", "xhigh"],
    "fallback": "high",
    "timeoutMs": 30000
  }
]

Select auto from OpenCode's variant picker or launch with:

opencode run --model openai/gpt-5.6-sol --variant auto "your request"

Behavior

  • Uses OMP's four-level classification prompt and parsing rules.
  • Trims judge input to 6,000 characters: 4,000 from the start and 2,000 from the end.
  • Runs the judge with tools disabled and a concrete none variant by default.
  • Intersects classifier levels with the active model's enabled variants.
  • Preserves auto across turns and process restarts.
  • Falls back to the active agent/model variant when available, then high, then the highest supported level.
  • Copies the complete selected variant options, including provider-specific fields such as reasoningSummary and include.

OpenCode runs the judge through a temporary agent session rather than OMP's direct provider call. A longer default timeout is therefore necessary during cold startup.

Oh My OpenAgent

Compatible with Oh My OpenAgent 4.17.1. The plugin runs after agent variant resolution, preserves the session's auto state in metadata, and applies concrete effort options in chat.params without replacing the visible auto variant.

Development

npm install
npm test
npm run typecheck

Attribution

The difficulty prompt, input-window policy, level parser, and fallback semantics are adapted from Oh My Pi, licensed under the MIT License. See THIRD_PARTY_NOTICES.

License

AGPL-3.0-only. See LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors