Skip to content

feat: add /output-limit for a per-model max output budget - #5

Open
elijahwander wants to merge 1 commit into
jadmadi:mainfrom
elijahwander:feat/output-limit
Open

elijahwander wants to merge 1 commit into
jadmadi:mainfrom
elijahwander:feat/output-limit

Conversation

@elijahwander

Copy link
Copy Markdown

Summary

  • Generalizes the rule engine to target either limit.context (existing /context-limit) or limit.output (new /output-limit).
  • /output-limit shares the same parsing and pattern matching: plain tokens, 16K, 1M, 50%, 0 clears, and * / provider/* / exact patterns (longest match wins).
  • Both budgets clamp to the field's catalog value, so they only lower, never raise.
  • Context and output rules are stored separately (context-limit / output-limit); one catalog transform applies both.

Motivation

A per-model max output budget caps reply length/cost, complementing the existing context budget that moves the compaction point.

Test plan

  • bun test — 20 pass, 0 fail (added applyBudget output lowering + ceiling clamp, and /output-limit set/separate-storage/display tests).
  • No imports added; plugin remains a dependency-free plain { id, setup } object.

Notes

  • Bumped VERSION and package.json to 0.2.0.
  • Kept the existing ## OpenCode referral section unchanged.

Generalize the rule engine so a budget can target either `limit.context`
or `limit.output`. `/output-limit` shares `/context-limit`'s parsing and
pattern matching (tokens, `16K`, `1M`, `50%`, `0` clears, and `*` /
`provider/*` / exact patterns) and clamps to the field's catalog value so
it only lowers, never raises. Rules for each field are stored separately
under `context-limit` and `output-limit`, and one catalog transform applies
both.
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