CLI/hippocampus: rename core memory functions to memory_*

Aligns function names with tool names for consistency:
- hippocampus: render → memory_render, write → memory_write, etc.
- tools/memory.rs: macro no longer prepends memory_ prefix
- CLI files: use typed async API throughout (graph.rs, journal.rs, admin.rs)

This eliminates the "memory_graph_topology" tool name bug where
graph_* and journal_* tools were incorrectly prefixed.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-13 13:26:22 -04:00
parent fa50f1c826
commit 5b07a81aa7
7 changed files with 106 additions and 130 deletions

View file

@ -1,5 +1,6 @@
// cli/journal.rs — journal subcommand handlers
use crate::agent::tools::memory;
pub fn cmd_tail(n: usize, full: bool, provenance: Option<&str>, dedup: bool) -> Result<(), String> {
let path = crate::store::nodes_path();
@ -66,32 +67,23 @@ pub fn cmd_tail(n: usize, full: bool, provenance: Option<&str>, dedup: bool) ->
Ok(())
}
pub fn cmd_journal_tail(n: usize, full: bool, level: u8) -> Result<(), String> {
let format = if full { "full" } else { "compact" };
let result = crate::mcp_server::memory_rpc(
"journal_tail",
serde_json::json!({"count": n, "level": level, "format": format}),
).map_err(|e| e.to_string())?;
pub async fn cmd_journal_tail(n: usize, full: bool, level: u8) -> Result<(), String> {
let format = if full { Some("full") } else { Some("compact") };
let result = memory::journal_tail(None, Some(n as u64), Some(level as u64), format, None).await
.map_err(|e| e.to_string())?;
print!("{}", result);
Ok(())
}
pub fn cmd_journal_write(name: &str, text: &[String]) -> Result<(), String> {
pub async fn cmd_journal_write(name: &str, text: &[String]) -> Result<(), String> {
if text.is_empty() {
return Err("journal write requires text".into());
}
super::check_dry_run();
let body = text.join(" ");
let result = crate::mcp_server::memory_rpc(
"journal_new",
serde_json::json!({
"name": name,
"title": name,
"body": body,
"level": 0
}),
).map_err(|e| e.to_string())?;
let result = memory::journal_new(None, name, name, &body, Some(0)).await
.map_err(|e| e.to_string())?;
println!("{}", result);
Ok(())
}