Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
mcp: memory_briefing + memory_explore (gap-adaptive)
AkitaOnRailse04a4c593c34
diff --git a/Cargo.lock b/Cargo.lockindex 54717382..c9b05e43 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -168,6 +168,7 @@ dependencies = ["ai-memory-wiki","anyhow","axum",+ "jiff","rmcp","schemars","serde",diff --git a/crates/ai-memory-consolidate/src/consolidator.rs b/crates/ai-memory-consolidate/src/consolidator.rsindex bdf8f31f..f67f6182 100644--- a/crates/ai-memory-consolidate/src/consolidator.rs+++ b/crates/ai-memory-consolidate/src/consolidator.rs@@ -184,6 +184,15 @@ impl Consolidator {&self.writer}+ /// Borrow the underlying LLM provider. Used by lightweight LLM+ /// callers (`memory_explore`) that want to issue a one-shot+ /// completion without going through the full consolidate+ /// pipeline.+ #[must_use]+ pub fn llm(&self) -> Arc<dyn ai_memory_llm::LlmProvider> {+ self.llm.clone()+ }+/// M7b multi-page consolidation: ask the LLM for a batch of page/// updates spanning sessions/, concepts/, decisions/, then write/// them all atomically (one SQL transaction).diff --git a/crates/ai-memory-mcp/Cargo.toml b/crates/ai-memory-mcp/Cargo.tomlindex 96c5836a..f7b4e58e 100644--- a/crates/ai-memory-mcp/Cargo.toml+++ b/crates/ai-memory-mcp/Cargo.toml@@ -23,6 +23,10 @@ tracing.workspace = truermcp.workspace = trueschemars.workspace = trueaxum.workspace = true+# Time gap calculation for `memory_explore` (parse stored ISO-8601+# timestamps + delta against now). The rest of the crate doesn't+# need a clock dep.+jiff.workspace = true[dev-dependencies]tempfile.workspace = truediff --git a/crates/ai-memory-mcp/src/server.rs b/crates/ai-memory-mcp/src/server.rsindex 2483389c..fd21b871 100644--- a/crates/ai-memory-mcp/src/server.rs+++ b/crates/ai-memory-mcp/src/server.rs@@ -137,6 +137,26 @@ struct HandoffAcceptArgs {cwd: Option<String>,}+#[derive(Debug, Serialize, Deserialize, schemars::JsonSchema)]+struct BriefingArgs {+ /// How many recently-updated pages to include (default 10, max 100).+ #[serde(default)]+ recent_pages_limit: Option<usize>,+}++#[derive(Debug, Serialize, Deserialize, schemars::JsonSchema)]+struct ExploreArgs {+ /// Optional topic to bias the digest toward (e.g. "recent rules",+ /// "pending handoffs", or a free-form question). When absent the+ /// digest covers the project broadly.+ #[serde(default)]+ focus: Option<String>,+ /// How many recently-updated pages the underlying briefing should+ /// consider (default 10).+ #[serde(default)]+ recent_pages_limit: Option<usize>,+}+#[tool_router]impl AiMemoryServer {/// Construct a server backed by the given reader/writer + 3-tuple@@ -475,6 +495,85 @@ impl AiMemoryServer {let response = StatusResponse { counts };ok_json(&response)}++ /// Composite "what's going on" snapshot — structured data only,+ /// no LLM call. Pair with `memory_explore` if you want prose.+ #[tool(description = "Compose a structured snapshot of project activity \+ WITHOUT any LLM call: lifetime counts, 7-day and 30-day activity \+ windows, last-observation timestamp, pending handoff count, \+ current `_rules/` pages, and recent-page list. Cheap, fast, \+ deterministic. Use this when you want a programmatic view of \+ project state; use `memory_explore` if you want an LLM-composed \+ prose summary on top of the same data.")]+ async fn memory_briefing(+ &self,+ Parameters(args): Parameters<BriefingArgs>,+ ) -> Result<CallToolResult, McpError> {+ let limit = args.recent_pages_limit.unwrap_or(10);+ let snapshot = self+ .reader+ .briefing(limit)+ .await+ .map_err(|e| McpError::internal_error(e.to_string(), None))?;+ ok_json(&snapshot)+ }++ /// LLM-driven exploration. Calls `memory_briefing` internally, computes+ /// the time gap since the last observation, then asks the configured+ /// LLM to compose a calibrated prose digest (more detail for longer+ /// gaps, less for short ones). Falls back to a friendly JSON dump if+ /// no LLM is configured.+ #[tool(description = "Compose a calibrated prose digest of project \+ state. Calls `memory_briefing` for structured data, computes how \+ long it's been since the last observation, then asks the LLM to \+ scale verbosity to the gap (just-checked-in → 1-line, weeks-away \+ → fuller catchup). Accepts an optional `focus` argument to bias \+ the digest toward a topic (e.g. \"recent rules\" / \"pending \+ handoffs\" / a free-form question). When no LLM is configured \+ this returns the underlying briefing JSON unchanged so the \+ caller can render its own prose.")]+ async fn memory_explore(+ &self,+ Parameters(args): Parameters<ExploreArgs>,+ ) -> Result<CallToolResult, McpError> {+ let limit = args.recent_pages_limit.unwrap_or(10);+ let snapshot = self+ .reader+ .briefing(limit)+ .await+ .map_err(|e| McpError::internal_error(e.to_string(), None))?;++ let Some(llm) = &self.consolidator else {+ // No LLM configured — return the structured snapshot.+ // Caller can render prose itself if it wants.+ return ok_json(&serde_json::json!({+ "prose": null,+ "reason": "no LLM provider configured; returning structured briefing instead",+ "briefing": snapshot,+ }));+ };++ let gap = explore_gap_from_snapshot(&snapshot);+ let request = build_explore_request(&snapshot, &gap, args.focus.as_deref());+ let provider = llm.llm();+ let text = match provider.complete(request).await {+ Ok(resp) => resp.text,+ Err(e) => {+ tracing::warn!(error = %e, "memory_explore LLM call failed; degrading to briefing");+ return ok_json(&serde_json::json!({+ "prose": null,+ "reason": format!("LLM call failed: {e}"),+ "briefing": snapshot,+ }));+ }+ };++ ok_json(&serde_json::json!({+ "prose": text,+ "gap": gap,+ "briefing": snapshot,+ }))+ }}#[tool_handler]@@ -516,6 +615,149 @@ fn ok_json<T: Serialize>(value: &T) -> Result<CallToolResult, McpError> {Ok(CallToolResult::success(vec![Content::text(s)]))}+/// Description of how long it's been since the last observation.+/// `memory_explore` uses this both to size its prompt verbosity and+/// to give the LLM an explicit "time gap is N hours" cue.+#[derive(Debug, Serialize)]+struct ExploreGap {+ /// Hours since the last observation, or `None` if nothing has+ /// ever been observed for this project.+ hours_since_last: Option<f64>,+ /// Coarse bucket name used to drive the prompt:+ /// `none` — no prior activity at all.+ /// `fresh` — last observation < 1 h ago.+ /// `today` — < 24 h ago.+ /// `recent` — < 7 days ago.+ /// `dormant` — < 30 days ago.+ /// `stale` — > 30 days ago.+ bucket: &'static str,+ /// Plain-English description for the LLM prompt.+ description: String,+}++fn explore_gap_from_snapshot(s: &ai_memory_store::BriefingSnapshot) -> ExploreGap {+ let Some(last) = s.last_observation_at.as_deref() else {+ return ExploreGap {+ hours_since_last: None,+ bucket: "none",+ description: "no prior activity recorded for this project".into(),+ };+ };+ let Ok(last_ts) = last.parse::<jiff::Timestamp>() else {+ return ExploreGap {+ hours_since_last: None,+ bucket: "none",+ description: format!("last observation timestamp unparseable: {last}"),+ };+ };+ let delta_us = jiff::Timestamp::now().as_microsecond() - last_ts.as_microsecond();+ let hours = (delta_us as f64) / 1_000_000.0 / 3600.0;+ let (bucket, description) = if hours < 1.0 {+ (+ "fresh",+ format!("{:.1} minutes since last observation", hours * 60.0),+ )+ } else if hours < 24.0 {+ ("today", format!("{hours:.1} hours since last observation"))+ } else if hours < 24.0 * 7.0 {+ (+ "recent",+ format!("{:.1} days since last observation", hours / 24.0),+ )+ } else if hours < 24.0 * 30.0 {+ (+ "dormant",+ format!("{:.1} days since last observation", hours / 24.0),+ )+ } else {+ (+ "stale",+ format!("{:.1} days since last observation", hours / 24.0),+ )+ };+ ExploreGap {+ hours_since_last: Some(hours),+ bucket,+ description,+ }+}++/// Build the ChatRequest for `memory_explore`. The user message+/// inlines the entire briefing as JSON — small enough (a few KB) that+/// model context is not a concern. The system prompt + the gap+/// bucket together steer verbosity.+fn build_explore_request(+ snapshot: &ai_memory_store::BriefingSnapshot,+ gap: &ExploreGap,+ focus: Option<&str>,+) -> ai_memory_llm::ChatRequest {+ let snapshot_json = serde_json::to_string_pretty(snapshot).unwrap_or_else(|_| "{}".into());+ let mut user = String::new();+ user.push_str("## Project state snapshot\n\n");+ user.push_str("```json\n");+ user.push_str(&snapshot_json);+ user.push_str("\n```\n\n");+ user.push_str(&format!(+ "## Time gap\n\nBucket: `{}` — {}.\n\n",+ gap.bucket, gap.description+ ));+ if let Some(focus) = focus {+ user.push_str("## Focus\n\nThe user is specifically interested in: ");+ user.push_str(focus);+ user.push_str("\n\nBias the digest toward this topic while still covering anything urgent (pending handoffs, recently-changed rules).\n");+ }+ ai_memory_llm::ChatRequest {+ system: Some(EXPLORE_SYSTEM_PROMPT.into()),+ messages: vec![ai_memory_llm::ChatMessage {+ role: ai_memory_llm::Role::User,+ content: user,+ }],+ max_tokens: 1500,+ temperature: Some(0.2),+ }+}++/// System prompt for `memory_explore`. Pure faithfulness rules+/// (mirrors the consolidation system prompt's discipline) + explicit+/// verbosity-vs-gap scaling.+const EXPLORE_SYSTEM_PROMPT: &str = "\+You are composing a digest of a software project's long-term memory \+for a developer reorienting to the project. You receive a structured \+snapshot (JSON) and a `time gap` bucket; your output is markdown \+prose.\n\+\n\+## Verbosity scales with the gap\n\+\n\+- `fresh` (< 1 h ago) — one line. The developer was just here; \+ reorient minimally. Example: \"Last touched X. No pending work.\"\n\+- `today` (< 24 h) — 2-4 lines. What was last worked on; pending \+ handoffs if any; nothing else.\n\+- `recent` (< 7 days) — 1-2 paragraphs. Summary of what's changed; \+ any new rules; pending handoffs; warnings.\n\+- `dormant` (< 30 days) — 3-5 paragraphs. Fuller catchup: \+ activity over the window, new rules with one-line explanations, \+ pending handoffs spelled out, decay candidates if any.\n\+- `stale` (> 30 days) — full briefing. Activity totals, every rule \+ surfaced briefly, all pending handoffs, decay candidates, \+ warnings about stale knowledge.\n\+- `none` (no prior activity) — one paragraph saying so plus the \+ current rule list (if any).\n\+\n\+## FAITHFULNESS\n\+\n\+Everything in your output MUST be grounded in the snapshot. Do not \+invent dates, counts, or page titles. Do not invent rules or \+warnings that aren't in the data. If the snapshot is empty (zero \+counts, no recent_pages), say so plainly — do not pad with generic \+advice.\n\+\n\+## Format\n\+\n\+Plain markdown. Use level-2 headers (`##`) only for the longer \+buckets (`dormant`/`stale`). For `fresh`/`today`/`recent` skip \+headers entirely. Quote rule titles from the snapshot with \+backticks. Never wrap the whole response in code fences.";+#[cfg(test)]mod tests {use super::*;@@ -590,6 +832,106 @@ mod tests {assert!(text.contains("\"pages_latest\": 1"));}+ #[tokio::test]+ async fn memory_briefing_returns_structured_snapshot() {+ let (_tmp, _store, server, _ws, _pj) = setup_server().await;+ let result = server+ .memory_briefing(Parameters(BriefingArgs {+ recent_pages_limit: Some(5),+ }))+ .await+ .unwrap();+ let text = result+ .content+ .first()+ .and_then(|c| c.as_text())+ .map(|t| t.text.clone())+ .unwrap();+ // Spot-check the structural shape — every key must be present+ // so callers don't need to defensively handle missing fields.+ for key in [+ "\"counts\":",+ "\"activity_7d\":",+ "\"activity_30d\":",+ "\"last_observation_at\":",+ "\"pending_handoff_count\":",+ "\"rules\":",+ "\"recent_pages\":",+ ] {+ assert!(text.contains(key), "missing {key} in briefing:\n{text}");+ }+ // setup_server inserts one page, no sessions/observations,+ // no rules. The activity windows therefore observe zero.+ assert!(+ text.contains("\"sessions\": 0"),+ "expected lifetime sessions: 0\n{text}"+ );+ }++ /// `memory_explore` without an LLM provider configured must+ /// degrade to returning the underlying briefing rather than+ /// erroring. Mirrors the behaviour of `memory_consolidate`+ /// (no provider → clean error/no-op), and matches the design+ /// invariant that LLM features are strictly opt-in.+ #[tokio::test]+ async fn memory_explore_without_llm_degrades_to_briefing() {+ let (_tmp, _store, server, _ws, _pj) = setup_server().await;+ let result = server+ .memory_explore(Parameters(ExploreArgs {+ focus: None,+ recent_pages_limit: Some(5),+ }))+ .await+ .unwrap();+ let text = result+ .content+ .first()+ .and_then(|c| c.as_text())+ .map(|t| t.text.clone())+ .unwrap();+ assert!(+ text.contains("\"prose\": null"),+ "expected null prose\n{text}"+ );+ assert!(+ text.contains("no LLM provider configured"),+ "expected fallback reason\n{text}"+ );+ assert!(+ text.contains("\"briefing\":"),+ "expected briefing payload\n{text}"+ );+ }++ #[test]+ fn explore_gap_bucket_picks_right_label() {+ use ai_memory_store::BriefingSnapshot;+ // No prior activity → `none`.+ let snap = BriefingSnapshot::default();+ let gap = explore_gap_from_snapshot(&snap);+ assert_eq!(gap.bucket, "none");+ assert!(gap.hours_since_last.is_none());++ // Helper: build a snapshot with last_observation_at N hours ago.+ let snap_at = |hours: i64| -> BriefingSnapshot {+ let ts = jiff::Timestamp::now() - jiff::SignedDuration::from_hours(hours);+ BriefingSnapshot {+ last_observation_at: Some(ts.to_string()),+ ..Default::default()+ }+ };++ let cases = [(2, "today"), (24 * 10, "dormant"), (24 * 60, "stale")];+ for (hours, expected) in cases {+ let g = explore_gap_from_snapshot(&snap_at(hours));+ assert_eq!(+ g.bucket, expected,+ "{hours}h → {expected}, got {}",+ g.bucket+ );+ }+ }+#[tokio::test]async fn memory_recent_returns_one_hit() {let (_tmp, _store, server, _ws, _pj) = setup_server().await;diff --git a/crates/ai-memory-store/src/lib.rs b/crates/ai-memory-store/src/lib.rsindex ec307398..1df3c9ca 100644--- a/crates/ai-memory-store/src/lib.rs+++ b/crates/ai-memory-store/src/lib.rs@@ -22,7 +22,8 @@ mod writer;pub use decay::{DecayParams, retention_score};pub use error::{StoreError, StoreResult};pub use reader::{- DecayCandidate, PageHit, ReaderPool, StatusCounts, StoredEmbedding, f32_vec_to_bytes,+ ActivityWindow, BriefingPage, BriefingSnapshot, DecayCandidate, PageHit, ReaderPool,+ StatusCounts, StoredEmbedding, f32_vec_to_bytes,};pub use writer::WriterHandle;diff --git a/crates/ai-memory-store/src/reader.rs b/crates/ai-memory-store/src/reader.rsindex ca2f3a23..8996b31e 100644--- a/crates/ai-memory-store/src/reader.rs+++ b/crates/ai-memory-store/src/reader.rs@@ -51,6 +51,63 @@ pub struct StatusCounts {pub observations: u64,}+/// Rolling activity counters over a fixed time window. Surfaced by+/// [`ReaderPool::briefing`] so the caller (or an LLM-driven `memory_explore`)+/// can calibrate verbosity against how busy the project's been.+#[derive(Debug, Clone, Default, Serialize)]+pub struct ActivityWindow {+ /// Window size in days (e.g. 7 or 30).+ pub days: u32,+ /// Sessions whose `created_at` falls in the window.+ pub sessions: u64,+ /// Observations whose `created_at` falls in the window.+ pub observations: u64,+ /// Pages whose `updated_at` falls in the window — counts only+ /// `is_latest = 1`. Supersession of an old version into a new one+ /// counts as one update (the new row).+ pub pages_updated: u64,+}++/// Snapshot used by `memory_briefing` and the LLM-driven+/// `memory_explore`. Pure SQL aggregation; no LLM, no schema reads+/// outside the existing `pages` / `sessions` / `observations` /+/// `handoffs` tables.+#[derive(Debug, Clone, Default, Serialize)]+pub struct BriefingSnapshot {+ /// Lifetime totals — same shape `memory_status` returns today.+ pub counts: StatusCounts,+ /// Activity over the last 7 days.+ pub activity_7d: ActivityWindow,+ /// Activity over the last 30 days.+ pub activity_30d: ActivityWindow,+ /// Timestamp of the most recent observation (ISO-8601), or `null`+ /// if no observations exist. The `now - last_observation_at` gap+ /// is the signal `memory_explore` uses to scale its verbosity.+ pub last_observation_at: Option<String>,+ /// Number of open (un-accepted) handoffs.+ pub pending_handoff_count: u64,+ /// All pages currently under `_rules/` — small, surfaced verbatim+ /// because they're the highest-signal type of memory.+ pub rules: Vec<BriefingPage>,+ /// Top-N most-recently-updated `is_latest = 1` pages.+ pub recent_pages: Vec<BriefingPage>,+}++/// Trimmed page view for the briefing — path, title, kind, updated_at+/// timestamp. Body and snippets are intentionally omitted (the caller+/// can follow up with `memory_query` if they need detail).+#[derive(Debug, Clone, Serialize)]+pub struct BriefingPage {+ /// Relative wiki path.+ pub path: String,+ /// Page title (first H1 / frontmatter title).+ pub title: String,+ /// Semantic classification — `decision` / `gotcha` / `rule` / `fact`.+ pub kind: String,+ /// ISO-8601 timestamp of the last update.+ pub updated_at: String,+}+/// Cheap, cloneable read-only connection pool handle.#[derive(Clone)]pub struct ReaderPool {@@ -526,6 +583,93 @@ impl ReaderPool {.await}+ /// Assemble a [`BriefingSnapshot`] — pure SQL aggregation across+ /// the `pages` / `sessions` / `observations` / `handoffs` tables.+ /// No LLM, no schema reads outside what's already there.+ ///+ /// `recent_pages_limit` caps the `recent_pages` array; pass a+ /// small number (5-20) — this is meant to be skimmed, not paged+ /// through.+ ///+ /// # Errors+ /// Propagates any SQL or pool error.+ #[allow(clippy::too_many_lines)]+ pub async fn briefing(&self, recent_pages_limit: usize) -> StoreResult<BriefingSnapshot> {+ let recent_limit = recent_pages_limit.clamp(1, 100) as i64;+ self.with_conn(move |conn| {+ let now_us = jiff::Timestamp::now().as_microsecond();+ let day_us: i64 = 86_400 * 1_000_000;+ let cutoff_7d = now_us - 7 * day_us;+ let cutoff_30d = now_us - 30 * day_us;++ let counts = StatusCounts {+ pages_latest: count(conn, "SELECT COUNT(*) FROM pages WHERE is_latest = 1")?,+ pages_all: count(conn, "SELECT COUNT(*) FROM pages")?,+ sessions: count(conn, "SELECT COUNT(*) FROM sessions")?,+ observations: count(conn, "SELECT COUNT(*) FROM observations")?,+ };++ let activity_7d = window_activity(conn, 7, cutoff_7d)?;+ let activity_30d = window_activity(conn, 30, cutoff_30d)?;++ let last_observation_at: Option<i64> = conn+ .query_row("SELECT MAX(created_at) FROM observations", [], |row| {+ row.get::<_, Option<i64>>(0)+ })+ .optional()?+ .flatten();+ let last_observation_at = last_observation_at+ .and_then(|us| jiff::Timestamp::from_microsecond(us).ok())+ .map(|ts| ts.to_string());++ let pending_handoff_count: u64 =+ count(conn, "SELECT COUNT(*) FROM handoffs WHERE state = 'open'")?;++ // Rules: any `is_latest = 1` page under `_rules/`.+ // Routed there automatically by the consolidator when+ // `kind = "rule"` — see consolidator.rs::slugify_for_rule.+ let mut rules_stmt = conn.prepare(+ "SELECT path, title, \+ COALESCE(json_extract(frontmatter_json, '$.kind'), 'fact') AS kind, \+ updated_at \+ FROM pages \+ WHERE is_latest = 1 AND path LIKE '_rules/%' \+ ORDER BY updated_at DESC",+ )?;+ let rules: Vec<BriefingPage> = rules_stmt+ .query_map([], briefing_page_from_row)?+ .collect::<Result<Vec<_>, _>>()?+ .into_iter()+ .collect::<Result<Vec<_>, _>>()?;++ let mut recent_stmt = conn.prepare(+ "SELECT path, title, \+ COALESCE(json_extract(frontmatter_json, '$.kind'), 'fact') AS kind, \+ updated_at \+ FROM pages \+ WHERE is_latest = 1 \+ ORDER BY updated_at DESC \+ LIMIT ?1",+ )?;+ let recent_pages: Vec<BriefingPage> = recent_stmt+ .query_map(params![recent_limit], briefing_page_from_row)?+ .collect::<Result<Vec<_>, _>>()?+ .into_iter()+ .collect::<Result<Vec<_>, _>>()?;++ Ok(BriefingSnapshot {+ counts,+ activity_7d,+ activity_30d,+ last_observation_at,+ pending_handoff_count,+ rules,+ recent_pages,+ })+ })+ .await+ }+/// Return aggregate counts for the `status` view.////// # Errors@@ -828,6 +972,50 @@ fn count(conn: &Connection, sql: &str) -> StoreResult<u64> {Ok(u64::try_from(n.unwrap_or(0)).unwrap_or(0))}+/// Count rows in a time-bounded window. Used by [`ReaderPool::briefing`]+/// to compute "last 7 days" / "last 30 days" activity slices.+fn window_activity(conn: &Connection, days: u32, cutoff_us: i64) -> StoreResult<ActivityWindow> {+ let count_since = |sql: &str| -> StoreResult<u64> {+ let n: Option<i64> = conn+ .query_row(sql, params![cutoff_us], |row| row.get(0))+ .optional()?;+ Ok(u64::try_from(n.unwrap_or(0)).unwrap_or(0))+ };+ Ok(ActivityWindow {+ days,+ // `sessions` schema uses `started_at`, not `created_at` — easy+ // to forget because the other tables all use `created_at`.+ sessions: count_since("SELECT COUNT(*) FROM sessions WHERE started_at > ?1")?,+ observations: count_since("SELECT COUNT(*) FROM observations WHERE created_at > ?1")?,+ pages_updated: count_since(+ "SELECT COUNT(*) FROM pages WHERE is_latest = 1 AND updated_at > ?1",+ )?,+ })+}++/// Materialise one row from the briefing's recent-pages / rules queries+/// into a [`BriefingPage`]. The row shape is `(path, title, kind,+/// updated_at_us)` — all queries above MUST select those columns in+/// that order.+fn briefing_page_from_row(row: &rusqlite::Row<'_>) -> rusqlite::Result<StoreResult<BriefingPage>> {+ let path: String = row.get(0)?;+ let title: String = row.get(1)?;+ let kind: String = row.get(2)?;+ let updated_us: i64 = row.get(3)?;+ Ok(jiff::Timestamp::from_microsecond(updated_us)+ .map(|ts| BriefingPage {+ path,+ title,+ kind,+ updated_at: ts.to_string(),+ })+ .map_err(|e| {+ StoreError::Memory(ai_memory_core::MemoryError::MalformedRecord(format!(+ "bad updated_at: {e}"+ )))+ }))+}+fn checkout(inner: &Inner) -> StoreResult<Connection> {if let Some(conn) = inner.pool.lock().pop() {return Ok(conn);diff --git a/docker/Dockerfile b/docker/Dockerfileindex 336b4271..635810f0 100644--- a/docker/Dockerfile+++ b/docker/Dockerfile@@ -14,6 +14,11 @@ RUN apt-get update \&& rm -rf /var/lib/apt/lists/*COPY Cargo.toml Cargo.lock rust-toolchain.toml deny.toml ./COPY crates ./crates+# `evals/` is a workspace member (off-tree A/B harness, not shipped+# in the image — but Cargo refuses to parse the workspace manifest+# if a declared member doesn't exist on disk). Copy the dir so the+# manifest resolves; `-p ai-memory-cli` keeps the binary build narrow.+COPY evals ./evalsRUN --mount=type=cache,target=/usr/local/cargo/registry \--mount=type=cache,target=/work/target \cargo build --release -p ai-memory-cli \