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

@ -158,6 +158,8 @@ pub struct Agent {
pub pending_yield: bool,
pub pending_model_switch: Option<String>,
pub pending_dmn_pause: bool,
/// Provenance tag for memory operations — identifies who made the change.
pub provenance: String,
/// Persistent conversation log — append-only record of all messages.
pub conversation_log: Option<ConversationLog>,
/// BPE tokenizer for token counting (cl100k_base — close enough
@ -214,6 +216,7 @@ impl Agent {
pending_yield: false,
pending_model_switch: None,
pending_dmn_pause: false,
provenance: "manual".to_string(),
conversation_log,
tokenizer,
context,
@ -253,6 +256,7 @@ impl Agent {
pending_yield: false,
pending_model_switch: None,
pending_dmn_pause: false,
provenance: self.provenance.clone(),
conversation_log: None,
tokenizer,
context: self.context.clone(),