Store a memory via the GENERIC vault path (as `memory write`/attest do).
(repo: &Repository, id: &str, kind: &str, about: &[&str], body: &str)
| 563 | |
| 564 | /// Store a memory via the GENERIC vault path (as `memory write`/attest do). |
| 565 | fn store_memory(repo: &Repository, id: &str, kind: &str, about: &[&str], body: &str) { |
| 566 | let mut spine = Map::new(); |
| 567 | spine.insert("uid".into(), Value::String(id.to_string())); |
| 568 | spine.insert("memoryKind".into(), Value::String(kind.to_string())); |
| 569 | spine.insert("status".into(), Value::String("active".into())); |
| 570 | spine.insert( |
| 571 | "createdAt".into(), |
| 572 | Value::String("2026-07-01T00:00:00+00:00".into()), |
| 573 | ); |
| 574 | if !about.is_empty() { |
| 575 | spine.insert( |
| 576 | "about".into(), |
| 577 | Value::Array(about.iter().map(|a| Value::String(a.to_string())).collect()), |
| 578 | ); |
| 579 | } |
| 580 | let path = bridge::normalize_memory_path(id); |
| 581 | repo.vault_store( |
| 582 | &path, |
| 583 | VaultEntryType::Memory, |
| 584 | body.as_bytes().to_vec(), |
| 585 | serde_json::to_string(&spine).unwrap(), |
| 586 | ) |
| 587 | .unwrap(); |
| 588 | } |
| 589 | |
| 590 | /// Lift+attest a stored memory with the given keypair. |
| 591 | fn attest_with(repo: &Repository, id: &str, kp: &KeyPair) -> MemoryNode { |