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

Function normalize_memory_path

atomic-cli/src/commands/memory/bridge.rs:68–72  ·  view source on GitHub ↗

Normalize a bare id, a `memory/ ` path, an ` .md` name, or a full `memory/ .md` path all to the canonical vault path `memory/ .md`. This is the SINGLE memory id/path resolver: no manifest lookup, no prefix, no case-folding — the manifest key IS the path (contrast the intent normalizer, which is deliberately NOT reused). A memory is a single flat file per id, never a directory.

(id_or_path: &str)

Source from the content-addressed store, hash-verified

66/// normalizer, which is deliberately NOT reused). A memory is a single flat
67/// file per id, never a directory.
68pub fn normalize_memory_path(id_or_path: &str) -> String {
69 let without_prefix = id_or_path.strip_prefix("memory/").unwrap_or(id_or_path);
70 let stem = without_prefix.strip_suffix(".md").unwrap_or(without_prefix);
71 format!("memory/{stem}.md")
72}
73
74/// The `<id>` stem for a bare id or any accepted path form. Used both to build
75/// the human-facing messages and (sanitized) to KEY the attestation path.

Callers 8

runMethod · 0.70
memory_idFunction · 0.70
read_memoryFunction · 0.70
repo_with_memoryFunction · 0.70
store_memoryFunction · 0.70

Calls

no outgoing calls