feat(mecatui): expose run and team token budgets in embedded configuration
@JAORMX is already working on this.
Since Sep 7, 2026.
- Dominant language
- Go
- Stars
- 152
- Forks
- 16
- Avg merge
- 14h 48m
- Merged PRs (30d)
- 536
Description
Problem
mecated exposes --max-run-tokens and --max-team-tokens, but the mecatui embedded-server configuration leaves app.Config.MaxRunTokens and app.Config.MaxTeamTokens at their zero values. This makes both budget brakes unlimited in the default local TUI, and there is no operator config-file way to set them.
Desired change
Add operator-tier configuration-file support for the embedded mecatui server per-engine and team-wide token ceilings. The configuration should map through mecatui resolved config into app.Config.MaxRunTokens and app.Config.MaxTeamTokens.
Acceptance criteria
- The operator settings file can configure a positive per-engine run-token ceiling and a positive team-wide token ceiling for embedded mecatui.
- Absent settings retain current behavior:
0/ unlimited. - Invalid values fail closed or are reported consistently with existing settings parsing conventions.
- The values reach
app.Config.MaxRunTokensandapp.Config.MaxTeamTokens; the existing inherited/tighten-only budget semantics remain unchanged. - Configuration precedence and operator-vs-project trust treatment are documented and covered by tests.
- User-facing mecatui documentation explains the settings and their distinction from child per-call
max_run_tokens.
Context
Current mecated flags: cmd/mecated/main.go:1417-1418. Mecatui has no corresponding fields/flags and its embeddedConfig does not set the app config values: cmd/mecatui/config.go, cmd/mecatui/main.go (embeddedConfig). The budget behavior itself is already implemented in engine/agent/loop.go (effectiveMaxRunTokens, budgetExhausted) and team supervisor code; this is composition/config plumbing, not new budgeting behavior.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.