feat(usage): attribute every auxiliary LLM call in canonical token usage
Open
@jbeda is already working on this.
Since Sep 7, 2026.
- Dominant language
- Go
- Stars
- 152
- Forks
- 16
- Avg merge
- 14h 48m
- Merged PRs (30d)
- 536
Description
Goal
Audit every model/provider invocation outside the normal agent-run stream and ensure its input/output usage is recorded in the canonical durable Session.tokenUsage ledger under a purpose-specific usage kind and server-selected provider/model attribution.
The session-title generator is the first migrated auxiliary caller (session_title). Other LLM-backed operations may currently discard usage or fold it into the main run incorrectly.
Acceptance criteria
- Inventory all composition/server/agent auxiliary LLM call sites, including their ownership, lifetime, session association, and current usage handling.
- For every session-associated call, record usage in a closed, purpose-specific canonical usage kind; preserve
Session.Usage,EvResult.Usage, andMaxRunTokensas main-run-only unless an explicitly documented policy says otherwise. - For calls that cannot be tied to a session, document the intentional accounting boundary rather than fabricating attribution.
- Preserve provider neutrality: do not widen
port.LLMRequestfor accounting or provider-private controls. - Add offline coverage for every migrated call and update living architecture/implementation documentation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.