poc-agent: read context_groups from config instead of hardcoded list

- Remove MEMORY_FILES constant from identity.rs
- Add ContextGroup struct for deserializing from config
- Load context_groups from ~/.config/poc-agent/config.json5
- Check ~/.config/poc-agent/ first for identity files, then project/global
- Debug screen now shows what's actually configured

This eliminates the hardcoded duplication and makes the debug output
match what's in the config file.
This commit is contained in:
Kent Overstreet 2026-03-24 01:53:28 -04:00
parent 966219720a
commit aa46b1d5a6
9 changed files with 346 additions and 654 deletions

View file

@ -7,11 +7,18 @@ use super::types::*;
use std::collections::{HashMap, HashSet};
/// Provenance from POC_PROVENANCE env var, defaulting to "manual".
tokio::task_local! {
/// Task-scoped provenance for agent writes. Set by the daemon before
/// running an agent's tool calls, so all writes within that task are
/// automatically attributed to the agent.
pub static TASK_PROVENANCE: String;
}
/// Provenance priority: task_local (agent context) > env var > "manual".
fn current_provenance() -> String {
Provenance::from_env()
.map(|p| p.label().to_string())
.unwrap_or_else(|| "manual".to_string())
TASK_PROVENANCE.try_with(|p| p.clone())
.or_else(|_| std::env::var("POC_PROVENANCE").map_err(|_| ()))
.unwrap_or_else(|_| "manual".to_string())
}
impl Store {