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

@traqr/memory

v0.2.0

Published

Persistent memory for AI agents. Multi-strategy retrieval (semantic + BM25 + RRF), 3-zone cosine triage, type-aware lifecycle, entity canonicalization. Postgres + pgvector.

Readme

@traqr/memory

TypeScript library for persistent AI agent memory. Multi-strategy retrieval (semantic + BM25 + RRF), 3-zone cosine triage, entity extraction, type-aware lifecycle. Postgres + pgvector.

Use this library if you're building your own memory-powered application. For an MCP server that works out of the box, see traqr-memory-mcp.

Install

npm install @traqr/memory

Quick Usage

import { configureMemory, storeMemory, searchMemoriesV2, triageAndStore } from '@traqr/memory'

// Configure once at startup
configureMemory({
  supabaseUrl: process.env.SUPABASE_URL,
  supabaseKey: process.env.SUPABASE_SERVICE_ROLE_KEY,
})
// OR for raw Postgres:
configureMemory({
  databaseUrl: process.env.DATABASE_URL,
})

// Store a memory
const memory = await storeMemory({
  content: 'React Server Components require "use client" for interactive components',
  sourceType: 'session',
})

// Search by meaning (multi-strategy: semantic + BM25 + RRF fusion)
const results = await searchMemoriesV2('React component patterns', { limit: 5 })

// Store with deduplication triage (cosine similarity zones + LLM borderline)
const result = await triageAndStore({
  content: 'Always use useCallback for event handlers passed to memoized children',
  sourceType: 'session',
})
// result.zone: 'noop' (duplicate) | 'add' (new) | 'borderline' (LLM decided)

VectorDB Providers

Two providers, same SQL functions, different transport:

| Provider | Connection | Transport | When to use | |----------|-----------|-----------|-------------| | Supabase | SUPABASE_URL + SUPABASE_SERVICE_ROLE_KEY | PostgREST (HTTP) | Easiest setup, free tier | | Postgres | DATABASE_URL | pg wire protocol | RDS, Aurora, Docker, self-hosted |

Auto-detected from environment variables. Or explicit:

import { getVectorDB } from '@traqr/memory'

const db = getVectorDB({ type: 'postgres' })
await db.ping() // true

For raw Postgres, install the pg package: npm install pg

Embedding Providers

| Provider | Env Var | Model | Dimensions | |----------|---------|-------|-----------| | OpenAI | OPENAI_API_KEY | text-embedding-3-small | 1536 | | Gemini | GOOGLE_API_KEY | gemini-embedding-001 | 1536 | | Bedrock | EMBEDDING_PROVIDER=bedrock + AWS creds | amazon.nova-embed-v1:0 | 1536 | | Ollama | EMBEDDING_PROVIDER=ollama | nomic-embed-text | 768 | | None | EMBEDDING_PROVIDER=none | — | 0 (BM25 only) |

Set EMBEDDING_PROVIDER explicitly, or it auto-detects from available API keys.

import { getEmbeddingProvider } from '@traqr/memory'

const ep = getEmbeddingProvider()
console.log(ep.provider, ep.model, ep.dimensions)
// 'openai', 'text-embedding-3-small', 1536

Key Exports

// High-level operations
import {
  storeMemory, searchMemoriesV2, getMemory, updateMemory, deleteMemory,
  triageAndStore, storeWithDedup, archiveMemory, remember, recall,
} from '@traqr/memory'

// VectorDB layer
import { getVectorDB, resetVectorDB } from '@traqr/memory'
import type { VectorDBProvider, Memory, MemorySearchResult } from '@traqr/memory'

// Embeddings
import { generateEmbedding, getEmbeddingProvider } from '@traqr/memory'
import type { EmbeddingProvider, EmbeddingResult } from '@traqr/memory'

// Configuration
import { configureMemory, getMemoryConfig } from '@traqr/memory'

// Auto-derive (extracts domain, category, topic, tags from content)
import { deriveAll } from '@traqr/memory'

// Multi-strategy retrieval internals
import { reciprocalRankFusion, detectStrategies } from '@traqr/memory'

Database Setup

Run setup.sql on your Postgres 15+ database (pgvector required):

# Supabase: paste into SQL Editor
# Postgres: psql $DATABASE_URL -f setup.sql
# Docker:
docker run -d --name traqrdb -e POSTGRES_PASSWORD=postgres -p 5432:5432 pgvector/pgvector:pg16
psql postgresql://postgres:postgres@localhost:5432/postgres -f node_modules/traqr-memory-mcp/setup.sql

License

FSL-1.1-ALv2 — use freely for any purpose except offering a competing commercial memory service. Converts to Apache-2.0 after 2 years.