Context vs. Prompt Engineering

Prompt Engineering: Writing instructions for single tasks

Context Engineering: Managing all tokens (instructions + tools + data + history) across multi-turn interactions

Key shift: "What to say" → "What information to include"

Core Problem: Context Rot

Guiding Principle:

Smallest set of high-signal tokens for desired outcome


Effective Context Components

System Prompts

✅ Simple, direct language at right altitude (not too specific/vague)

✅ Use XML tags or Markdown sections

✅ Start minimal, add based on failures

❌ No hardcoded logic or vague guidance

Tools

✅ Token-efficient, self-contained, minimal overlap

✅ Descriptive parameters, clear purpose

❌ No bloated tool sets or ambiguous choices

Examples

✅ Curate diverse, canonical examples

❌ No edge case laundry lists

Retrieval Strategies

Just-In-Time (JIT):

Hybrid (Recommended):

Long-Horizon Techniques

1. Compaction

Summarize → restart with compressed version

2. Note-Taking

Persistent notes outside context

3. Sub-Agents

Specialized agents → condensed summaries

Decision Framework

image.png


Quick Wins

  1. Remove bloated tools/examples
  2. Structure prompts with XML/Markdown
  3. Use hybrid retrieval
  4. Clear old tool results
  5. Add memory tool for notes

Core Principle

"Do the simplest thing that works"

Context remains precious - thoughtful curation beats exhaustive inclusion.