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

memories-lite

v0.99.3

Published

A lightweight memory system for LLM agents

Downloads

238

Readme

🧠 Memories-lite

A lightweight memory layer for AI agents, leveraging LLMs for fact extraction and vector embeddings for retrieval.

📋 Table of Contents

🚀 Quick Start

# Install the package
npm install memories-lite

# Basic usage
import { MemoriesLite } from 'memories-lite';

const memory = new MemoriesLite({
  llm: {
    provider: 'openai',
    config: { apiKey: 'YOUR_API_KEY' }
  },
  embedder: {
    provider: 'openai',
    config: { apiKey: 'YOUR_API_KEY', model: 'text-embedding-3-small' }
  }
});

// Add a memory for a user
await memory.capture("I prefer dark chocolate over milk chocolate", "user123");

// Retrieve relevant memories
const results = await memory.retrieve("What are my food preferences?", "user123");

🌟 Highlights

  • Higher Performance: Optimized memory operations that run significantly faster than mem0
  • Business-Centric Design: Simplified API and workflows specifically tailored for business use cases
  • Advanced Hybrid Scoring: Improved relevance through a custom scoring algorithm that balances vector similarity, recency, and importance
  • Enhanced Security: One database per user architecture that provides stronger isolation and data protection
  • Streamlined Implementation: Focused on essential features with minimal dependencies

📥 Installation

npm install memories-lite
# or
yarn add memories-lite

🔍 Basic Usage

import { MemoriesLite } from 'memories-lite';

// Basic configuration
const memory = new MemoriesLite({
  llm: {
    provider: 'openai',
    config: { apiKey: 'YOUR_OPENAI_API_KEY' }
  },
  embedder: {
    provider: 'openai',
    config: { apiKey: 'YOUR_OPENAI_API_KEY' }
  }
  // Vector store defaults to an in-memory store
});

// Unique ID for each user
const userId = 'user-123';

// Add memories
await memory.capture('I love Italian food', userId);

// Retrieve relevant memories
const results = await memory.retrieve('What foods do I like?', userId);
console.log('Relevant memories:', results.results.map(m => m.memory));

// Update a memory
if (results.results.length > 0) {
  await memory.update(results.results[0].id, 'I love Italian and French cuisine', userId);
}

// Delete a memory
if (results.results.length > 0) {
  await memory.delete(results.results[0].id, userId);
}

// Get all memories for a user
const allMemories = await memory.getAll(userId, {});

🔑 Key Features

  • Memory Capture: Extract and store relevant information from conversations
  • Contextual Retrieval: Find memories most relevant to the current query
  • User Isolation: Each user's memories are stored separately for privacy and security
  • Memory Types: Support for different types of memories (factual, episodic, etc.)
  • Custom Scoring: Hybrid scoring system balancing similarity, recency, and importance

🧩 Memory Types

Memories-lite supports four main types of memory:

  1. Factual Memory

    • User preferences, traits, and personal information
    • Example: "User likes Italian cuisine"
  2. Episodic Memory ⏱️

    • Time-based events and interactions
    • Example: "User has a meeting tomorrow at 2pm"
  3. Semantic Memory 🧠

    • General knowledge and concepts
    • Example: "Yoga is beneficial for mental health"
  4. Procedural Memory 🔄

    • Step-by-step processes and workflows
    • Example: "Steps to configure the company VPN"

💼 Use Cases

  • Customer Support Bots: Remember customer preferences and past interactions
  • Personal Assistants: Build context-aware AI assistants that learn about user preferences
  • Business Applications: Integrate with enterprise systems to maintain contextual awareness
  • Educational Tools: Create learning assistants that remember student progress

⚙️ Advanced Configuration

// Custom scoring for different memory types
const customMemory = new MemoriesLite({
  llm: {
    provider: 'openai',
    config: { apiKey: 'YOUR_API_KEY' }
  },
  embedder: {
    provider: 'openai', 
    config: { apiKey: 'YOUR_API_KEY' }
  },
  vectorStore: {
    provider: 'lite',
    config: {
      dimension: 1536,
      scoring: {
        // Prioritize factual memories with long retention
        factual: { alpha: 0.7, beta: 0.2, gamma: 0.1, halfLifeDays: 365 },
        // Make preferences permanently available
        assistant_preference: { alpha: 0.6, beta: 0.0, gamma: 0.4, halfLifeDays: Infinity },
      }
    }
  }
});

📚 Documentation

For detailed technical information and implementation details, see:

🙏 Acknowledgements

Forked from the Mem0 project ❤️.

Inspired by research concepts from:

  • A-MEM: Agentic Memory for LLM Agents
  • MemoryLLM: Self-Updatable Large Language Models
  • Reflexion: Language Agents with Verbal Reinforcement Learning

📝 Development Roadmap

  • [x] Semantic Memory Typing & Structuring: Explicitly tagging and utilizing memory types (factual, episodic, semantic, procedural)
  • [x] Implicit Memory Updates: Auto-merging memories based on context without explicit ID references
  • [x] Virtual Sessions/Context Grouping: Group memories related to specific conversation contexts
  • [x] User Isolation: Separate storage per user for enhanced security and data privacy
  • [x] Memory Type Detection: LLM-based automatic classification of memory types
  • [x] Core Memory Operations: Basic CRUD operations with user-specific isolation
  • [x] Memory Decay & Scoring: Hybrid scoring with recency decay and importance weights
  • [ ] Reflexion Pattern Integration: Self-correction loops for memory refinement
  • [x] Memory Recency: Prioritizing memories based on importance and time decay
  • [x] Edge Case Tests: Complete unit tests for episodic and factual memory edge cases
  • [ ] Middleware Support: Hooks and middleware for custom processing pipelines

📄 License

MIT