Install MemoGrafter and prepare the database.
MemoGrafter runs server-side on Node.js and uses PostgreSQL with pgvector for the built-in storage backend.
Requirements
pgvector extension for the built-in PostgresGraphStore.Install the package
Install MemoGrafter from npm in the server-side package where your chatbot or memory workflow runs.
# Add the MemoGrafter runtime to your server-side app.
npm install memo-grafterInitialize project files
Create the generated MemoGrafter config and schema files. These files live under src/memo-grafter/ so they are easy to review, keep separate from your application code, and commit with the rest of your project.
# Generate MemoGrafter config and schema files.
npx memo-grafter initGenerated files overview
Review both generated files after initialization. Keep secrets in environment variables rather than committing credentials in mg.config.ts.
src/memo-grafter/mg.config.ts contains project-level MemoGrafter settings, including the database connection and optional feature configuration.src/memo-grafter/mg.schema.ts defines the MemoGrafter-managed database schema used by migration and other CLI tooling.Create the database schema
Run the migration command after setting DATABASE_URL. MemoGrafter owns only its mg_* tables and required PostgreSQL extensions.
# Create or update only MemoGrafter-owned database tables.
npx memo-grafter migrateVerify the installation
Run Doctor after migration to verify the installed package, configuration, PostgreSQL connection, pgvector extension, migration state, and required MemoGrafter tables. Doctor performs read-only diagnostics and does not change your configuration or database.
npx memo-grafter doctorMigration boundary
memo-grafter migrate manages only MemoGrafter-owned mg_* tables and PostgreSQL extensions. Application tables remain in your existing Prisma, Drizzle, SQL, or custom migration workflow.