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

@coopah/bentley-store-postgres

v0.2.2

Published

PostgreSQL storage backend for Bentley (with pgvector support)

Readme

@coopah/bentley-store-postgres

PostgreSQL storage backend for Bentley workspace memory with pgvector support for efficient semantic search.

Install

pnpm add @coopah/bentley-store-postgres

Make sure your PostgreSQL instance has the pgvector extension installed if you want semantic search.

Dependencies

Usage

import { createBentley } from "@coopah/bentley-core";
import { bentleyPostgresPlugin } from "@coopah/bentley-store-postgres";

const bentley = createBentley({
  plugins: [
    bentleyPostgresPlugin({
      connectionString: process.env.DATABASE_URL!,
    }),
  ],
});

With Embeddings (Semantic Search via pgvector)

import { embed } from "ai";
import { openai } from "@ai-sdk/openai";

bentleyPostgresPlugin({
  connectionString: process.env.DATABASE_URL!,
  embedder: async (text) => {
    const { embedding } = await embed({ model: openai.embedding("text-embedding-3-small"), value: text });
    return embedding;
  },
});

When an embedder is provided, semantic search uses pgvector's <=> (cosine distance) operator for fast similarity queries instead of brute-force scanning.

Running Migrations

import { BentleyPostgresStore } from "@coopah/bentley-store-postgres";

const store = new BentleyPostgresStore({ connectionString: process.env.DATABASE_URL! });
await store.migrate(); // Creates tables and pgvector extension

API

  • bentleyPostgresPlugin(config)BentleyPlugin that registers PostgreSQL as the workspace memory backend
  • BentleyPostgresStore — Implements BentleyWorkspaceMemory from core
  • MIGRATIONS — Database migration scripts

Configuration

interface PostgresStoreConfig {
  connectionString: string;                          // PostgreSQL connection URI
  embedder?: (text: string) => Promise<number[]>;    // Optional embedding function for semantic search
}

BentleyPostgresStore Methods

Implements the full BentleyWorkspaceMemory interface:

| Method | Description | |--------|-------------| | getSoul(shellId) | Get shell identity (SOUL.md equivalent) | | updateSoul(shellId, content) | Update shell identity | | getMemory(shellId) | Retrieve long-term memory facts | | appendMemory(shellId, fact) | Add a memory fact | | getRecentMessages(shellId, threadId, limit?) | Get conversation history | | addMessage(shellId, threadId, message) | Store a message | | semanticSearch(shellId, query, topK?) | pgvector similarity search | | getRecentMessagesWithStrategy() | Memory reduction with configurable strategies | | getHeartbeatChecklist(shellId) | Recurring task state | | migrate() | Run schema migrations (creates tables + pgvector extension) | | close() | Close the connection pool |

Database Tables

  • bentley_souls — Shell identity
  • bentley_memories — Long-term facts with timestamps
  • bentley_messages — Conversation history by shell/thread
  • bentley_heartbeats — Task runner state
  • bentley_embeddings — Vector embeddings (pgvector type) for semantic search

Related Packages

| Package | Role | |---------|------| | @coopah/bentley-core | Core runtime (required) | | @coopah/bentley-store-sqlite | SQLite backend (simpler, no pgvector) |

License

MIT