RFC: optional semantic-memory providers for buzz-agent and buzz-acp
Problem
Buzz has a strong portable core-memory mechanism through NIP-AE engrams, but agents do not currently have an optional semantic-memory layer for large, continuously growing conversation history. Operators who want retrieval across sessions and harnesses must wire that lifecycle outside Buzz, which makes behavior inconsistent between the built-in buzz-agent and external ACP runtimes such as Codex, Grok, or Hermes.
This proposal is to add an optional semantic-memory provider interface that complements rather than replaces NIP-AE core memory:
- NIP-AE remains the canonical portable home for identity, durable rules, and goals.
- A semantic provider stores extracted conversational facts and retrieves only relevant records per turn.
- Provider state remains external and operator-controlled.
- The feature is disabled by default and fail-open when unavailable.
Proposed first provider: self-hosted Mem0 OSS
Mem0 OSS exposes a language-neutral REST API for create/search/update/delete operations and scopes records with user_id, agent_id, and run_id. A Rust client therefore does not require embedding the Python SDK or changing the relay protocol.
Suggested initial integration:
- A small shared provider abstraction used by both
buzz-agentandbuzz-acp. - A self-hosted Mem0 OSS implementation using its unversioned REST endpoints (
/memories,/search, and individual memory CRUD routes). - Optional automatic recall before a turn and writeback after a successful completed turn.
- Explicit
memory_searchandmemory_addtools for the built-in agent. Update/delete tools could follow after the permission model is agreed. - Stable scopes for:
- owner-shared memory;
- current-agent memory;
- optional session/run memory.
- Retrieved memory framed as untrusted data, never instructions.
Safety and lifecycle defaults
- Provider disabled by default.
- No limit on records retained by the provider; prompt injection remains independently bounded.
- Safe finite per-turn retrieval/injection defaults with operator overrides.
- Automatic writeback explicitly configurable and limited to completed turns.
- Canceled, failed, and incomplete turns are not stored automatically.
- Memory contents, queries, and credentials are omitted from tracing fields and errors.
- API credentials supplied through environment/file injection rather than agent persona text or prompts.
- No relay schema or new Nostr event kind required.
Interaction with existing Buzz memory
This would not change [Agent Memory — core] or the current NIP-AE lifecycle. A typical prompt would contain:
- Buzz base/system/persona context;
- NIP-AE core memory;
- a bounded block of relevant semantic memories;
- current channel/thread context.
That keeps canonical agent identity portable through Buzz while allowing larger operator-owned stores to grow independently.
Validation performed
A local Rust implementation has been exercised against a self-hosted Mem0 OSS deployment with a real buzz-acp Codex identity:
- a fresh Buzz turn was acknowledged and written;
- a separate later turn recalled the exact proof phrase without containing it in the recall request;
- a direct scoped Mem0 query independently found the persisted record;
- the provider was used through the ordinary ACP prompt lifecycle, not by asking the agent to call a separate memory plugin;
- unit tests cover authentication, user/agent scoping, response normalization, bounded valid-JSON prompt rendering, untrusted-data framing, and fail-open lifecycle behavior;
- targeted formatting, Clippy, and Rust tests pass for
buzz-agentandbuzz-acp.
No deployment URLs, secrets, or operator-specific wrappers are part of the proposed contribution.
Deliberate non-goals for the first PR
- Replacing NIP-AE core memory.
- Bundling Bitwarden/BWS-specific credential resolution; operators can inject the resulting environment variable externally.
- Changing kind:10100 agent-directory publication. That area already has active work in #5546 and #5612.
- Bundling Windows ACP wrapper-shim fixes; those are independently useful and should be a separate bug-fix PR.
- Supporting the hosted Mem0 Platform API in the first implementation. Its paths and authentication differ from self-hosted OSS and should be a separate adapter if desired.
Questions for maintainers
- Does an optional semantic-memory provider fit the intended boundary of
buzz-agentandbuzz-acp? - Would maintainers prefer a shared
buzz-memorycrate, or a smaller provider module in an existing crate? - Should automatic writeback default to off even after the provider is enabled?
- Should the first PR include only search/add, leaving model-initiated update/delete for a later permission-aware change?
- Is a finite injection budget with an explicit operator override acceptable, while leaving provider storage itself unlimited?
If the direction is welcome, I can send a focused DCO-signed PR containing only the provider abstraction, self-hosted Mem0 adapter, lifecycle wiring, documentation, and tests.
I think this fits if semantic memory is treated as a Project-bound capability, not another portable state store.
A portable agent definition can declare that it needs semantic recall, its intended scopes, retention and writeback policy, and data exclusions. It should not carry a Mem0 URL, credential, connection ID, or provider-specific user ID. On import, Buzz should show the requirement, let the owner connect a provider in the Project, then have the execution target report Ready or Setup required.
I would not make every provider failure fail-open. If recall is optional, degraded operation is honest. If the owner marked it required, starting without it changes the agent and should block or require an explicit override. The running generation should record which memory binding and policy were applied.
Before code, I would settle the lifecycle UX: what moves with the agent, what remains in the provider, how the owner disconnects or deletes it, and whether a new Project starts with empty memory or reconnects the existing store. Automatic writeback should default off until the owner approves data scope, retention, and provider.
That keeps core identity portable while external memory remains a replaceable binding, which is the same boundary tools need.
Hermes is named as one of the external runtimes here, so one data point on where the provider boundary might sit.
Hermes has its own memory abstraction internally (agent/memory_provider.py, agent/memory_manager.py) with its store behind it, so an external ACP runtime is not necessarily a passive consumer in this design.
That matters for the direction of flow. crates/buzz-acp/src/engram_fetch.rs fetches the core engram at session birth and renders it into the prompt as a text section:
Ok(Some(profile)) => Some(format!("[{SECTION_LABEL}]\n{profile}")),
That is read-only from the runtime's perspective. An agent maintaining its own durable memory has no path to write back to the NIP-AE core, so the two stores drift apart over time and the engram stops reflecting what the agent actually knows.
If the provider interface lands, exposing a read and write contract to ACP runtimes rather than a prompt-rendered section would let an external agent treat the engram as its backing store instead of maintaining a parallel one. That keeps NIP-AE canonical, which is the property the RFC argues for.
The failure handling in build_core_section is worth preserving in whatever shape this takes. Emitting nothing on a transport error, rather than an empty core, is the right call and the reasoning in that module applies equally to a write path.
Happy to be more specific about the Hermes side if that is useful.
Thanks—this is helpful framing. I agree that semantic memory could fit naturally as a capability tied to Buzz’s built-in Projects functionality, rather than becoming another piece of portable provider state.
My understanding is that the portable NIP-MP Project event should remain metadata-only. The Mem0 endpoint, credentials, connection details, and provider-specific namespace would instead stay in owner-controlled Project settings, outside both kind:30621 and the portable agent definition.
I’m picturing three layers:
- An optional declaration in the portable agent definition. Most agents would omit it entirely. When included, it could say that semantic memory is preferred or required and describe the intended scopes, writeback policy, and data exclusions.
- A Project-local capability binding in the existing Projects UI. This is where the owner could enable semantic memory, connect Mem0, choose participating agents and scopes, approve retention and writeback policies, and manage disconnection or deletion.
- A runtime record showing which binding and policy were applied for that agent generation, along with a status such as Ready, Degraded, Setup required, or explicitly overridden—without recording credentials or memory contents.
If neither an agent declaration nor a Project binding exists, Buzz would behave exactly as it does today and require no additional setup. A Project owner could also choose to enable semantic memory for an agent through Project settings without modifying the agent’s portable definition.
For lifecycle defaults, I’d suggest that a new Project begin with an empty memory namespace; reconnecting an existing store be an explicit choice; disconnecting preserve the provider’s data; and deletion remain a separate, confirmed action. Automatic writeback would initially stay off until the owner approves the provider, scope, retention, and exclusions.
Mem0 OSS could serve as the first provider behind this Project capability while keeping the underlying binding replaceable. I’ll hold off on code until maintainers confirm that the Projects capability/settings surface is the right home for it.
Thanks—this is useful, especially the point that an external ACP runtime may already own a memory lifecycle rather than acting as a passive prompt consumer. I agree that the design should avoid creating two independent automatic writers.
One distinction I would keep explicit is between NIP-AE core memory and the proposed semantic store. The core is the portable, canonical home for identity, durable rules, and goals; the semantic provider is intended for a much larger body of retrieved conversational facts. I would not want automatic semantic extraction to write directly into core or silently change portable agent identity.
A native read/write contract for NIP-AE from ACP runtimes still seems valuable, but I think writes should be separately permissioned and auditable. That could cover core and the existing cold mem/ slugs without making the external semantic provider their backing store.
For this RFC, your point suggests a useful capability-negotiation rule: an ACP runtime should be able to report whether it already manages durable memory, whether it accepts Buzz-provided recall, and whether Buzz or the runtime owns writeback for a given Project binding. The Project should select one automatic writer by default; dual writeback should require an explicit policy.
I agree that the current fetch behavior should be preserved: an unavailable or unreadable core must not be represented as an empty core.
The Hermes detail that would help most is whether its memory abstraction can accept an externally supplied provider/binding—or disable its own automatic recall and writeback for a session. That would tell us whether Hermes should consume the Project-bound provider directly or negotiate a narrower recall-only path.
One provider-neutral test I would add before choosing the first adapter is temporal mutation, not only add/search:
- Write fact A.
- Correct it to fact B.
- Current recall returns B.
- An as-of query from before the correction returns A.
- Lineage inspection shows both records and the correction edge.
- Forgetting the scope removes both from future retrieval.
That catches providers which return a semantically similar but stale fact—important when the memory is injected as untrusted context.
Disclosure: I maintain Lians, an Apache-2.0 local-first memory backend. It already models correction history, temporal/as-of recall, scopes, provenance, and explicit forgetting. For Buzz, I would map it to the Project-bound capability described above: configuration and credentials stay Project-local; NIP-AE remains canonical identity; one automatic writer is selected; recall is framed as untrusted data; and required versus optional controls block/degraded behavior.
If useful, I can provide a small provider-neutral conformance fixture for add/search/correct/forget/lineage plus a Lians adapter alongside the proposed Mem0 adapter. That would let maintainers evaluate the boundary against two implementations without committing the abstraction to one provider. No need to replace the proposed first provider.
Thanks—this is a really useful addition. The temporal fixture makes me wonder whether correction handling should sit above the individual adapter and become part of Buzz’s native agent-turn lifecycle.
Once semantic memory is enabled for a Project binding, the selected automatic writer could classify extracted memories as additions, reinforcements, corrections, or forgetting requests. A correction would append fact B with a supersedes relationship to fact A rather than destructively overwriting A. Current recall would exclude A, while as-of recall and lineage could still reconstruct the history. Providers with native temporal support could implement that directly; other providers could rely on a Buzz-managed version ledger plus adapter-level indexing and current-state filtering.
That would make temporal correctness default-on for an enabled memory binding without making semantic memory itself mandatory. I would still keep passive supersession conservative: an explicit user correction can usually be applied automatically, while an ambiguous contradiction should coexist or remain pending rather than silently rewriting what the agent “knows.” Provenance and the single-writer rule also seem important here.
I’d welcome the provider-neutral fixture. A few implementation details from Lians would be especially helpful in shaping it: how do you distinguish an actual correction from a merely related fact, how do you separate event time from ingestion time, and what exactly does scoped forgetting remove across prior versions, embeddings, caches, and retained audit metadata? If those semantics can be expressed cleanly in the fixture, I think testing Mem0 and Lians against the same lifecycle contract would be a strong way to keep the abstraction honest.
Disclosure: I maintain bastra-recall (MIT, TypeScript), a local-first memory for coding agents: a markdown vault plus hybrid BM25/vector recall, attached over MCP and REST. https://github.com/n0mad-ai/bastra-recall
Before I build anything, a boundary question to the maintainers that can be answered with yes or no.
What I would build: a community-level provider. One recall instance per relay, as a sidecar next to the relay, addressed by buzz-agent and buzz-acp through the provider interface from this RFC. Scopes: community-shared, per agent pubkey, optionally per channel. That matches the boundary Buzz already draws: one relay is one community.
What agents would get that neither the engram nor the log delivers today: retrieval by situation rather than by similarity alone (trigger phrases per memory, weighted above the rest of the text), a score that says when a hit is weak, aging per memory type, versions instead of overwrites, and visible conflicts when two agents assert incompatible things. That is the correction and lineage axis ebeirne describes above as a test. Every save lands in an audit log. Storage is plain markdown files: the community's memory is a folder a human can read, diff and edit, not a database the owner cannot open.
What I would not touch: the NIP-AE core. It stays the canonical home of identity and rules. The provider holds retrieved knowledge, framed as untrusted data, off by default, and degraded rather than silent on failure, as worked out above in this thread.
The question, @wpfleger96, since engram_fetch.rs and most of buzz-acp are yours: does a shared memory at community level, a relay-wide provider, sit inside the boundary you want for buzz-agent and buzz-acp, or should semantic memory stay strictly per agent or per Project? If the former is welcome, I will build the adapter against whatever interface lands here and line up next to Mem0 and Lians with a provider-neutral conformance run. If not, I would rather know now than build a provider nobody takes.
A concrete provider example that seems worth accounting for here is Hindsight, especially because Hermes already ships a working lifecycle around it.
Hermes' Hindsight integration is effectively the behavior this RFC is describing: automatic recall before a turn, automatic retain after a successful turn, plus explicit recall/reflect tools for deeper retrieval. The important part is that the agent runtime does not need to decide which individual facts are worth storing first. Hindsight handles extraction, entity resolution, deduplication, relationships, and consolidation downstream.
That makes Hindsight a useful second implementation target for keeping the provider abstraction genuinely provider-neutral rather than Mem0-shaped. It also gives a practical migration path for Hermes users who want Buzz to become the primary local agent while continuing to use the same long-term memory bank.
For my use case, the ideal end state would be:
- NIP-AE/core memory stays small and portable for identity, rules, and durable preferences.
- Hindsight is a Project-bound semantic provider for long-term facts/relationships/decisions.
- Buzz automatically recalls a bounded set before the turn and retains the completed turn afterward.
- Explicit recall/reflect remain available as tools for deeper historical queries.
- Provider state remains external and operator-owned, so Buzz and another runtime such as Hermes can point at the same bank during migration.
I would strongly prefer the provider interface to support Hindsight alongside Mem0 rather than treating semantic memory as a Mem0-specific feature. Hermes is already useful prior art for the lifecycle and defaults.