forked from kent/consciousness
rename agent: fix tool calls and target override
- Add memory_rename tool (in-place rename, preserves content and links)
- Update rename.agent prompt to use memory_rename() instead of text output
- Fix {{rename}} placeholder to respect --target keys when provided
- Add format_rename_targets() for targeted rename runs
This commit is contained in:
parent
bb2e3b9fbb
commit
37acb9502d
4 changed files with 62 additions and 8 deletions
|
|
@ -303,6 +303,38 @@ pub fn format_rename_candidates(store: &Store, count: usize) -> (Vec<String>, St
|
|||
(keys, out)
|
||||
}
|
||||
|
||||
/// Format specific target keys as rename candidates (for --target mode)
|
||||
pub fn format_rename_targets(store: &Store, keys: &[String]) -> String {
|
||||
let mut out = String::new();
|
||||
out.push_str(&format!("## Nodes to rename ({} targets)\n\n", keys.len()));
|
||||
|
||||
for key in keys {
|
||||
let Some(node) = store.nodes.get(key) else {
|
||||
out.push_str(&format!("### {}\n\n(node not found)\n\n---\n\n", key));
|
||||
continue;
|
||||
};
|
||||
out.push_str(&format!("### {}\n", key));
|
||||
let created = if node.timestamp > 0 {
|
||||
crate::store::format_datetime(node.timestamp)
|
||||
} else {
|
||||
"unknown".to_string()
|
||||
};
|
||||
out.push_str(&format!("Created: {}\n", created));
|
||||
|
||||
let content = &node.content;
|
||||
if content.len() > 800 {
|
||||
let truncated = crate::util::truncate(content, 800, "\n[...]");
|
||||
out.push_str(&format!("\nContent ({} chars, truncated):\n{}\n\n",
|
||||
content.len(), truncated));
|
||||
} else {
|
||||
out.push_str(&format!("\nContent:\n{}\n\n", content));
|
||||
}
|
||||
|
||||
out.push_str("---\n\n");
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Get split candidates sorted by size (largest first)
|
||||
pub fn split_candidates(store: &Store) -> Vec<String> {
|
||||
let mut candidates: Vec<(&str, usize)> = store.nodes.iter()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue