provenance: pass directly through thought::dispatch, remove globals

Provenance now flows as a function parameter through the entire tool
dispatch chain: thought::dispatch → memory::dispatch → store methods.

Removed task_local (TASK_AGENT), thread_local (TASK_PHASE), and env
var (POC_PROVENANCE) from the tool dispatch path. The env var remains
only as a fallback for non-tool paths (CLI commands, digest).

Phase names are passed from knowledge.rs → llm.rs → api.rs, and
api.rs updates the provenance string between steps. No globals needed.
This commit is contained in:
ProofOfConcept 2026-03-27 15:44:39 -04:00
parent 36bde60ba0
commit 92ca2bf2c8
7 changed files with 34 additions and 47 deletions

View file

@ -74,10 +74,11 @@ pub async fn dispatch(
name: &str,
args: &serde_json::Value,
tracker: &ProcessTracker,
provenance: Option<&str>,
) -> Option<ToolOutput> {
// Memory and journal tools
if name.starts_with("memory_") || name.starts_with("journal_") || name == "output" {
let result = memory::dispatch(name, args, None);
let result = memory::dispatch(name, args, provenance);
return Some(match result {
Ok(s) => ToolOutput::text(s),
Err(e) => ToolOutput::error(e),