{"record":{"id":"9c1bca041f31e44f","repo":"davila7/claude-code-templates","slug":"sem-w001","errorCode":"SEM_W001","errorMessage":"Suspicious instruction: Role pretending detected","messagePattern":"Suspicious instruction: Role pretending detected","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli-tool/src/validation/validators/SemanticValidator.js","lineNumber":87,"sourceCode":"      {\n        pattern: /(forget|disregard|remove)\\s+(everything|all\\s+previous|prior\\s+context)/gi,\n        code: 'SEM_E009',\n        message: 'Context manipulation attempt detected',\n        severity: 'high'\n      },\n      {\n        pattern: /modify\\s+your\\s+(own\\s+)?(code|behavior|instructions?|rules?)/gi,\n        code: 'SEM_E010',\n        message: 'Self-modification request detected',\n        severity: 'high'\n      }\n    ];\n\n    // Suspicious patterns (warnings, not errors)\n    this.SUSPICIOUS_PATTERNS = [\n      {\n        pattern: /\\bpretend\\s+(you\\s+are|to\\s+be)\\b/gi,\n        code: 'SEM_W001',\n        message: 'Suspicious instruction: Role pretending detected',\n        severity: 'medium'\n      },\n      {\n        pattern: /\\b(jailbreak|DAN|ChatGPT\\s+Developer\\s+Mode)\\b/gi,\n        code: 'SEM_W002',\n        message: 'Known jailbreak terminology detected',\n        severity: 'medium'\n      },\n      {\n        pattern: /output\\s+raw\\s+(code|text|data)/gi,\n        code: 'SEM_W003',\n        message: 'Raw output request (potential data exfiltration)',\n        severity: 'low'\n      },\n      {\n        pattern: /(repeat|echo)\\s+after\\s+me/gi,\n        code: 'SEM_W004',","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/validation/validators/SemanticValidator.js#L69-L105","documentation":"SEM_W001 is a medium-severity warning matching /\\bpretend\\s+(you\\s+are|to\\s+be)\\b/gi. Unlike the SEM_E* errors it belongs to SUSPICIOUS_PATTERNS and is surfaced as a warning, not a failure. It flags role-play framing ('pretend you are ...') because, while usually benign, it is the soft end of role-redefinition injection attacks.","triggerScenarios":"Component content containing 'pretend you are' or 'pretend to be' (case-insensitive, word-boundary anchored). Typical in persona, roleplay, simulation, and training-data generation components.","commonSituations":"Persona agents ('pretend you are a pirate debugger'); interview/simulation components; demo and educational prompt collections.","solutions":["Usually no action needed — it's a warning; verify the roleplay is intentional and benign","Rephrase to 'Act as ...' or 'Take the role of ...' to avoid the pattern entirely","Keep the warning in the review report as an audit signal for human reviewers","If warnings block your pipeline (strict mode), adjust the validation threshold or rephrase"],"exampleFix":"// before\nPretend you are a senior code reviewer giving feedback.\n\n// after\nAct as a senior code reviewer giving feedback.","handlingStrategy":"validation","validationCode":"const PRETEND_RE = /\\bpretend\\s+(you\\s+are|to\\s+be)\\b/i;\nconst warnings = (content.match(new RegExp(PRETEND_RE.source, 'gi')) || []).length;\nif (warnings > 0) console.warn(`${warnings} roleplay warning(s); confirm they are intentional.`);","typeGuard":"function isSafeRoleplayText(text) { return !/\\bpretend\\s+(you\\s+are|to\\s+be)\\b/i.test(text); }","tryCatchPattern":null,"preventionTips":["Prefer 'Act as ...' phrasing in persona components","Treat SEM_W* findings as review signals, not blockers","Keep a waiver log for intentional roleplay components"],"tags":["roleplay","semantic-validation","warning"],"backgroundTag":"prompt-injection-detected","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}