Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
Merge remote-tracking branch 'refs/remotes/pr/16'
AkitaOnRails0fa892b0b2e1
diff --cc crates/ai-memory-hooks/src/payload.rsindex aa5ce249,f0252bee..56c9c75f--- a/crates/ai-memory-hooks/src/payload.rs+++ b/crates/ai-memory-hooks/src/payload.rs@@@ -8,8 -8,20 +8,20 @@@ use serde::{Deserialize, Serialize}pub struct HookQuery {/// Lifecycle event identifier (kebab-case or snake_case).pub event: String,- /// Agent CLI identifier (`claude-code`, `codex`, `open-code`, `omp`).+ /// Agent CLI identifier (`claude-code`, `codex`, `cursor`, etc.).pub agent: Option<String>,+ /// Working directory of the agent at the time the hook fired.+ /// Most agents put this in the JSON body, but accepting it on the+ /// query string too lets `curl` / tests / non-Claude bridges+ /// populate it without constructing a body envelope.+ pub cwd: Option<String>,+ /// Workspace name override (typically declared by the agent's+ /// host-side hook via a `.ai-memory.toml` walk-up). When `None`+ /// the server falls back to `DEFAULT_WORKSPACE_NAME`.+ pub workspace: Option<String>,+ /// Project name override (same source as `workspace`). When+ /// `None` the server falls back to `basename(cwd)`.+ pub project: Option<String>,}/// Coalesced view of an incoming hook event after light parsing of thediff --cc crates/ai-memory-hooks/src/router.rsindex 4e8e7cfa,2f0c89ab..750850b6--- a/crates/ai-memory-hooks/src/router.rs+++ b/crates/ai-memory-hooks/src/router.rs@@@ -34,13 -33,12 +34,19 @@@ use crate::loguse crate::payload::{HookEnvelope, HookEvent, HookQuery, parse_agent};use crate::synth::synthesize_session_page;+/// Default maximum number of hook events allowed to be processing at once.+///+/// This matches the writer queue order of magnitude and prevents unbounded+/// background tasks during tool-heavy bursts. Saturated servers return 429 so+/// callers can drop or retry instead of growing memory without bound.+pub const DEFAULT_HOOK_INGEST_MAX_IN_FLIGHT: usize = 1024;++ /// Resolved-project cache: `(cwd, workspace_override, project_override)`+ /// keyed map, shared behind a Tokio mutex so the router can be cloned+ /// freely without losing the in-flight cache hits.+ pub type ProjectCache =+ Arc<tokio::sync::Mutex<HashMap<(String, String, String), (WorkspaceId, ProjectId)>>>;+/// Shared state passed to the hook handler.#[derive(Clone)]pub struct HookState {