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