Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
docs: reassess competitive standing after the 2.4 retrieval features
AkitaOnRails9c416de64a6b
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex 787d3cc9..58a9db93 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -426,7 +426,7 @@ for mistaken handoff creation. `memory_feedback` implements thewithout conflating read and write semantics, and the access counter itsupplements cannot tell "this page answered the question" from "this pagewasted a read". The narrow-surface discipline still holds —-every new tool has to earn its slot — but the count is 17, not 10.+every new tool has to earn its slot — but the count is now 23, not 10.The managed Agent Skills are a narrow prompt-packaging exception to theotherwise wiki-centered architecture. They are static `SKILL.md` files thatdiff --git a/docs/benchmarks/retrieval-ab-r2.md b/docs/benchmarks/retrieval-ab-r2.mdindex 4b93220f..b0d808f7 100644--- a/docs/benchmarks/retrieval-ab-r2.md+++ b/docs/benchmarks/retrieval-ab-r2.md@@ -14,6 +14,13 @@ Provenance (commit, dataset sha256, hardware, per-config knob summary) iscarried exactly as the single-config reports carry it. See`evals/README.md` for the full flag reference.+The harness can additionally run **end-to-end QA-accuracy** (`--qa`, #771/#772):+each question's retrieved context is handed to an LLM that answers it, and an+LLM-as-judge grades the answer against the gold label. This reports+answered/graded accuracy, answer latency (p50/p95), and answer-token cost+alongside the retrieval triple. It requires a provider key and is off by+default.+## How to run```bash@@ -54,3 +61,36 @@ add query latency):Hardware: AMD Ryzen 9 7950X3D (32 threads). Replace this section with afull-dataset run before citing any A/B number.++### Illustrative sample-20 run (triple + QA-accuracy, NOT a baseline)++Recorded to show the triple + QA columns on a real run. **`--sample 20`, 20+LongMemEval-S questions — illustrative, NOT the full-500 baseline.** The+published baseline stays 0.823 hit@5 (local) / 0.668 zero-LLM in+[README.md](README.md); do not cite the numbers below as a baseline.++Retrieval (zero-LLM):++| metric | value |+|---|---|+| hit@1 | 0.750 |+| hit@5 | 0.800 |+| hit@10 | 0.800 |+| recall@5 | 0.800 |+| latency p50 / p95 ms | 2 / 3 |+| ctx tok mean / median | 330.2 / 386.5 |++QA-accuracy (Gemini `gemini-2.5-flash` answered + graded):++| metric | value |+|---|---|+| QA accuracy | 9/20 = 0.450 |+| answer latency p50 / p95 ms | 705 / 862 |+| answer tokens mean | 453.9 |++Reproduce (QA needs `GEMINI_API_KEY`):++```bash+cargo run --release -p ai-memory-eval -- retrieval \+ --sample 20 --qa --qa-provider gemini --qa-model gemini-2.5-flash+```diff --git a/docs/comparison.md b/docs/comparison.mdindex cc9858b9..0a03d99a 100644--- a/docs/comparison.md+++ b/docs/comparison.md@@ -51,7 +51,7 @@ not). See [where we're behind](#where-were-behind-or-different-by-choice).|---|---|---|---|| Fact extractors | Mem0, LangMem | Cheap per-turn personalization | Atomic facts lose relational/causal context (see [TriMem](research-2026-landscape.md#4-research-developments-worth-knowing)); LLM-per-turn; not file-first || Hosted memory API (hybrid) | **Supermemory**, **LiquidLM** | Chunk-RAG + LLM temporal fact-graph + per-user profiles in one query; managed connectors (Drive/Notion/GitHub), multimodal, metadata/tag query filters | Cloud-first (best features + extraction are paid/hosted); LLM-required quality path; an opaque store is the source of truth (not file-first, nothing to `grep`/diff). Supermemory's MIT self-host binary drops the connectors + extraction models; LiquidLM is closed-source and cloud-only (no self-host at all) |-| User-modeling / theory-of-mind | **Honcho** (Plastic Labs) | Reasoning-derived model of what each "peer" knows/believes over time — personalizes around the *human* the agent serves | Different problem: it remembers the *user*, ai-memory remembers the *project*. Opaque Postgres, LLM-required (Deriver/Dreamer), multi-service stack; adjacent (shares MCP/plugin delivery) but not a coding-memory migration target |+| User-modeling / theory-of-mind | **Honcho** (Plastic Labs) | Reasoning-derived model of what each "peer" knows/believes over time — personalizes around the *human* the agent serves | Different problem: it remembers the *user*, ai-memory remembers the *project*. Opaque Postgres, LLM-required (Deriver/Dreamer), multi-service stack; adjacent (shares MCP/plugin delivery) but not a coding-memory migration target. ai-memory borrowed the *conveniences*, not the engine: an opt-in dialectic **answer** over its own hits and a **reasoning** tier now ship (both off by default, LLM-required) || Temporal knowledge graph | Zep/Graphiti, Cognee | Bi-temporal "what was true vs believed when" | Needs a graph DB; heavier to self-host. ai-memory ships **bi-temporal-lite** on SQLite ([`temporal.md`](temporal.md)) + typed edges ([`typed-edges.md`](typed-edges.md)) for the useful part || Memory OS / self-editing | Letta, MemOS, MIRIX | Agent curates its own tiered memory | Token-expensive self-editing; Letta itself now concedes file-first ("Is a Filesystem All You Need?") || Hosted context database | **OpenViking** (ByteDance) | Progressive L0/L1/L2 loading; directory-scoped retrieval; broad integrations | LLM-**required** (VLM + embeddings); opaque swappable storage; AGPLv3 core + SaaS/enterprise weight |@@ -116,7 +116,13 @@ core bets independently, from different substrates:ai-memory also **shipped the borrowable ideas** from that research rather thanjust cataloguing them: typed relation edges, ingestion-time temporal validitywith `as_of` queries, local (no-key) embeddings as the default, and the-cross-session abstraction pass are all in the product today.+cross-session abstraction pass are all in the product today. The 2.4 line added+five more, each **opt-in with defaults byte-identical**: a bounded related-pages+graph walk (`memory_read_page include_related`, basic-memory/LiquidLM), an opt-in+dialectic **answer** over hits and a **reasoning** tier (Honcho, both+LLM-required and off by default), a **pin-before-search** contract (`memory_query+pin_first` + a pinned standing-context briefing, LiquidLM), and a+**show-superseded** retrieval knob over the supersession chains.## Coming from another tool?@@ -139,7 +145,9 @@ cross-session abstraction pass are all in the product today.explicit uploads. You give up (for now) their multimodal ingestion(video/audio/PDF/Office), a polished consumer web app + grounded chat, andmanaged hosting; you gain data ownership, no required API spend, offline- operation, and per-project team sharing. Different job: they build a general+ operation, per-project team sharing, and — now opt-in on the 2.4 line — a+ pin-before-search contract and a bounded related-pages graph walk over the link+ neighbours ai-memory already computes. Different job: they build a general"second brain," ai-memory remembers *this repo*.- **From Hindsight / OpenViking:** you trade a hosted, LLM-required service fora self-contained binary that runs zero-LLM by default and keeps memory in@@ -152,11 +160,16 @@ cross-session abstraction pass are all in the product today.Fair means saying this plainly:-- **Raw retrieval score.** 0.823 hit@5 on LongMemEval-S is comparable to- mcp-memory-service and below agentmemory's 0.967 (hybrid + reranking). Part- is deliberate — a 2 KB privacy cap on captured excerpts puts evidence deep- inside one long turn out of the index's reach; the benchmark measures the- *shipped, sanitized* system, not an idealized retriever.+- **Raw retrieval score, and no local reranker.** 0.823 hit@5 on LongMemEval-S+ is comparable to mcp-memory-service and below agentmemory's 0.967 (hybrid ++ reranking). Part is deliberate — a 2 KB privacy cap on captured excerpts puts+ evidence deep inside one long turn out of the index's reach; the benchmark+ measures the *shipped, sanitized* system, not an idealized retriever. The only+ reranker is LLM-as-judge, so the zero-LLM default path has none; the opt-in+ `answer=true` dialectic synthesis (2.4) is likewise LLM-required, off by+ default, and its end-to-end QA-accuracy is early and small-sample (see+ [`benchmarks/retrieval-ab-r2.md`](benchmarks/retrieval-ab-r2.md)), not a+ headline claim.- **Headline benchmark comparability.** Hindsight quotes 91.4% *accuracy* andOpenViking quotes LoCoMo lifts — different datasets/metrics than our hit@5,and both are self-reported/preprint. We publish a reproducible harness and adiff --git a/docs/competitive-parity.md b/docs/competitive-parity.mdindex 828931a0..f9a85b93 100644--- a/docs/competitive-parity.md+++ b/docs/competitive-parity.md@@ -85,7 +85,7 @@ until the eval harness (R2) that would justify activating them gets built.| Git-as-snapshot | agentmemory | **BETTER** | The wiki files *are* the truth (diffable), not a `state.json` dump || Pages-over-facts / living pages | Hindsight | **PARITY** (native) | Same architecture, file-first vs their Postgres-first; `settled_first` briefing shipped || Cross-session experience/abstraction pass | Letta/Hindsight/surveys | **REAL, ~parity** | ≥2-session evidence guard is the genuine article — but LLM-required and **off by default** |-| Typed relation edges | graph camp | **SHALLOW on retrieval** | Data model + `contradicts`→lint is real, but retrieval **does not weight edge type** (explain-only) |+| Typed relation edges | graph camp | **PARTLY SHIPPED** | Link-neighbours are now a first-class retrieval surface — `memory_read_page include_related` walks the `page_links` graph outward (bounded BFS, #775) — but retrieval **RANK weighting by edge type is still not done** (edge kind stays explain-only in `memory_query`) || Belief-strength consolidation | Hindsight / mcp-memory-service | **BEHIND** | `page_evidence` substrate shipped but **ranking-inert**; we still correct via binary supersession, not evidence-weighted belief || bi-temporal-lite | Zep/Graphiti | **BEHIND by design** | Ingestion-time only; world-time validity deferred (honestly, because dating facts needs an LLM and breaks the zero-LLM path) |@@ -94,11 +94,15 @@ until the eval harness (R2) that would justify activating them gets built.Documented recommendations only — **nothing here is scheduled or to beimplemented without a separate decision.** Ordered by leverage.-1. **Build the R2 reproducible eval harness (highest leverage).** It is the+1. **R2 reproducible eval harness — now built (#771/#772).** It was themeta-blocker: belief-strength ranking, typed-edge rank weighting, and a- published accuracy/latency/context-tokens *triple* are all gated on "prove it- with a number." Every quality gap below is dammed behind this one missing- piece. Nothing else in this list should ship before it exists.+ published accuracy/latency/context-tokens *triple* were all gated on "prove it+ with a number." The harness now measures that triple **and** end-to-end+ QA-accuracy (LLM-as-judge), so the gate is open; what remains is running the+ full-500 matrix and then activating the dormant substrate below against it.+ Illustrative sample-20 numbers are in+ [`benchmarks/retrieval-ab-r2.md`](benchmarks/retrieval-ab-r2.md); the+ published full-500 triple is still pending.2. **A zero-LLM / local reranker (candle cross-encoder).** The single most-citedweakness: our only reranker is LLM-as-judge, so the zero-LLM default path —our headline — has *no* reranking, while basic-memory ships a local one and@@ -123,21 +127,29 @@ implemented without a separate decision.** Ordered by leverage.README hero, add a one-line `ai-memory run claude` quickstart, and ship a"coming from Claude built-in?" importer (the `~/.claude/.../memory/` format isnearly identical markdown + `type` frontmatter — a cheap, strong on-ramp).-6. **Smaller, competitor-specific closes:** a graph-walk retrieval tool- (basic-memory's `build_context`/`memory://`, borrowed-but-unshipped); MCP tool- behavior hints (readOnly/destructive/idempotent) on the 23-tool surface; a- clustering/dedup consolidation pass (mcp-memory-service's DBSCAN); a read-only- graph visualization in `/web`; a first-class TS SDK story for ecosystem parity;- an optional **dialectic/oracle query** (ask-a-question → synthesized answer)- and a **reasoning-tier knob** (Honcho) — but strictly as opt-in LLM layers- *over* the zero-LLM FTS/RRF core, never a requirement; a **pin-before-search- contract** and a first-class **`follow_references`/`get_related` graph-walk- MCP tool** (LiquidLM) exposing the link-neighbor RRF we already compute, plus- a **"hide superseded unless asked" retrieval knob** over our supersession- chains. Deliberately out of scope: Honcho's theory-of-mind user-modeling- engine and LiquidLM's opaque-cloud / LLM-mandatory / multimodal-second-brain- substrate (all off-mission for file-first, zero-LLM coding memory; the- global-scope preferences page already covers the useful user-prefs slice).+6. **Smaller, competitor-specific closes — five now shipped on 2.4 (opt-in,+ defaults byte-identical):** the graph-walk retrieval tool (basic-memory's+ `build_context`/`memory://`, LiquidLM's `follow_references`/`get_related`)+ shipped as `memory_read_page include_related`/`related_depth` (#775), a bounded+ BFS exposing the link-neighbour walk over `page_links` we already compute; the+ **dialectic/oracle query** (Honcho) shipped as `memory_query answer=true`+ (#782) — a synthesized+cited answer over the hits, LLM-required and off by+ default (graceful `answer_unavailable` with no provider); the **reasoning-tier+ knob** (Honcho) shipped as `memory_query`/`memory_explore+ reasoning: {minimal..max}` (#783), mapping to a per-tier token budget; the+ **pin-before-search contract** (LiquidLM) shipped as `memory_query pin_first`+ + `memory_briefing.pinned` (#780); and the **"hide superseded unless asked"+ retrieval knob** shipped as `memory_query include_superseded=true` (#773) over+ our supersession chains. All five are strictly opt-in LLM/retrieval layers+ *over* the zero-LLM FTS/RRF core, never a requirement (invariant #13).+ **Still unshipped:** MCP tool behavior hints+ (readOnly/destructive/idempotent) on the 23-tool surface; a clustering/dedup+ consolidation pass (mcp-memory-service's DBSCAN); a read-only graph+ visualization in `/web`; a first-class TS SDK story for ecosystem parity.+ Deliberately out of scope: Honcho's theory-of-mind user-modeling engine and+ LiquidLM's opaque-cloud / LLM-mandatory / multimodal-second-brain substrate+ (all off-mission for file-first, zero-LLM coding memory; the global-scope+ preferences page already covers the useful user-prefs slice).7. **Fix doc staleness the audit surfaced** (accuracy, not features):`research-basic-memory.md` understates basic-memory's shipped cross-encoderreranking + Teams tier; `research-agentmemory.md` says 53 tools / 124 endpoints@@ -151,11 +163,18 @@ implemented without a separate decision.** Ordered by leverage.cross-harness capture, claim-once handoffs + messaging, and multi-usershared-within-project. On operability, data ownership, and cross-agent/teamcontinuity, ai-memory is genuinely ahead of every overlapping competitor.-- **The honest weakness is retrieval quality**, and it is *self-inflicted by- discipline, not by copying*: belief-strength and typed-edge ranking are built- but switched off, no local reranker exists, and there is no published- comparable number — all because the R2 eval harness that would justify turning- them on has not been built. **Build R2, then activate what's already there.**+- **The borrowed conveniences now ship (opt-in).** The 2.4 line landed the five+ competitor-specific closes above — related-walk, dialectic answer, reasoning+ tier, pin-before-search, and the show-superseded knob — each opt-in with+ defaults byte-identical, and the R2 harness that gates the quality work now+ exists and measures the accuracy+latency+context-tokens triple plus end-to-end+ QA-accuracy (illustrative sample-20 only so far).+- **The honest weakness is still retrieval quality**, and it remains+ *self-inflicted by discipline, not by copying*: no local zero-LLM reranker+ exists, belief-strength (`page_evidence`) and typed-edge **RANK** weighting are+ built but still switched off, and the published *full-dataset* triple is still+ pending (only illustrative sample-20 numbers so far). The gate (R2) is now+ open — **activate what's already there against a full-500 run.**- **Migration answer:** for the self-hosted, multi-harness, team, zero-LLM,own-your-data coding-memory user, yes — we do the basics and add what theycan't get elsewhere. For app personalization, enterprise graph queries, agent