{# 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 %}
Filtered to {{ filter_label }} Clear ✕
{% endif %}

Where the money goes

{% if pareto.total_session_count %}
{{ pareto.total_cost }}
Total cost{% if not is_filtered %} (all sessions){% endif %}
{{ pareto.pareto_session_count }}
Sessions to 80%
{{ pareto.total_session_count }}
Sessions with cost

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 %}

Pareto table

{% if pareto.rows %}

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

{% for row in pareto.rows %} {{ split_cell(row.split) }} {{ spark_cell(row.spark) }} {% endfor %}
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 }} {{ row.cumulative }} {{ "%.1f"|format(row.cum_pct) }}%
{% else %}

No sessions with cost{% if is_filtered %} during {{ filter_label }}{% endif %}.

{% endif %}

Breakdowns

Each breakdown partitions every session into two buckets and compares total spend. "% of total $" sums to 100% across the pair.

{% set splits = [ ("Subagent presence", subagent_split, "Sessions that used Task/Agent subagents or produced sidechain messages."), ("Huge reads", huge_reads_split, "Sessions where Read-category cache creation is ≥10% of cost and ≥100k tokens."), ("Skill / slash command usage", skill_split, "Sessions that invoked a non-built-in slash command or skill."), ] %} {% for label, split, hint in splits %}

{{ label }}

{{ 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) }}%
{% endfor %}