---
slug: "ContextSwitch"
name: "ContextSwitch"
type: "Protocols"
layer: "Society"
ref: "ContextSwitch#aa92"
sema_id: "sema:ContextSwitch#mh:SHA-256:aa928020743949b151e03433b563540eaf1bb56dad262297d2907bd0473931e2"
tags: ["Society","Protocols"]
updated: 2026-11-11
mindscape: "bootstrap"
index_url: https://mindscape.pages.dev/bootstrap/index.json
url: https://mindscape.pages.dev/bootstrap/ContextSwitch/
related: ["Context","Agent","Mode","WorkerMode"]
---

# ContextSwitch

Explicit, scoped protocol-mode toggle with enter/revert boundaries

Layer: Society · Category: Protocols

## Mechanism

[Agent](https://mindscape.pages.dev/bootstrap/Agent.md)s explicitly signal a change in [Context](https://mindscape.pages.dev/bootstrap/Context.md) (protocol [Mode](https://mindscape.pages.dev/bootstrap/Mode.md)), 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](https://mindscape.pages.dev/bootstrap/Mode.md) change (which applies to the whole agent), ContextSwitch is scoped to a specific conversation or channel and carries explicit enter/exit boundaries.

## 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](https://mindscape.pages.dev/bootstrap/Mode.md) 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.

## Builds on

- [Context](https://mindscape.pages.dev/bootstrap/Context.md) (Infrastructure; Accepts)
- [Agent](https://mindscape.pages.dev/bootstrap/Agent.md) (Mind; References)
- [Mode](https://mindscape.pages.dev/bootstrap/Mode.md) (Infrastructure; References)

## Used by

- [WorkerMode](https://mindscape.pages.dev/bootstrap/WorkerMode.md) (Society; References)

## Identity

- Sema ID: `sema:ContextSwitch#mh:SHA-256:aa928020743949b151e03433b563540eaf1bb56dad262297d2907bd0473931e2`
- Ref: `ContextSwitch#aa92`
- Supersedes:
  - `sema:ContextSwitch#mh:SHA-256:42cd102f1c3a2cba8029abd03d5949fb5b75b3df128016ef8bcb97f9304d8aef`
  - `sema:ContextSwitch#mh:SHA-256:67b2747f9e0dc041462f36df02e5b33540c2feb0d83bf40c580ea122d8f9ec06`
  - `sema:ContextSwitch#mh:SHA-256:f8c3d5f265624d0ff6af28dc26f6f347ae6286a04bde02398818e9bb12d761db`

## Links

- [Pattern page](https://mindscape.pages.dev/bootstrap/ContextSwitch/)
- [View in the interactive graph](https://mindscape.pages.dev/bootstrap/#ContextSwitch)
- [JSON](https://mindscape.pages.dev/bootstrap/ContextSwitch.json)
- [Index of all patterns](https://mindscape.pages.dev/bootstrap/index.json)
