Skip to main content

Module classify

Module classify 

Source
Expand description

Heuristic task-type classification (debugging vs feature work vs refactor…).

Breaks total spend down by what the user was actually doing, so a glance at the report answers “where did my tokens go?” in human terms rather than per model/day. Each session is bucketed into one TaskType from two weak signals only — the prompt text the user typed (Event::content_summary on EventKind::User events) and the histogram of tool names the agent ran. No file contents, paths, or tool inputs are available (see [ToolCall]), so the classifier is deliberately coarse and reports a confidence and the signals it fired on rather than pretending to be certain.

Spend is rolled up the same way as super::aggregate: deduplicated per request (CLAUDE.md §8.1) and folded from sub-agent transcripts into the parent session’s row (§8.3), so the per-type totals here reconcile with the summary grand totals. Classification of a folded group is taken from its representative (non-sidechain) session; spend always sums across the whole group.

Structs§

ClassifyReport
Everything the renderers need for the task-type breakdown.
SessionClass
One classified session row (sub-agent transcript spend folded into it).
TaskTypeRollup
Spend for one TaskType, summed over every session classified into it.

Enums§

TaskType
What the user was doing in a session, inferred from prompt text + tool mix.

Functions§

classify
Classify each session by task type and roll deduplicated spend up per type.