Problem
Agent plugins that enrich token data from external sources (e.g. Cursor's CSV server export) have no way to signal to the core UI whether a session's data is estimated (local heuristic) or enriched (server-verified). The core renders all sessions identically, so users can't tell which token counts are approximate and which are accurate.
This came up building @tokentop/agent-cursor: sessions appear immediately with estimated tokens (text.length / 4), then get backfilled with accurate data from Cursor's server. During the gap, there's no visual distinction.
Proposed solution
Add an optional metadata field to SessionUsageData:
export interface SessionUsageData {
// ... existing fields ...
/**
* Optional plugin-defined metadata passed through to the core.
* Plugins can use this to signal data quality, enrichment status,
* or other plugin-specific information the UI may choose to render.
*
* Known keys (convention, not enforced):
* - `isEstimated` (boolean) — true when token counts are local estimates
*/
metadata?: Record<string, unknown>;
}
This is a non-breaking, additive change. Existing plugins that don't set metadata are unaffected. The core decides how (or whether) to render metadata — plugins just expose the data.
Alternatives considered
- Prefix
sessionName with a marker (e.g. "≈ Session Name") — hacky, mixes display concerns into data
- Use absence of
cacheRead/cacheWrite as implicit signal — fragile, breaks for sessions that genuinely have no cache usage
- Add a dedicated
isEstimated boolean — too narrow; metadata bag is more extensible for future plugin needs
Area
Type definitions
Scope
Small (config, tweak, single type)
Additional context
Downstream issues:
- ttop: Propagate
metadata through AgentSessionAggregate and render an indicator in SessionsTable (separate issue)
- agent-cursor: Set
metadata.isEstimated in enrichWithCsvData() (will be implemented once SDK ships the type)
Implementation is ~3 lines in src/types/agent.ts. No runtime behavior change.
Problem
Agent plugins that enrich token data from external sources (e.g. Cursor's CSV server export) have no way to signal to the core UI whether a session's data is estimated (local heuristic) or enriched (server-verified). The core renders all sessions identically, so users can't tell which token counts are approximate and which are accurate.
This came up building
@tokentop/agent-cursor: sessions appear immediately with estimated tokens (text.length / 4), then get backfilled with accurate data from Cursor's server. During the gap, there's no visual distinction.Proposed solution
Add an optional
metadatafield toSessionUsageData:This is a non-breaking, additive change. Existing plugins that don't set
metadataare unaffected. The core decides how (or whether) to render metadata — plugins just expose the data.Alternatives considered
sessionNamewith a marker (e.g."≈ Session Name") — hacky, mixes display concerns into datacacheRead/cacheWriteas implicit signal — fragile, breaks for sessions that genuinely have no cache usageisEstimatedboolean — too narrow;metadatabag is more extensible for future plugin needsArea
Type definitions
Scope
Small (config, tweak, single type)
Additional context
Downstream issues:
metadatathroughAgentSessionAggregateand render an indicator inSessionsTable(separate issue)metadata.isEstimatedinenrichWithCsvData()(will be implemented once SDK ships the type)Implementation is ~3 lines in
src/types/agent.ts. No runtime behavior change.