agents: extract run_and_apply, eliminate dead split-plan.md

- Add run_and_apply() — combines run_one_agent + action application
  into one call. Used by daemon job_consolidation_agent and
  consolidate_full, which had identical run+apply loops.

- Port split_plan_prompt() to use split.agent via defs::resolve_placeholders
  instead of loading the separate split-plan.md template. Make
  resolve_placeholders public for this.

- Delete prompts/split-plan.md — superseded by agents/split.agent
  which was already the canonical definition.
This commit is contained in:
ProofOfConcept 2026-03-10 17:51:32 -04:00
parent abab85d249
commit 945865f594
6 changed files with 35 additions and 127 deletions

View file

@ -118,7 +118,6 @@ fn job_fact_mine(ctx: &ExecutionContext, path: &str) -> Result<(), TaskError> {
}
/// Run a single consolidation agent (replay, linker, separator, transfer, health).
/// Builds prompt, calls Sonnet, stores report node in the store.
fn job_consolidation_agent(
ctx: &ExecutionContext,
agent_type: &str,
@ -129,19 +128,9 @@ fn job_consolidation_agent(
run_job(ctx, &format!("c-{}", agent), || {
ctx.log_line("loading store");
let mut store = crate::store::Store::load()?;
ctx.log_line(&format!("running agent: {} (batch={})", agent, batch));
let result = super::knowledge::run_one_agent(&mut store, &agent, batch, "consolidate")?;
let ts = crate::store::compact_timestamp();
let mut applied = 0;
for action in &result.actions {
if super::knowledge::apply_action(&mut store, action, &agent, &ts, 0) {
applied += 1;
}
}
ctx.log_line(&format!("done: {} actions ({} applied)", result.actions.len(), applied));
let (total, applied) = super::knowledge::run_and_apply(&mut store, &agent, batch, "consolidate")?;
ctx.log_line(&format!("done: {} actions ({} applied)", total, applied));
Ok(())
})
}