Shared subconscious state — walked keys are Mind-level, not per-agent

SubconsciousSharedState holds walked keys shared between all
subconscious agents. Enables splitting surface-observe into separate
surface and observe agents that share the same walked state.

Walked is passed to run_forked() at run time instead of living on
AutoAgent. UI shows walked count in the subconscious screen header.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-07 02:13:06 -04:00
parent ef868cb98f
commit f3ba7e7097
4 changed files with 37 additions and 23 deletions

View file

@ -128,6 +128,7 @@ pub struct App {
pub(crate) context_info: Option<ContextInfo>,
pub(crate) shared_context: SharedContextState,
pub(crate) agent_state: Vec<crate::mind::SubconsciousSnapshot>,
pub(crate) subconscious_shared: crate::mind::SubconsciousSharedState,
pub(crate) channel_status: Vec<ChannelStatus>,
pub(crate) idle_info: Option<IdleInfo>,
}
@ -150,6 +151,7 @@ impl App {
should_quit: false, submitted: Vec::new(),
context_info: None, shared_context,
agent_state: Vec::new(),
subconscious_shared: Default::default(),
channel_status: Vec::new(), idle_info: None,
}
}
@ -406,7 +408,9 @@ pub async fn run(
// State sync on every wake
idle_state.decay_ewma();
app.update_idle(&idle_state);
app.agent_state = mind.subconscious_snapshots().await;
let (snaps, shared) = mind.subconscious_snapshots().await;
app.agent_state = snaps;
app.subconscious_shared = shared;
if !startup_done {
if let Ok(mut ag) = agent.try_lock() {
let model = ag.model().to_string();