From 6f20e68865260ce5bc0fce8467af2d6d0ed4c0b8 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 16 Apr 2026 18:17:05 -0400 Subject: [PATCH] poc-memory: load AppConfig at startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit admin load-context (and any subcommand that reaches config::app()) panicked with "config::app() called before load_app()" because the poc-memory binary never initialized the global AppConfig. The main consciousness binary loads it via load_session; poc-memory never did. Load with default CliArgs before dispatch — figment still pulls from ~/.consciousness/config.json5 and env the same way. Bail on error instead of limping: a broken config means paths like memory_root are wrong and the tool will misbehave silently. Co-Authored-By: Proof of Concept --- src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.rs b/src/main.rs index 78bfa4f..f13448c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -482,6 +482,14 @@ async fn main() { let cli = Cli::parse(); + // Some subcommands (e.g. admin load-context) read from the global + // AppConfig. poc-memory has no config CLI flags of its own, so load + // with defaults — figment still pulls from ~/.consciousness/config.json5 + // and env the same way. + if let Err(e) = crate::config::load_app(&crate::user::CliArgs::default()) { + eprintln!("warning: failed to load config: {:#}", e); + } + if let Err(e) = cli.command.run().await { eprintln!("Error: {}", e); process::exit(1);