mind: rename Session to Mind

The cognitive state machine is a Mind, not a Session. This is the
struct that AgentCycle will hang off of when we add subagent forking.

Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2026-04-05 01:55:14 -04:00
parent 390b6c6c0a
commit 1f06b49503

View file

@ -1,6 +1,6 @@
// mind/ — Cognitive layer
//
// Session state machine, DMN, identity, observation socket.
// Mind state machine, DMN, identity, observation socket.
// Everything about how the mind operates, separate from the
// user interface (TUI, CLI) and the agent execution (tools, API).
@ -8,11 +8,11 @@ pub mod dmn;
pub mod identity;
pub mod log;
// consciousness.rs — Session state machine and event loop
// consciousness.rs — Mind state machine and event loop
//
// The core runtime for the consciousness binary. Session manages turns,
// The core runtime for the consciousness binary. Mind manages turns,
// DMN state, compaction, scoring, and slash commands. The event loop
// bridges Session (cognitive state) with App (TUI rendering).
// bridges Mind (cognitive state) with App (TUI rendering).
//
// The event loop uses biased select! so priorities are deterministic:
// keyboard events > turn results > render ticks > DMN timer > UI messages.
@ -44,13 +44,13 @@ enum Command {
None,
}
// --- Session: all mutable state for a running agent session ---
// --- Mind: all mutable state for a running agent session ---
/// Collects the ~15 loose variables that previously lived in run()
/// into a coherent struct with methods. The event loop dispatches
/// to Session methods; Session manages turns, compaction, DMN state,
/// to Mind methods; Mind manages turns, compaction, DMN state,
/// and slash commands.
pub struct Session {
pub struct Mind {
agent: Arc<Mutex<Agent>>,
config: SessionConfig,
ui_tx: ui_channel::UiSender,
@ -81,7 +81,7 @@ pub struct Session {
scoring_in_flight: bool,
}
impl Session {
impl Mind {
fn new(
agent: Arc<Mutex<Agent>>,
config: SessionConfig,
@ -796,7 +796,7 @@ pub async fn run(cli: crate::user::CliArgs) -> Result<()> {
let (turn_tx, mut turn_rx) = mpsc::channel::<(Result<TurnResult>, StreamTarget)>(1);
let no_agents = config.no_agents;
let mut session = Session::new(agent, config, ui_tx.clone(), turn_tx);
let mut session = Mind::new(agent, config, ui_tx.clone(), turn_tx);
session.update_status();
if !no_agents {
session.start_memory_scoring(); // also sends initial agent snapshots