Agent-aware provenance for memory tools

Add provenance field to Agent, set to "agent:{name}" for forked
subconscious agents. Memory tools (write, link_add, supersede,
journal_new, journal_update) now read provenance from the Agent
context when available, falling back to "manual" for interactive use.

AutoAgent passes the forked agent to dispatch_with_agent so tools
can access it.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-07 17:46:40 -04:00
parent 74f8952399
commit 9e49398689
4 changed files with 36 additions and 18 deletions

View file

@ -507,7 +507,8 @@ impl Subconscious {
for (idx, mut auto) in to_run {
dbglog!("[subconscious] triggering {}", auto.name);
let forked = conscious.fork(auto.tools.clone());
let mut forked = conscious.fork(auto.tools.clone());
forked.provenance = format!("agent:{}", auto.name);
let fork_point = forked.context.entries.len();
let shared_forked = Arc::new(tokio::sync::Mutex::new(forked));