Skip to content

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

Rust

fixup(recall): fmt, changelog, marker-file docs

AkitaOnRails4b47e3e979f2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e61fb281..575afe82 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
+- New `.ai-memory.toml` marker option `[recall] default_global = "true"`
+ ([#177]): sessions in the marked tree make an *unscoped* `memory_query`
+ behave as `global=true`, so meta-repos that constantly need
+ sibling-project context stop passing `global=true` by hand. Strictly
+ opt-in and per-repo; explicit `workspace`/`project`/`scopes`/`global`
+ arguments always win. While active, unscoped queries return
+ cross-project `global_hits` (workspace+project annotated) instead of
+ project `hits` + `global_scope_hits`; `memory_recent` stays
+ project-scoped (documented follow-up).
- `purge-project` and `rename-project` now write attributed rows to the
append-only `audit_log`, inside the same transaction as the operation
itself — so "which user wiped project X?" finally has an answer, and a
diff --git a/crates/ai-memory-core/src/active_project.rs b/crates/ai-memory-core/src/active_project.rs
index 5494fb66..61f6f2c9 100644
--- a/crates/ai-memory-core/src/active_project.rs
+++ b/crates/ai-memory-core/src/active_project.rs
@@ -353,7 +353,13 @@ impl ActiveProject {
Instant::now(),
);
}
- guard.insert(scoped, workspace_id, project_id, default_global, Instant::now());
+ guard.insert(
+ scoped,
+ workspace_id,
+ project_id,
+ default_global,
+ Instant::now(),
+ );
}
/// Read the currently active project for the given actor, if any has
diff --git a/crates/ai-memory-hooks/src/router.rs b/crates/ai-memory-hooks/src/router.rs
index fec58f6c..bf184edd 100644
--- a/crates/ai-memory-hooks/src/router.rs
+++ b/crates/ai-memory-hooks/src/router.rs
@@ -940,9 +940,12 @@ async fn resolve_project_ids_inner(
(None, Some(c)) => match derive_project_from_cwd(c, project_strategy) {
Some(resolved) => resolved,
None => {
- state
- .active_project
- .set_for(actor, state.workspace_id, state.project_id, default_global);
+ state.active_project.set_for(
+ actor,
+ state.workspace_id,
+ state.project_id,
+ default_global,
+ );
return Ok((state.workspace_id, state.project_id));
}
},
@@ -953,9 +956,12 @@ async fn resolve_project_ids_inner(
// gets refactored. Same effect as `unreachable!`, but
// visible at compile time instead of inside the panic
// message.
- state
- .active_project
- .set_for(actor, state.workspace_id, state.project_id, default_global);
+ state.active_project.set_for(
+ actor,
+ state.workspace_id,
+ state.project_id,
+ default_global,
+ );
return Ok((state.workspace_id, state.project_id));
}
};
diff --git a/crates/ai-memory-mcp/src/server.rs b/crates/ai-memory-mcp/src/server.rs
index 727f19bf..06d27598 100644
--- a/crates/ai-memory-mcp/src/server.rs
+++ b/crates/ai-memory-mcp/src/server.rs
@@ -4720,7 +4720,12 @@ mod tests {
.unwrap();
for (w, p, path, body) in [
(ws, infra, "cluster.md", "recall_token lives in infra"),
- (ops_ws, runbooks, "deploy.md", "recall_token lives in runbooks"),
+ (
+ ops_ws,
+ runbooks,
+ "deploy.md",
+ "recall_token lives in runbooks",
+ ),
] {
store
.writer
diff --git a/docs/marker-file.md b/docs/marker-file.md
index 51a2f5f8..e0badd40 100644
--- a/docs/marker-file.md
+++ b/docs/marker-file.md
@@ -62,6 +62,18 @@ project_strategy = "repo-root"
# opt-in here keeps the drop from affecting other projects on the same
# server. Off by default (absent / "false").
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).
+# 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
+# active, unscoped queries return cross-project `global_hits` instead
+# of project `hits` + `global_scope_hits` (the `_global` preference
+# pages still appear, annotated, among the global results).
+[recall]
+default_global = "true"
```
**Naming rules** for `workspace` and `project`, validated server-side: