poc-memory agent run: single agent execution with dry-run

New command: `poc-memory agent run <agent> [--count N] [--dry-run]`

Runs a single agent by name through the full pipeline (build prompt,
call LLM, apply actions). With --dry-run, sets POC_MEMORY_DRY_RUN=1
so all mutations are no-ops but the agent can still read the graph.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kent Overstreet 2026-03-16 18:13:24 -04:00
parent 7e131862d6
commit f0df489465
2 changed files with 26 additions and 0 deletions

View file

@ -5,6 +5,19 @@ use crate::store::StoreView;
use crate::agents::llm;
use std::sync::atomic::{AtomicUsize, Ordering};
pub fn cmd_run_agent(agent: &str, count: usize, dry_run: bool) -> Result<(), String> {
if dry_run {
std::env::set_var("POC_MEMORY_DRY_RUN", "1");
}
let mut store = store::Store::load()?;
let log = |msg: &str| eprintln!("[{}] {}", agent, msg);
let (total, applied) = crate::agents::knowledge::run_and_apply_with_log(
&mut store, agent, count, "test", &log,
)?;
eprintln!("[{}] {} actions, {} applied", agent, total, applied);
Ok(())
}
pub fn cmd_consolidate_batch(count: usize, auto: bool, agent: Option<String>) -> Result<(), String> {
let store = store::Store::load()?;

View file

@ -558,6 +558,17 @@ enum AgentCmd {
/// Path to JSONL transcript
path: String,
},
/// Run a single agent by name
Run {
/// Agent name (e.g. observation, linker, distill)
agent: String,
/// Batch size (number of seed nodes/fragments)
#[arg(long, default_value_t = 5)]
count: usize,
/// Dry run — set POC_MEMORY_DRY_RUN=1 so mutations are no-ops
#[arg(long)]
dry_run: bool,
},
/// Show spaced repetition replay queue
#[command(name = "replay-queue")]
ReplayQueue {
@ -800,6 +811,8 @@ fn main() {
AgentCmd::FactMine { path, batch, dry_run, output, min_messages }
=> cli::agent::cmd_fact_mine(&path, batch, dry_run, output.as_deref(), min_messages),
AgentCmd::FactMineStore { path } => cli::agent::cmd_fact_mine_store(&path),
AgentCmd::Run { agent, count, dry_run }
=> cli::agent::cmd_run_agent(&agent, count, dry_run),
AgentCmd::ReplayQueue { count } => cli::agent::cmd_replay_queue(count),
AgentCmd::Evaluate { matchups, model, dry_run }
=> cli::agent::cmd_evaluate_agents(matchups, &model, dry_run),