{# Pareto + binary-splits panel. Embedded full-page on first render and re-fetched as an HTMX fragment when the user clicks a daily/hourly bar on the cost chart. The container ``#cost-portfolio-panel`` is owned by ``cost_overview.html``; this partial is what gets swapped. #} {% from "_spend_shapes.html" import split_cell, spark_cell %} {% if is_filtered %}
{{ ttl_verdict.recommendation }} would have been cheaper here — about {{ ttl_verdict.savings }} ({{ "%.1f"|format(ttl_verdict.margin_pct) }}%) over these {{ "{:,}".format(ttl_verdict.n_requests) }} requests.
{% else %}The two settings land within {{ "%.1f"|format(ttl_verdict.margin_pct) }}% of each other over these {{ "{:,}".format(ttl_verdict.n_requests) }} requests — too close to call. Leave it alone.
{% endif %}
Replayed at 5m: {{ ttl_verdict.cost_5m }} · at 1h:
{{ ttl_verdict.cost_1h }}{% if ttl_verdict.ttl_observed %} ·
currently billed at {{ ttl_verdict.ttl_observed }}{% endif %}.
{{ ttl_verdict.n_gaps_recoverable }} gap(s) a longer TTL would
rescue, {{ ttl_verdict.n_gaps_unrecoverable }} break(s) past
{{ ttl_verdict.max_ttl_minutes }} min that nothing recovers, and
{{ ttl_verdict.n_structural }} structural invalidation(s) that
cost the same either way. 1h charges 2× input on every
incremental cache write, not just the rebuilds it avoids — which
is why the waste figure above cannot decide this on its own.
Subagents are excluded; they have their own
subagentPromptCacheTtl.
These {{ pareto.pareto_session_count }} sessions represent 80% of {{ pareto.total_cost }} total cost ({{ pareto.pareto_cost }} cumulative).
{% else %}No cost data{% if is_filtered %} for {{ filter_label }}{% endif %}.
{% endif %}Sessions ranked by cost. The highlighted row is where cumulative spend crosses 80% — everything above it is the "vital few".
Cost split: cache read cache write output
| Started | Project | Title | Cost | Cost split | Spend shape | Cumulative | % of total |
|---|---|---|---|---|---|---|---|
| {{ row.started_at }} | {{ row.project }} | {{ row.title or row.session_id[:8] }} | {{ row.cost }} | {{ split_cell(row.split) }} {{ spark_cell(row.spark) }}{{ row.cumulative }} | {{ "%.1f"|format(row.cum_pct) }}% |
No sessions with cost{% if is_filtered %} during {{ filter_label }}{% endif %}.
{% endif %}Each breakdown partitions every session into two buckets and compares total spend. "% of total $" sums to 100% across the pair.
{{ hint }}
| Sessions | Total $ | Mean $ | % of total $ | |
|---|---|---|---|---|
| With | {{ split["with"].sessions }} | {{ split["with"].cost }} | {{ split["with"].mean_cost }} | {{ "%.1f"|format(split["with"].pct_cost) }}% |
| Without | {{ split["without"].sessions }} | {{ split["without"].cost }} | {{ split["without"].mean_cost }} | {{ "%.1f"|format(split["without"].pct_cost) }}% |