Skip to content

feat(statistics): add canonical SessionUsageRecord and nano-USD cost primitives - #29

Open
efirvida wants to merge 1 commit into
upstream/statistics-trackerfrom
upstream/statistics-01-usage-record
Open

efirvida wants to merge 1 commit into
upstream/statistics-trackerfrom
upstream/statistics-01-usage-record

Conversation

@efirvida

@efirvida efirvida commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Chain Context

Field Value
Chain per-session statistics module (upstream Gentleman-Programming#1583)
Tracker upstream/statistics-tracker → upstream integration PR Gentleman-Programming#1627 (draft)
Position 1 of 27
Base upstream/statistics-tracker
Depends on None — first slice
Follow-up upstream/statistics-01-usage-record (slice 2)
Review budget 345 / 400
Starts at upstream/statistics-tracker
Ends with feat(statistics): add canonical SessionUsageRecord and nano-USD cost primitives

Chain Overview

upstream/main
 └── upstream/statistics-tracker (root, integration PR #1627)
      └── … slices 1..0 …
           └── 📍 upstream/statistics-01-usage-record
                └── … slices 2..27 …

Scope

  • Includes: feat(statistics): add canonical SessionUsageRecord and nano-USD cost primitives
  • Excludes: every other slice. A polluted diff against upstream/statistics-tracker is a branching bug, not a scope surprise.

Verification

Focused and affected suites are green on this slice; tests and docs for this unit ship with it.

…primitives

Define the single canonical usage shape every statistics issue consumes
(SessionUsageRecord, UsageTokens, TimeSegment, TurnRecord) and the money
primitive: integer nano-USD, exact for the provider's nine-decimal costs,
with a UsageCost that keeps a reported $0 distinct from an absent cost.

Expose the pure ingestion seam I1 and I2 need (sessionCostFromEntries,
childUsageCost, accumulateTaskCost, delegatedCostFromTasks) over plain
shapes, so the agent code only adapts and a future plugin can reuse the
same no-coercion rule without dragging statistics logic into the core.

Tests cover present, reported-zero and absent components, exact
nine-decimal summation, and the delegated fold.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant