Versions in this module Expand all Collapse all v1 v1.1.2 Nov 25, 2026 v1.1.1 Nov 25, 2026 Changes in this version + const DefaultRetentionDays + func DayStart(t time.Time) time.Time + func Summarize(records []Record, now time.Time) metrics.UsageSummary + func WeekStart(t time.Time) time.Time + type Live struct + func NewLive(store *Store) *Live + func (l *Live) Summary() (metrics.UsageSummary, error) + type MechanismSavings struct + Calls int64 + Estimator string + IsCost bool + Measured bool + Mechanism string + Notes string + OriginalTokens int64 + ResultingTokens int64 + SavedTokens int64 + func (m MechanismSavings) SavedPercent() float64 + type Record struct + Estimator string + PID int + SessionID string + Snapshot metrics.MetricsSnapshot + Timestamp time.Time + func NewRecord(sessionID string) Record + type SavingsReport struct + EstimatedCostSaved *float64 + Estimator string + ExtraTurnsEstimate int64 + GeneratedAt time.Time + Mechanisms []MechanismSavings + Methodology string + PerSession []SessionSummary + PricePerMTok *float64 + SessionCount int + Since time.Time + TopServersByResponseSize []ToolSize + TopToolsByResponseSize []ToolSize + TotalOriginalTokens int64 + TotalSavedPercent float64 + TotalSavedTokens int64 + func BuildSavingsReport(records []Record, since time.Time, pricePerMTok *float64) SavingsReport + func (r SavingsReport) CSV(w io.Writer) error + func (r SavingsReport) JSON() ([]byte, error) + func (r SavingsReport) Markdown(by string) string + func (r SavingsReport) Text(by string) string + type SessionSummary struct + SessionID string + Timestamp time.Time + TotalOriginalTokens int64 + TotalSavedTokens int64 + type Store struct + func NewStore() (*Store, error) + func NewStoreWithDir(dir string) (*Store, error) + func (s *Store) Append(rec Record) error + func (s *Store) Dir() string + func (s *Store) Load(since time.Time) ([]Record, error) + func (s *Store) Prune(retention time.Duration) (int, error) + type ToolSize struct + Calls int64 + OriginalTokens int64 + Tool string