A developer needs Claude to only reference information from a provided context document — never from training data. Is this constraint structural, semantic, or stylistic? Which enforcement layer is appropriate?
Answer: Semantic — enforce with prompt instructions as primary guidance AND application-layer verification to check that claims are present in the context
Sourcing constraints are semantic — they govern the accuracy and provenance of content, not its structure or style. For accuracy-critical constraints, prompt instructions alone are insufficient (the model can drift from them on edge cases). The correct approach is prompt instructions as primary guidance plus application-layer verification — checking that key claims reference the provided context. This is the 'both layers' case from the programmatic vs. prompt-based framework. JSON schema (A) enforces structure, not sourcing. Prompt-only (B) is insufficient for accuracy-critical constraints. Post-processing removal (D) is fragile — extracting only sourced sentences without context produces incoherent output.