Run subconscious collect/trigger on every event loop iteration

Previously only fired after conscious turn completion. Now runs on
every wake — DMN timer, user input, background events. Subconscious
agents get checked regardless of what woke the loop.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-07 02:37:11 -04:00
parent 6191f30aec
commit 3788695634

View file

@ -442,13 +442,6 @@ impl Mind {
if !self.config.no_agents { if !self.config.no_agents {
cmds.push(MindCommand::Score); cmds.push(MindCommand::Score);
} }
// Trigger subconscious agents after conscious turn completes
if !self.config.no_agents {
let mut sub = self.subconscious.lock().await;
sub.collect_results(&self.agent).await;
sub.trigger(&self.agent).await;
}
} }
_ = tokio::time::sleep(timeout), if !turn_active => { _ = tokio::time::sleep(timeout), if !turn_active => {
@ -459,6 +452,13 @@ impl Mind {
} }
} }
// Subconscious: collect finished results, trigger due agents
if !self.config.no_agents {
let mut sub = self.subconscious.lock().await;
sub.collect_results(&self.agent).await;
sub.trigger(&self.agent).await;
}
// Check for pending user input → push to agent context and start turn // Check for pending user input → push to agent context and start turn
let pending = self.shared.lock().unwrap().take_pending_input(); let pending = self.shared.lock().unwrap().take_pending_input();
if let Some(text) = pending { if let Some(text) = pending {