# core/sessions — AGENTS.md ## Purpose Session lifecycle management: defines session state, status transitions, approval mode, bound profile/workspace, and the projector/reducer/repository stack for tracking active and historical sessions. ## Ownership CORREX kernel team. ## Local Contracts - `Session` — core session domain type with id, status, bound profile and workspace. - `SessionState` rebuilt from `SessionEvents` via `DefaultSessionReducer` + `SessionProjector`. - `DefaultSessionRepository` wraps `EventReplayer`. - `SessionStatus` — enum of lifecycle states (e.g. PENDING, RUNNING, COMPLETE, FAILED). - `ApprovalMode` — per-session approval policy binding (AUTO, MANUAL, etc.). - `BoundAgentInstructions` / `BoundProfile` / `BoundProjectProfile` / `BoundWorkspace` — types capturing what was bound to the session at launch time; these are immutable once set. - `SessionSummary` / `SessionSummaryProjector` — lightweight projection for listing sessions without full state replay. - `SessionCounterProjection` / `SessionCounterState` — cross-session counter projection. - `TransitionResult` — outcome type for session state transitions. ## Work Guidance - Follow the standard Events→State→Reducer→Projector→Repository pattern (see `core/AGENTS.md`). - `DefaultSessionReducer` only does `state.copy(...)`. No lifecycle decision logic in the reducer. - Bound types (`BoundProfile`, `BoundWorkspace`, etc.) are immutable once written to the event log. Do not mutate them post-bind. ## Verification ```bash ./gradlew :core:sessions:test --rerun-tasks ``` Tests in `testing/projections/` (DefaultSessionReducerTest) and `testing/replay/` (SessionReplayTest, SessionEmptyReplayTest). ## Child DOX Index No child AGENTS.md (leaf module).