config: hot-reload via RPC, Arc<Config> for cheap sharing

Config is now stored in RwLock<Arc<Config>> instead of OnceLock<Config>.
get() returns Arc<Config> (cheap clone), and reload() re-reads from disk.

New RPC: "reload-config" — reloads config.jsonl without restarting
the daemon. Logs the change to daemon.log. Useful for switching
between API backends and claude accounts without losing in-flight
tasks.

New CLI: poc-memory agent daemon reload-config

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kent Overstreet 2026-03-19 13:41:13 -04:00
parent 0944ecc43f
commit af3171d6ec
4 changed files with 43 additions and 7 deletions

View file

@ -469,6 +469,8 @@ enum DaemonCmd {
},
/// Interactive TUI
Tui,
/// Reload config file without restarting
ReloadConfig,
}
#[derive(Subcommand)]
@ -1057,6 +1059,12 @@ fn cmd_daemon(sub: DaemonCmd) -> Result<(), String> {
DaemonCmd::Consolidate => daemon::rpc_consolidate(),
DaemonCmd::Run { agent, count } => daemon::rpc_run_agent(&agent, count),
DaemonCmd::Tui => tui::run_tui(),
DaemonCmd::ReloadConfig => {
match daemon::send_rpc_pub("reload-config") {
Some(resp) => { eprintln!("{}", resp.trim()); Ok(()) }
None => Err("daemon not running".into()),
}
}
}
}