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 🙏

© 2025 – Pkg Stats / Ryan Hefner

remina-v2

v0.1.9

Published

Ultimate AI Memory System with Vector + Graph + Temporal Decay

Downloads

202

Readme

Remina v2 - Ultimate AI Memory System

The best-in-class AI memory system with unified Vector + Graph storage, temporal decay, and intelligent memory consolidation.

Features

  • Hybrid Storage: Vector (Milvus) + Graph (FalkorDB) for both semantic and relational queries
  • Temporal Decay: Memories fade over time, frequently accessed ones stay strong
  • Memory Consolidation: LLM-based ADD/UPDATE/DELETE decisions prevent duplicates
  • Two-Tier Caching: Redis L1 cache + PostgreSQL L2 storage
  • Hybrid Search: RRF fusion of vector, fulltext, and graph results
  • Intent Detection: Smart query routing based on query patterns

Stack

| Component | Technology | Purpose | |-----------|------------|---------| | L1 Cache | Redis | Hot memories, session context | | L2 Storage | PostgreSQL | Source of truth, full records | | Vector | Milvus | Semantic search, embeddings | | Graph | FalkorDB | Entity-relationship traversal | | LLM | OpenAI | Fact extraction, consolidation |

Quick Start

1. Start Infrastructure

cd remina-v2
docker-compose up -d

2. Install

npm install remina

3. Use

import { Memory } from 'remina';

const memory = new Memory({
  postgres: { connectionString: 'postgresql://remina:remina@localhost:5432/remina' },
  redis: { url: 'redis://localhost:6379' },
  milvus: { address: 'localhost:19530' },
  falkordb: { url: 'redis://localhost:6380' },
  openaiApiKey: process.env.OPENAI_API_KEY!,
});

// Add memories from conversation
await memory.add([
  { role: 'user', content: 'My name is Bob. I run Merkle Palace hotel.' },
  { role: 'assistant', content: 'Nice to meet you Bob!' },
  { role: 'user', content: 'The hotel has three room types: Deluxe, Standard, and Heritage.' },
], 'user-123');

// Search - works for both semantic AND relational queries
const results = await memory.search('What room types does Merkle Palace have?', 'user-123');

console.log(results.memories);
// [{ content: 'Merkle Palace has three room types: Deluxe, Standard, and Heritage', ... }]

console.log(results.relations);
// [
//   { source: 'Merkle Palace', relationship: 'HAS_ROOM_TYPE', target: 'Deluxe', fact: '...' },
//   { source: 'Merkle Palace', relationship: 'HAS_ROOM_TYPE', target: 'Standard', fact: '...' },
//   { source: 'Merkle Palace', relationship: 'HAS_ROOM_TYPE', target: 'Heritage', fact: '...' },
// ]

// Clean up
await memory.close();

API

Memory

class Memory {
  constructor(config: MemoryConfig)

  // Core operations
  add(messages: string | Message[], userId: string): Promise<AddResult>
  search(query: string, userId: string, limit?: number): Promise<SearchResult>
  get(memoryId: string): Promise<MemoryRecord | null>
  getAll(userId: string, limit?: number): Promise<MemoryRecord[]>
  update(memoryId: string, content: string): Promise<void>
  delete(memoryId: string): Promise<DeleteResult>
  deleteAll(userId: string): Promise<DeleteResult>

  // Graph operations
  getEntity(entityId: string): Promise<Entity | null>
  getEntities(userId: string, limit?: number): Promise<Entity[]>
  getRelationships(userId: string, limit?: number): Promise<Relationship[]>
  traverse(entityId: string, hops?: number): Promise<Entity[]>

  // Lifecycle
  close(): Promise<void>
}

Configuration

interface MemoryConfig {
  // Required connections
  postgres: { connectionString: string }
  redis: { url: string }
  milvus: { address: string; token?: string }
  falkordb: { url: string }

  // LLM
  openaiApiKey: string
  openaiModel?: string        // Default: 'gpt-4o-mini'
  embeddingModel?: string     // Default: 'text-embedding-3-small'

  // Optional tuning
  decay?: {
    halfLifeDays?: number     // Default: 30
    frequencyBoost?: number   // Default: 0.1
    importanceWeight?: number // Default: 0.3
  }
  cache?: {
    memoryTtlSeconds?: number // Default: 3600
    searchTtlSeconds?: number // Default: 300
    enabled?: boolean         // Default: true
  }
}

How It Works

Write Path

  1. Extract Facts: LLM extracts memorable facts from conversation
  2. Consolidate: Compare with existing memories, decide ADD/UPDATE/DELETE
  3. Extract Graph: LLM extracts entities and relationships
  4. Store: Save to Postgres (L2), Milvus (vector), FalkorDB (graph), Redis (L1)

Read Path

  1. Check Cache: Redis L1 for recent queries
  2. Parallel Search: Milvus (vector) + Postgres (fulltext) + FalkorDB (graph)
  3. Rank: RRF fusion + temporal decay scoring
  4. Return: Combined memories + relations

Temporal Decay

Memories decay exponentially over time:

score = base_score × e^(-λt)

Where:

  • λ = ln(2) / halfLifeDays
  • t = days since last access

Frequently accessed memories get a logarithmic boost.

License

Apache-2.0