2025 was prompt engineering. Top teams in 2026 optimize context engineering—the prompt is a small slice of what the model sees.
From Prompt to Context
Prompt Engineering (2023–2024):
Focus → better instructions
Scope → user's last message
Context Engineering (2025–2026):
Focus → full information environment
Scope → system prompt + skills + retrieved docs + tool results
+ history + files + logs + …
Same prompt, different context assembly → 10× quality swing (Anthropic, Cursor engineering blogs).
What Goes in Context
One agent call might include:
┌─ System prompt ─────────────────────────┐ ~500 tokens
├─ Skills (on demand) ───────────────────┤ ~1000 tokens
├─ MCP resources ────────────────────────┤ ~2000 tokens
├─ Code context ─────────────────────────┤ ~8000 tokens
├─ Tool results ─────────────────────────┤ ~3000 tokens
├─ Conversation history ─────────────────┤ ~5000 tokens
├─ User message ─────────────────────────┤ ~200 tokens
└────────────────────────────────────────┘
~20,000 of 128,000
Still problems:
- Lost in the middle—weaker attention mid-context
- Noise—irrelevant files steer the model wrong
- Linear cost—every +1000 tokens adds latency and spend
Six Context Strategies
1. Retrieve Precisely, Don’t Dump Everything
❌ Entire 500-file repo in context
✅ Semantic index → load 5–10 relevant files
Cursor @file = precise; @codebase = search then select.
2. Layered Summarization
Raw chat (5000 tokens)
→ summary (500): "User refactoring auth; JWT done; writing tests"
→ keep summary + last 3 full turns
Claude Code compresses early steps on long tasks.
3. Selective Tool Results
Ten tool calls—not all ten stay:
ls → keep (structure)
cat config.json → keep
npm test → keep failures only (2000 lines → 20)
debug steps 4–7 → drop (superseded)
final fix → keep
4. Dynamic Skill Loading
Load 1–3 skills for “create PR”—not all 20 skills every turn.
5. Structured Beats Prose
❌ "TypeScript project, Astro 5, Tailwind 4, Cloudflare Pages, no DB…" (~100 tokens)
✅ stack: { lang: "TS", framework: "Astro 5", css: "Tailwind 4",
deploy: "CF Pages", db: null } (~30 tokens)
6. Position Matters
[System prompt] ← rules (always seen)
[… bulk middle …]
[User message] ← current task
[Latest tool result] ← fresh evidence adjacent to user
Cursor’s Context Stack (Observed)
- Built-in agent system prompt
.cursor/rules/- Matched SKILL.md files
- Codebase semantic index (top-K files)
- Open editor tabs (higher weight)
- Recent terminal output
- MCP resource payloads
- Session chat history
Index retrieval quality = whether the agent finds the right files.
Claude Code on Long Tasks
- Start: relevant files + CLAUDE.md
- Mid-run: compress completed work to summaries
- Errors: keep message + stack trace, not full logs
- Late steps: “current state + remaining work + recent actions”
Enables 50+ step runs without forgetting the original goal.
Measuring Context Quality
| Metric | Meaning | How |
|---|---|---|
| Context precision | % of context that’s relevant | human labels |
| Context recall | needed info included? | vs ideal context |
| Token efficiency | tokens for same quality | A/B strategies |
| Needle-in-haystack | find buried fact? | benchmarks |
Summary
Prompt = what you say. Context = what the model sees. Optimizing context beats tweaking prompts by an order of magnitude.
Highest ROI inside the harness. Next: measuring whether agents actually improve—eval and observability.