report

package
v0.1.42 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MutatingTools = map[string]bool{
	"edit_file":   true,
	"edit_symbol": true,
	"write_file":  true,
	"create_file": true,
	"delete_file": true,
}

MutatingTools are tool names that change the filesystem. A turn that issues one of these (or a final answer that ships no tool calls) is counted as "productive" under BroCode's north-star efficiency metric (see internal/tokens/ratio.go and docs/PHILOSOPHY.md).

Functions

This section is empty.

Types

type AggregateReport

type AggregateReport struct {
	SessionCount          int     `json:"session_count"`
	TotalTurns            int     `json:"total_assistant_turns"`
	TotalToolCalls        int     `json:"total_tool_calls"`
	TotalFileChanges      int     `json:"total_file_changes"`
	TotalTokens           int     `json:"total_tokens"`
	TotalCostUSD          float64 `json:"total_estimated_cost_usd"`
	MeanProductivePct     int     `json:"mean_productive_ratio_pct"`
	SessionsWithAnomalies int     `json:"sessions_with_anomalies"`

	Models      []string       `json:"models"`
	AnomalyFreq map[string]int `json:"anomaly_frequency"`
}

AggregateReport summarizes a set of SessionReports — the cross-session benchmark view. Like SessionReport it contains only aggregate signals.

func Summarize

func Summarize(reports []*SessionReport) *AggregateReport

Summarize folds a set of reports into a single cross-session benchmark view.

func (*AggregateReport) RenderJSON

func (a *AggregateReport) RenderJSON() (string, error)

RenderJSON returns the indented JSON form.

func (*AggregateReport) RenderMarkdown

func (a *AggregateReport) RenderMarkdown() string

RenderMarkdown returns a compact cross-session summary.

type PhaseBreakdown added in v0.1.5

type PhaseBreakdown struct {
	Discovery    PhaseStats `json:"discovery"`    // search, read, list, locate
	Execution    PhaseStats `json:"execution"`    // edit, write, delete, bash, git
	Verification PhaseStats `json:"verification"` // test, diagnose, lsp, review
	Context      PhaseStats `json:"context"`      // memory, ask_user
}

PhaseBreakdown groups agent activity into canonical software engineering stages.

type PhaseStats added in v0.1.5

type PhaseStats struct {
	Calls    int      `json:"calls"`
	Failures int      `json:"failures"`
	Tools    []string `json:"tools,omitempty"`
}

PhaseStats aggregates metrics for a single engineering process phase.

type SessionReport

type SessionReport struct {
	SessionID   string    `json:"session_id"`
	ProjectPath string    `json:"project_path"`
	Mode        string    `json:"mode"`
	Models      []string  `json:"models"`
	CreatedAt   time.Time `json:"created_at"`
	DurationSec float64   `json:"duration_sec"`

	UserMsgs       int `json:"user_msgs"`
	AssistantTurns int `json:"assistant_turns"`
	ToolCalls      int `json:"tool_calls"`
	ToolResults    int `json:"tool_results"`
	ToolFailures   int `json:"tool_failures"`
	Compactions    int `json:"compactions"`
	FileChanges    int `json:"file_changes"`
	DistinctTools  int `json:"distinct_tools"`

	TotalTokens  int     `json:"total_tokens"`
	InputTokens  int     `json:"input_tokens"`
	OutputTokens int     `json:"output_tokens"`
	CostUSD      float64 `json:"estimated_cost_usd"`

	ProductivePct int `json:"productive_ratio_pct"`

	Phases PhaseBreakdown `json:"phases,omitempty"`

	Anomalies []string `json:"anomalies,omitempty"`
}

SessionReport is a fully aggregated, privacy-safe summary of one agent session. It intentionally contains NO message text, file contents, or secrets — only counts, token metrics, and heuristic anomaly flags. That makes it safe to export (md/json) as a real-world usage/benchmark dataset.

func Build

func Build(st *store.Store, sessionID string) (*SessionReport, error)

Build reconstructs a SessionReport from the persisted session + event log. It never reads message contents into the report — only numeric/structural signals — so the output is safe to share as a benchmark dataset.

func BuildAll

func BuildAll(st *store.Store, since time.Time) ([]*SessionReport, error)

BuildAll reconstructs reports for every session, optionally filtered to sessions created at or after `since` (zero time = no filter). Sessions that fail to load are skipped so one corrupt row never aborts a bulk export.

func (*SessionReport) RenderJSON

func (r *SessionReport) RenderJSON() (string, error)

RenderJSON returns the indented JSON form of the report.

func (*SessionReport) RenderMarkdown

func (r *SessionReport) RenderMarkdown() string

RenderMarkdown returns a human-readable report. It contains only aggregate metrics — never message text or file contents.

Jump to

Keyboard shortcuts

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