Context Engineering is a Discipline, Not a Prompt Trick
Attribution
Creator: Dzmitryi Kharlanau (SAP Lead).
Canonical: https://dkharlanau.github.io/datasets/LLM-prompts/CE-01.json
JSON (copy / reuse)
{
"byte_id": "CE-01",
"title": "Context Engineering is a Discipline, Not a Prompt Trick",
"category": "context_engineering",
"audience": [
"consultants",
"business_analysts",
"solution_architects",
"enterprise_SAP"
],
"thesis": "LLM output quality is primarily determined by the contextual information payload assembled at inference time. Therefore, treating context as an engineered artifact (with structure, ordering, compression, and validation) consistently outperforms ad-hoc prompt tweaking.",
"research_basis": {
"key_findings": [
{
"claim": "Inference-time context optimization can be formalized as 'Context Engineering' with components, implementations, and measurable outcomes.",
"evidence": "A dedicated survey frames context engineering as systematic optimization of the information payload, beyond prompt wording.",
"sources": [
"turn0search20"
]
},
{
"claim": "Long contexts are not used uniformly: models show position sensitivity ('lost in the middle'), so placement and ordering of critical facts matters.",
"evidence": "Controlled experiments show retrieval/key-value performance depends strongly on where supporting info appears in the prompt.",
"sources": [
"turn0search1"
]
},
{
"claim": "In RAG with long-context LLMs, reordering retrieved chunks can yield training-free improvements by exploiting positional effects and reducing distraction from hard negatives.",
"evidence": "Research proposes retrieval reordering as a practical mitigation aligned with 'lost in the middle' behavior.",
"sources": [
"turn0search21"
]
},
{
"claim": "Manual prompt crafting is increasingly replaced by modular + automated optimization approaches (prompt search / pipeline compilers).",
"evidence": "Recent work introduces automatic prompt optimization frameworks and DSPy-style modular compilation/optimization for LLM pipelines.",
"sources": [
"turn0search2",
"turn0search6"
]
},
{
"claim": "Industry practice is converging on 'context engineering' as an information architecture problem (not 'clever prompting').",
"evidence": "Practical engineering guidance explicitly defines context engineering as providing an AI with all information/tools it needs, emphasizing structure and discipline.",
"sources": [
"turn0search12"
]
}
],
"notes_for_practitioners": [
"Do not assume 'more context' = 'better'. The goal is higher signal-to-noise + correct placement of high-signal items.",
"Treat context as a versioned artifact: design, test, measure, iterate."
]
},
"operational_model": {
"definition": "Context Engineering = building the smallest sufficient information payload that maximizes task success probability under constraints (token budget, time, risk).",
"context_layers": [
{
"layer": "L1_mission",
"purpose": "Why this work exists; success criteria.",
"max_tokens_hint": 80,
"example": "Goal: produce a client-ready decision note on SAP integration option selection."
},
{
"layer": "L2_domain_contract",
"purpose": "Vocabulary lock + business rules + invariants (what must never be violated).",
"max_tokens_hint": 200,
"example": "Definitions: Sold-to vs Ship-to; BP roles; replication ownership; data governance rules."
},
{
"layer": "L3_system_constraints",
"purpose": "Architecture facts: systems, boundaries, non-negotiables, security, SLAs.",
"max_tokens_hint": 220,
"example": "MDG is system of record for BP; S/4 consumes via web services; queue and retry semantics."
},
{
"layer": "L4_task_state",
"purpose": "What we know now; open questions; current decision point.",
"max_tokens_hint": 180,
"example": "We must recommend 1 of 3 options; data quality is medium; go-live in 8 weeks."
},
{
"layer": "L5_output_contract",
"purpose": "Exact required output structure + acceptance criteria.",
"max_tokens_hint": 120,
"example": "Return JSON with options, tradeoffs, risks, recommendation, and 'what to validate next'."
}
],
"ordering_rule": "Place the highest-signal constraints at the beginning and the output contract at the end. Avoid burying critical constraints mid-context (positional risk)."
},
"consulting_protocol": {
"name": "Context Payload Build (CPB)",
"steps": [
{
"step": 1,
"action": "Write the output contract first (format + sections + max length).",
"why": "Forces the model to allocate attention toward required structure and acceptance criteria."
},
{
"step": 2,
"action": "Lock vocabulary (glossary) and invariants (what must be true).",
"why": "Prevents term drift and silent assumption changes."
},
{
"step": 3,
"action": "Assemble only decision-relevant facts; tag each as {fact | assumption | unknown}.",
"why": "Reduces hallucination risk and makes gaps visible."
},
{
"step": 4,
"action": "Apply chunk ordering: (A) hard constraints, (B) key facts, (C) supporting evidence, (D) long references as appendices.",
"why": "Mitigates 'lost in the middle' and distraction from irrelevant retrieval."
},
{
"step": 5,
"action": "Compression pass: summarize appendices into 5–10 bullets, keep full text optional.",
"why": "Improves signal density without losing traceability."
},
{
"step": 6,
"action": "Run a 'constraints recall' check: ask the model to restate constraints before solving.",
"why": "If it cannot restate constraints, it cannot reliably comply with them."
}
]
},
"templates": {
"context_header_template": [
"L1 Mission:",
"L2 Domain Contract (glossary + invariants):",
"L3 System Constraints:",
"L4 Task State (facts/assumptions/unknowns):",
"L5 Output Contract:"
],
"constraints_recall_check": "Before answering, restate the non-negotiable constraints in 5 bullets. If any are missing, ask clarifying questions instead of proceeding."
},
"anti_patterns": [
{
"name": "Context Dump",
"symptom": "Pasting raw docs/tickets without structure.",
"impact": "Low signal density; positional failures; wrong assumptions.",
"fix": "Layering + tagging + ordering + compression."
},
{
"name": "Mid-Context Critical Constraint",
"symptom": "The most important rule is hidden in the middle of a long prompt.",
"impact": "Model ignores it intermittently.",
"fix": "Put hard constraints at the top; output contract at the bottom."
},
{
"name": "RAG Without Rerank/Order",
"symptom": "Retrieved chunks are appended in arbitrary order.",
"impact": "Hard negatives distract; model picks wrong evidence.",
"fix": "Rerank + reorder + keep only the top-k high-signal chunks."
}
],
"success_metrics": [
"Constraint compliance rate (does the output respect all invariants?)",
"Decision usefulness score (would a senior consultant accept it with minimal edits?)",
"Hallucination rate (claims without support in provided facts)",
"Iteration count to acceptable output (lower is better)"
],
"next_byte_suggestion": {
"byte_id": "CE-02",
"title": "Positional Strategy: Designing for 'Lost in the Middle' in Long Context + RAG"
},
"meta": {
"schema": "dkharlanau.dataset.byte",
"schema_version": "1.1",
"dataset": "LLM-prompts",
"source_project": "cv-ai",
"source_path": "LLM-prompts/CE-01.json",
"generated_at_utc": "2026-02-03T14:33:32+00:00",
"creator": {
"name": "Dzmitryi Kharlanau",
"role": "SAP Lead",
"website": "https://dkharlanau.github.io",
"linkedin": "https://www.linkedin.com/in/dkharlanau"
},
"attribution": {
"attribution_required": true,
"preferred_citation": "Dzmitryi Kharlanau (SAP Lead). Dataset bytes: https://dkharlanau.github.io"
},
"license": {
"name": "",
"spdx": "",
"url": ""
},
"links": {
"website": "https://dkharlanau.github.io",
"linkedin": "https://www.linkedin.com/in/dkharlanau"
},
"contact": {
"preferred": "linkedin",
"linkedin": "https://www.linkedin.com/in/dkharlanau"
},
"canonical_url": "https://dkharlanau.github.io/datasets/LLM-prompts/CE-01.json",
"created_at_utc": "2026-02-03T14:33:32+00:00",
"updated_at_utc": "2026-02-03T15:29:02+00:00",
"provenance": {
"source_type": "chat_export_extraction",
"note": "Extracted and curated by Dzmitryi Kharlanau; enriched for attribution and crawler indexing."
},
"entity_type": "llm_prompt_byte",
"entity_subtype": "category:context_engineering",
"summary": "Context Engineering is a Discipline, Not a Prompt Trick"
}
}