Skip to content

Context warnings trigger too early on 1M context window models #510

Closed

Description

@bowenZoo

Problem

gstack skills (especially /plan-eng-review) warn about context running low even when context usage is only ~27%. On a 1M context window (Claude Opus 4.6), 27% means ~730K tokens remaining — far from any real constraint.

Root Cause

The prompt in plan-eng-review/SKILL.md:307 contains:

"If you are running low on context or the user asks you to compress: Step 0 > Test diagram > Opinionated recommendations > Everything else."

This instruction makes the model context-anxious regardless of actual available space. The model doesn't have precise token-counting ability — it relies on heuristics like conversation length. When the prompt explicitly mentions context management, the model becomes overly cautious and starts warning/compressing prematurely.

This was likely calibrated for 200K context windows. On 1M models, the thresholds are completely wrong:

Context Used 200K remaining 1M remaining Should warn?
27% ~146K ~730K 200K: maybe. 1M: absolutely not
50% ~100K ~500K 200K: yes. 1M: no
80% ~40K ~200K Both: yes

Suggested Fix

Make context management context-window-aware. Options:

  1. Detect model context size — Check if the model has extended context (1M) and adjust thresholds accordingly. Could use a gstack-config setting like context_window: 1m.

  2. Remove the proactive instruction — Instead of telling the model to watch for low context, only react when Claude Code's own compaction system triggers. The system already handles this automatically.

  3. Add a user config — gstack-config set context_warning off to let users opt out of context management hints in the prompt.

Environment

  • gstack v0.11.19.0
  • Claude Opus 4.6 (1M context)
  • Skills affected: at least plan-eng-review, likely others with similar instructions

Activity

  1. claygeo commented on Jun 19, 2026

    @claygeo

    This looks resolved on main as of v0.13.7.0. plan-eng-review no longer tells the model to watch for "running low on context"; the priority-hierarchy line now reads "Do not preemptively warn about context limits -- the system handles compaction automatically," and test/gen-skill-docs.test.ts pins it with two regression tests (no generated SKILL.md may contain "running low on context"; plan-eng-review must contain "Do not preemptively warn"). A repo-wide search turns up no remaining preemptive-context phrasing in any shipped skill. Looks safe to close.

  2. time-attack commented on Jul 15, 2026

    @time-attack
    Contributor

    @16francej Please close this issue as resolved. Current main no longer guesses that context is low and warns too early; it reacts only to an explicit request or the host’s real compaction signal. That behavior shipped in #641.

  3. capy-ai commented on Oct 3, 2026

    @capy-ai
    Contributor

    plan-eng-review no longer tells the model to watch for low context; the template now says "The system handles context limits; do not preemptively warn" (plan-eng-review/SKILL.md.tmpl:81 on main). Fixed in v0.13.5.0 (#641).
    If you still see this on the latest gstack, please reopen with details.

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

Metadata

Metadata

Assignees

No one assigned

    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