Skip to content

[Product] Surface local cost-driver notes for token/context waste #251

@luoyuctl

Description

@luoyuctl

Background

agenttrace already reports local tokens, estimated cost, context pressure, large parameters, retry loops, repeated tool output, and slow-run evidence. A small product gap remains: users can see that a session was expensive, but the report does not always connect that cost to an avoidable local evidence pattern in plain language.

Evidence

User value

When a local session has high spend or token usage, users should quickly understand whether the likely driver was context pressure, large tool parameters/output, retry loops, or long idle/rework patterns, without reading every raw trace.

Adoption rationale

Developer experience improves when the overview report turns existing local evidence into a conservative next diagnostic clue. This strengthens Reliability value while staying local-first and privacy-preserving.

Suggested scope

  • Add a conservative possible_cost_driver or equivalent note to JSON overview summary or session-level output using existing evidence only.
  • Surface the same idea in Markdown/HTML/text overview where appropriate, using wording such as "possible driver" rather than guaranteed savings.
  • Prefer already-computed signals: context pressure, large parameters, repeated tool output/retry loop, high tool failure rate, long gaps, or high tokens per assistant turn if already available.
  • Keep output deterministic and fixture-backed.

Non-goals

  • Do not index prompt content or raw conversation text.
  • Do not add prompt compression, output suppression, memory capture, vector search, context injection, or MCP behavior.
  • Do not build a billing dashboard, hosted telemetry, or external pricing integration.
  • Do not claim guaranteed token savings.
  • Do not add new parser/source support.

Acceptance criteria

  • Demo or fixture-backed overview output includes a conservative possible cost-driver note when existing local evidence supports one.
  • JSON output remains stable and documented by the relevant report/output contract checks.
  • Markdown/HTML/text output, if touched, uses local evidence wording and avoids hosted-observability or savings claims.
  • go test ./... passes.
  • Relevant CI scripts pass, especially report semantics, deterministic output, and output contract if changed.

Suggested lane

lane/product, priority/P2, status/ready-for-agent

Risk

Medium. The user-facing value is small but useful; the main risk is overclaiming causality from heuristic evidence, so wording must stay conservative.

Source

source/product: Product validation and ecosystem signal scan on 2026-05-20.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lane/productProduct experience and user journey workpriority/P2Useful follow-up worksource/productCreated or updated by product manager routingstatus/ready-for-agentReady for an agent to implement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions