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

Function is_index_scaffold

atomic-cli/src/commands/memory/list.rs:535–544  ·  view source on GitHub ↗

Is this `memory/…` entry the vault's index scaffold rather than a real canonical memory? The default `memory/MEMORY.md` installed by `init_vault` carries frontmatter `{"name":"MEMORY","type":"index"}` — it has no `uid`/`memoryKind` and is not attestable, so it must not appear as a row in the canonical, attestation-aware list. Detection reads the entry's declared `type == "index"` frontmatter (fail

(repo: &Repository, path: &str)

Source from the content-addressed store, hash-verified

533/// `type == "index"` frontmatter (fail-open: a read error is treated as "not an
534/// index" so a genuine memory is never silently hidden).
535fn is_index_scaffold(repo: &Repository, path: &str) -> bool {
536 let Ok(Some(entry)) = repo.vault_retrieve(path) else {
537 return false;
538 };
539 serde_json::from_str::<serde_json::Value>(&entry.frontmatter_json)
540 .ok()
541 .and_then(|v| v.get("type").and_then(|t| t.as_str()).map(str::to_owned))
542 .as_deref()
543 == Some("index")
544}
545
546#[cfg(test)]
547mod tests {

Callers 3

runMethod · 0.85

Calls 4

vault_retrieveMethod · 0.80
getMethod · 0.65
okMethod · 0.45
as_strMethod · 0.45