Expose context window usage to enable session handoff before context runs out
Problem
There's no way to know how much context has been consumed during a session. Work quality degrades silently as the window fills up — Claude forgets earlier file reads, loses architectural decisions, and gives contradictory suggestions. Auto-compaction helps extend sessions but discards context that may still be relevant.
When a session eventually ends, all in-session context is lost. Starting a new session requires manually reconstructing state: re-explaining decisions, re-reading files, re-describing the plan. For complex multi-file tasks this wastes significant time.
Proposal
Expose context usage metrics (tokens used / total) so that:
- Users can see how much context remains (status bar, indicator, or query)
- A warning can fire at a configurable threshold (e.g., 80%)
- A
/handoffcommand can generate a continuation prompt — session summary + next steps + key file paths — ready to paste into a fresh session
Why this matters
The harness already knows the exact token count, but neither Claude nor plugins can access it. Plugins like context-mem can compress tool outputs and provide cross-session memory, but they rely on heuristics to guess context usage — the harness exposing real metrics would make session management precise instead of approximate.
Environment
- Claude Code CLI, macOS
- Opus 4.6 (1M context)
- Heavy tool use sessions (file reads, edits, bash, web search)
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗