Skip to content

fix(tui): --spec usage names the whole frozen-prompt cost, never zero - #230

Open
Max17190 wants to merge 2 commits into
mainfrom
usage-names-the-whole-frozen-cost
Open

fix(tui): --spec usage names the whole frozen-prompt cost, never zero#230
Max17190 wants to merge 2 commits into
mainfrom
usage-names-the-whole-frozen-cost

Conversation

@Max17190

@Max17190 Max17190 commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Why

openmax --spec usage is the surface a user reads to answer "what is my prompt costing me". It short-circuited to no extensions installed; the frozen prompt carries zero extension cost whenever no external tool or skill was present, but the frozen prefix still carries AGENTS.md, the memory index, and the layout map on every request. A project holding only a memory note or an AGENTS.md was told, untruthfully, that it paid nothing. This surfaced independently in dogfooding of both the observability and the skill-pack workflows: a project with four memory notes (616 bytes on every request) reported zero extension cost, and answering the real cost took a from-scratch A/B measurement of budget events.

Summary

  • Print the frozen-prefix component breakdown (base rules, self-extension guide, AGENTS.md, memory index, layout map, tool schemas, and the total, with a ~tok estimate) above the extension table. The data already lived in PromptBreakdown.
  • List installed memory notes with their index-line cost beside skills in the table (access counts live in the activation log, so those columns stay blank).
  • Only report an absence for the tool/skill/memory extensions that are truly empty, and never emit an absolute "zero" line while the frozen prefix carries anything.

No change to the frozen prompt itself, the wire, or any stored format; this is the reporting surface only.

Test Plan

  • cargo test -p open-max-tui: new spec_usage_names_memory_cost_and_never_claims_zero (shown red on the prior short-circuit, which printed the false "zero extension cost" and named no memory; green after).
  • cargo test --workspace and cargo clippy --workspace --all-targets at zero warnings.
  • Manual: --spec usage in a project with a memory note now prints the frozen-prefix breakdown and a memory row.

Greptile Summary

The command now provides a detailed frozen-prefix usage breakdown for project configuration and extensions. No blocking issue remains.

Confidence Score: 5/5

No blocking failure remains.

The affected command completed successfully in isolated project configurations and produced the expected usage report.

T-Rex T-Rex Logs

What T-Rex did

  • Ran the end-to-end usage validation script from the repository to verify usage accounting and memory-state handling; it created isolated temporary projects and HOME directories, invoked the warmed openmax binary with --spec usage, and completed with exit code 0, reporting PASS with all three historical paths disproved by real CLI output.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (2): Last reviewed commit: "fix(tui): count the tool-schema array as..." | Re-trigger Greptile

The usage economics surface short-circuited to "no extensions installed;
the frozen prompt carries zero extension cost" whenever no external tool or
skill was present, but the frozen prefix still carries AGENTS.md, the memory
index, and the layout map on every request. A project holding only a memory
note or an AGENTS.md was told it paid nothing.

Print the frozen-prefix component breakdown (base rules, self-extension guide,
AGENTS.md, memory index, layout map, tool schemas, total) above the extension
table, list installed memory notes with their index-line cost beside skills,
and only report an absence for the tool/skill/memory extensions that are truly
empty. The data already lived in PromptBreakdown.

Test plan: cargo test -p open-max-tui (new
spec_usage_names_memory_cost_and_never_claims_zero shown red on the prior
short-circuit, green after); cargo clippy at zero warnings.
Comment thread crates/tui/src/main.rs Outdated
Comment thread crates/tui/src/main.rs
…x state

Greptile review of this PR:
- schema cost summed each tool's schema alone, omitting the JSON-array
  brackets and commas the request actually carries; measure
  tool_schemas_wire().len(), the exact on-wire bytes, instead.
- the empty-extensions line said "no memory extensions installed" from
  breakdown.memory being empty, but that means the frozen INDEX carries no
  note, not that none exists: a note faded past the index floor or dropped by
  the byte cap is still on disk. Say "no memory note is in the frozen index"
  and point at openmax --recall for the on-disk notes.
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