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

@cortex-memory/memoryai

v2.2.0

Published

MemoryAI v2.2 — One brain. ∞ agents. Forever. Adds Brain Export/Import (vendor-neutral bundles), Public Benchmark (smart recall vs full context), Trust Graph (per-agent reputation), Cognitive Twin (simulate user voice). Plus the v2 base: 11 biological beh

Readme

MemoryAI — Node.js SDK

Persistent memory for AI agents and bots. Zero dependencies, native fetch (Node 18+).

npm install memoryai

Quick Start

import { MemoryAI } from 'memoryai';

const mem = new MemoryAI({ apiKey: 'hm_sk_...' });

await mem.store('khách thích màu đỏ', { tags: ['customer:123'], priority: 'hot' });
const results = await mem.recall('sở thích khách', { tags: ['customer:123'] });
console.log(results);

Bot Examples

Zalo Bot

import { MemoryAI } from 'memoryai';

const mem = new MemoryAI({
  apiKey: process.env.MEMORYAI_KEY!,
  graceful: true, // never crash the bot
});

async function handleMessage(userId: string, text: string) {
  // Recall context
  const memories = await mem.recall(text, { tags: [`zalo:${userId}`], limit: 3 });

  // ... send to LLM with memories as context ...

  // Store what you learned
  await mem.store(assistantReply, { tags: [`zalo:${userId}`], source: 'zalo-bot' });
}

Telegram Bot

```typescript
const mem = new MemoryAI({
  apiKey: process.env.MEMORYAI_KEY!,
  graceful: true,
});

bot.on('message', async (ctx) => {
  const userId = String(ctx.from.id);
  const context = await mem.bootstrap({ taskDescription: `telegram:${userId}` });
  // ... use context in your LLM prompt ...
  await mem.store(reply, { tags: [`tg:${userId}`] });
});

Shopee Bot

const mem = new MemoryAI({
  apiKey: process.env.MEMORYAI_KEY!,
  graceful: true,
  circuitBreaker: { threshold: 3, cooldownMs: 60_000 },
});

async function handleShopeeChat(shopId: string, buyerId: string, message: string) {
  const tag = `shopee:${shopId}:${buyerId}`;
  const memories = await mem.recall(message, { tags: [tag], limit: 5 });
  // ... generate reply with context ...
  await mem.store(reply, { tags: [tag], source: 'shopee' });
}

Graceful Mode

For bots that must never crash — graceful: true makes all methods return null (or [] for recall) instead of throwing on errors.

const mem = new MemoryAI({ apiKey: '...', graceful: true });

const result = await mem.store('test'); // null on error, StoreResult on success
const memories = await mem.recall('test'); // [] on error, MemoryResult[] on success

Circuit Breaker

Built-in circuit breaker prevents cascading failures. After N consecutive failures, the circuit opens and rejects requests immediately for a cooldown period.

// Default: 5 failures → open for 30s
const mem = new MemoryAI({ apiKey: '...' });

// Custom thresholds
const mem2 = new MemoryAI({
  apiKey: '...',
  circuitBreaker: { threshold: 3, cooldownMs: 60_000 },
});

// Disable circuit breaker
const mem3 = new MemoryAI({ apiKey: '...', circuitBreaker: false });

// Check state
mem.getCircuitState(); // 'CLOSED' | 'OPEN' | 'HALF_OPEN'
mem.resetCircuit();

Retry + Backoff

Automatic retry with exponential backoff for transient errors (429, 502, 503, 504, network errors). Default: 3 retries with [1s, 2s, 4s] backoff.

const mem = new MemoryAI({
  apiKey: '...',
  retries: 5, // max retries
  timeout: 15_000, // per-request timeout
});

Full API Reference

| Method | Description | |--------|-------------| | store(content, opts?) | Store a memory chunk | | storeCode(content, opts) | Store code with IDE metadata | | recall(query, opts?) | Search memories | | stats() | Usage statistics | | compact(content, opts?) | Compact text into memory | | compactProject(content, opts) | Compact code with file metadata | | indexProject(fileTree, opts?) | Index project file tree | | learn(opts) | Store action + result + lesson | | bootstrap(opts?) | Get context block for session start | | explore(chunkId, limit?) | Explore graph neighbors | | clusters(limit?) | Get topic clusters | | listEntities(opts?) | List tracked entities | | entityChunks(name, limit?) | Get chunks for an entity | | handoffStart(conversation, opts?) | Start session handoff | | handoffRestore(opts?) | Restore from handoff | | handoffComplete(opts?) | Complete handoff | | handoffStatus() | Check handoff status | | l2Store(bankName, content, opts?) | Store in reasoning bank (Pro+) | | l2Recall(query, opts?) | Recall from reasoning banks (Pro+) | | l2Compress(bankName) | Compress reasoning bank | | l2Stats() | Reasoning layer stats | | sessionRecover(opts?) | Recover session context | | contextMonitor(opts) | Monitor context window | | snapshotCreate() | Create memory snapshot | | snapshotList() | List snapshots | | snapshotRestore(id) | Restore from snapshot | | exportData() | Export all data | | importData(chunks) | Import data | | deleteData() | Delete all data | | healthDetailed() | Detailed health check |

Get API Key

Sign up at memoryai.dev to get your API key.

License

MIT