Provenance and ContextRole
Assign the trust semantics of the content you are compressing.
Roles
SYSTEM and DEVELOPER are trusted. USER is semi-trusted. ASSISTANT, TOOL, and RAG are untrusted: wording and preservation-pattern matches cannot move them above Tier 2 or make them must_keep. GENERAL is the legacy default.
Trust boundary
LLMSlim trusts caller-provided role labels and cannot authenticate provenance.
roles.py
from llmslim import ContextRole, compress
result = compress(retrieved_text, context_role=ContextRole.RAG)Does ContextRole prevent prompt injection?
No. It mitigates compression-induced instruction elevation. Applications still need defense in depth.
Can LLMSlim authenticate a role label?
No. The caller is responsible for accurate provenance.