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:571–579  ·  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

569/// Read a vault path from KG node metadata. New identity schemes can change
570/// node IDs without changing this retrieval contract.
571fn memory_path_from_node(node: &KgNode) -> Option<String> {
572 node.metadata
573 .as_ref()
574 .and_then(|metadata| metadata.get("vault_path"))
575 .and_then(|path| path.as_str())
576 .filter(|path| path.starts_with("memory/") && path.ends_with(".md"))
577 .map(String::from)
578 .or_else(|| legacy_memory_node_id_to_path(&node.id))
579}
580
581/// Legacy fallback: `memory:architecture` -> `memory/architecture.md`.
582fn legacy_memory_node_id_to_path(node_id: &str) -> Option<String> {

Callers 2

gather_candidatesMethod · 0.85
add_memory_neighborsFunction · 0.85

Calls 4

as_refMethod · 0.80
getMethod · 0.65
as_strMethod · 0.45

Tested by

no test coverage detected