# State guide
Display reducers, activity relationships, pane focus and derived render caches.
## Where to look
| State facade/models/cache access | `../state.rs`, `transcript_cache.rs` |
| Output application/stream reconciliation | `output_events.rs` |
| Activity graph/tool/child links | `activity_state.rs`, `activity_state/{parent_graph,subagent_transcript}.rs` |
| Transcript navigation/selection | `transcript_state.rs` |
| Prompt lifecycle/display commands | `prompt_state.rs`, `prompt_actions.rs` |
| Modal input/selection affordances | `modal.rs`, `modal/` |
| Pane visibility/focus/pinning | `layout.rs` |
| Primary/child/provider-context views | `primary_agent_state.rs`, `subagent_viewer.rs`, `provider_context.rs` |
## Local contracts
- `apply_output_event` lives in `output_events.rs`, not facade. Final assistant/thinking events reconcile dropped previews. Finish redaction/control-sanitizer state at hard boundaries before unrelated rows; fragments cannot cross messages.
- Preserve activity IDs for selection/transcript links/active-tool replacement. Explicit parent wins over inferred ancestry; reject cycles.
- Source edits invalidate affected transcript/activity caches; normalize tool indices/selection/scroll after removals/replacements. `TranscriptEntries` owns and prunes row metadata; state owns selection/targeted cache eviction, activity ingestion refreshes typed cards.
- Child viewer caches tabs/subtree cards/offsets. Reparenting invalidates old/new ancestry; retain visible-row rendering and bounded projection.
- Modal previews summarize navigation; modal models hold input/selection affordances, not durable workflow ownership. Review reducer ordering when changing transitions.
- `profiling_support.rs` stays outside production builds.