← Domains & pillars

Model & Prompt LifecycleView domain

APRF-03

Context Engineering

Bound and structure what the model is allowed to see and use.

Purpose

Design how context windows are filled—retrieval, history, tool results, and system state—so the model receives necessary, authorized, and bounded information.

Mandatory checks

Gate controls. Each check is pass/fail via artifact + pass condition. Expected from the annotated capability level when the system meets the minimum criticality tier.

  • CTX-M1L3 · DefinedTier 2 · ProductionhybridE3

    Every production context builder shall enforce a finite max token/byte budget and documented prioritization rules so oversized inputs are truncated or rejected—never silently overflowing the model window.

    Artifact
    Context-budget config (max tokens/bytes) for each production context builder + Unit/integration tests showing truncate/reject per priority rules with 0 silent overflows
    Pass condition
    100% of production context builders enforce a max token/byte budget; tests show oversized inputs are truncated/rejected per priority rules with 0 silent overflows (budget evidence measuredAt ≤90 days). If no production AI paths assemble model context (RAG, chat history, tool results, or prompt templates), score NOT_APPLICABLE.

    Why this control exists

    Threat map

    Bound context assembly so oversized or attacker-padded input cannot displace instructions or exhaust resources.

    Threats mitigated

    Prompt InjectionDenial of ServiceDenial of Wallet

    Protects

    ContextPromptsCostAvailability

    MITRE: ATLAS AML.T0046 · ATLAS AML.T0029 · ATLAS AML.T0034.001

    Explicit size ceilings and priority rules stop chaff or padded content from crowding out system instructions and grounding facts. They also cap the token cost and latency of any single request, limiting resource-exhaustion abuse.

    Informative threat context — mappings reduce exposure and do not guarantee mitigation; not certification.

  • CTX-M2L3 · DefinedTier 2 · ProductionhybridE3

    Retrieved and tool-sourced content shall receive a source label/type and an access check before inclusion in assembled model context—unauthorized chunks must be excluded.

    Artifact
    Context assembly code enforcing source labels on retrieved and tool-sourced chunks + Automated tests showing ACL exclusion of unauthorized chunks at 100% and labels on included chunks
    Pass condition
    Automated tests: unauthorized retrieval/tool chunks are excluded at 100%; included chunks carry a source label/type field in 100% of sampled assembled contexts (label/ACL evidence measuredAt ≤90 days). If context is prompt-only with no retrieval/tools, score NOT_APPLICABLE.

    Why this control exists

    Threat map

    Ensure content entering the context is attributed to a source and authorized for the requesting principal.

    Threats mitigated

    Prompt InjectionData ExfiltrationUnauthorized Memory AccessSensitive Information Disclosure

    Protects

    ContextDataMemoryUsers

    MITRE: ATLAS AML.T0051.001 · ATLAS AML.T0070 · ATLAS AML.T0071 · ATLAS AML.T0066 · ATLAS AML.T0085.000 · ATT&CK T1213

    Indirect injection arrives as retrieved or tool-returned content that is otherwise indistinguishable from trusted instruction. Labelling provenance and enforcing access at inclusion time keeps unauthorized data out of context and lets the model treat third-party content as data rather than instruction.

    Informative threat context — mappings reduce exposure and do not guarantee mitigation; not certification.

  • CTX-M3L3 · DefinedTier 2 · ProductionhybridE3

    Production context assembly shall apply a documented inclusion policy that enumerates sensitive classes—including secrets and regulated data—with allow/deny rules, and shall strip or block disallowed classes before they enter the model context.

    Artifact
    Data-class inclusion policy enumerating sensitive classes with allow/deny rules + Enforcement tests or DLP hooks showing ≥95% strip/block on the sensitive-class fixture suite
    Pass condition
    Policy enumerates sensitive classes and allow/deny rules; tests show disallowed classes are stripped or blocked at ≥95% on the sensitive-class fixture suite (policy/suite evidence measuredAt ≤90 days). If context is purely static non-sensitive templates with no such paths, score NOT_APPLICABLE.

    Why this control exists

    Threat map

    Prevent secrets and regulated data from entering model context without an explicit approved policy.

    Threats mitigated

    Secret LeakageSensitive Information DisclosureData Exfiltration

    Protects

    SecretsDataContextPrompts

    MITRE: ATLAS AML.T0057 · ATLAS AML.T0024 · ATLAS AML.T0082 · ATT&CK T1552

    Data that never enters the context cannot be elicited by any prompt, injection, or jailbreak. An explicit inclusion policy for secrets and regulated classes is therefore the strongest available mitigation for model-mediated disclosure.

    Informative threat context — mappings reduce exposure and do not guarantee mitigation; not certification.

Evidence required

  • Context assembly design document
  • ACL enforcement evidence on retrieval paths
  • Samples of labeled context structures (redacted)
More detailPhilosophy, failures, practices, validations, examples, crosswalks, and evolution

Engineering philosophy

Context is a scarce, trusted resource. Overstuffing, under-filtering, and leaking privileged context are engineering defects, not model quirks. Structure beats volume.

Why it matters

Poor context design causes hallucinations, privacy leaks, prompt injection via retrieved content, and unbounded cost. Agents fail when context is noisy or when critical constraints are buried.

Common failures

  • Dumping entire conversation history without summarization or TTL
  • Retrieving documents without ACL enforcement at query time
  • No provenance: model cannot distinguish user text from retrieved policy
  • Tool results concatenated without size or sensitivity limits

Severity & risk

Severity
high
Impact if violated
Risk level
high
Typical residual risk (impact × likelihood)

Engineering best practices

  • Design explicit context slots: instructions, user, memory, retrieval, tools
  • Prefer citations and IDs over pasting large documents when possible
  • Apply the same authorization checks to context as to API responses
  • Test adversarial documents in the corpus as first-class fixtures

Automatic validations

  • Unit tests for context builders and ACL filters
  • Metrics on context token composition by source
  • Guards rejecting oversized tool payloads

Manual validations

  • Review of retrieval corpora for injection and oversharing risk
  • Spot checks that production traces show expected context structure

Examples

  • A RAG system includes document IDs and ACL tags; the model only sees chunks the user may access
  • Agent tool output is truncated and classified before re-entering the context window

References

Crosswalks

  • MAP Map

    NIST AI Risk Management Framework · supports

  • Privacy-Enhanced Privacy-Enhanced

    NIST AI Risk Management Framework · aligns-with

  • LLM02 Sensitive Information Disclosure

    OWASP Top 10 for Large Language Model Applications · supports

  • LLM08 Vector and Embedding Weaknesses

    OWASP Top 10 for Large Language Model Applications · supports

  • C5.2 AI Resource Authorization & Classification

    OWASP AI Application Security Verification Standard (AISVS) · supports

  • C7.3 Output Safety

    OWASP AI Application Security Verification Standard (AISVS) · supports

  • C8.1 Access Controls on Memory & RAG Indices

    OWASP AI Application Security Verification Standard (AISVS) · supports

  • C8.2 Embedding Sanitization & Validation

    OWASP AI Application Security Verification Standard (AISVS) · supports

  • C8.3 Memory Expiry & Revocation

    OWASP AI Application Security Verification Standard (AISVS) · supports

  • C12.1 Request & Response Logging

    OWASP AI Application Security Verification Standard (AISVS) · supports

  • L2 Data Operations

    CSA MAESTRO (Multi-Agentic Threat Model) · supports

  • Performance Efficiency Performance Efficiency

    AWS Well-Architected Framework · partial

Future evolution

Standard context schemas across agent frameworks and portable ACL-aware retrieval protocols.