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: