Context Engineering
Context engineering manages ALL tokens in the context window — not just the prompt text. Context rot degrades recall as token count grows. Three techniques for long-horizon tasks: compaction, note-taking, sub-agent isolation.
DSPy
DSPy replaces hand-written prompts with optimised programs — Signatures declare I/O, MIPROv2 optimises instructions and few-shot demos, yielding 10-40% improvement on structured tasks.
Prompt Engineering
Claude-specific XML structuring outperforms Markdown, 2-5 few-shot examples in example tags, CoT for reasoning tasks but not with Extended Thinking, and DSPy for automated optimisation at scale.
Structured Outputs and Constrained Decoding
Three tiers of reliability — prompt-based (fragile), retry-based via instructor (good enough for most hosted APIs), constrained decoding via XGrammar/Outlines (guaranteed, zero retries) — with native API support from OpenAI and Gemini but not yet Anthropic.