context-engineering
Installation
SKILL.md
Context Engineering Skill
Goal
Engineer what enters the model's context window — and what stays out — so an agent stays reliable and cheap as its task grows. The context window is a finite, contended resource: every token of system prompt, tool schema, message history, retrieved document, and tool output competes for the same budget, and quality degrades as the window fills ("context rot"). The objective is to deliberately decide, at each step, what the model needs to see right now, using four strategies — Write, Select, Compress, Isolate — rather than letting history accumulate by default.
Steps
-
Set a context-window budget
- Treat the window as a budget, not a container. Reserve named slices: a fixed allocation for system/developer instructions and tool schemas, a slice for retrieved knowledge, a slice for working history, and headroom for the model's own output.
- Account for "context rot": retrieval accuracy and instruction-following degrade well before the hard token limit, so target a soft ceiling (often a fraction of the maximum) rather than filling to the edge.
- Measure actual token counts per slice; do not estimate by character count.
-
WRITE — persist state outside the window
- Move durable state to scratchpads, files, or a memory store the agent can re-read on demand, instead of carrying it in every turn.
- Use structured note-taking: have the agent record decisions, open questions, and intermediate results to an external note it owns, so a long task survives context truncation or a fresh sub-agent.
- This is where GABBE's memory layers do the heavy lifting — defer to
working-memory.skillfor short-horizon scratch state andepisodic-consolidation.skillfor distilling completed episodes into durable memory. Do not reimplement those layers here; this skill decides what to write and when, they decide how it is stored.