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

Function memory_list_attestation

libatomic/src/daemon/services_agent.rs:1161–1205  ·  view source on GitHub ↗

A memory's attestation, loaded through the memory bridge's dual-read: the tracked `attestations/memory/ /attested.md` entry first, then the single legacy sidecar path.

(
    repo: &Repository,
    id: &str,
    frontmatter: &Map<String, Value>,
    body: &str,
)

Source from the content-addressed store, hash-verified

1159/// the tracked `attestations/memory/<id>/attested.md` entry first, then
1160/// the single legacy sidecar path.
1161fn memory_list_attestation(
1162 repo: &Repository,
1163 id: &str,
1164 frontmatter: &Map<String, Value>,
1165 body: &str,
1166) -> LoadedAttestation<MemoryNode> {
1167 let vpath = format!("attestations/memory/{}/attested.md", sanitize_id(id));
1168 if let Ok(Some(entry)) = repo.vault_retrieve(&vpath) {
1169 if let Ok(node) = serde_json::from_str::<MemoryNode>(body_of(&entry).trim_end()) {
1170 return classify_artifact(
1171 node,
1172 tracked_source_anchor(&entry),
1173 source_content_hash(frontmatter, body),
1174 );
1175 }
1176 }
1177 let path = repo
1178 .dot_dir()
1179 .join("canonical")
1180 .join("memory")
1181 .join(sanitize_id(id))
1182 .join("attested.jsonld");
1183 if path.exists() {
1184 if let Ok(text) = std::fs::read_to_string(&path) {
1185 if let Ok(artifact) = serde_json::from_str::<Value>(&text) {
1186 if let Ok(node) = serde_json::from_value::<MemoryNode>(
1187 artifact.get("node").cloned().unwrap_or(Value::Null),
1188 ) {
1189 let recorded = artifact
1190 .get("source")
1191 .and_then(|s| s.get("sourceContentHash"))
1192 .and_then(Value::as_str)
1193 .map(str::to_string);
1194 return classify_artifact(
1195 node,
1196 recorded,
1197 source_content_hash(frontmatter, body),
1198 );
1199 }
1200 }
1201 return LoadedAttestation::None;
1202 }
1203 }
1204 LoadedAttestation::None
1205}
1206
1207/// The local vault-init body's recursive tracker: add every file under
1208/// the vault directory (relative to the repository root).

Callers 1

list_vault_entriesMethod · 0.85

Calls 9

body_ofFunction · 0.85
classify_artifactFunction · 0.85
tracked_source_anchorFunction · 0.85
vault_retrieveMethod · 0.80
source_content_hashFunction · 0.70
sanitize_idFunction · 0.70
getMethod · 0.65
dot_dirMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected