Expand description
Session analysis types and functions.
This module computes analytics from parsed Session data. Analysis is intentionally in the CLI, not the parsing library, because what metrics matter is subjective and consumer-specific.
Structs§
- Command
Category - Command
Detail - Detail for a specific command pattern within a category.
- Command
Stats - Statistics for a command category (e.g., “build”, “test”, “git”).
- Correction
- An assistant correction or apology.
- Cost
Breakdown - Cost breakdown for a session.
- Dedup
Token Stats - Token deduplication statistics.
- Error
Pattern - A recurring error pattern.
- File
Operation - File operation statistics.
- Largest
Tool Result - A single large tool result, for the top-N results by character count.
- Model
Pricing - Model pricing information (per million tokens).
- Retry
Hotspot - A command pattern that failed and was retried.
- Session
Analysis Report - Complete analysis of a session.
- Token
Stats - Token usage statistics.
- Tool
Chain - A sequence of consecutive single-tool calls (potential parallelization).
- Tool
Pattern - A common tool pattern across sessions.
- Tool
Stats - Statistics for a single tool.
Enums§
- Correction
Kind - Type of correction made by the assistant.
Functions§
- analyze_
session - Analyze a parsed session and compute statistics.
- categorize_
command - Categorize a single shell command and return category + normalized pattern.
- categorize_
error - Categorize an error by its content.
- detect_
correction - Detect correction patterns in assistant text. Returns (category, excerpt) if a correction is found.
- extract_
tool_ patterns - Extract all subsequences of length 2-5 from tool chains.
- normalize_
path - Normalize a file path for aggregation.