[FEATURE]: expose current context window usage in agent state #7107

Open
opened 2026-02-16 18:06:12 -05:00 by yindo · 0 comments
Owner

Originally created by @HicaroD on GitHub (Jan 21, 2026).

Originally assigned to: @thdxr on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

My goal is to optimize my workflow by operating within the 'smart zone'—which I define as keeping context window usage between 0-40%.

Currently, staying in this zone requires me to manually monitor the agent and halt execution if it exceeds 40%.

Ideally, it would be awesome to have a way to retrieve the agent's current state, specifically the context window usage percentage. This would allow me to automate my workflow and prevent the agent from crossing this threshold.

Why would you possibly want this on your workflow?

Let's say you are using some sorta of Ralph-like workflow for development, your workflow would get lots of benefits to add this new feature to the loop.

Your prompt could add instructions to pool information about the context window. If it is too close to 40% (or any percentage you want), you would ask to halt its own execution, sync your progress file and create a new session to keep working.

Originally created by @HicaroD on GitHub (Jan 21, 2026). Originally assigned to: @thdxr on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request My goal is to optimize my workflow by operating within the 'smart zone'—which I define as keeping context window usage between 0-40%. Currently, staying in this zone requires me to manually monitor the agent and halt execution if it exceeds 40%. Ideally, it would be awesome to have a way to retrieve the agent's current state, specifically the context window usage percentage. This would allow me to automate my workflow and prevent the agent from crossing this threshold. ### Why would you possibly want this on your workflow? Let's say you are using some sorta of Ralph-like workflow for development, your workflow would get lots of benefits to add this new feature to the loop. Your prompt could add instructions to pool information about the context window. If it is too close to 40% (or any percentage you want), you would ask to halt its own execution, sync your progress file and create a new session to keep working.
yindo added the discussion label 2026-02-16 18:06:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7107