Store a memory via the GENERIC vault path (as `memory write`/attest do).
(repo: &Repository, id: &str, kind: &str, about: &[&str], body: &str)
| 386 | |
| 387 | /// Store a memory via the GENERIC vault path (as `memory write`/attest do). |
| 388 | fn store_memory(repo: &Repository, id: &str, kind: &str, about: &[&str], body: &str) { |
| 389 | let mut spine = Map::new(); |
| 390 | spine.insert("uid".into(), Value::String(id.to_string())); |
| 391 | spine.insert("memoryKind".into(), Value::String(kind.to_string())); |
| 392 | spine.insert("status".into(), Value::String("active".into())); |
| 393 | spine.insert( |
| 394 | "createdAt".into(), |
| 395 | Value::String("2026-07-01T00:00:00+00:00".into()), |
| 396 | ); |
| 397 | if !about.is_empty() { |
| 398 | spine.insert( |
| 399 | "about".into(), |
| 400 | Value::Array(about.iter().map(|a| Value::String(a.to_string())).collect()), |
| 401 | ); |
| 402 | } |
| 403 | let path = bridge::normalize_memory_path(id); |
| 404 | repo.vault_store( |
| 405 | &path, |
| 406 | VaultEntryType::Memory, |
| 407 | body.as_bytes().to_vec(), |
| 408 | serde_json::to_string(&spine).unwrap(), |
| 409 | ) |
| 410 | .unwrap(); |
| 411 | } |
| 412 | |
| 413 | /// Lift+attest a stored memory with the given keypair. |
| 414 | fn attest_with(repo: &Repository, id: &str, kp: &KeyPair) -> MemoryNode { |