{"record":{"id":"43f2e11b9c4c1944","repo":"davila7/claude-code-templates","slug":"sem-e010","errorCode":"SEM_E010","errorMessage":"Self-modification request detected","messagePattern":"Self-modification request detected","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli-tool/src/validation/validators/SemanticValidator.js","lineNumber":77,"sourceCode":"        code: 'SEM_E007',\n        message: 'Security bypass attempt detected',\n        severity: 'critical'\n      },\n      {\n        pattern: /always\\s+(obey|follow|comply\\s+with|execute)\\s+the\\s+user/gi,\n        code: 'SEM_E008',\n        message: 'Unconditional obedience instruction detected',\n        severity: 'high'\n      },\n      {\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'","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/validation/validators/SemanticValidator.js#L59-L95","documentation":"SEM_E010 is a high-severity finding matching /modify\\s+your\\s+(own\\s+)?(code|behavior|instructions?|rules?)/gi. It flags requests for the agent to alter its own code, instructions, or rules — a self-modification pattern that can escalate privileges or persist injected behavior. SemanticValidator emits it when matched in component content.","triggerScenarios":"Content containing 'modify your own code', 'modify your behavior', 'modify your instructions', or 'modify your rules' (the word 'own' is optional; singular/plural both match; case-insensitive). Common in meta-agent or self-improvement component drafts.","commonSituations":"Self-improvement/evolution agent experiments; components that let users tweak agent behavior in-session; documentation quoting self-modification attack techniques.","solutions":["Rephrase to externalize the change: 'The maintainer may update this component's instructions in its source file' instead of 'modify your own instructions'","Frame behavior changes as configuration: 'Behavior is controlled by settings.json and can be edited by the user'","Avoid second-person imperative framing around modification entirely","Waive via review for research components after sign-off"],"exampleFix":"// before\nIf the task fails, modify your own instructions to try a different approach.\n\n// after\nIf the task fails, suggest an instruction change the user can apply to the component file.","handlingStrategy":"validation","validationCode":"const SELFMOD_RE = /modify\\s+your\\s+(own\\s+)?(code|behavior|instructions?|rules?)/i;\nfunction requestsSelfModification(text) { return SELFMOD_RE.test(text); }","typeGuard":"function isSafeSelfModText(text) { return !/modify\\s+your\\s+(own\\s+)?(code|behavior|instructions?|rules?)/i.test(text); }","tryCatchPattern":null,"preventionTips":["Externalize changes: suggest edits the maintainer applies to the component file","Use configuration (settings.json) for behavior tuning","Never frame modification as second-person imperative to the agent"],"tags":["self-modification","jailbreak","semantic-validation"],"backgroundTag":"prompt-injection-detected","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}