Cost basis on the remaining Usage cards, the Overview hero chip and Sessions transcript cost chips - #6000
Conversation
✅ Drift Bot (ClawMetry): no drift detectedDrift Bot analyzed the changed files against this project's blueprints and requirements and found no drift. |
| html += '<td style="padding:6px 8px;font-size:13px;text-align:right;color:var(--text-muted);">' + escHtml(String(row.invocations == null ? '' : row.invocations)) + '</td>'; | ||
| html += '<td style="padding:6px 8px;font-size:13px;text-align:right;">' + window.cmCostFigure(num(row, 'avg_cost_usd', 'avg_cost'), avgEntry, { noBadge: true, label: 'Average cost per invocation' }) + '</td>'; | ||
| html += '<td style="padding:6px 8px;font-size:13px;text-align:right;font-weight:600;color:var(--text-accent);">' + window.cmCostFigure(num(row, 'total_cost_usd', 'total_cost'), totalEntry, { noBadge: true, label: 'Total cost' }) + '</td>'; | ||
| html += '<td style="padding:6px 8px;font-size:12px;text-align:right;"><a href="' + escHtml(row.clawhub_url) + '" target="_blank" style="color:#4caf50;text-decoration:none;">ClawHub ↗</a></td>'; |
Visual diffBot run failed before producing screenshots. Check the workflow logs. This check is non-blocking. |
✅ Drift Bot (ClawMetry): no drift detectedDrift Bot analyzed the changed files against this project's blueprints and requirements and found no drift. |
1 similar comment
✅ Drift Bot (ClawMetry): no drift detectedDrift Bot analyzed the changed files against this project's blueprints and requirements and found no drift. |
acde63e to
cce43ce
Compare
✅ Drift Bot (ClawMetry): no drift detectedDrift Bot analyzed the changed files against this project's blueprints and requirements and found no drift. |
1 similar comment
✅ Drift Bot (ClawMetry): no drift detectedDrift Bot analyzed the changed files against this project's blueprints and requirements and found no drift. |
b7358eb to
42bf4c0
Compare
✅ Drift Bot (ClawMetry): no drift detectedDrift Bot analyzed the changed files against this project's blueprints and requirements and found no drift. |
1 similar comment
✅ Drift Bot (ClawMetry): no drift detectedDrift Bot analyzed the changed files against this project's blueprints and requirements and found no drift. |
445e37c to
5ef325f
Compare
✅ Drift Bot (ClawMetry): no drift detectedDrift Bot analyzed the changed files against this project's blueprints and requirements and found no drift. |
5ef325f to
e72c609
Compare
✅ Drift Bot (ClawMetry): no drift detectedDrift Bot analyzed the changed files against this project's blueprints and requirements and found no drift. |
2 similar comments
✅ Drift Bot (ClawMetry): no drift detectedDrift Bot analyzed the changed files against this project's blueprints and requirements and found no drift. |
✅ Drift Bot (ClawMetry): no drift detectedDrift Bot analyzed the changed files against this project's blueprints and requirements and found no drift. |
…ranscript chips Refs #5937 (REQ-OBS-CEA-025, AC-OBS-CEA-025.8 to .10). - clawmetry/cost_basis_surfaces.py: one place for the financial-basis entries of every remaining cost surface. - efficiency.py / spend_flow.py stamp them inside the engines, so the local routes and the hosted snapshot slices carry identical entries. - routes/usage.py: forecast, cost comparison, cache trends, cache risk, compression, by-plugin, skill attribution, by-team, spend optimization. - routes/sessions.py: transcript and transcript-page payloads label messages[].cost_usd; the snapshot transcripts slice reuses the dict. - app.js: those cards, the Overview hero chip and the transcript turn and tool chips render through provenance.js (new cmCostFigure). - Fixes found on the way: the runtime-scoped Spending tile called an undefined fmtCost (tile stayed node-wide, hero showed the runtime), and the Skill Cost Leaderboard read avg_cost/total_cost while the local API sends *_usd, printing $0.00 on every row. "Your actual spend" is now "usage value at published rates". - Guards: per-tab unbadged-render ratchet discovered from the tab templates (overview 24, usage 0, transcripts 5); line ceiling 62 -> 43; tests/test_cost_basis_remaining_surfaces.py (payloads, snapshot slices, shipped renderers under node). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jm9d7s4fN55hN3YzQo75o9
…0.00 total Refs #5937. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jm9d7s4fN55hN3YzQo75o9
…e the other paths The previous commit labelled it unknown, which stamp() nulls, and test_api TestSkillCosts (a numeric total_cost) failed on all three OSes. With no skill reads found, a total of 0 over zero skills is exact. Refs #5937. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jm9d7s4fN55hN3YzQo75o9
…ted after rebase uses document.createElement); the node harness now provides both. docs/MODULE_MAP.md regenerated on the rebased tree. Refs #5937. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jm9d7s4fN55hN3YzQo75o9
…a known number tests/test_live_session_truth.py (MOAT Verifier) pins that 'free' is computed only after the cost value is known and that the cost chip is pushed only when known. The refactor had folded both into _cmHeroCostChip; they are restored in place with the same meaning (value, not tile text), and the chip keeps its basis badge. Refs #5937. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jm9d7s4fN55hN3YzQo75o9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012gURwssjXXXdN4ftTqnycU
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R2qvyzQXsAhnjfrCt4izc8
a13ef74 to
5e0e879
Compare
✅ Drift Bot (ClawMetry): no drift detectedDrift Bot analyzed the changed files against this project's blueprints and requirements and found no drift. |
Closes the remaining scope of #5937 that #5975 (released in 0.12.877) left open: the audit on 2026-09-14 found several Usage cards, the Overview hero cost chip and the Sessions transcript per-turn and per-tool chips still printing dollar amounts with no financial basis.
Factory requirement: REQ-OBS-CEA-025, extended with AC-OBS-CEA-025.8, .9 and .10 (non-goals and in-flight banner updated): https://factory.8090.ai/project/b415065f-ab2f-4f53-8864-0c009fd098cb/requirements/950d4687-45cc-45a8-9d58-0c0d82fd5d9b
What is now labelled
Every figure is usage value at published rates (
published_rate), orunknownwhere nothing could be read. None claims contract or actual spend. Counterfactuals (projected savings, the month-end forecast, the same tokens on another model) carry the arithmetic basisestimatedbeside it.Overview
fmtCostthat does not exist in that scope. The ReferenceError was swallowed, so the tile kept node-wide figures while the hero showed the runtime's. This is the "hero figure differs from the tile" noted on Cost figures: label vendor-reported vs contract vs estimated everywhere; split actual spend from API-equivalent #5937. The tile, its badge and the hero now share one entry, which also carries the financial basis.Usage
cmProv.text, and the table cells through the shared figure.total_cost_usd/avg_cost_usd, but the renderer readtotal_cost/avg_cost(the hosted synthesiser's shape), so every local row printed $0.00. It now reads both shapes.Sessions
/api/transcript/<id>,/api/transcript-page/<id>) carry amessages[].cost_usdentry.Server side and cloud parity (FLYWHEEL §0a)
clawmetry/cost_basis_surfaces.py(new) holds the entries for every surface above, in one place.clawmetry/efficiency.pyandclawmetry/spend_flow.pystamp them inside the engines./api/efficiency,/api/spend-flow, everybyRuntimescope and the hosted snapshot'sefficiencyandspendFlowslices therefore carry identical entries. The cloud interceptor's per-runtime copy ofspendFlowkeeps them too.routes/usage.pystamps the forecast, cost comparison, cache trends, spend optimization, cache risk, compression, by-plugin, skill attribution and by-team payloads, on both the DuckDB and the legacy paths. The hostedforecast,costComparison,cacheTrendsandspendOptimizationsnapshot slices reuse those builders.routes/sessions.pystamps the transcript dict. The hosted snapshot'stranscriptsslice reuses it, andcm-cloud-transcriptreturns that object whole.provenance.jsaddscmCostFigure: the shared figure for a cost whose basis may not have arrived. It badges when an entry exists and never invents one.Guards
tests/test_provenance_render_coverage.pytemplates/tabs/<tab>.html, plus its helpers three calls deep, and local money formatters are discovered by shape. Ceilings: overview 24, usage 0, transcripts 5.tests/test_cost_basis_remaining_surfaces.py(15 tests, added to CI's provenance step)docs/acceptance_criteria.jsonwith no duplicate ids.docs/ac_coverage_baseline.jsonanddocs/MODULE_MAP.mdare regenerated.Verified
pytestpasses for the four provenance and cost-basis files (79 tests), plus 195 tests across the efficiency, spend flow, cache trends, compression, transcript, usage and cost optimizer suites.node --check, module map--check, AC traceability, and ruff clean on the new files. Ruff counts on the changed route files are unchanged from main.local_only. The dashboard's spawned daemon was pointed at the worktree code.?runtime=claude_code: the Spending tile and hero chip printed the same figure with the same entry, with no page errors. The scoped tile now renders; before, it failed silently.tests/test_usage_forecast_local_store_v3.py: 3 tests fail identically on a clean origin/main checkout (a 6/7 daily rate near midnight). This predates this change.Overlap with other PRs (all merged, resolved on this branch)
Rebased linearly onto main, no merge commits. Resolved semantically:
_cmFetchOverviewSharedpath and "still loading" states; the hero chip label and the scoped Spending tile fix sit on top./api/usage/by-teamreturns bothgatewayand the label.app.js, so the ratchet counts did not move (whole file 43, Overview 24, Usage 0, Sessions 5).tests/test_live_session_truth.pychecks (MOAT Verifier).Not in this change
cm-tokens-synthin clawmetry-cloud), so those two cards show figures with no badge on hosted until the cloud side adds entries.billingCoverage, brain and cost-breakdown pass-through remains as listed on Cost figures: label vendor-reported vs contract vs estimated everywhere; split actual spend from API-equivalent #5937, and the new snapshot entries reach hosted with the next cloud pin.🤖 Generated with Claude Code
https://claude.ai/code/session_01Jm9d7s4fN55hN3YzQo75o9