npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

genkitx-goodmem

v0.1.2

Published

Genkit AI framework plugin for GoodMem, a retrieval-augmented generation (RAG) memory service.

Readme

genkitx-goodmem

GoodMem plugin for Genkit.

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.

This package exposes the GoodMem API as 11 Genkit tools under the goodmem/ namespace, callable from any Genkit agent or flow.

Installation

npm install genkitx-goodmem
# or
pnpm add genkitx-goodmem
# or
yarn add genkitx-goodmem

genkit is a peer dependency. If you do not already have it installed:

npm install genkit

Quickstart

import { genkit } from 'genkit';
import { goodmem } from 'genkitx-goodmem';

const ai = genkit({
  plugins: [
    goodmem({
      baseUrl: process.env.GOODMEM_BASE_URL || 'https://localhost:8080',
      apiKey: process.env.GOODMEM_API_KEY!,
    }),
  ],
});

Once the plugin is loaded, 11 tools are registered and available to any Genkit agent or flow.

Tool naming

All tools sit under the goodmem/ namespace and use snake_case action names. For example: goodmem/create_space, goodmem/list_embedders. The <plugin>/<action> shape follows Genkit's convention.

Available tools

| Tool | Description | |---|---| | goodmem/list_embedders | List embedder models available on the server. | | goodmem/list_spaces | List spaces visible to the API key. | | goodmem/get_space | Fetch a space by UUID. | | goodmem/create_space | Create a space (idempotent by name). | | goodmem/update_space | Rename, retag, or change the public-read flag on a space. | | goodmem/delete_space | Delete a space and every memory in it. | | goodmem/create_memory | Store text or a file as a memory. | | goodmem/list_memories | List memories in a space, with status/sort filters. | | goodmem/retrieve_memories | Semantic retrieval across one or more spaces. | | goodmem/get_memory | Fetch a memory by UUID, optionally with content. | | goodmem/delete_memory | Delete a memory. |

Retrieval options

goodmem/retrieve_memories accepts the following parameters in addition to query, spaceIds, and maxResults:

| Parameter | Type | Description | |---|---|---| | metadataFilter | string | SQL-style JSONPath filter applied server-side to every space key. Example: CAST(val('$.category') AS TEXT) = 'feat' | | waitForIndexing | boolean | Poll for results when none come back on the first call (default true). | | maxWaitSeconds | number | Polling budget in seconds (default 10). | | pollInterval | number | Seconds between polls (default 2). | | rerankerId | string | Reranker model UUID to refine result ordering. | | llmId | string | LLM UUID that generates a contextual abstract reply. | | relevanceThreshold | number | Minimum score (0-1) for inclusion. Only used with a reranker or LLM. | | llmTemperature | number | Creativity (0-2) for the LLM post-processor. Only used with llmId. | | chronologicalResort | boolean | Reorder results by creation time instead of relevance. | | includeMemoryDefinition | boolean | Fetch full memory metadata alongside matched chunks (default true). |

list_memories options

| Parameter | Type | Description | |---|---|---| | statusFilter | "PENDING" \| "PROCESSING" \| "COMPLETED" \| "FAILED" | Restrict results to one processing status. | | includeContent | boolean | Include original document content alongside metadata (default false). | | sortBy | "created_at" \| "updated_at" | Field used to sort the returned memories. | | sortOrder | "ASCENDING" \| "DESCENDING" | Sort direction. |

Environment variables

| Variable | Description | |---|---| | GOODMEM_BASE_URL | Base URL of the GoodMem API server. Default in examples: https://localhost:8080. | | 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. |

Helper functions

The plugin also exports two helper functions for direct programmatic use. The goodmem/list_spaces and goodmem/list_embedders tools call into these:

import { listSpaces, listEmbedders } from 'genkitx-goodmem';

const spaces = await listSpaces({
  baseUrl: 'https://localhost:8080',
  apiKey: process.env.GOODMEM_API_KEY!,
});

const embedders = await listEmbedders({
  baseUrl: 'https://localhost:8080',
  apiKey: process.env.GOODMEM_API_KEY!,
});

Example: full workflow

import { genkit, z } from 'genkit';
import { goodmem } from 'genkitx-goodmem';

const ai = genkit({
  plugins: [
    goodmem({
      baseUrl: 'https://localhost:8080',
      apiKey: process.env.GOODMEM_API_KEY!,
    }),
  ],
});

const memoryFlow = ai.defineFlow(
  { name: 'memoryFlow', inputSchema: z.string(), outputSchema: z.any() },
  async (query) => {
    const listEmbedders = await ai.registry.lookupAction(
      '/tool/goodmem/list_embedders'
    );
    const { embedders } = await listEmbedders({});
    const embedderId = embedders[0].embedderId;

    const createSpace = await ai.registry.lookupAction(
      '/tool/goodmem/create_space'
    );
    const space = await createSpace({
      name: 'my-knowledge-base',
      embedderId,
    });

    const createMemory = await ai.registry.lookupAction(
      '/tool/goodmem/create_memory'
    );
    await createMemory({
      spaceId: space.spaceId,
      textContent: 'The capital of France is Paris.',
      source: 'manual',
    });

    const retrieve = await ai.registry.lookupAction(
      '/tool/goodmem/retrieve_memories'
    );
    return retrieve({
      query,
      spaceIds: [space.spaceId],
      maxResults: 5,
    });
  }
);

End-to-end demo

examples/example_usage.ts walks through three scenarios: persistent project context, a scribe and analyst pipeline, and metadata-driven retrieval. The answering step uses OpenAI via @genkit-ai/compat-oai. Set OPENAI_API_KEY before running.

# from a checkout of this repo:
pnpm install
pnpm run demo
# or to inspect traces in the Genkit Developer UI:
genkit start -- tsx examples/example_usage.ts

Testing

Run the unit test suite (mocked fetch, exercises every tool):

pnpm install
pnpm run test

License

Apache License 2.0. See LICENSE.