Skip to content
Developer Preview

session/contextUsage

A provider-reported context-occupancy fact folded to a changed (windowTokens, usedTokens, pressure) triple.

Type: SessionContextUsageParams

session/contextUsage params: context-window pressure — the counted-once occupancy at the latest provider-reported durable fact, joined with the host’s pressure basis. Replace wholesale; emitted only when the (windowTokens, usedTokens, pressure) triple changes value (identical adoptions emit nothing).

Field Type Stability Presence Description
pressure ContextPressureLevel required Server-computed pressure level over the basis thresholds.
sessionId string required The owning session.
sourceRange SourceRange required The durable records this event folded from.
usedTokens integer required Counted-once prompt tokens plus output tokens of the driving record, saturating — the honest occupancy floor.
viewCursor string required Opaque, strictly monotonic view cursor.
windowTokens integer optional The effective context-window size from the host’s pressure basis; absent when the basis has no limit — the limit part is omitted, never invented.
Source

schema/msp/experimental/msp.schema.json#/notifications/session~2FcontextUsage

{
"description": "A provider-reported context-occupancy fact folded to a changed (windowTokens, usedTokens, pressure) triple.",
"params": {
"$ref": "#/$defs/SessionContextUsageParams"
}
}