# dsh-adaptive-effort
Per-reply label: model · effort · tokens with runtime stats

Badge at the end of every reply: glm-5.3 · 低(low) · 344 tok; the stats to its right are host-native.

**DSH host plugin: auto-select `reasoning_effort` (low / high / max) per user turn with a MiniMax complexity scorer (heuristic fallback), an effort-router-style token ledger (per-tier usage, savings estimate, misroute flags), and a per-reply metadata label (model · effort · tokens · steps, click to jump back to the reply's start). GLM-5.3 safe: never auto-picks `off`/`medium`, clamps a manual `off` on forced-thinking models to `low`.** [中文](./README.md) · English ## How it works 1. Each user message is scored once by a MiniMax chat-completions call with thinking disabled (`thinking: {type:"disabled"}` — fast and cheap; heuristic fallback on timeout/HTTP/missing key). 2. The tier (`low`/`high`/`max`) is combined with recent tool-call payload heft (heavy payloads can only upgrade, never downgrade). 3. The effort is injected into every `agent/request` via the cordis waterfall (`prepend`, so the session model-selection assembly cannot overwrite it). Manual picks in the model selector always win; the plugin injects an `Auto` option that enables scheduling. 4. Forced-thinking models (GLM-5.3+, GLM-4.7): a manual `off` is clamped to `low` — the provider rejects `thinking.type: disabled` outright. 5. Every decision + the observed per-step token usage lands in `~/.dsh/adaptive-effort/ledger-.jsonl`; `node lib/report.js --last` renders a Chinese report with per-tier stats, savings estimate, and misroute flags. ## Effort entry: the model popup (v0.2.1) Exactly like picking a DeepSeek reasoning level: open the model popup → the reasoning-effort list below the model gains an extra row 「自动」 — pick it and the MiniMax scorer schedules low/high/max; pick Off/Low/High/Max (native) and the plugin stays out of the way; unset also stays untouched. Any `off` on forced-thinking models (GLM-5.3+) is clamped to `low` with a log line. The settings card only holds the backend config (scorer backend, API key, scoring model, enable toggle, tool-upgrade toggle); a profile-level `level` force remains available via cordis.yml for advanced use.
Settings → Plugins → adaptive-effort card

Settings → Plugins → adaptive-effort: scorer backend / API key / scoring model / master toggle / heavy-tool upgrade.

## Config (cordis.yml / settings namespace `adaptive-effort`) `enabled` (true) · `level` (auto — or a forced off/low/high/max) · `mode` (minimax|heuristic) · `minimaxApiKey` ('' → env `MINIMAX_API_KEY`) · `minimaxBaseUrl` (https://api.minimaxi.com/v1) · `minimaxModel` (MiniMax-M3) · `scoreTimeoutMs` (4000) · `allowToolUpgrade` (true) · `clampForcedThinkingOff` (true) · `ledgerDir` ('' → `~/.dsh/adaptive-effort`) ## Credits Classifier shape from [hermes-plugin-adaptive-effort](https://github.com/viz-A-viz/hermes-plugin-adaptive-effort) (MiniMax backend instead of local embeddings); ledger from [effort-router](https://github.com/cfitzgerald-pd/effort-router); host wiring and the `auto` mask from [dsh-thinking-levels](https://github.com/drscrewdriver/dsh-thinking-levels); GLM-5.3 constraints per [Zhipu docs](https://docs.bigmodel.cn/cn/guide/models/text/glm-5.3). ## License MIT