Usage, cost & context
Live meters
Section titled “Live meters”The engine emits a context meter with every model step, so the TUI footer moves while a turn runs, not only between turns:
- context percentage (the
ctx NN%gauge) - session cost in USD
- cache-hit percentage
- reasoning effort, whenever the model exposes reasoning control
In the TUI, [tui] status_line segments can show cost, tokens, cache state, feature toggles, and update availability alongside model, mode, and context.
Pricing honesty
Section titled “Pricing honesty”ka refuses to display numbers it cannot stand behind:
- Curated placeholder prices are flagged
priced = false; the footer andka modelsnever show costs computed from unverified rows. - The models.dev overlay (
cargo xtask models-syncin the repository) carries real published pricing. - Subscription plans (coding-plan models) appear as unpriced
planrows; you pay the subscription, not per token. - With an unpriced model active, ask-mode approval prompts omit the cost estimate instead of inventing one.
Guards
Section titled “Guards”Two thresholds, both off by default, ask once per session when crossed:
[guards]spend_usd = 2.0 # session total costcontext_pct = 90 # context meter percentageAnswering stop aborts the current turn cleanly; the strand stays intact.
ka run adds a run-cap family on top: --max-budget-usd asks to stop when the budget is crossed, --max-cost and --max-time exit with code 3 when crossed, and --warn-cost prints a warning to stderr. See the CLI reference.
What happens as context fills
Section titled “What happens as context fills”The context survival ladder kicks in, cheapest first:
- Caps + spill: oversized tool output becomes a
spill://pointer on disk before the model sees it. - Prune: blank tool results outside the protected window are elided.
- Digest: a same-model summary (
/compact [focus]triggers one manually) that never separates a tool call from its result. - Idle compaction: an idle session whose context crosses the threshold is compacted once, off by default. Set
[context] idle_minutestogether withidle_compact_pctto enable it;autocompact_pctsets the threshold explicitly, and/autocompact N|offchanges it live. - Promotion: with
[context] promote = true(the default), an overflowing turn can be re-dispatched to a bigger-context sibling of the same family.
/context in the TUI shows where the window stands.
Budgets beyond guards
Section titled “Budgets beyond guards”/goal <condition> keeps the session working toward a condition, with an optional USD budget and a cheap-model judge run per turn; see the TUI commands.