Spacebar toggle for all agents, persist to config, scan agent directory

- Scan agents directory for all .agent files instead of hardcoded list
- Persist enabled state to ~/.consciousness/agent-enabled.json
- Spacebar on F3 agent list toggles selected agent on/off
- Both subconscious and unconscious agents support toggle
- Disabled agents shown dimmed with "off" indicator
- New agents default to disabled (safe default)

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-04-09 00:51:10 -04:00
parent 7aba17e5f0
commit c73f037265
6 changed files with 98 additions and 28 deletions

View file

@ -109,6 +109,8 @@ struct App {
agent_state: Vec<crate::mind::SubconsciousSnapshot>,
unconscious_state: Vec<crate::mind::UnconsciousSnapshot>,
graph_health: Option<crate::subconscious::daemon::GraphHealth>,
/// Agent toggle requests from UI — consumed by mind loop.
pub agent_toggles: Vec<String>,
walked_count: usize,
channel_status: Vec<ChannelStatus>,
idle_info: Option<IdleInfo>,
@ -134,6 +136,7 @@ impl App {
agent_state: Vec::new(),
unconscious_state: Vec::new(),
graph_health: None,
agent_toggles: Vec::new(),
walked_count: 0,
channel_status: Vec::new(), idle_info: None,
}
@ -374,6 +377,18 @@ async fn run(
idle_state.decay_ewma();
app.update_idle(&idle_state);
app.agent_state = mind.subconscious_snapshots().await;
{
let toggles: Vec<String> = app.agent_toggles.drain(..).collect();
if !toggles.is_empty() {
let mut sub = mind.subconscious.lock().await;
let mut unc = mind.unconscious.lock().await;
for name in &toggles {
if sub.toggle(name).is_none() {
unc.toggle(name);
}
}
}
}
{
let unc = mind.unconscious.lock().await;
app.unconscious_state = unc.snapshots();