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

Function is_index_scaffold

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

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

Callers 3

runMethod · 0.85

Calls 3

vault_retrieveMethod · 0.80
getMethod · 0.65
as_strMethod · 0.45