insights

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package insights derives structured observations from sessions and workspaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderJSON

func RenderJSON(w io.Writer, report Report) error

func RenderText

func RenderText(w io.Writer, report Report)

Types

type Options

type Options struct {
	Limit int
}

type PromptSummary

type PromptSummary struct {
	SessionID string `json:"session_id"`
	Index     int    `json:"index"`
	Text      string `json:"text"`
}

type Report

type Report struct {
	Kind              string           `json:"kind"`
	Sessions          int              `json:"sessions"`
	Messages          int              `json:"messages"`
	UserMessages      int              `json:"user_messages"`
	AssistantMessages int              `json:"assistant_messages"`
	Prompts           int              `json:"prompts"`
	ToolUses          int              `json:"tool_uses"`
	Usage             TokenTotals      `json:"usage"`
	TopTools          []ToolCount      `json:"top_tools,omitempty"`
	RecentSessions    []SessionSummary `json:"recent_sessions,omitempty"`
	RecentPrompts     []PromptSummary  `json:"recent_prompts,omitempty"`
}

func Build

func Build(store *session.Store, options Options) (Report, error)

type SessionSummary

type SessionSummary struct {
	ID                string      `json:"id"`
	Messages          int         `json:"messages"`
	UserMessages      int         `json:"user_messages"`
	AssistantMessages int         `json:"assistant_messages"`
	Prompts           int         `json:"prompts"`
	ToolUses          int         `json:"tool_uses"`
	Usage             TokenTotals `json:"usage"`
}

type TokenTotals

type TokenTotals struct {
	Input         int `json:"input"`
	Output        int `json:"output"`
	CacheCreation int `json:"cache_creation"`
	CacheRead     int `json:"cache_read"`
}

func (*TokenTotals) Add

func (t *TokenTotals) Add(usage anthropic.Usage)

func (*TokenTotals) Merge

func (t *TokenTotals) Merge(other TokenTotals)

type ToolCount

type ToolCount struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL