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

@thinkfleet/memory-sdk

v0.2.0

Published

TypeScript SDK for memory.thinkfleet.ai — admin + project memory CRUD, semantic search, feedback, and Lattice behavioral patterns

Readme

@thinkfleet/memory-sdk

TypeScript SDK for memory.thinkfleet.ai — a managed memory + behavioral-pattern engine for AI agents.

Two resources:

  • memory — admin + project memory CRUD, semantic search, promote/confirm/reject workflow, feedback
  • lattice — behavioral pattern intelligence (extract, monitor, retrieve, search, observe)

Runs anywhere with a modern fetch: Node 18+, Bun, Deno, browsers, Cloudflare Workers.


Install

npm install @thinkfleet/memory-sdk
# or: pnpm add @thinkfleet/memory-sdk
# or: bun add @thinkfleet/memory-sdk

Quick start

import { ThinkFleetMemory } from '@thinkfleet/memory-sdk'

const tf = new ThinkFleetMemory({
  apiKey: 'sk-...',           // Platform Admin → API Keys
  projectId: 'proj_...',      // Default project for all calls
})

// Dashboard stats
const stats = await tf.memory.admin.stats()
console.log(`${stats.total} memories, ${stats.pendingReview} pending review`)

// Seed a memory the agent should know
await tf.memory.admin.create({
  content: 'Customer prefers email over phone.',
  type: 'preference',
  scope: 'project',
})

// Semantic search
const hits = await tf.memory.admin.search({
  query: 'communication preferences',
  limit: 5,
})

Configuration

const tf = new ThinkFleetMemory({
  apiKey: 'sk-...',                              // Required
  projectId: 'proj_...',                         // Required default
  baseUrl: 'https://memory.thinkfleet.ai',       // Default
  maxRetries: 2,                                 // Retries 429/5xx with backoff
  timeout: 30_000,                               // ms
  fetch: globalThis.fetch,                       // BYO fetch
  requestInterceptors:  [...],                   // Mutate RequestInit before send
  responseInterceptors: [...],                   // Inspect Response before JSON parse
})

Per-request project override

await tf.memory.admin.list({ scope: 'project' }, { projectId: 'proj_other' })

Cognito JWT instead of API key

Pass a request interceptor that swaps the Authorization header on each call:

const tf = new ThinkFleetMemory({
  apiKey: 'unused',  // still required to be non-empty, but interceptor wins
  projectId: 'proj_...',
  requestInterceptors: [
    async (_url, init) => {
      const jwt = await getCognitoJwt()
      return {
        ...init,
        headers: {
          ...(init.headers as Record<string, string>),
          Authorization: `Bearer ${jwt}`,
        },
      }
    },
  ],
})

Resources

tf.memory — current-user memories

| Method | Endpoint | | ------------------------- | ------------------------------------- | | mine(params?) | GET /projects/:id/memory/mine | | delete(memoryId) | DELETE /projects/:id/memory/:memId | | submitFeedback(body) | POST /projects/:id/memory/feedback|

tf.memory.admin — admin / project-wide memory

| Method | Endpoint | | ------------------------------------------- | ------------------------------------------------- | | list(params?) | GET /projects/:id/admin/memory | | listPlatform(params?) | GET /projects/:id/admin/memory/platform | | listPendingReview(params?) | GET /projects/:id/admin/memory/review | | stats() | GET /projects/:id/admin/memory/stats | | create(body) | POST /projects/:id/admin/memory | | update(memId, body) | PATCH /projects/:id/admin/memory/:memId | | confirm(memId, body) | POST /projects/:id/admin/memory/:memId/confirm| | promote(memId, body) | POST /projects/:id/admin/memory/:memId/promote| | search(body) | POST /projects/:id/admin/memory/search | | delete(memId) | DELETE /projects/:id/admin/memory/:memId | | listFeedback(memId) | GET /projects/:id/admin/memory/:memId/feedback|

tf.lattice — behavioral patterns

| Method | Endpoint | | ----------------------------------- | ----------------------------------------------------- | | extractPatterns(body?) | POST /projects/:id/lattice/patterns/extract | | getPattern(patternId) | GET /projects/:id/lattice/patterns/:patternId | | listPatterns(contactId, params?) | GET /projects/:id/lattice/contacts/:cid/patterns | | getContext(contactId, params?) | GET /projects/:id/lattice/contacts/:cid/context | | runMonitorTick() | POST /projects/:id/lattice/monitor/tick | | getMonitorStatus() | GET /projects/:id/lattice/monitor/status |


Memory scopes

import { MemoryScope } from '@thinkfleet/memory-sdk'

MemoryScope.PLATFORM   // visible to every project on the platform
MemoryScope.PROJECT    // visible to every user in this project
MemoryScope.AGENT      // tied to a specific chatbotId
MemoryScope.USER       // tied to a specific chatIdentityId
MemoryScope.SESSION    // tied to a specific sessionKey

Error handling

All non-2xx responses throw a typed error. Catch the base type or the specific one:

import {
  ThinkFleetMemoryError,
  AuthenticationError,
  AuthorizationError,
  NotFoundError,
  ValidationError,
  RateLimitError,
  ServerError,
  TimeoutError,
} from '@thinkfleet/memory-sdk'

try {
  await tf.memory.admin.create({ content: '' })
} catch (err) {
  if (err instanceof ValidationError) {
    console.error('Bad request:', err.message, err.params)
  } else if (err instanceof RateLimitError) {
    console.warn('Throttled; retry after', err.retryAfterMs, 'ms')
  } else if (err instanceof ThinkFleetMemoryError) {
    console.error('API error:', err.code, err.statusCode, err.message)
  } else {
    throw err
  }
}

License

MIT