# Shell guide
Owns shared session/config state, local command helpers, and platform-shell spawning, not a text REPL.
## Where to look
| Shared active state and command helpers | `mod.rs` |
| Compaction command helper | `compact.rs` |
| Platform process spawning | `runtime.rs` |
| Deadline-aware MCP/LSP child stdin writes | `child_pipe_writer.rs` |
## Local rules
- `ShellState` holds shared active runtime state despite its historical name. Parsing stays in `../commands/mod.rs`; Mission Control owns conversation input and provider connection UI.
- `spawn_platform_shell` pipes output and creates a separate Unix process group; it is not the complete bounded command executor.
- Distinguish `ShellEnvPolicy::Ambient` and `Sanitized`: sanitized Unix commands skip startup profiles and use the subprocess environment profile.
- Callers own cwd preflight, pipe limits, timeouts, cancellation and process cleanup; spawning alone does not enforce them.
- MCP/LSP share `ChildPipeWriter`: nonblocking stdin, serialized writes and deadline/cancellation checks during lock acquisition and writes. Reuse request deadlines; add no writer threads/queues. Callers own framing and connection cleanup after partial-write failures.
- Compaction delegates to the runtime/session path; it is not a generic external command runner.