# Shell guide
## Scope
Owns shared session/config state, local command helpers, and platform-shell spawning. It is not a text REPL.
## Where to look
| Shared active state and local command helpers | `mod.rs` |
| Compaction command helper | `compact.rs` |
| Platform process spawning | `runtime.rs` |
## Local rules
- `ShellState` holds shared active runtime state despite its historical name. Keep slash-command parsing in `../commands/mod.rs`; Mission Control owns conversation input and provider connection UI.
- `spawn_platform_shell` sets piped output and, on Unix, a separate process group. It is a spawn helper, not the complete bounded command executor.
- Keep `ShellEnvPolicy::Ambient` and `Sanitized` distinct: Unix sanitized commands skip startup profiles and use the subprocess environment profile.
- Callers own cwd preflight, pipe limits, timeouts, cancellation, and process cleanup. Do not assume spawning alone enforces those guarantees.
- Compaction uses the existing runtime/session path; it is not a generic external command runner.