Skip to content

Shared memory

basemind provides a shared memory layer scoped to your repository: agents can store notes and search them by meaning.

Each repository (keyed by its normalized git origin URL) has its own memory store. Clones and worktrees of the same repo on one machine share that store. When you work on an unrelated project, that memory stays separate — no leakage.

Any agent can:

  • Write a note: memory put {key: "auth-flow", value: "…"} stores a key-value pair.
  • Search by meaning: memory search {query: "password validation"} finds stored notes by semantic similarity, even if the exact words don’t match.
  • Retrieve exact keys: memory get {key: "auth-flow"} fetches one stored note.
  • List by prefix: memory list {prefix: "auth-"} finds all keys starting with a prefix.
  • Delete: memory delete {key: "auth-flow"} removes a note.

Notes are simple key-value pairs:

key: "sqlinjection-mitigation"
value: "All user inputs are parameterized at the data layer via the Query class.
Prepared statements escape at the database driver level."

The key is a short identifier; the value is prose explaining what you want to remember.

Shared memory is useful for:

  • Architectural decisions: “These modules are always deployed together.”
  • Refactoring markers: “This legacy API is being phased out in favor of V2.”
  • Gotchas and workarounds: “On Windows, the build requires Visual Studio 2022+.”
  • Patterns: “Auth tokens are stored in Redis with a 1-hour TTL.”
  • Cross-session context: “The last agent was working on the payment module.”

Memory search is powered by LanceDB’s vector embeddings. You don’t need exact keywords — search by meaning. If you stored “All inputs are parameterized at the database driver”, you can find it with memory search {query: "SQL injection prevention"}.

Memory is indexed by the repository’s git origin URL, so:

  • Two clones or worktrees of the same repo on the same machine share the same memory. The store lives in the machine-global cache, so it is not synced between machines.
  • Forks or different remotes have separate memory stores (different URLs).
  • Each unrelated repo has its own memory (different URL).

This scoping is automatic — you don’t configure it.