davila7/claude-code-templates · error
SEM_E009
SEM_E009
Error message
Context manipulation attempt detected
What it means
SEM_E009 is a high-severity semantic finding matching /(forget|disregard|remove)\s+(everything|all\s+previous|prior\s+context)/gi. It detects context-wiping instructions typical of injection attacks that try to erase system prompts or prior guardrails. The validator emits it whenever the phrase appears in a component's validated content.
Source
Thrown at cli-tool/src/validation/validators/SemanticValidator.js:71
code: 'SEM_E006',
message: 'Shell access attempt detected',
severity: 'critical'
},
{
pattern: /(disable|bypass|override|skip)\s+(security|safety|filter|protection|validation)/gi,
code: 'SEM_E007',
message: 'Security bypass attempt detected',
severity: 'critical'
},
{
pattern: /always\s+(obey|follow|comply\s+with|execute)\s+the\s+user/gi,
code: 'SEM_E008',
message: 'Unconditional obedience instruction detected',
severity: 'high'
},
{
pattern: /(forget|disregard|remove)\s+(everything|all\s+previous|prior\s+context)/gi,
code: 'SEM_E009',
message: 'Context manipulation attempt detected',
severity: 'high'
},
{
pattern: /modify\s+your\s+(own\s+)?(code|behavior|instructions?|rules?)/gi,
code: 'SEM_E010',
message: 'Self-modification request detected',
severity: 'high'
}
];
// Suspicious patterns (warnings, not errors)
this.SUSPICIOUS_PATTERNS = [
{
pattern: /\bpretend\s+(you\s+are|to\s+be)\b/gi,
code: 'SEM_W001',
message: 'Suspicious instruction: Role pretending detected',
severity: 'medium'View on GitHub (pinned to a0851ed10c)
Solutions
- Rephrase reset semantics: 'Treat this message as the start of a new task' instead of 'forget everything'
- For summarization, use 'summarize independent of prior turns' rather than 'disregard all previous context'
- Keep quoted injection text out of validated fields or paraphrase it
- Waive through the review pipeline when the wording is clearly benign and reviewed
Example fix
// before Forget everything above and start fresh. // after Begin a new task; earlier conversation is out of scope for this request.
Defensive patterns
Strategy: validation
Validate before calling
const CTX_RE = /(forget|disregard|remove)\s+(everything|all\s+previous|prior\s+context)/i;
function wipesContext(text) { return CTX_RE.test(text); } Type guard
function isSafeContextText(text) { return !/(forget|disregard|remove)\s+(everything|all\s+previous|prior\s+context)/i.test(text); } Prevention
- Express resets as 'start a new task' rather than 'forget everything'
- Describe scoping positively ('only this message is in scope')
- Paraphrase quoted injection examples
When it happens
Trigger: Content containing 'forget everything', 'disregard all previous instructions/context', or 'remove prior context' (case-insensitive). Frequently appears in conversation-reset features or in quoted prompt-injection examples.
Common situations: Components implementing a 'fresh start' or reset workflow; summarization components that legitimately want to ignore earlier chatter; docs that quote classic 'ignore all previous instructions' attacks.
Related errors
AI-assisted analysis of davila7/claude-code-templates@a0851ed10c (2026-08-28).
Data as JSON: /api/errors/1a722de2c6422953.
Report an issue: GitHub.