Skip to content

a5c-ai/babysitter / library/methodologies/gsd/skills/context-engineering

context-engineering

Verified

Context window monitoring and budget management. Keeps orchestrator at 15-30% context usage while subagents get full 200k tokens. Provides warnings at thresholds, context-aware summarization triggers, and wave-level budget planning.

FileKindSize
README.mdmarkdown2.1 KB
SKILL.mdskill md7.1 KB
# context-engineering

Context window monitoring and budget management for GSD orchestration.

## Quick Start

Context engineering prevents context rot -- the quality degradation that occurs as the context window fills up. The orchestrator stays lean (15-30% usage) while subagents get fresh 200k-token context each.

### Check Current Usage

Context usage is estimated from cumulative tool output sizes and conversation history.

### Threshold Warnings

- **70%**: Warning - consider summarizing completed work
- **85%**: Critical - spawn new subagent for remaining work
- **95%**: Emergency - save state and exit immediately

### Plan Wave Budgets

Before executing a multi-wave phase, estimate context budget:
- Each agent spawn costs ~3% of orchestrator context
- Each agent result processing costs ~2%
- Total orchestrator usage should stay under 30%

## Examples

### Healthy Orchestrator Session

```
Tokens: ~35,000 / 200,000 (17.5%)
Status: HEALTHY
3 agent spawns completed, 2 remaining
Budget: on track (estimated total: 28%)
```

### Context Warning

```
[CONTEXT 70%] Warning: Context window at 70%.
Recommendation: Summarize completed wave results before spawning next wave.
```

### Emergency Wrap-Up

```
[CONTEXT 95%] Emergency: Context window at 95%.
Actions taken:
1. Updated STATE.md with current position
2. Committed all pending changes
3. Created continue-here.md with handoff context
```

## Troubleshooting

### Context fills too quickly
- Check if large files are being read in full (use targeted reads instead)
- Ensure agent results are being summarized, not passed verbatim
- Verify wave parallelization is enabled (reduces sequential context accumulation)

### Budget estimates are off
- Token estimation uses character/4 heuristic, which is approximate
- Adjust `agentSpawnCost` and `agentResultCost` in config if estimates are consistently wrong
- Consider using `quality` profile for complex work (fewer iterations = less context)

### Emergency threshold triggered too early
- Review orchestrator workflow for inline work that should be delegated to agents
- Increase summarization frequency between waves
- Consider splitting large phases into sub-phases
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall