MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / memory_path_from_node

Function memory_path_from_node

atomic-cli/src/commands/vault/context.rs:653–661  ·  view source on GitHub ↗

Read a vault path from KG node metadata. New identity schemes can change node IDs without changing this retrieval contract.

(node: &KgNode)

Source from the content-addressed store, hash-verified

651/// Read a vault path from KG node metadata. New identity schemes can change
652/// node IDs without changing this retrieval contract.
653fn memory_path_from_node(node: &KgNode) -> Option<String> {
654 node.metadata
655 .as_ref()
656 .and_then(|metadata| metadata.get("vault_path"))
657 .and_then(|path| path.as_str())
658 .filter(|path| path.starts_with("memory/") && path.ends_with(".md"))
659 .map(String::from)
660 .or_else(|| memory_node_id_to_path(&node.id))
661}
662
663fn memory_node_id_to_path(node_id: &str) -> Option<String> {
664 let (_, name) = iri::parse_memory(node_id).ok()?;

Callers 2

gather_candidatesMethod · 0.70
add_memory_neighborsFunction · 0.70

Calls 4

as_refMethod · 0.80
memory_node_id_to_pathFunction · 0.70
getMethod · 0.65
as_strMethod · 0.45

Tested by

no test coverage detected