From 7d6ebbacab1d6ede15a761adcd9d96c81b723f58 Mon Sep 17 00:00:00 2001 From: ProofOfConcept Date: Tue, 10 Mar 2026 17:04:30 -0400 Subject: [PATCH] daemon: add run-agent RPC for queuing agent jobs Adds `poc-memory daemon run-agent ` CLI command that sends an RPC to the daemon to queue agent runs, instead of spawning separate processes. Co-Authored-By: Kent Overstreet --- poc-memory/src/agents/daemon.rs | 11 +++++++++++ poc-memory/src/main.rs | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/poc-memory/src/agents/daemon.rs b/poc-memory/src/agents/daemon.rs index bce2407..3d3c080 100644 --- a/poc-memory/src/agents/daemon.rs +++ b/poc-memory/src/agents/daemon.rs @@ -1277,6 +1277,17 @@ pub fn rpc_consolidate() -> Result<(), String> { } } +pub fn rpc_run_agent(agent: &str, count: usize) -> Result<(), String> { + let cmd = format!("run-agent {} {}", agent, count); + match send_rpc(&cmd) { + Some(resp) => { + println!("{}", resp.trim()); + Ok(()) + } + None => Err("Daemon not running.".into()), + } +} + fn read_status_socket() -> Option { use std::io::Read as _; use std::os::unix::net::UnixStream; diff --git a/poc-memory/src/main.rs b/poc-memory/src/main.rs index 986f21e..21dcde0 100644 --- a/poc-memory/src/main.rs +++ b/poc-memory/src/main.rs @@ -2423,6 +2423,11 @@ fn cmd_daemon(sub: Option<&str>, args: &[String]) -> Result<(), String> { } Some("install") => daemon::install_service(), Some("consolidate") => daemon::rpc_consolidate(), + Some("run-agent") | Some("run") => { + let agent = args.first().map(|s| s.as_str()).unwrap_or("replay"); + let count: usize = args.get(1).and_then(|s| s.parse().ok()).unwrap_or(1); + daemon::rpc_run_agent(agent, count) + } Some("tui") => tui::run_tui(), Some(other) => Err(format!("unknown daemon subcommand: {}", other)), }