6.1 — Context Engineering

CCDV-F Domain 6 · Task 6.1

What You Need to Know

Context engineering is “the set of strategies for curating and maintaining the optimal set of tokens during LLM inference.” Prompt engineering asks what the instructions say; context engineering asks what is in the window at all.

Bloat and Drift Are Not the Same Fault

Fault Cause Fix
Bloat Volume — full API payloads, whole files, complete search results fill the window Pruning, just-in-time loading, compaction
Drift Behaviour — standing rules stated once now sit hundreds of turns back Placement: move rules to where the model reads them

A bigger window postpones size failure; it does nothing about recall. Context rot: attention budget depletes as token count grows.

Just-in-Time Loading

Keep lightweight identifiers (file paths, stored queries, web links) instead of pasting every record. Load data through tools when the task calls for it. Hybrid: small core up front; fetch everything else as needed.

Pruning Spent Tool Output

Context editing (beta context-management-2025-06-27): clear_tool_uses_20250919 clears old tool results server-side, replaces with placeholders. Configure trigger, keep, clear_at_least, exclude_tools. Clearing invalidates the cached prefix from the clearing point.

Compaction and the Preservation Contract

Replaces the settled portion with a structured summary. Two forms:

  • On demand (beta compact-2026-09-04) — your code decides when
  • At a token threshold (beta compact-2026-01-12) — API decides when

A custom instructions string replaces the default summarisation prompt entirely. Write the preservation contract in advance: decisions and reasons, established facts and sources, constraints still binding, open questions, state of unfinished work. Drop raw payloads already reduced to facts.

Compaction is billed as its own iteration in usage.iterations. Top-level counts exclude it.

Isolating the Sprawl

Context isolation through subagents: each subagent runs in its own conversation; intermediate tool calls stay inside; only the final message returns to the parent. Exploration stays out of the main window entirely.

Check your understanding

Practice Scenario

🔒 This practice scenario is part of Skillmarked Pro

The lessons stay free. Pro unlocks the other 24 CCDV-F practice scenarios and the 53-question timed mock exam, plus everything for every other exam.

See plans

Cancel anytime. Or €199 a year, which saves 17%.

Not sure yet? Try 10 free mock exam questions.

Already Pro? Log in.

Sources