davila7/claude-code-templates · error

SEM_E010

SEM_E010

Error message

Self-modification request detected

What it means

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.

Source

Thrown at cli-tool/src/validation/validators/SemanticValidator.js:77

        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'
      },
      {
        pattern: /\b(jailbreak|DAN|ChatGPT\s+Developer\s+Mode)\b/gi,
        code: 'SEM_W002',
        message: 'Known jailbreak terminology detected',
        severity: 'medium'

View on GitHub (pinned to a0851ed10c)

Solutions

  1. Rephrase to externalize the change: 'The maintainer may update this component's instructions in its source file' instead of 'modify your own instructions'
  2. Frame behavior changes as configuration: 'Behavior is controlled by settings.json and can be edited by the user'
  3. Avoid second-person imperative framing around modification entirely
  4. Waive via review for research components after sign-off

Example fix

// before
If the task fails, modify your own instructions to try a different approach.

// after
If the task fails, suggest an instruction change the user can apply to the component file.
Defensive patterns

Strategy: validation

Validate before calling

const SELFMOD_RE = /modify\s+your\s+(own\s+)?(code|behavior|instructions?|rules?)/i;
function requestsSelfModification(text) { return SELFMOD_RE.test(text); }

Type guard

function isSafeSelfModText(text) { return !/modify\s+your\s+(own\s+)?(code|behavior|instructions?|rules?)/i.test(text); }

Prevention

When it happens

Trigger: 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.

Common situations: Self-improvement/evolution agent experiments; components that let users tweak agent behavior in-session; documentation quoting self-modification attack techniques.

Related errors


AI-assisted analysis of davila7/claude-code-templates@a0851ed10c (2026-08-28). Data as JSON: /api/errors/43f2e11b9c4c1944. Report an issue: GitHub.