How agents switch between situations without losing state. Not a stack — a transport layer over the three externalizations defined in coordination-topology">Foundation 07.
#Problem
A single session routinely traverses multiple contexts: you start on task A, discover it requires B, B raises question C. Each transition risks losing state. Current mitigations — spawning new sessions, posting to boards, holding everything in the context window — are either expensive (multi-agent overhead) or fragile (context window compression erases working state).
#Insight: the state is already there
The initial design proposed a separate "stack" structure with frames, cursors, push/pop operations. That over-engineers a new format for state that existing structures already carry:
| Existing structure | What it holds | Axis |
|---|---|---|
Board (board.md) | What's happening here, messages between agents | Domain |
Index (index.md) | What exists here, navigational structure | Domain |
| Tasks | Active work items with status | Method |
| Engagement state (TBD) | Where are we in the procedure | Method |
| Trace (TBD) | Where the agent has been, why it moved | Actor |
What's missing isn't a storage format — it's transport: the mechanism for an agent to leave one situation and enter another cleanly.
#Design
#Context switch = checkpoint + engage
Switching context is the same operation whether the agent returns to the same situation or moves to a new one:
- Checkpoint — update the current domain's board with what you've done and what comes next. This is the write side.
- Trace — record the transition in the actor's navigation log: where you were, where you're going, why.
- Engage — load the new situation's board and index. This is the read side.
The agent doesn't carry state across the switch. All persistent state lives at the domain (board + index) or in the method (engagement state). The agent is stateless between situations; the trace records what the agent can't hold.
#The trace
Each actor-token maintains a log of its navigation. The trace is private to the actor — different agents at the same situation have different traces.
.claude/trace.md (or per-session: .claude/traces/<session-id>.md)
Each entry records: timestamp, from-situation, to-situation, trigger (what caused the move). This creates a directed graph of the session's traversal.
11:00 whatsapp-import → iphone-extraction | need broader extraction plan
11:15 iphone-extraction → cloud-storage | 309GB backup needs offsite
11:20 cloud-storage → context-stack | noticed need for context management
12:30 context-stack → write-placement | file misplacement connects to inscription
The trace serves two purposes:
- Resume: agent reads its own trace to recall where it's been
- Reconstruction: trace + boards + indices = lossless session recovery (Foundation 07 claim)
#Engagement state (third externalization)
The method-axis externalization — where are we in the procedure, what's been done, what comes next. This is the state that the old "stack frames" were trying to capture, but it belongs to the method, not to a separate stack.
Design TBD. The key constraint: engagement state must be readable by any actor that enters the situation, not just the one that wrote it.
#When to use subagents vs. context switch
Not every transition is a context switch. The decision depends on how much context you need:
| Scenario | Use |
|---|---|
| Quick lookup, no shared state needed | Subagent (isolated, fresh context) |
| Sustained work in new domain | Context switch (checkpoint + engage) |
| Deep focus that would evict current context | New session (fresh window) |
| Return to previous work | Engage from trace |
Subagents are for reads. Context switches are for writes that need persistence.
#Relationship to existing structures
| Structure | Scope | Externalizes |
|---|---|---|
| Board | inter-agent | coordination messages, situation state |
| Index | navigational | content structure, what exists here |
| Tasks | flat list | work items |
| Memory | cross-session | durable patterns |
| Session log | post-session | archival record |
| Trace | intra-session | actor navigation history |
| Engagement state | cross-session | method execution position |
#Connection to HAAK thesis
Context transport makes human steering cheaper. Instead of re-explaining context after a switch, the human says "go back to X" and the agent engages, reads the board, and has the state. The intervention cost drops from explanation to selection.
#What's built, what's not
| Component | Status |
|---|---|
| Board (checkpoint target) | Built, active |
| Index (engage target) | Built, active |
| Engage skill | Built |
| Checkpoint skill | Built (as /checkpoint) |
| Trace | Designed, not built |
| Engagement state | Designed (Foundation 07), not built |
| Automatic checkpoint-on-exit | Not built — /bye updates board but doesn't record trace |
Architecture 20 — 20 — Context Transport — 2026 — Zachary F. Mainen / HAAK