Subconscious screen: detail view with post-fork entries

Track fork point in run_forked(), capture entries added during the
run. Subconscious screen shows these in a detail view (Enter to
drill in, Esc to go back) — only the subconscious agent's own
conversation, not the inherited conscious context.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-07 02:08:48 -04:00
parent c2a3844d69
commit ef868cb98f
3 changed files with 127 additions and 6 deletions

View file

@ -59,6 +59,9 @@ pub struct AutoAgent {
/// Named outputs from the agent's output() tool calls.
/// Collected per-run, read by Mind after completion.
pub outputs: std::collections::HashMap<String, String>,
/// Entries added during the last forked run (after the fork point).
/// The subconscious screen shows these.
pub last_run_entries: Vec<super::context::ConversationEntry>,
// Observable status
pub current_phase: String,
pub turn: usize,
@ -163,6 +166,7 @@ impl AutoAgent {
priority,
walked: Vec::new(),
outputs: std::collections::HashMap::new(),
last_run_entries: Vec::new(),
current_phase: String::new(),
turn: 0,
}
@ -198,9 +202,14 @@ impl AutoAgent {
}).collect();
let orig_steps = std::mem::replace(&mut self.steps, resolved_steps);
let forked = agent.fork(self.tools.clone());
let fork_point = forked.context.entries.len();
let mut backend = Backend::Forked(forked);
let result = self.run_with_backend(&mut backend, None).await;
self.steps = orig_steps; // restore templates
// Capture entries added during this run
if let Backend::Forked(ref agent) = backend {
self.last_run_entries = agent.context.entries[fork_point..].to_vec();
}
self.steps = orig_steps;
result
}