Tune subconscious agent trigger intervals

Fix interval=0 agents firing when there's no new conversation content.
Adjust intervals: observe=1KB, journal/reflect=10KB.

Co-Authored-By: ProofOfConcept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-10 02:39:50 -04:00
parent 1aa60552bc
commit eae8d92918

View file

@ -278,11 +278,11 @@ use crate::subconscious::defs;
/// Names and byte-interval triggers for the built-in subconscious agents.
const AGENTS: &[(&str, u64)] = &[
("subconscious-surface", 0), // every trigger
("subconscious-observe", 0), // every trigger
("subconscious-thalamus", 0), // every trigger
("subconscious-journal", 20_000), // every ~20KB of conversation
("subconscious-reflect", 100_000), // every ~100KB of conversation
("subconscious-surface", 0), // every new conversation content
("subconscious-observe", 1_000), // every ~1KB of conversation
("subconscious-thalamus", 0), // every new conversation content
("subconscious-journal", 10_000), // every ~10KB of conversation
("subconscious-reflect", 10_000), // every ~10KB of conversation
];
/// Snapshot for the TUI — includes a handle to the forked agent
@ -354,7 +354,9 @@ impl SubconsciousAgent {
fn should_trigger(&self, conversation_bytes: u64, interval: u64) -> bool {
if !self.auto.enabled || self.is_running() { return false; }
if interval == 0 { return true; }
if interval == 0 {
return conversation_bytes > self.last_trigger_bytes;
}
conversation_bytes.saturating_sub(self.last_trigger_bytes) >= interval
}