Principle #3 · /sdd context

Context Engineering Budget — the discipline of context

The Product Engineer owns the context budget of every agent session. An agent does not degrade its quality at the theoretical limit of its window — it degrades it well before. The Context Engineering Budget is the discipline that turns this physical reality into operational rules.

Context rot — degradation before the limit

Context rot refers to the degradation of LLM quality well before the theoretical limit of the context window. The symptoms are recognisable: less accurate answers, forgotten spec constraints, repetitive behaviour. A hundred-page AGENT-GUIDE is not more effective — it is less effective: the agent receives everything, understands little. That is why injecting all artifacts at once is the framework's main anti-pattern.

In March 2026, Anthropic formalised Context Engineering as a discipline in its own right, distinct from prompt engineering — "the art and science of curating what enters the limited context window". The AIAD Context Budget is an operational implementation of it, present in the framework since v1.3.

The operational threshold: 60-70% of the window

Rule v1.6

Use 60-70% of the available context as the effective maximum. Example: 200k tokens available → max budget ≈ 130k. Beyond that, context-rot symptoms appear before the theoretical limit.

Context window reference, as of 25/09/2026
Model categoryNative windowEffective budget (60-70%)
Frontier models — for example Claude Sonnet 5, rolled out in late June 2026 in Claude Code, Kiro and GitHub Copilot1M tokens (now standard)≈ 600k to 700k tokens
Fast modelsMay remain at 200k tokens≈ 130k tokens

The key point: the available window does not change the 60-70% threshold — it shifts it upwards. 1M-token windows push back the degradation threshold; they do not remove it, nor do they exempt you from splitting work into single-objective sessions.

A dated reference, not a lasting truth

A cross-cutting rule of doctrine v1.9: any capability or pricing assumption cited in an AIAD artifact is dated and revalidated periodically. The table above is valid as of 25/09/2026; it cites no prices, and in particular no promotional pricing, which is temporary by nature. The budget rules, for their part, are stated as mechanisms — share of the window, placement, delegation — so that they remain valid when models change.

The session composition rules

Context Engineering Budget rules
RuleDetail
Permanent contextCondensed AGENT-GUIDE + ARCHITECTURE summary — max 500 tokens each
Per-task activationONE active SPEC at a time (unless an explicit combined activation scope is declared)
Strategic contextThe full PRD is injected only during the framing phase, never during development
Placement ruleIntent Statement and active SPEC at the top of the context, against the "lost in the middle effect"

The "lost in the middle effect" is documented: LLMs pay more attention to the beginning and end of their context than to the middle. Placing the intent and the SPEC at the top guarantees that what must not be betrayed stays in the zone of best adherence.

Delegating to sub-agents: inherited context

Some harnesses make sub-agents inherit the parent conversation. The cost of a delegation then depends on the mechanism:

  • if the sub-agent inherits the parent conversation, its cost is parent context at the time of the fork + its own work, not a marginal cost: it is better to delegate early, while the parent context is still light;
  • the fork point becomes an explicit cost item in the Context Audit;
  • if inheritance is disabled, the sub-agent starts from a blank context and must be given the Intent Statement and the active SPEC explicitly.
In the aiad-sdd package — upcoming release, not yet published

The next release of the package, not yet published, adds to /sdd context an "Inherited context (delegations)" line in the measurement of the actual context, a matching line in the budget estimate of the SPEC template, and a diagnostic in the context-budget skill: late delegations (inherited context above 50% of the total) → delegate earlier in the session.

Intentional compaction and loop engineering

Two field practices complement the budget. Intentional compaction (Dex Horthy, HumanLayer) means deliberately compacting the history into a written state — decisions taken, files touched, next steps — rather than enduring automatic compaction. Loop engineering means structuring each agentic loop around an objective, an exit criterion and a check. This vocabulary dates from 2026 and remains unsettled vocabulary: it is adopted as a description of practices, not as a standard.

The economic argument

The discipline of context is not just a quality matter — it is a measurable cost-optimisation decision. Two converging data points validate intent-based design: R2Code (arXiv, April 2026) measures −41.7% of tokens consumed on spec-anchored code, with +7.4% fidelity; AWS Strands (2026) observes −96% of tokens on intent-based workflows. On code-generation-intensive projects, the saving is directly measurable — and model-agnostic: it applies regardless of the platform. The /sdd context command provides an estimate of the cost avoided per session.

The context-budget skill and the 5 health metrics

The post-session audit is tooled by the context-budget skill, invoked by /sdd context, /sdd exec (budget check) and /sdd resume. It computes five metrics and produces a health score out of 5:

The 5 health metrics M1 to M5
MetricDefinitionTarget
M1 — Useful-utilisation rate% of context actually referenced by the agent / total injected context≥ 70%
M2 — Restart frequencyNumber of /compact or resumes0 ideal, 1 acceptable
M3 — Estimate/actual ratioActual context / estimated0.8 – 1.3
M4 — Coherence scoreAGENT-GUIDE constraints respected / total≥ 90%
M5 — Session durationActive minutes< 35 min

Each off-target metric points to a precise remediation: M1 < 70% → too much context injected; M4 dropping → context rot, condense the AGENT-GUIDE; M5 > 35 min → objective too broad, go through /sdd split. If a metric is not measurable, the score comes out as ?/5 — a JNSP, not a zero.

A single session < 35 minutes, then /compact

The practical rule that sums it all up: one session = one objective, lasting less than 35 minutes, context = AGENT-GUIDE + condensed ARCHITECTURE + active SPEC. Beyond 35 minutes, run /compact and restart on a clean session — a session that drags on is the signal of a SPEC that is too broad or a poorly prepared context, not of a slow agent. The /sdd resume command then rebuilds a minimal, precise context from the summary of the interrupted session, without re-injecting everything.