agent_cycles, memory-search: use forward_to_daemon instead of Store::load
Replace direct store access with calls to the daemon's memory_render tool via MCP socket. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
5f30bc670e
commit
dba3210530
2 changed files with 12 additions and 17 deletions
|
|
@ -376,9 +376,9 @@ pub fn format_agent_output(output: &AgentCycleOutput) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !output.surfaced_keys.is_empty() {
|
if !output.surfaced_keys.is_empty() {
|
||||||
if let Ok(store) = consciousness::store::Store::load() {
|
|
||||||
for key in &output.surfaced_keys {
|
for key in &output.surfaced_keys {
|
||||||
if let Some(rendered) = consciousness::cli::node::render_node(&store, key) {
|
let args = serde_json::json!({"key": key});
|
||||||
|
if let Ok(rendered) = consciousness::mcp_server::forward_to_daemon("memory_render", args) {
|
||||||
if !rendered.trim().is_empty() {
|
if !rendered.trim().is_empty() {
|
||||||
use std::fmt::Write as _;
|
use std::fmt::Write as _;
|
||||||
writeln!(out, "--- {} (surfaced) ---", key).ok();
|
writeln!(out, "--- {} (surfaced) ---", key).ok();
|
||||||
|
|
@ -387,7 +387,6 @@ pub fn format_agent_output(output: &AgentCycleOutput) -> String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(ref reflection) = output.reflection {
|
if let Some(ref reflection) = output.reflection {
|
||||||
use std::fmt::Write as _;
|
use std::fmt::Write as _;
|
||||||
|
|
|
||||||
|
|
@ -165,20 +165,16 @@ fn run_agent_and_parse(agent: &str, session_arg: &Option<String>) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let Ok(store) = consciousness::store::Store::load() else {
|
|
||||||
eprintln!("Failed to load store");
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
for key in &keys {
|
for key in &keys {
|
||||||
if let Some(content) = consciousness::cli::node::render_node(&store, key) {
|
let args = serde_json::json!({"key": key});
|
||||||
if !content.trim().is_empty() {
|
match consciousness::mcp_server::forward_to_daemon("memory_render", args) {
|
||||||
|
Ok(content) if !content.trim().is_empty() => {
|
||||||
println!("--- {} (surfaced) ---", key);
|
println!("--- {} (surfaced) ---", key);
|
||||||
print!("{}", content);
|
print!("{}", content);
|
||||||
println!();
|
println!();
|
||||||
}
|
}
|
||||||
} else {
|
Ok(_) => {}
|
||||||
eprintln!(" key not found: {}", key);
|
Err(_) => eprintln!(" key not found: {}", key),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if has_none {
|
} else if has_none {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue