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

@memoryai.dev/core

v1.1.0

Published

Shared core library for MemoryAI packages - config, offline cache, API client, context-guard client

Readme

@memoryai.dev/core

Shared core library for MemoryAI packages - config resolution, offline cache, and API client.

Features

  • Unified Config System: Resolves config from multiple sources with priority: Per-IDE > Server > Shared Local > Env Vars > Defaults
  • Offline Cache: SQLite-based cache for memories, works without network
  • API Client: Robust client with retry logic, exponential backoff, and timeout handling
  • Type Safety: Full TypeScript types and interfaces

Installation

npm install @memoryai.dev/core

Usage

Basic Usage

import { MemoryClient } from '@memoryai.dev/core';

const client = new MemoryClient({
  config: {
    endpoint: 'https://memoryai.dev',
    apiKey: 'hm_sk_...',
  }
});

// Recall memories
const result = await client.recall({
  query: 'user preferences',
  limit: 5
});

// Store memory
await client.store({
  content: 'User prefers concise responses',
  memory_type: 'preference'
});

// Compact context
await client.compact({
  summary: 'Session summary...'
});

Config Resolution

Config is resolved from multiple sources with priority:

  1. Per-IDE config (passed to constructor)
  2. Server overrides (fetched from API)
  3. Shared local config (~/.memoryai/config.json)
  4. Environment variables (HM_ENDPOINT, HM_API_KEY, etc.)
  5. Hardcoded defaults
// Shared config file: ~/.memoryai/config.json
{
  "endpoint": "https://memoryai.dev",
  "apiKey": "hm_sk_...",
  "contextCap": 1000000,
  "compactAt": 20,
  "criticalAt": 30
}

Offline Mode

The client automatically caches recall results in SQLite. If the server is unreachable, cached results are returned:

const client = new MemoryClient({ enableCache: true });

// First call - hits server and caches result
const result1 = await client.recall({ query: 'test' });
console.log(result1.cached); // false

// Second call - returns cached result
const result2 = await client.recall({ query: 'test' });
console.log(result2.cached); // true

// Clean old cache entries (older than 24h)
client.cleanCache(86400000);

Health Check

const health = await client.health();
console.log(health.online); // true/false
console.log(health.latency_ms); // 123

API

MemoryClient

Main client class.

Constructor:

new MemoryClient(options?: MemoryClientOptions)

Methods:

  • recall(options: RecallOptions): Promise<RecallResult>
  • store(options: StoreOptions): Promise<{ id: string }>
  • compact(options: CompactOptions): Promise<void>
  • health(): Promise<HealthStatus>
  • updateConfig(updates: Partial<MemoryAIConfig>): void
  • getConfig(): MemoryAIConfig
  • cleanCache(maxAgeMs?: number): number
  • getCacheStats(): { memories: number; queries: number; size_bytes: number } | null
  • clearCache(): void
  • close(): void

Config Utilities

import { resolveConfig, readSharedConfig, writeSharedConfig, validateConfig } from '@memoryai.dev/core';

// Read shared config
const config = readSharedConfig();

// Write shared config
writeSharedConfig({
  endpoint: 'https://memoryai.dev',
  apiKey: 'hm_sk_...'
});

// Validate config
const errors = validateConfig(config);

Architecture

Used by:

  • memoryai-mcp - MCP server for Claude Desktop, VS Code, etc.
  • memoryai-claude - HTTP hooks for Claude Code CLI

License

MIT