@tuturuuu/ai/memory boundary. Product routes must not call the
sidecar from the browser and must not create product-specific memory stores.
Scope
Memory scope is alwaysuser + workspace. The shared helper builds a stable
container tag from those two identifiers and stores product, surface, route,
locale, timezone, conversation, and workspace metadata on each write.
Default recall is cross-product within that user + workspace container. Use
metadata filters only when a route needs a narrower product or surface view.
Runtime
UsewithAiMemory for AI SDK calls when the route has a user and workspace.
Use ingestAiMemoryEvent, buildAiMemoryContext, and the Mira-compatible tool
executors for explicit memory reads and writes.
Reads fail open by default, and writes are best effort. Every embedding used for
memory add/search is generated through the metered @tuturuuu/ai embedding
helper before the sidecar is called. If credits, pricing, token counting, or
billable attribution cannot be verified, the memory operation skips before
calling Google. Structural metering failures disable memory for the user scope.
Keep SUPERMEMORY_FAIL_OPEN=true unless a product explicitly requires strict
persistence.
Required server-side env:
DOCKER_SUPERMEMORY_API_KEY, DOCKER_SUPERMEMORY_POSTGRES_PASSWORD,
DOCKER_SUPERMEMORY_DATABASE_URL, or DOCKER_SUPERMEMORY_ENABLED=false only
when an operator needs to override that generated runtime. An explicit false
value also removes the sidecar from Docker blue/green support builds and health
gates.
SUPERMEMORY_API_KEY is internal infrastructure configuration. Never expose it
through browser-visible env vars or client responses.
User Controls
Workspace settings live behind:Migration
Legacymira_memories rows are imported with the admin-only backfill endpoint:
customId values. Rows without a legacy
workspace are imported into the user’s default or personal workspace and tagged
with legacy_mira metadata.
Self-Hosting
The Docker fleet runs the first-party memory sidecar as an internal support service namedsupermemory for compatibility with existing base URL, API key,
watcher, and Compose wiring. The sidecar stores 3072-dimensional
gemini-embedding-2 vectors in extensions.halfvec(3072) with HNSW cosine
indexes, plus GIN indexes for metadata and full-text hybrid search. The
supermemory-db-migrate service applies apps/supermemory/db schema changes
before the runtime starts.
The watcher and cron recovery path use the same generated Docker env, so
recreating web-blue-green-watcher does not require manually exporting memory
service secrets. There is no SUPERMEMORY_IMAGE enterprise-image contract.
Connectors such as Google Drive, OneDrive, and Notion are disabled for the first
rollout. Product ingestion should persist concise summaries only; do not ingest
raw files or binaries unless the source is user-owned, enabled, and explicitly
appropriate for memory.