Firebase Genkit
Expose GoodMem's RAG memory as Genkit tools under the goodmem/ namespace for any Genkit agent or flow.
Overview
GoodMem gives AI agents retrieval-augmented generation (RAG) memory: store documents in a space
and GoodMem chunks, embeds, and indexes them so your agent can pull back the most relevant
passages on any question. The Genkit plugin exposes the GoodMem API as 11 tools under the
goodmem/ namespace — creating spaces, storing memories, and semantic retrieval with optional
reranking and LLM summaries — callable from any Genkit agent or flow. The canonical source is the
standalone genkitx-goodmem package; the upstream Genkit PR is only a proposal.
Installation
npm install genkitx-goodmem
# or
pnpm add genkitx-goodmem
# or
yarn add genkitx-goodmemgenkit is a peer dependency. Install it too if you do not already have it:
npm install genkitConfiguration
| Variable | Description |
|---|---|
GOODMEM_BASE_URL | Base URL of your GoodMem server, e.g. https://your-goodmem-server.example.com. |
GOODMEM_API_KEY | API key sent as the X-API-Key header. |
NODE_TLS_REJECT_UNAUTHORIZED | Set to 0 for local dev with a self-signed certificate. Node's fetch reads it directly. |
The goodmem() plugin also accepts baseUrl and apiKey arguments directly if you prefer to
configure them in code instead of the environment.
Quick start
import { genkit } from 'genkit';
import { goodmem } from 'genkitx-goodmem';
const ai = genkit({
plugins: [
goodmem({
baseUrl: process.env.GOODMEM_BASE_URL || 'https://your-goodmem-server.example.com',
apiKey: process.env.GOODMEM_API_KEY!,
}),
],
});Once the plugin is loaded, 11 tools are registered and available to any Genkit agent or flow.
Local development. The example above uses a TLS-verified production URL. If you are running
GoodMem locally with a self-signed certificate, use https://localhost:8080 and disable TLS
verification with the client's verify-SSL option (see the Configuration table above). Keep TLS
verification enabled for any deployed server.
Retrieval post-processing
GoodMem's retrieval call accepts these optional post-processing parameters (each framework exposes them under its own naming convention):
| Parameter | Range | Description |
|---|---|---|
reranker_id | UUID | Reranker model that reorders matched chunks by relevance. |
llm_id | UUID | LLM that generates a contextual answer (abstractReply) alongside the chunks. |
relevance_threshold | 0–1 | Minimum relevance score for a result to be included. |
llm_temperature | 0–2 | Sampling temperature for the LLM post-processor. |
max_results | integer | Maximum number of results to return. |
chronological_resort | boolean | Re-sort the final results by creation time instead of relevance. |
Learn more
The full README, examples, and API reference are available on the npm package page.