Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

fixup(consolidate): document the admission preflight + error-mapping cleanup

AkitaOnRailsf18b90e2cbde
diff --git a/crates/ai-memory-store/src/reader.rs b/crates/ai-memory-store/src/reader.rs
index 0d0e4f8f..cdb33052 100644
--- a/crates/ai-memory-store/src/reader.rs
+++ b/crates/ai-memory-store/src/reader.rs
@@ -1392,10 +1392,16 @@ impl ReaderPool {
};
let ws_bytes: Vec<u8> = row.get(0)?;
let proj_bytes: Vec<u8> = row.get(1)?;
- let ws = WorkspaceId::from_slice(&ws_bytes)
- .map_err(|_| rusqlite::Error::IntegralValueOutOfRange(0, 0))?;
- let proj = ProjectId::from_slice(&proj_bytes)
- .map_err(|_| rusqlite::Error::IntegralValueOutOfRange(1, 0))?;
+ let ws = WorkspaceId::from_slice(&ws_bytes).map_err(|e| {
+ StoreError::Memory(ai_memory_core::MemoryError::MalformedRecord(format!(
+ "bad observation workspace_id: {e}"
+ )))
+ })?;
+ let proj = ProjectId::from_slice(&proj_bytes).map_err(|e| {
+ StoreError::Memory(ai_memory_core::MemoryError::MalformedRecord(format!(
+ "bad observation project_id: {e}"
+ )))
+ })?;
Ok(Some((ws, proj)))
})
.await
diff --git a/docs/admission-webhooks.md b/docs/admission-webhooks.md
index 5ba73ed8..afa1502b 100644
--- a/docs/admission-webhooks.md
+++ b/docs/admission-webhooks.md
@@ -41,6 +41,15 @@ Webhooks fire on these `op` values today (extensible enum):
`write-page`, `/admin/write-page`, the lint rewriter, hook synthesis.
- `consolidate` — LLM consolidation writes from the consolidator
(SessionEnd opt-in + PreCompact + manual `memory_consolidate`).
+ **Fires up to twice per consolidation**: once as an admission *preflight*
+ before the LLM call — with an **empty body** and the target page path (for
+ multi-page runs, the canonical `sessions/<id>.md` anchor path) — and again
+ as the normal write-time check with the real content. Treat blocking calls
+ as **decisions, not delivery events**: gate on `op` / `actor` / `workspace`
+ / `project` / path, don't reject solely because the body is empty, and
+ don't count blocking calls as one-write-happened side effects (use a
+ non-blocking observer webhook for that). Any mutation returned during the
+ preflight is discarded.
- `delete` — a single page is removed (`Wiki::delete_page`, triggered by the
`memory_delete_page` MCP tool). Carries the page path, no body; fired
**before** the file is removed so a mirror can `git rm` the same path. The