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

Function is_index_scaffold

atomic-cli/src/commands/memory/list.rs:366–375  ·  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

364/// `type == "index"` frontmatter (fail-open: a read error is treated as "not an
365/// index" so a genuine memory is never silently hidden).
366fn is_index_scaffold(repo: &Repository, path: &str) -> bool {
367 let Ok(Some(entry)) = repo.vault_retrieve(path) else {
368 return false;
369 };
370 serde_json::from_str::<serde_json::Value>(&entry.frontmatter_json)
371 .ok()
372 .and_then(|v| v.get("type").and_then(|t| t.as_str()).map(str::to_owned))
373 .as_deref()
374 == Some("index")
375}
376
377#[cfg(test)]
378mod tests {

Callers 3

runMethod · 0.85

Calls 3

vault_retrieveMethod · 0.80
getMethod · 0.65
as_strMethod · 0.45