Why
Long agentic sessions eat context. Users should be able to see where tokens go — like /cost shows spend, /context should show context-window usage.
What
New slash command /context that prints a breakdown of the current session's context usage:
- System prompt (core + project rules) tokens
- Conversation messages (user / assistant / tool results)
- Tool schemas
- Total vs the active tier's context window, with a simple bar/percentage
- Current compaction state (has the session been compacted? ledger size?)
A bytes/4 token estimate is fine — consistency matters more than exactness. Keep one estimation helper as the single source of truth so /context, compaction, and the sidebar all agree.
Where to start
src/screens/repl.ts — SLASH_COMMANDS catalog + handleSlashCommand()
src/agent/compaction.ts — existing char/token budget helpers (charBudgetForWindow)
- Sidebar stats already track token counts — reuse, don't duplicate
Acceptance criteria
/context renders the breakdown in the transcript
- Appears in slash autocomplete with a description
bun run typecheck and bun test green
Why
Long agentic sessions eat context. Users should be able to see where tokens go — like
/costshows spend,/contextshould show context-window usage.What
New slash command
/contextthat prints a breakdown of the current session's context usage:A bytes/4 token estimate is fine — consistency matters more than exactness. Keep one estimation helper as the single source of truth so
/context, compaction, and the sidebar all agree.Where to start
src/screens/repl.ts—SLASH_COMMANDScatalog +handleSlashCommand()src/agent/compaction.ts— existing char/token budget helpers (charBudgetForWindow)Acceptance criteria
/contextrenders the breakdown in the transcriptbun run typecheckandbun testgreen