diff --git a/app/renderer/components/Sankey.tsx b/app/renderer/components/Sankey.tsx
index 0753b596..58364b97 100644
--- a/app/renderer/components/Sankey.tsx
+++ b/app/renderer/components/Sankey.tsx
@@ -152,8 +152,21 @@ function modelDisplayLabel(raw: string): string {
function projectDisplayLabel(raw: string): string {
const value = raw.trim()
if (isOtherNode(value)) return 'Other'
- const parts = value.split(/[\\/]+/).filter(Boolean)
- return ellipsize(parts.at(-1) ?? value, 24)
+ const pathDelimited = /[\\/]/.test(value)
+ const parts = value.split(pathDelimited ? /[\\/]+/ : /-+/).filter(Boolean)
+ let displayParts = parts.slice(-3)
+
+ // A three-segment tail rooted directly under a home directory starts with
+ // the user name, which adds noise rather than useful project context.
+ if (displayParts.length === 3 && /^(users?|home)$/i.test(parts.at(-4) ?? '')) {
+ displayParts = displayParts.slice(1)
+ }
+
+ if (/^(projects|src|config)$/i.test(displayParts[0] ?? '')) {
+ displayParts[0] = displayParts[0].toLowerCase()
+ }
+
+ return ellipsize(displayParts.join('/') || value, 24)
}
function shortenId(value: string): string {
diff --git a/app/renderer/sections/Models.test.tsx b/app/renderer/sections/Models.test.tsx
index 5476883b..c36841cc 100644
--- a/app/renderer/sections/Models.test.tsx
+++ b/app/renderer/sections/Models.test.tsx
@@ -100,6 +100,17 @@ const byTaskRows: ModelReportRow[] = [
costUSD: 244.12,
savingsUSD: 61.22,
},
+ {
+ ...rows[0],
+ category: 'delegation',
+ calls: 120,
+ inputTokens: 8_000_000,
+ outputTokens: 500_000,
+ cacheReadTokens: 6_000_000,
+ totalTokens: 14_500_000,
+ costUSD: 20.88,
+ savingsUSD: 5.18,
+ },
]
describe('Models', () => {
@@ -175,6 +186,13 @@ describe('Models', () => {
await waitFor(() => expect(getModels).toHaveBeenCalledWith('week', 'anthropic', true))
expect(await screen.findByText('coding')).toBeInTheDocument()
+ expect(screen.getByText('delegation')).toBeInTheDocument()
+ expect(screen.getByText('3,520')).toBeInTheDocument()
+ expect(screen.getByText('$265.00')).toBeInTheDocument()
+ expect(screen.getByText('$66.40')).toBeInTheDocument()
expect(screen.getByText('$244.12')).toBeInTheDocument()
+ expect(screen.getAllByText('Claude Opus 4.8')).toHaveLength(1)
+ expect(document.querySelectorAll('.model-task-group')).toHaveLength(1)
+ expect(document.querySelectorAll('.model-task-row')).toHaveLength(2)
})
})
diff --git a/app/renderer/sections/Models.tsx b/app/renderer/sections/Models.tsx
index 6e51ca53..3aebe29c 100644
--- a/app/renderer/sections/Models.tsx
+++ b/app/renderer/sections/Models.tsx
@@ -83,6 +83,8 @@ export function Models({
}
function ModelsTable({ rows, byTask }: { rows: ModelReportRow[]; byTask: boolean }) {
+ if (byTask) return
+
return (
@@ -98,14 +100,42 @@ function ModelsTable({ rows, byTask }: { rows: ModelReportRow[]; byTask: boolean
{rows.map((row, i) => (
-
+
))}
)
}
-function ModelTableRow({ row, byTask }: { row: ModelReportRow; byTask: boolean }) {
+function ModelsByTaskTable({ rows }: { rows: ModelReportRow[] }) {
+ const groups = groupTaskRows(rows)
+
+ return (
+
+
+
+ | Task |
+ Calls |
+ Input |
+ Output |
+ Cache read |
+ Cost |
+ Saved |
+
+
+ {groups.map(group => (
+
+
+ {group.rows.map((row, i) => (
+
+ ))}
+
+ ))}
+
+ )
+}
+
+function ModelTableRow({ row }: { row: ModelReportRow }) {
const unpriced = row.costUSD === 0 && row.savingsUSD === 0
const cellClass = unpriced ? 'dim' : undefined
const tokenValue = (value: number) => (unpriced ? '—' : fmtCompact(value))
@@ -120,12 +150,6 @@ function ModelTableRow({ row, byTask }: { row: ModelReportRow; byTask: boolean }
{row.modelDisplayName}
- {byTask && row.category ? (
- <>
- {' · '}
- {row.category}
- >
- ) : null}
{unpriced ? (
<>
{' '}
@@ -142,3 +166,61 @@ function ModelTableRow({ row, byTask }: { row: ModelReportRow; byTask: boolean }
)
}
+
+function ModelGroupRow({ rows }: { rows: ModelReportRow[] }) {
+ const model = rows[0]
+ const calls = rows.reduce((sum, row) => sum + row.calls, 0)
+ const costUSD = rows.reduce((sum, row) => sum + row.costUSD, 0)
+ const savingsUSD = rows.reduce((sum, row) => sum + row.savingsUSD, 0)
+ const unpriced = costUSD === 0 && savingsUSD === 0
+
+ return (
+ |
+ |
+
+
+ {model.modelDisplayName}
+ {unpriced ? add alias › : null}
+
+ |
+ {fmtInt(calls)} |
+ |
+ |
+ |
+ {unpriced ? '—' : formatUsd(costUSD)} |
+ 0 ? 'pos' : undefined}>{unpriced ? '—' : formatUsd(savingsUSD)} |
+
+ )
+}
+
+function ModelTaskRow({ row }: { row: ModelReportRow }) {
+ const unpriced = row.costUSD === 0 && row.savingsUSD === 0
+ const cellClass = unpriced ? 'dim' : undefined
+ const tokenValue = (value: number) => (unpriced ? '—' : fmtCompact(value))
+
+ return (
+
+ | {row.category ?? 'general'} |
+ {fmtInt(row.calls)} |
+ {tokenValue(row.inputTokens)} |
+ {tokenValue(row.outputTokens)} |
+ {tokenValue(row.cacheReadTokens)} |
+ {unpriced ? '—' : formatUsd(row.costUSD)} |
+ 0 ? 'pos' : undefined}>{unpriced ? '—' : formatUsd(row.savingsUSD)} |
+
+ )
+}
+
+function groupTaskRows(rows: ModelReportRow[]) {
+ const groups = new Map()
+ for (const row of rows) {
+ const key = `${row.provider}\u0000${row.model}`
+ const group = groups.get(key)
+ if (group) group.rows.push(row)
+ else groups.set(key, { provider: row.provider, model: row.model, rows: [row] })
+ }
+ return [...groups.values()]
+}
diff --git a/app/renderer/sections/Spend.test.tsx b/app/renderer/sections/Spend.test.tsx
index e1eeea79..4c925c17 100644
--- a/app/renderer/sections/Spend.test.tsx
+++ b/app/renderer/sections/Spend.test.tsx
@@ -274,7 +274,7 @@ describe('Spend', () => {
expect(screen.getByText(/gpt-5.5-codex/)).toBeInTheDocument()
expect(screen.queryByText(/Opus 4.8/)).not.toBeInTheDocument()
expect(screen.queryByText(/GPT-5.5 Codex/)).not.toBeInTheDocument()
- expect(screen.getByText(/mobile-app/)).toBeInTheDocument()
+ expect(screen.getByText(/src\/mobile-app/)).toBeInTheDocument()
expect(screen.queryByText(/Users\/me\/src\/mobile-app/)).not.toBeInTheDocument()
const opusRibbon = container.querySelector('[data-testid="sankey-ribbon"][data-model="claude-opus-4-20260701"]')
diff --git a/app/renderer/styles/plain.css b/app/renderer/styles/plain.css
index e490a114..3615112a 100644
--- a/app/renderer/styles/plain.css
+++ b/app/renderer/styles/plain.css
@@ -291,6 +291,24 @@ body { overflow: hidden; background: var(--bg); color: var(--ink); }
.phead { border-color: var(--line2); }
.phead .r.link, a { color: var(--accent); }
.alias { color: var(--accent); }
+
+/* Models: grouped task lens. */
+.models-by-task { min-width: 660px; }
+.models-by-task .model-task-group + .model-task-group { border-top: 1px solid var(--line2); }
+.models-by-task .model-group-row td {
+ padding-top: 10px; padding-bottom: 10px; border-bottom: 0; background: var(--phead);
+ color: var(--ink); font-weight: 560;
+}
+.models-by-task .model-group-lead { display: flex; align-items: center; gap: 9px; }
+.models-by-task .model-group-row .mdot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
+.models-by-task .model-group-name { font-size: 13px; font-weight: 600; }
+.models-by-task .model-task-row td { position: relative; border-bottom: 0; }
+.models-by-task .model-task-row td::before {
+ content: ''; position: absolute; top: 0; right: 0; left: 0; height: 1px; background: var(--line2);
+}
+.models-by-task .model-task-row td:first-child { padding-left: 24px; font-weight: 500; }
+.models-by-task .model-task-row td:first-child::before { left: 22px; }
+.models-by-task .model-task-row td:last-child::before { right: 2px; }
.bars .b, .bars .c.hi .b, .bars .c.hi2 .b { background: var(--bar); box-shadow: none; }
.bars .c.hi .b { background: var(--bar-hi); }
.bars .c.hi2 .b { background: color-mix(in srgb, var(--bar-hi) 70%, var(--bar)); }