Help us shape the future of Go! Take the 2026 Go Developer Survey

metrics

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package metrics is effectiveness accounting (SPEC-ADDITIONS §16): it optimizes useful outcomes per unit of scarce human attention, not raw activity. A regression is more attention per accepted arc, not fewer arcs.

Index

Constants

View Source
const LedgerFile = ".adh/metrics.json"

LedgerFile is the effectiveness ledger path (§16): a JSON array of Records a closed arc appends its cost to.

Variables

This section is empty.

Functions

This section is empty.

Types

type Record

type Record struct {
	Arc              string `json:"arc"`
	AttentionMinutes int    `json:"attention_minutes"`
	ComputeTokens    int    `json:"compute_tokens"`
	Accepted         bool   `json:"accepted"`
}

Record is one closed arc's cost.

func Load

func Load(path string) ([]Record, error)

Load reads the effectiveness ledger at path. A missing file is empty (not an error); a malformed one is EINVALID. It is the thin I/O shell around the pure Summarize core.

type StepClass

type StepClass struct {
	Deterministic int `json:"deterministic"`
	Model         int `json:"model"`
}

StepClass counts an arc's history transitions resolved deterministically (evaluation, gate, commit, close) versus those that took a relayed model turn (a strategy/execution/critic reply) — the effectiveness north-star (§16): accretion (routing rules, checks, lessons) should drive the model share down over time. It is a coarse proxy classified from history text — a direction to watch, not a gate.

func ClassifyHistory

func ClassifyHistory(history []string) StepClass

ClassifyHistory classifies each history line as a deterministic step or a relayed model turn (§16). A line matching neither taxonomy is ignored, so the ratio counts only classified steps. It is pure.

func (StepClass) Add

func (c StepClass) Add(other StepClass) StepClass

Add sums two step classes, for aggregating over many arcs.

func (StepClass) Ratio

func (c StepClass) Ratio() float64

Ratio is the deterministic share of classified steps (0 when none classified) — the north-star to watch trend upward as accretion shrinks the model surface.

type Summary

type Summary struct {
	Arcs               int     `json:"arcs"`
	Accepted           int     `json:"accepted"`
	AttentionMinutes   int     `json:"attention_minutes"`
	ComputeTokens      int     `json:"compute_tokens"`
	AttentionPerAccept float64 `json:"attention_per_accept"`
}

Summary aggregates records over a period. The json tags exist because Summary is now a payload: `metrics --jsonl` emits it directly, and without them a consumer would read Go field names where every other envelope in this family is snake_case. Free to add now — before this it was never serialised, so no consumer can be relying on the capitalised form.

func Summarize

func Summarize(records []Record) Summary

Summarize aggregates records. AttentionPerAccept — the headline effectiveness figure — divides attention by accepted arcs (never by zero).

func (Summary) AttentionDelta

func (s Summary) AttentionDelta(prev Summary) float64

AttentionDelta returns this period's attention-per-accept minus the prior period's. A positive delta is a regression (more attention per outcome).

Jump to

Keyboard shortcuts

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