Versions in this module Expand all Collapse all v1 v1.3.4 Apr 9, 2026 v1.3.3 Feb 18, 2026 v1.3.2 Feb 14, 2026 v1.3.1 Feb 9, 2026 Changes in this version + func InitReadOnly() error v1.3.0 Feb 9, 2026 Changes in this version + func BeginTx() (*sql.Tx, error) + func DeleteSessionMessages(sessionID string) error + func GetIndexedSessions() (map[string]time.Time, error) + func GetMaxIndexedAtByTool() (map[string]time.Time, error) + func TxDeleteSessionMessages(tx *sql.Tx, sessionID string) error + func TxInsertMessage(tx *sql.Tx, msg Message) error + func TxInsertSession(tx *sql.Tx, sess Session) error + func TxInsertSessionSimple(tx *sql.Tx, id, project, firstQuery, filePath, tool string, msgCount int) error + type ModelUsageSummary struct + CostUSD float64 + InputTokens int + OutputTokens int + Sessions int + TotalTokens int + type RecentSession struct + CostUSD float64 + FirstQuery string + ID string + IndexedAt time.Time + InputTokens int + MessageCount int + Model string + OutputTokens int + Project string + Provider string + Tool string + type ToolUsageSummary struct + CostUSD float64 + InputTokens int + OutputTokens int + Sessions int + TotalTokens int + type UsageStats struct + SessionCount int + TotalCacheRead int + TotalCacheWrite int + TotalCostUSD float64 + TotalInputTokens int + TotalOutputTokens int + TotalTokens int v1.2.0 Feb 7, 2026 Changes in this version + const ProjectStatusActive + const ProjectStatusArchived + const ProjectStatusInactive + const SessionDurationHours + func AddProjectManually(path string) error + func ClassifyProjects() error + func ClearIndex() error + func CloseDB() + func DeleteProject(path string) error + func GetAPICredentials() ([]string, error) + func GetDB() *sql.DB + func GetProjectsForOnboarding() (active []Project, inactive []Project, err error) + func GetRecentSessions(limit int) ([]map[string]interface{}, error) + func GetStats() (int, int, error) + func GetTokenStatsByProvider(days int) (map[string]TokenStats, error) + func GetUsageByToolForActiveBlock(provider string) ([]ToolUsageStats, *SessionBlock, error) + func GetUsageStats() (map[string]interface{}, error) + func GetUsageStatsByModel() (map[string]map[string]interface{}, error) + func GetUsageStatsByTool() (map[string]map[string]interface{}, error) + func InitDB() error + func InsertMessage(msg Message) error + func InsertSession(sess Session) error + func InsertSessionSimple(id, project, firstQuery, filePath, tool string, msgCount int) error + func InsertTokenUsage(usage TokenUsage) error + func MergeProjects(oldPath, newPath string) (int, int, error) + func OpenReadOnlySQLite(path string) (*sql.DB, error) + func PruneStaleProjects() (int, error) + func SetAPICredential(provider string) error + func SetProjectUserEnabled(path string, enabled bool) error + func UpdateSessionTokens(sessionID string, inputTokens, outputTokens, cacheRead, cacheWrite int, ...) error + func UpsertProject(path string, lastActivity time.Time) error + type Message struct + Agent string + CacheReadTokens int + CacheWriteTokens int + Content string + CostUSD float64 + Date string + ID int64 + InputTokens int + MessageUUID string + Model string + OutputTokens int + ParentUUID string + Project string + Provider string + ReasoningTokens int + Role string + SessionID string + Timestamp time.Time + Tool string + WorkingDirectory string + type Project struct + CreatedAt time.Time + ID int64 + LastActivity time.Time + Name string + Path string + Status string + UserEnabled bool + func GetEnabledProjects() ([]Project, error) + func GetProjectByPath(path string) (*Project, error) + func GetProjects() ([]Project, error) + func GetProjectsByStatus(status string) ([]Project, error) + type SearchResult struct + Content string + Model string + Project string + Provider string + Rank float64 + Role string + SessionID string + Snippet string + Tool string + func Search(query string, limit int) ([]SearchResult, error) + type Session struct + Agent string + CLIVersion string + Date string + EndTime time.Time + FilePath string + FirstQuery string + GitBranch string + ID string + IndexedAt time.Time + MessageCount int + Model string + Project string + Provider string + StartTime time.Time + Tool string + TotalCacheRead int + TotalCacheWrite int + TotalCostUSD float64 + TotalInputTokens int + TotalOutputTokens int + TotalReasoningTokens int + WorkingDirectory string + type SessionBlock struct + ActualEndTime time.Time + CacheRead int + CacheWrite int + CostUSD float64 + EndTime time.Time + ID string + InputTokens int + IsActive bool + IsGap bool + MessageCount int + Models []string + OutputTokens int + Providers []string + ResetTime *time.Time + SessionCount int + StartTime time.Time + func GetActiveBlock() (*SessionBlock, error) + func GetRecentBlocks(count int) ([]SessionBlock, error) + func GetSessionBlocks(days int) ([]SessionBlock, error) + func IdentifySessionBlocks(entries []UsageEntry) []SessionBlock + func (b SessionBlock) CostPerHour() float64 + func (b SessionBlock) DurationMinutes() float64 + func (b SessionBlock) ProjectedCost() float64 + func (b SessionBlock) ProjectedTokens() int + func (b SessionBlock) RemainingTime() time.Duration + func (b SessionBlock) TokensPerMinute() float64 + func (b SessionBlock) TotalTokens() int + type SessionMatch struct + BestRank float64 + FinalScore float64 + FirstQuery string + MatchCount int + MessageCount int + Project string + SessionID string + Snippet string + SnippetRole string + StartTime time.Time + Tool string + func SearchGrouped(query string, limit int) ([]SessionMatch, error) + type TokenStats struct + SessionCount int + TotalCacheRead int + TotalCacheWrite int + TotalCostUSD float64 + TotalInputTokens int + TotalOutputTokens int + TotalTokens int + func GetTokenStats(days int) (TokenStats, error) + type TokenUsage struct + CacheReadTokens int + CacheWriteTokens int + CostUSD float64 + InputTokens int + Model string + OutputTokens int + Provider string + SessionID string + Timestamp time.Time + TotalTokens int + type ToolUsageStats struct + CacheRead int + CacheWrite int + InputTokens int + OutputTokens int + Provider string + SessionCount int + Tool string + TotalTokens int + func GetUsageByToolInWindow(provider string, windowStart, windowEnd time.Time) ([]ToolUsageStats, error) + type UsageEntry struct + CacheReadTokens int + CacheWriteTokens int + CostUSD float64 + InputTokens int + Model string + OutputTokens int + Provider string + SessionID string + Timestamp time.Time + func GetUsageEntries(days int) ([]UsageEntry, error) v1.1.0 Jan 29, 2026