[Feature Request] Add context awareness and pre-compaction hooks for parallel agent sessions

Resolved 💬 6 comments Opened Feb 13, 2026 by FlowTether Closed May 1, 2026

Bug Description
Subject: Feature request — Claude Code needs built-in context awareness before compaction

Please route to an engineer. This is a product gap, not a support question.

Claude Code has no built-in mechanism for users or the model to know how much context remains before compaction fires. The "Context left until auto-compact" message only appears below ~10% remaining, which is far too late — especially with parallel agents.

Real example from last night: I had 4-5 Task agents running. They finished and started reporting back to the main session. Their reports are large tool outputs that burn context fast. The main CC got compacted mid-receive — right as agents were delivering their results. The agent reports appear to have arrived into already-compacted context, meaning they were effectively empty. The main CC then had to redo the work the agents had already completed. Multiple agents' worth of work, lost, because there was no warning with enough headroom to do anything about it.

With parallel agents, 10% remaining is seconds, not minutes. A warning at that threshold is not a warning — it's a notification that you've already lost.

I've built my own system to fill this gap — a statusline meter reading context_window.used_percentage, a Stop hook that fires at 35% remaining so the model can write a session log while it still has full context, and a session logging command that captures decisions and state. It works. But I should not have had to build it.

The pieces are already there inside Claude Code. The statusline JSON exposes used_percentage. Hooks can fire after responses. The auto-compact threshold exists internally. They just aren't connected into anything user-facing.

What this needs at the product level:

  1. A visible context usage indicator in the CLI — not just a late warning, a persistent meter
  2. A configurable pre-compaction hook that fires at a user-defined threshold (I use 35%) with enough remaining context for the model to perform cleanup actions before compaction
  3. These reading from the same authoritative number (currently used_percentage and auto-compact disagree by ~15 points)

This is the single most important resource in Claude Code and there's currently near-zero visibility into it. Anyone running sessions longer than 20 minutes or using parallel agents is flying blind.

https://i.gyazo.com/7262e4a202e4216937c4a34c309c4afd.png

Thanks —
Kiera

Environment Info

  • Platform: win32
  • Terminal: null
  • Version: 2.1.39
  • Feedback ID: c63c471e-b8a3-4d9e-a077-0607743bb70f

Note: Content was truncated.

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗