Architecture

Context Rot is a
Systems Problem

How Amplifier's Architecture Keeps AI Sharp

Active Architectural Pattern

April 2026

The Problem

Your AI Gets Dumber
as You Work

01
Quality Degrades
90 minutes in, your AI starts hallucinating imports and forgetting conventions. The model is the same. The context is the problem.
02
Context Window Fills
Every file read, every error trace, every conversation turn crowds out what matters. Relevant signal drowns in accumulated noise.
03
Prompt Fixes Are Band-Aids
Better prompts and session resets help, but don't eliminate the root cause. You're managing symptoms, not solving the problem.
The Insight

Context Windows Are for
Working, Not Remembering

Context rot isn't a prompting problem. It's a systems architecture problem. Amplifier doesn't clean the context window — it structures work so context accumulation is physically isolated from sessions that need to stay sharp.

Treat context windows like CPU registers, not databases — small, fast, and ephemeral, with durable state stored on disk where it belongs.

Six Patterns — 01

Pattern 1: The Context Sink

Without Isolation
Read 20 files directly: ~20,000 tokens consumed in your session. Quality degrades. Every read is a withdrawal from your context budget with no way to reclaim it.
With Context Sink
Delegate to a sub-agent: ~200 tokens in your orchestrator session. ~98% savings per exploration. The sub-agent absorbs the cost — its context is disposable by design.
# The orchestrator stays sharp. # The worker absorbs the cost. delegate( agent="foundation:explorer", prompt="Summarize the auth module", context_depth="none" # fresh window ) # Orchestrator receives: ~200 tokens # Sub-agent consumed: ~20,000 tokens # Net cost to you: ~200 tokens
Key Insight

The sub-agent's context is consumed and discarded. The orchestrator only receives the distilled result — a summary, an answer, a diff. The exploration cost never hits your session.

Six Patterns — 02

Pattern 2: Fresh Sessions by Default

Every delegated task gets a fresh context window. No session runs long enough to degrade.

# recipe.yaml — each step is a new agent, new window steps: - name: analyze-codebase agent: foundation:explorer context_depth: "none" # fresh window, every time prompt: "Find all authentication patterns" - name: generate-tests agent: foundation:coder context_depth: "none" # another fresh window prompt: "Write tests for {{ analyze-codebase.output }}"
The Inversion

This inverts the typical workflow. Instead of one long degrading session, you get a series of short, sharp sessions that each start at peak capability. Session 50 is as sharp as session 1.

Six Patterns — 03

Pattern 3: State Lives in Files

The context window is ephemeral. Files are permanent. STATE.yaml and CONTEXT-TRANSFER.md carry institutional memory across sessions without burdening any individual context window.

# STATE.yaml — complete project memory in ~50 lines. # Read at the start of every session. project: amplifier-safeguard phase: autonomous-validation epoch: 4240 next_action: "run-smoke-tests" last_verified: 2026-04-08 blocker: null context: "All 47 modules passing. Focus on perf regressions."
The Analogy

A human developer doesn't keep their entire project history in working memory. They check the ticket, read the relevant code, and focus. Amplifier's agents work the same way. The STATE file is the ticket. The context window is the scratchpad.

Six Patterns — 04, 05, 06

Three More Architectural Patterns

04
Thin Orchestrator
The orchestrator dispatches but never does heavy work. Workers are disposable. The orchestrator's context stays at ~30–40% utilization — it never degrades because it never accumulates.
05
Model Routing
A 13-role matrix assigns the right model tier to each task. Classification tasks don't waste a reasoning model's context. The right capability for the right task — every time.
06
Recipes
Multi-step workflows with checkpoint persistence. Each step is a fresh agent. Resumable after any interruption — the recipe carries the state, not the session.

Together these six patterns form an architecture for context hygiene — not a collection of prompting tricks. The property is enforced by structure, not discipline.

The Evidence

The Compound Effect

4,240+
Epochs
100s
Features Shipped
~98%
Token Savings
0
Context Degradation

The safeguard project ran 4,240+ autonomous sessions, each starting fresh from a ~50-line STATE.yaml. Quality in session 200 was identical to session 1. The architecture enforced the property — no discipline required from any individual session.

On the ~98% Figure

Per-exploration savings via context sinks: delegating a 20-file scan to a sub-agent consumes ~200 orchestrator tokens vs. ~20,000 for direct reads — a ~99:1 ratio per operation. "0 context degradation" reflects an architectural hard boundary (sessions reset by design), not a measured quality metric.

Comparison

Prompt-Level vs Architecture-Level

Prompt-Level Approach Architecture-Level Approach
Compress or prune within one session Distribute work across isolated sessions
State lives in the context window State lives in files on disk
User manages context manually Architecture enforces isolation
Gradual degradation as the window fills Hard boundaries — each session either works or doesn't
Restart means starting over Checkpoints preserve progress across any interruption
Sources

Research & Methodology

Data as of: April 9, 2026    Feature status: Active

Research performed:

Related repositories:
microsoft/amplifier-foundation  ·  microsoft/amplifier-bundle-dev-machine  ·  microsoft/amplifier-bundle-self-driving

Gaps & qualifications:
The ~98% token savings figure applies to the orchestrator session's context cost for a single delegation operation — not total system token usage. "0 context degradation" reflects an architectural design property (sessions reset by design), not a measured quality metric. "100s of features shipped" is qualitative; no automated feature-count exists. The 4,240 epoch count reflects the epoch field in STATE.yaml at time of analysis.

Related reading: context-rot-is-a-systems-problem-article.md (full technical article — move to repo root)

Get Started

Context management is a systems problem.
It deserves a systems solution.

Try Amplifier — architecture that keeps AI sharp, session after session.

# Install Amplifier uv tool install amplifier # Every agent delegation starts fresh delegate( agent="foundation:explorer", context_depth="none" )
github.com/microsoft/amplifier  →
1 / 11
More Amplifier Stories