Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fixup(recall): merge main + CHANGELOG, docs, and audit nits
AkitaOnRailsa6f75b8d4284
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 633e190b..0cc77573 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -19,6 +19,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0high-precision signal ([#182]).### Added+- The `[recall] default_global` marker now broadens `memory_recent` too,+ completing the pair started with `memory_query` in v1.12.0: an unscoped+ `memory_recent` from an opted-in repo returns the most-recently-updated+ pages across every project as `global_hits` (workspace + project+ annotated). Explicit `workspace`/`project` arguments still scope exactly+ as before, and the plain project-scoped response shape is unchanged+ ([#181]).- New read-only admin endpoint `GET /admin/projects`: the authoritative`(workspace, project)` inventory with page counts and last-updatedtimestamps. Gives dashboards, exports, and backup/mirror tooling adiff --git a/crates/ai-memory-mcp/src/server.rs b/crates/ai-memory-mcp/src/server.rsindex 90c8f1ab..5c1ae74c 100644--- a/crates/ai-memory-mcp/src/server.rs+++ b/crates/ai-memory-mcp/src/server.rs@@ -1134,14 +1134,7 @@ impl AiMemoryServer {// `global` / `scopes` / `workspace` / `project` arg always wins, so// this only fires when the caller passed none of them.let explicit_scoping = !args.scopes.is_empty()- || args- .workspace- .as_deref()- .is_some_and(|s| !s.trim().is_empty())- || args- .project- .as_deref()- .is_some_and(|s| !s.trim().is_empty());+ || named_scope_args_present(args.workspace.as_deref(), args.project.as_deref());let recall_global = !explicit_scoping&& !args.global.unwrap_or(false)&& self.active_project.default_global_for(&aps_actor);@@ -1345,14 +1338,8 @@ impl AiMemoryServer {// unscoped `memory_recent` to "most recent across every project", each// hit annotated with its workspace + project. An explicit// `workspace`/`project` always wins (same precedence as memory_query).- let explicit_scoping = args- .workspace- .as_deref()- .is_some_and(|s| !s.trim().is_empty())- || args- .project- .as_deref()- .is_some_and(|s| !s.trim().is_empty());+ let explicit_scoping =+ named_scope_args_present(args.workspace.as_deref(), args.project.as_deref());if !explicit_scoping && self.active_project.default_global_for(&aps_actor) {let global_hits = self.reader@@ -2533,6 +2520,14 @@ impl AiMemoryServer {}}+/// True when the caller explicitly scoped the read by name — a non-empty+/// `workspace` or `project` argument. Explicit scoping always wins over the+/// `[recall] default_global` marker broadening; `memory_query` also counts+/// its `scopes` list on top of this.+fn named_scope_args_present(workspace: Option<&str>, project: Option<&str>) -> bool {+ workspace.is_some_and(|s| !s.trim().is_empty()) || project.is_some_and(|s| !s.trim().is_empty())+}+fn ok_json<T: Serialize>(value: &T) -> Result<CallToolResult, McpError> {let s = serde_json::to_string_pretty(value).map_err(|e| McpError::internal_error(e.to_string(), None))?;diff --git a/crates/ai-memory-store/src/reader.rs b/crates/ai-memory-store/src/reader.rsindex a92289d3..bd895db7 100644--- a/crates/ai-memory-store/src/reader.rs+++ b/crates/ai-memory-store/src/reader.rs@@ -1001,6 +1001,11 @@ impl ReaderPool {/// cross-project analog of [`Self::recent_pages_for_project`]; used when a/// read's scope broadens to global.///+ /// Recency has no FTS relevance score, so the reused+ /// [`PageHitWithMeta::rank`] field carries `updated_at` (µs, cast to+ /// REAL) — larger still means "ranks first", callers must not read it+ /// as an FTS rank.+ ////// # Errors/// Propagates any SQL or pool error.pub async fn recent_pages_global(&self, limit: usize) -> StoreResult<Vec<PageHitWithMeta>> {diff --git a/docs/marker-file.md b/docs/marker-file.mdindex 0d68f5f9..4f084308 100644--- a/docs/marker-file.md+++ b/docs/marker-file.md@@ -65,7 +65,8 @@ drop_subagent_captures = "true"# Optional. Broaden this repo's DEFAULT memory recall to every project:# an unscoped `memory_query` from sessions in this tree behaves as-# `global=true` (each hit annotated with its workspace + project).+# `global=true`, and an unscoped `memory_recent` returns the most recent+# pages across every project (each hit annotated with workspace + project).# Meant for meta-repos that constantly need sibling-project context.# Explicit args always win — passing `workspace`/`project`/`scopes`/# `global` overrides this for that call. Off by default. Note: while