Expand description
Context safety: provenance, trust, and pollution detection.
Everything the tiers/map/selection assemble eventually reaches a model. That makes context a trust boundary: a tool output, a fetched file, or a tampered data file can carry prompt-injection (“ignore previous instructions”), role-switching, hidden-unicode payloads, or exfiltration hints. This module tags each source with a provenance and trust level and scans its content for those patterns, so a human (and the assistant flow) can see what is in context, where it came from, and whether it looks poisoned before it is ever sent.
Structs§
- Injection
Finding - A suspicious pattern found in context content.
- Trust
Report - A full trust assessment of one context source.
Enums§
- Source
Kind - Where a piece of context came from — the root of traceability.
- Trust
Level - How much the content may be trusted to be inert data rather than instructions.
Functions§
- analyze_
source - Assemble a full trust report for one source.
- scan_
injection - Scan content for injection / pollution patterns.
is_coderelaxes the instruction-shaped rules (expected in prose) but keeps the data-file rules. - trust_
level - Derive a trust level from provenance and content classification. Workspace Rust source is trusted; data/vendored files are only semi-trusted (they can be tampered and should never carry instructions); anything external or model-generated is untrusted.