This guide applies only to the Rust core in src/. Follow the root guide for repository-wide rules and the architecture index for design invariants. This guide records only the non-obvious boundaries in src/.
session/is daemon-owned, transport-neutral state.application/andweb/are clients that translate their inputs and protocols into session operations; they do not own repositories, the terminal hub, shared preferences, or PTY sizing. See session design for the session boundary.- The attached TUI's daemon socket transport and the browser viewer's HTTP/WebSocket transport are separate security boundaries. The former relies on socket-file permissions and the latter on web authentication. Keep shared state changes in
session/, but do not combine authentication or wire handling for the two transports. See web design for the web layer. TerminalBackendjoins the localPtyBackendto the daemon-shared session'sHubBackend. Observe pane creation, closure, reordering, and resizing through the backend event contract; actual PTY sizing follows session-level ownership and confirmedResizedevents. Do not bypass this boundary by having a frontend update PTY or hub internals directly.
app.rsis the crate-internal TUI facade; preserve its existingpubandpub(crate)visibility. Group internal Git view handling underapp/git/and focus/input navigation underapp/navigation/. Keep application wiring and session I/O at the root ofapp/, and place new behavior at its nearest responsibility boundary so the flat module set does not grow again.
- Daemon frames distinguish control JSON from raw terminal bytes. If changing framing kinds, length validation, truncated-stream handling, or terminal-payload chunking invariants, update session design and the corresponding wire/contract tests. Keep session repository-set notifications behind a single watcher producer so competing client responses cannot reorder them.
- Put OS-dependent behavior behind the existing
platform/seam, and hide Unix/Windows differences in daemon socket types in one place,daemon/transport.rs. Before scattering newcfgbranches in callers, check whether the existing seam can absorb them. Document platform behavior that has no equivalent.