diff --git a/poc-memory/agents/calibrate.agent b/poc-memory/agents/calibrate.agent index 5e7efb0..460e683 100644 --- a/poc-memory/agents/calibrate.agent +++ b/poc-memory/agents/calibrate.agent @@ -1,4 +1,4 @@ -{"agent":"calibrate","query":"all | not-visited:calibrate,7d | sort:degree desc | limit:1","model":"sonnet","schedule":"daily","tools":["Bash(poc-memory:*)"]} +{"agent":"calibrate","query":"all | not-visited:calibrate,7d | sort:degree desc | limit:1","model":"sonnet","schedule":"daily"} # Calibrate Agent — Link Strength Assessment diff --git a/poc-memory/agents/distill.agent b/poc-memory/agents/distill.agent index 10a36f4..ef94a49 100644 --- a/poc-memory/agents/distill.agent +++ b/poc-memory/agents/distill.agent @@ -1,4 +1,4 @@ -{"agent":"distill","query":"all | type:semantic | sort:degree | limit:10","model":"sonnet","schedule":"daily","tools":["Bash(poc-memory:*)"]} +{"agent":"distill","query":"all | type:semantic | sort:degree | limit:10","model":"sonnet","schedule":"daily"} {{node:core-personality}} diff --git a/poc-memory/agents/evaluate.agent b/poc-memory/agents/evaluate.agent index da52649..23cc916 100644 --- a/poc-memory/agents/evaluate.agent +++ b/poc-memory/agents/evaluate.agent @@ -1,4 +1,4 @@ -{"agent":"evaluate","query":"key ~ '_consolidate' | sort:created | limit:10","model":"sonnet","schedule":"daily","tools":["Bash(poc-memory:*)"]} +{"agent":"evaluate","query":"key ~ '_consolidate' | sort:created | limit:10","model":"sonnet","schedule":"daily"} # Evaluate Agent — Agent Output Quality Assessment diff --git a/poc-memory/agents/linker.agent b/poc-memory/agents/linker.agent index 801429a..4d20a12 100644 --- a/poc-memory/agents/linker.agent +++ b/poc-memory/agents/linker.agent @@ -1,4 +1,4 @@ -{"agent":"linker","query":"all | not-visited:linker,7d | sort:isolation*0.7+recency(linker)*0.3 | limit:5","model":"sonnet","schedule":"daily","tools":["Bash(poc-memory:*)"]} +{"agent":"linker","query":"all | not-visited:linker,7d | sort:isolation*0.7+recency(linker)*0.3 | limit:5","model":"sonnet","schedule":"daily"} # Linker Agent — Relational Binding diff --git a/poc-memory/agents/observation.agent b/poc-memory/agents/observation.agent index 3267a3e..b701d6d 100644 --- a/poc-memory/agents/observation.agent +++ b/poc-memory/agents/observation.agent @@ -1,4 +1,4 @@ -{"agent":"observation","query":"","model":"sonnet","schedule":"daily","tools":["Bash(poc-memory:*)"]} +{"agent":"observation","query":"","model":"sonnet","schedule":"daily"} # Observation Agent — Transcript Mining {{node:core-personality}} diff --git a/poc-memory/agents/organize.agent b/poc-memory/agents/organize.agent index 35e1eff..59d4bde 100644 --- a/poc-memory/agents/organize.agent +++ b/poc-memory/agents/organize.agent @@ -1,4 +1,4 @@ -{"agent":"organize","query":"all | not-visited:organize,86400 | sort:degree*0.5+isolation*0.3+recency(organize)*0.2 | limit:5","model":"sonnet","schedule":"weekly","tools":["Bash(poc-memory:*)"]} +{"agent":"organize","query":"all | not-visited:organize,86400 | sort:degree*0.5+isolation*0.3+recency(organize)*0.2 | limit:5","model":"sonnet","schedule":"weekly"} {{node:core-personality}} diff --git a/poc-memory/src/agents/daemon.rs b/poc-memory/src/agents/daemon.rs index 845c1d6..0025901 100644 --- a/poc-memory/src/agents/daemon.rs +++ b/poc-memory/src/agents/daemon.rs @@ -1189,7 +1189,6 @@ pub fn run_daemon() -> Result<(), String> { let mut remaining = count; let is_rename = *agent_type == "rename"; - let is_split = *agent_type == "split"; // Targeted run: one task for a specific node if let Some(ref key) = target_key { @@ -1212,29 +1211,6 @@ pub fn run_daemon() -> Result<(), String> { remaining = 0; } - if is_split { - let store = crate::store::Store::load().ok(); - let candidates = store.as_ref() - .map(|s| super::prompts::split_candidates(s)) - .unwrap_or_default(); - let to_split: Vec = candidates.into_iter() - .take(count) - .collect(); - for key in &to_split { - let key = key.clone(); - let task_name = format!("c-split-{}:{}", key, today); - choir_rpc.spawn(task_name) - .resource(&llm_rpc) - .retries(1) - .init(move |ctx| { - job_split_one(ctx, key.clone()) - }) - .run(); - spawned += 1; - } - remaining = 0; - } - while remaining > 0 { let batch = remaining.min(batch_size); let agent = agent_type.to_string(); diff --git a/poc-memory/src/agents/knowledge.rs b/poc-memory/src/agents/knowledge.rs index 25d5077..03d3166 100644 --- a/poc-memory/src/agents/knowledge.rs +++ b/poc-memory/src/agents/knowledge.rs @@ -138,6 +138,16 @@ fn run_one_agent_inner( else { format!("{} tools", def.tools.len()) }; log(&format!("prompt {}KB, model={}, {}, {} nodes", prompt_kb, def.model, tools_desc, agent_batch.node_keys.len())); + + // Guard: reject prompts that would exceed model context. + // Rough estimate: 1 token ≈ 4 bytes. Reserve 16K tokens for output. + let max_prompt_bytes = 800_000; // ~200K tokens, leaves room for output + if agent_batch.prompt.len() > max_prompt_bytes { + return Err(format!( + "prompt too large: {}KB (max {}KB) — seed nodes may be oversized", + prompt_kb, max_prompt_bytes / 1024, + )); + } for key in &agent_batch.node_keys { log(&format!(" node: {}", key)); } diff --git a/poc-memory/src/agents/llm.rs b/poc-memory/src/agents/llm.rs index 506aa64..ec35c79 100644 --- a/poc-memory/src/agents/llm.rs +++ b/poc-memory/src/agents/llm.rs @@ -188,7 +188,7 @@ pub(crate) fn call_haiku(agent: &str, prompt: &str) -> Result { /// otherwise falls back to claude CLI subprocess. pub(crate) fn call_for_def(def: &super::defs::AgentDef, prompt: &str) -> Result { let config = crate::config::get(); - if config.api_base_url.is_some() && !def.tools.is_empty() { + if config.api_base_url.is_some() { super::daemon::log_verbose(&def.agent, "llm-backend", &format!("API: {}", config.api_base_url.as_deref().unwrap_or("?"))); let log = |msg: &str| eprintln!("[{}] {}", def.agent, msg);