feat: context window size awareness for 1M+ models (#1086)

GSD was designed around 200k context windows. With Opus 4.6 / Sonnet 4.6
shipping 1M context at standard pricing, GSD should adapt its strategies.

Changes:
- Add context_window config option (default: 200000, configurable to 1000000)
- Expose context_window in init output so workflows can adapt behavior
- Update execute-phase.md to note context-size-dependent strategies:
  - 200k: paths-only executor context, 10-15% orchestrator budget
  - 1M+: richer context passing, inline small phases, relaxed /clear
- Context monitor already uses percentage-based thresholds (adaptive)

Users can opt in via config.json:
  { "context_window": 1000000 }

Addresses #1086
This commit is contained in:
Tom Boucher
2026-03-17 07:49:14 -04:00
parent fc468adb42
commit 0377951a04
3 changed files with 13 additions and 3 deletions

View File

@@ -65,6 +65,7 @@ function loadConfig(cwd) {
parallelization: true,
brave_search: false,
resolve_model_ids: false, // when true, resolve aliases (opus/sonnet/haiku) to full model IDs
context_window: 200000, // default 200k; set to 1000000 for Opus/Sonnet 4.6 1M models
};
try {
@@ -108,6 +109,7 @@ function loadConfig(cwd) {
parallelization,
brave_search: get('brave_search') ?? defaults.brave_search,
resolve_model_ids: get('resolve_model_ids') ?? defaults.resolve_model_ids,
context_window: get('context_window') ?? defaults.context_window,
model_overrides: parsed.model_overrides || null,
};
} catch {

View File

@@ -31,6 +31,7 @@ function cmdInitExecutePhase(cwd, phase, raw) {
// Config flags
commit_docs: config.commit_docs,
parallelization: config.parallelization,
context_window: config.context_window,
branching_strategy: config.branching_strategy,
phase_branch_template: config.phase_branch_template,
milestone_branch_template: config.milestone_branch_template,

View File

@@ -191,8 +191,9 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
2. **Spawn executor agents:**
Pass paths only — executors read files themselves with their fresh 200k context.
This keeps orchestrator context lean (~10-15%).
Pass paths only — executors read files themselves with their fresh context window.
For 200k models, this keeps orchestrator context lean (~10-15%).
For 1M+ models (Opus 4.6, Sonnet 4.6), richer context can be passed directly.
```
Task(
@@ -652,7 +653,13 @@ Only suggest the commands listed above. Do not invent or hallucinate command nam
</process>
<context_efficiency>
Orchestrator: ~10-15% context. Subagents: fresh 200k each. No polling (Task blocks). No context bleed.
Orchestrator: ~10-15% context for 200k windows, can use more for 1M+ windows.
Subagents: fresh context each (200k-1M depending on model). No polling (Task blocks). No context bleed.
For 1M+ context models, consider:
- Passing richer context (code snippets, dependency outputs) directly to executors instead of just file paths
- Running small phases (≤3 plans, no dependencies) inline without subagent spawning overhead
- Relaxing /clear recommendations — context rot onset is much further out with 5x window
</context_efficiency>
<failure_handling>