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

@ -355,7 +355,11 @@ impl AutoAgent {
}
format!("{}: {}", key, value)
} else {
agent_tools::dispatch(&call.function.name, &args).await
let agent = match &*backend {
Backend::Forked(a) => Some(a.clone()),
_ => None,
};
agent_tools::dispatch_with_agent(&call.function.name, &args, agent).await
};
dbglog!("[auto] {} result: {} chars", self.name, output.len());