Skip to documentation
Docs navigation
Docs/Production deployment
Advanced

Production deployment

Deploy MemoGrafter as server-side memory infrastructure with deliberate migrations, isolation, workers, shutdown, and observability.

Deployment boundary

MemoGrafter is server-only and experimental. Keep database credentials, provider keys, memory authorization, and lifecycle actions behind application-controlled server boundaries.

Prepare the database

Run memo-grafter init during project setup.
Run memo-grafter migrate as an intentional deployment step, not on every request or application startup.
Provide PostgreSQL with pgvector and pgcrypto support.
Use connection pooling appropriate for application and worker concurrency.
Back up and monitor MemoGrafter-owned mg_* tables according to retention policy.

Process topology

Run web or API processes for foreground recall and response generation.
Run BullMQ workers separately when queue mode is enabled.
Choose one deliberate owner for scheduled crawler maintenance in multi-instance deployments.
Keep Studio local to trusted development environments.

Isolation and privacy

Use globally unique application-owned session identifiers where the lower-level API is used.
Authorize users, tenants, tags, and source/destination sessions before memory reads or transfer.
Treat tags as filters, not access controls.
Define soft-forget, hard-delete, backup, log, and export policies together.
Avoid logging raw private memory unless required and protected.

Graceful shutdown

Only close resources owned by the current component; avoid closing the same shared core through several wrappers.

shutdown.ts
async function shutdown() {
  crawler?.stop();
  await fleet?.close();
  await agent?.close();
  await memo?.close();
}
process.once("SIGTERM", shutdown);
process.once("SIGINT", shutdown);

Observability

Foreground invoke latency and first-token time.
Recall latency, empty-result rate, selected fact count, and prompt size.
Ingestion lag, queue depth, failed jobs, and retry count.
Provider request latency, rate limits, and usage.
Database pool saturation, vector-search latency, and migration status.
Lifecycle actions and cross-session transfer audit events.

Readiness checklist

Evaluate retrieval and transfer behavior on representative private and adversarial examples.
Test provider, Redis, and database failure paths.
Verify lifecycle cache invalidation.
Test shutdown with pending ingestion.
Confirm Studio is not publicly exposed.
Document the installed experimental version and upgrade procedure.