Skip to content

Cost Attribution Estimator#2

Open
orban wants to merge 6 commits into
mainfrom
feat/cost-attribution-estimator-v3
Open

Cost Attribution Estimator#2
orban wants to merge 6 commits into
mainfrom
feat/cost-attribution-estimator-v3

Conversation

@orban
Copy link
Copy Markdown
Owner

@orban orban commented Apr 3, 2026

Summary

  • add cost-attribution telemetry schema in STATE.json (metrics.component_invocations, extraction attempt/run counters, metrics.last_cost_report)
  • instrument relay hooks (post_tool_use, pack, pre_compact, reload, nudge) to increment component counters
  • add configurable config.cost_model defaults with backward-compatible state backfill
  • add deterministic estimator helpers and report renderer in pack.py, and persist report on each pack cycle
  • add /relay costs command guidance and README docs for estimator behavior/configuration
  • add tests covering schema init/backfill, counter increments, deterministic math, malformed counter safety, fallback config behavior, and report formatting

Assumptions

  • costs are modeled per-component operational estimates for internal attribution, not measured provider billing truth
  • per-invocation unit costs are configurable in STATE.json under config.cost_model

Example Output

/relay costs reports component invocations, unit costs, subtotals, total estimated cost, and extraction attempts/runs.

Validation

  • python3 -m pytest hooks/scripts/test_hooks.py -q

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