Context engineering
Type: note · Status: seedling · Tags: computational-model
The architecture and machinery for getting the right knowledge into a bounded context at the right time. Distillation — compressing knowledge for a specific task under a context budget — is the main operation, but not the only one. Routing (what not to load), scoping (what each consumer sees), and maintenance (pruning accumulated debris) are also context engineering operations. Context engineering is the system that orchestrates all of these.
Anthropic defines it as "strategies for curating and maintaining the optimal set of tokens during LLM inference" (Anthropic, 2025). This KB's treatment is consistent but more structural — context engineering decomposes into components:
Routing — deciding what knowledge is relevant before loading it. The instruction-specificity/loading-frequency match (always-loaded → on-reference → on-invoke → on-demand) is routing. CLAUDE.md as a router is routing. Retrieval-oriented descriptions that let agents decide "don't follow this" without loading the target are routing.
Loading — assembling the prompt from selected knowledge. The select function in the bounded-context orchestration model formalizes this: given state K and budget M, build prompt P with |P| ≤ M. Loading includes both what to include and how to frame it — the same knowledge under different framing has different extractable value.
Scoping — isolating what each consumer sees. Sub-agents as lexically scoped frames is scoping. The flat context has no scoping; architecture must impose it.
Maintenance — keeping loaded context healthy over time. Compaction, observation masking, and the workshop layer's holistic-rewrite discipline are maintenance. Without maintenance, context accumulates debris that degrades reasoning even when token counts are low.
The bounded-context orchestration model is the formal treatment of this machinery — the solve loop where the symbolic scheduler drives routing, loading, and scoping decisions for each bounded LLM call.
Relevant Notes:
- distillation — the main operation context engineering performs: compressing knowledge for a task under a budget
- context efficiency is the central design concern — motivation: why context engineering matters (context is the scarce resource)
- bounded-context orchestration model — formalisation: the select/call loop that structures context engineering decisions
- instruction specificity should match loading frequency — mechanism: the routing hierarchy (always-loaded → on-demand)
- LLM context is composed without scoping — mechanism: sub-agents as the scoping component
- agents navigate by deciding what to read next — mechanism: routing through retrieval-oriented descriptions
- legal drafting solves the same problem as context engineering — parallel: law's centuries of methodology for the same problem
- in-context learning presupposes context engineering — extends: in-context learning only works when context engineering has selected the right knowledge; this makes context engineering a prerequisite, not just an optimization