repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

extensions/context-size/README.md

Raw

context-size

Context-window usage telemetry for Pi.

Install / load

Loaded through the root pi-ext package. See root README.

Commands / tools / settings

Commands: none.

Tools: none.

Settings: none.

Hooks/events:

Emits:

Behavior

Shows current context-window usage as a token ratio plus a 10-cell bar.

If @bugabinga/pi-ext-footer is loaded, publishes a context-size footer segment in the llm zone. Otherwise uses Pi status text with id context-size.

Token counts are displayed in thousands, rounded.

Usage color:

No UI update runs when UI is unavailable.

Clears footer/status when context usage is unavailable. Clears status on session shutdown.

Markdown source
File outline
# context-size

Context-window usage telemetry for Pi.

## Install / load

Loaded through the root `pi-ext` package.
See [root README](../../README.md).

## Commands / tools / settings

Commands:
none.

Tools:
none.

Settings:
none.

Hooks/events:

- `session_start`
- `agent_start`
- `turn_end`
- `agent_end`
- `model_select`
- `session_compact`
- `session_shutdown`

Emits:

- `footer:segment` to publish/clear `context-size` footer segment.

## Behavior

Shows current context-window usage as a token ratio plus a 10-cell bar.

If `@bugabinga/pi-ext-footer` is loaded, publishes a `context-size` footer
segment in the `llm` zone.
Otherwise uses Pi status text with id `context-size`.

Token counts are displayed in thousands, rounded.

Usage color:

- `< 70%`:
  muted
- `≥ 70%`:
  warning
- `≥ 85%`:
  error
- unknown percent:
  muted

No UI update runs when UI is unavailable.

Clears footer/status when context usage is unavailable.
Clears status on session shutdown.