{
  "handle": "ContextSwitch",
  "mechanism": "{{agent}}s explicitly signal a change in {{context}} (protocol {{mode}}), and all subsequent messages are interpreted under the new ruleset until a 'Revert' signal is sent. The new context pushes onto a stack; Revert pops it. Unlike an ambient {{mode}} change (which applies to the whole agent), ContextSwitch is scoped to a specific conversation or channel and carries explicit enter/exit boundaries.",
  "gloss": "Explicit, scoped protocol-mode toggle with enter/revert boundaries",
  "_meta": {
    "ring": 0,
    "tier": 1,
    "supersedes": [
      "sema:ContextSwitch#mh:SHA-256:42cd102f1c3a2cba8029abd03d5949fb5b75b3df128016ef8bcb97f9304d8aef",
      "sema:ContextSwitch#mh:SHA-256:67b2747f9e0dc041462f36df02e5b33540c2feb0d83bf40c580ea122d8f9ec06",
      "sema:ContextSwitch#mh:SHA-256:f8c3d5f265624d0ff6af28dc26f6f347ae6286a04bde02398818e9bb12d761db"
    ],
    "path": [
      "Society",
      "Protocols"
    ]
  },
  "sema_id": "sema:ContextSwitch#mh:SHA-256:aa928020743949b151e03433b563540eaf1bb56dad262297d2907bd0473931e2",
  "sema_ref": "ContextSwitch#aa92",
  "sema_stub": "aa92",
  "invariants": [
    "The switch is signalled explicitly; it is never inferred from content.",
    "Revert pops the most recent switch, not an arbitrary one.",
    "Scoped to one conversation or channel, unlike an ambient {{mode}} change."
  ],
  "failure_modes": [
    "Unbalanced stack: a switch is never reverted, so the ruleset outlives the exchange it was for.",
    "Scope leak: messages outside the switched channel are interpreted under the new ruleset."
  ],
  "dependencies": {
    "accepts": {
      "context": "sema:Context#mh:SHA-256:c1b72256dc4732033ee42cc07ff5d9fb60a7f1a3e5634449c343692a33340756"
    },
    "references": {
      "agent": "sema:Agent#mh:SHA-256:e127459069739fffc96a71d54ef6e8c97ca53471d5349c16aa72a092a33756cd",
      "mode": "sema:Mode#mh:SHA-256:29d368514a2a815e9790a384c2aec12bd20a30e1ee06288e0aa59fdcffea0800"
    }
  },
  "sema_layer": "Society",
  "sema_category": "Protocols",
  "used_by": {
    "references": {
      "WorkerMode": "sema:WorkerMode#mh:SHA-256:ba4708992ae8c4469b3c98e025829fafa8caf6430f1da66ed74b50a8e9255990"
    }
  }
}
