Skip to content

[FEATURE]: Notify subagents when their context are running out #53030

Open

Description

@SodaWithoutSparkles

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

Follow up on #53024

This can, for example, notify subagent when a threshold of their context window usage passed a threshold (e.g. 40% or 70%), and telling them to "wrap up and report, your context window is running low". This avoids small models doing too much work and starts to hallucinate / create gibberish.

I searched "context subagent remind OR context subagent notify" without finding any relevant issues.

Activity

  1. github-actions commented on Oct 3, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    • #53024: Also discusses subagent context windows and explicitly proposes injecting a wrap-up instruction after a threshold is reached.
    • #44208: Requests configurable token-usage threshold alerts, including an agent-injected message as an option.
  2. opencodejr commented on Oct 27, 2026

    @opencodejr

    Thanks for the follow-up to #53024! You're asking for OpenCode to warn a subagent automatically when its context usage passes a set threshold (for example 40% or 70%), telling it to wrap up and report back, so smaller models don't keep going until they start making things up.

    Maintainers will consider it. Related issues:

    In the meantime, this could possibly be done as a v2 plugin, though I haven't built or tested one. The session context hook can add an instruction before each model request, and a plugin can tell when it is in a subagent session (one with a parent). It would need to compare the session's latest token usage against the model's context limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions