- 01. The seven layers that make up every AI product's context -- named as a mnemonic so you never forget them.
- 02. How missing one specific layer creates one specific failure -- and how to read the failure backwards to find the missing layer.
- 03. Why this framework works as both a design checklist when you're building and a diagnostic tool when something has gone wrong in production.
- 04. The minimum viable context for the simplest AI products and the full seven-layer stack for the most complex ones.
The Story
Within a week of shipping a wealth-advisor AI to 200 advisors, three failures showed up — each one tracing back to a different missing layer of context. The engineering team had done everything right by conventional standards: a detailed system prompt, a RAG pipeline that retrieved research reports, tools that could look up portfolio positions and run risk calculations. None of it was enough.
The assistant launches to 200 advisors. Within a week, three patterns emerge.
First, the assistant keeps recommending investment strategies that the firm's compliance department has flagged as unsuitable. The system prompt says "follow regulations," but no specific compliance rules are loaded. Second, when an advisor asks a follow-up question referencing something discussed five minutes earlier, the assistant responds as if hearing the topic for the first time. Third, the assistant gives beautiful narrative responses when the advisor needs a specific table of portfolio allocations.
Three failures. Three missing layers. The team had instructions (Constitution) and knowledge (kNowledge) and tools (Equipment). They were missing specific compliance constraints, conversation memory (Tracks), and output structure (Template). Each missing layer produced a distinct, predictable failure.
The Core Idea
Once you understand that context is a system (Topic 1) with a container that degrades (Topic 2), the next question is practical: what actually goes into the context window? The CONTEXT framework provides that list. Seven layers, named as a mnemonic so they stick.
The CONTEXT framework is a seven-layer architecture -- Constitution, Observations, kNowledge, Tracks, Equipment, eXecution, Template -- that maps everything in an AI product's context window.
-- The working definitionWhen an AI product gives wrong answers, the instinct is to blame the model. But tracing the failure through CONTEXT layers reveals that the root cause is almost always a context problem, not a capability problem.
Missing Constitution means the model improvises rules. Missing Observations means it guesses the format. Missing kNowledge means it makes things up. Missing Tracks means it forgets. Missing Equipment means it can't act. Missing eXecution means tool results vanish. Missing Template means the output is unparseable.
One Diagnostic.
Where This Hits in Production
The audit advantage. When the CONTEXT framework is shared across the product team, it creates a common vocabulary for diagnosing AI quality issues. Instead of "the AI is giving bad answers," the team can be precise: "the kNowledge layer is returning stale documents" or "the Template layer isn't constraining the output for mobile."
Regulated industries and the Constitution layer. In healthcare, finance, and legal, the Constitution layer isn't just a product decision -- it's a compliance artifact. A regulator asking "how does your AI ensure it doesn't give unsuitable investment advice?" can be answered with the constitution: specific rules loaded into every inference call, in priority order.
Multi-tenant layer customization. In enterprise B2B, different customers need different context layers. The CONTEXT framework gives the harness architecture a clean interface: each layer can be swapped per tenant without redesigning the entire pipeline.
The Trap
Treating the framework as a checkbox.
Teams learn CONTEXT, audit their product, find they're using all seven layers. Checkbox checked. But filling all seven layers without measuring whether each one actually improves output quality is like adding every spice in the kitchen to every dish.
A knowledge layer that retrieves 10 documents when 2 would suffice adds 8 documents' worth of noise. An observations layer with 5 examples when the model performs just as well with 1 wastes tokens.
The fix: incremental layer testing. Start with Constitution + kNowledge + Template. Measure quality. Add each layer with measurement, not faith.In Practice: The Quality Ladder
Each CONTEXT layer is an investment with a measurable return. The curve is steep at first and levels off -- the first four layers do 80% of the work.
Remember This
1. Seven layers, one mnemonic: Constitution, Observations, kNowledge, Tracks, Equipment, eXecution, Template. Miss a layer, and the model compensates badly -- hallucinating facts, improvising rules, forgetting context, or producing unparseable output.
2. The framework is diagnostic, not just descriptive. When the AI fails, trace the failure to the specific CONTEXT layer. That's where the fix lives.
3. Not every product needs all seven layers. Start with the minimum viable context and add layers with measurement.
Connecting the Dots
The framework's deepest leverage shows up when you cross it with evaluation. Most eval failures are context engineering failures. When an eval fails, the lazy response is to record the model gave a wrong answer. The right response is to ask: which CONTEXT layer failed? Cited an out-of-date regulation → kNowledge. Ignored the user's stated preference → Tracks. Violated a business rule → Constitution. Produced unstructured text when JSON was expected → Template. A team that knows kNowledge layer failures account for 60% of our eval misses knows exactly where to invest: improve retrieval, not rewrite prompts.
On the autonomy spectrum. At Levels 1-3 (autocomplete, chatbot, assistant), the PM designs each layer by hand. At Level 4-5 (copilot), the harness automates assembly. At Levels 6-7 (autonomous agent), the agent itself manages some layers -- deciding what to retrieve, choosing which tools to invoke, even adjusting its own constitution within predefined boundaries. The framework stays the same. Who manages it changes.
The moat connection. A team that uses all seven layers thoughtfully owns institutional knowledge a competitor cannot copy by reverse-engineering the prompt. The Constitution embeds your firm's compliance posture. The Observations encode your team's taste. The kNowledge retrieval pipeline encodes years of corpus curation. The Tracks memory model encodes your understanding of how your customers actually use the product. None of this is in the visible output. All of it shapes every visible output.
References
1. Building Effective Agents -- Anthropic Engineering Blog
2. Context Engineering for AI Agents -- Anthropic Engineering Blog