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

@rezzed.ai/memory

v0.2.0

Published

CacheBash Memory SDK — Lightweight client for memory pattern storage and recall

Readme

@rezzed.ai/memory

Lightweight TypeScript client for storing and recalling learned patterns via CacheBash.

Install

npm install @rezzed.ai/memory

Quick Start

import { CacheBashMemory } from "@rezzed.ai/memory";

const memory = new CacheBashMemory({
  apiKey: "your-api-key",
  programId: "your-program-id",
});

await memory.store({
  id: "pattern-001",
  domain: "workflow",
  pattern: "Always validate input before processing",
  confidence: 0.95,
  evidence: "Prevented 3 runtime errors in production",
});

const patterns = await memory.recall({ domain: "workflow" });

API Reference

Constructor

new CacheBashMemory(config: CacheBashMemoryConfig)

| Parameter | Type | Required | Description | | ----------- | --------------- | -------- | ------------------------------------------------ | | apiKey | string | Yes | Your CacheBash API key | | programId | string | Yes | Program ID for memory isolation | | transport | "rest" \| "mcp" | No | Transport mode (default: "rest") | | endpoint | string | No | Custom API endpoint URL |

store(input: StorePatternInput): Promise<void>

Store or update a memory pattern. If a pattern with the same id exists, it will be replaced.

await memory.store({
  id: "p-001",
  domain: "security",
  pattern: "Rate-limit all public endpoints",
  confidence: 0.92,
  evidence: "Blocked 3 brute-force attempts",
});

StorePatternInput fields:

| Field | Type | Description | | ------------ | -------- | -------------------------------------- | | id | string | Unique pattern identifier | | domain | string | Domain category (e.g. "security") | | pattern | string | The learned pattern or rule | | confidence | number | Confidence score (0-1) | | evidence | string | Supporting evidence or context |

recall(options?: RecallOptions): Promise<MemoryPattern[]>

Recall memory patterns with optional filters. Excludes stale patterns by default.

const all = await memory.recall();
const security = await memory.recall({ domain: "security" });
const search = await memory.recall({ search: "rate-limit" });
const withStale = await memory.recall({ includeStale: true });

RecallOptions:

| Field | Type | Description | | -------------- | --------- | ----------------------------------- | | domain | string | Filter by domain | | search | string | Text search across pattern/evidence | | includeStale | boolean | Include stale patterns (default: false) |

Returns: MemoryPattern[]

health(): Promise<MemoryHealth>

Get memory health statistics.

const health = await memory.health();
console.log(health.totalPatterns, health.activePatterns);

Returns:

| Field | Type | Description | | ------------------ | ---------- | ------------------------------------ | | totalPatterns | number | Total pattern count | | activePatterns | number | Non-stale patterns | | promotedPatterns | number | Patterns promoted to permanent store | | stalePatterns | number | Patterns marked as stale | | domains | string[] | All domain names | | lastUpdatedAt | string \| null | Last update timestamp | | lastUpdatedBy | string \| null | Last updating program | | decay | object | Decay configuration |

delete(patternId: string): Promise<void>

Delete a memory pattern by ID.

await memory.delete("p-001");

reinforce(patternId: string, options?: ReinforceOptions): Promise<void>

Reinforce an existing pattern. Bumps lastReinforced timestamp and optionally updates confidence or evidence.

await memory.reinforce("p-001", {
  confidence: 0.97,
  evidence: "Confirmed again in latest deploy",
});

ReinforceOptions:

| Field | Type | Description | | ------------ | -------- | ----------------------------- | | confidence | number | Updated confidence score | | evidence | string | Updated evidence text |

Configuration

Transport Modes

REST (default): Simple HTTP transport. Endpoint defaults to https://api.cachebash.dev.

const memory = new CacheBashMemory({
  apiKey: "your-key",
  programId: "your-program",
  transport: "rest",
});

MCP: JSON-RPC over MCP transport. Endpoint defaults to https://api.cachebash.dev/v1/mcp.

const memory = new CacheBashMemory({
  apiKey: "your-key",
  programId: "your-program",
  transport: "mcp",
});

Custom Endpoint

const memory = new CacheBashMemory({
  apiKey: "your-key",
  programId: "your-program",
  endpoint: "https://your-custom-endpoint.example.com",
});

Error Handling

All methods throw standard Error objects on failure. Errors fall into three categories:

HTTP errors — The API returned a non-2xx status code. The error message includes the status code.

try {
  await memory.store(pattern);
} catch (err) {
  // "HTTP 401: Unauthorized"
  // "HTTP 403: Forbidden"
  // "HTTP 404: Not Found"
  // "HTTP 500: Internal Server Error"
}

API errors — The API returned a 200 response with success: false.

try {
  await memory.store(pattern);
} catch (err) {
  // "API error: <message from server>"
}

Network errors — The fetch call itself failed (DNS resolution, timeout, connection refused).

try {
  await memory.store(pattern);
} catch (err) {
  // "fetch failed: network timeout"
  // "TypeError: Failed to fetch"
}

Examples

See the examples/ directory for runnable scripts:

Run an example:

CACHEBASH_API_KEY=your-key npx tsx packages/memory/examples/basic-usage.ts

Running Tests

cd packages/memory
npm test

Or with watch mode:

npm run test:watch

Integration Tests

Run against the live API:

CACHEBASH_API_KEY=your-key npm run test:integration

Integration tests are skipped automatically when no API key is set.

Benchmarks

Measure API latency:

CACHEBASH_API_KEY=your-key npm run benchmark

License

MIT