explaingit

gharibyan/agent-memory

Analysis updated 2026-05-18

16JavaScriptAudience · developerComplexity · 3/5LicenseSetup · easy

TLDR

agent-memory-sdk is a TypeScript library that gives AI agents automatic, persistent memory scoped by user, thread, or task, so apps do not have to manually re-send full chat history.

Mindmap

mindmap
  root((agent-memory-sdk))
    What it does
      Automatic memory recall
      Scoped by user thread operation
      Context budget limits
      Learning toggle per call
    Tech stack
      TypeScript
      Node.js
      SQLite
      Postgres pgvector
    Use cases
      Persistent chatbot memory
      Multi-user agent apps
      Token cost control
      Multi-provider agents
    Audience
      Developers
    Providers
      OpenAI
      Anthropic
      Gemini
      xAI

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add persistent, per-user memory to a chatbot without manually stuffing chat history into every prompt.

USE CASE 2

Store agent memory locally as JSON for prototypes, then switch to SQLite or Postgres with pgvector for production.

USE CASE 3

Cap how much stored memory context gets injected per call to control token costs.

USE CASE 4

Connect the same memory system to OpenAI, Anthropic, Gemini, xAI, or any OpenAI-compatible model provider.

What is it built with?

TypeScriptNode.jsSQLitePostgreSQL

How does it compare?

gharibyan/agent-memoryakaakshat246/ecoscore-browser-extensionandrelog99/dam
Stars161616
LanguageJavaScriptJavaScriptJavaScript
Setup difficultyeasyhardeasy
Complexity3/53/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Defaults to local JSON storage with no setup, SQLite and Postgres/pgvector adapters need extra configuration for production use.

MIT license: free to use, modify, and distribute, including commercially, as long as the copyright notice is kept.

In plain English

This is a TypeScript library called agent-memory-sdk, available as a single npm package, that adds persistent memory to AI agent applications. When you build a chatbot or AI assistant, one common problem is that the AI has no way to remember past conversations unless you manually paste the entire chat history into every new request. This library wraps your model calls so that memory is stored, recalled, and updated automatically, without you having to manage that history yourself. The memory system is organized into layers. User memory is tied to a specific person and persists across all their sessions. Thread memory covers a single conversation. Operation memory holds compact context for a specific task or workflow. You can set a budget to limit how much stored context gets injected into any one call, which keeps token costs under control. You can also turn off recall or learning for individual calls when you need a clean slate. For storing the memories, the library defaults to a local JSON file on disk, which is fine for prototypes. It also ships adapters for SQLite (a lightweight local database) and for Postgres with pgvector, which is a Postgres extension that enables vector search. The Postgres adapter handles its own database migrations automatically on first use, including creating the search index and relational tables. The library works with several AI model providers. Official adapters are included for OpenAI, Anthropic, Gemini, and xAI. There is also a generic helper for any provider that exposes an OpenAI-compatible chat API, so you can point it at custom or third-party model endpoints by supplying a base URL and API key. Internally the repository is split into multiple packages covering the core engine, each storage adapter, and each provider adapter, but all of those are compiled and bundled together into the single public npm package. End users install one package and get everything. The project is open source under the MIT license.

Copy-paste prompts

Prompt 1
Show me how to install agent-memory-sdk and create an agent with createAgent and openai.
Prompt 2
Explain the difference between userId, threadId, and operationId scoping in agent-memory-sdk.
Prompt 3
How do I switch agent-memory-sdk from local JSON storage to a Postgres store with pgvector?
Prompt 4
Set up agent-memory-sdk with the Anthropic provider adapter and disable learning for a single call.

Frequently asked questions

What is agent-memory?

agent-memory-sdk is a TypeScript library that gives AI agents automatic, persistent memory scoped by user, thread, or task, so apps do not have to manually re-send full chat history.

What language is agent-memory written in?

Mainly JavaScript. The stack also includes TypeScript, Node.js, SQLite.

What license does agent-memory use?

MIT license: free to use, modify, and distribute, including commercially, as long as the copyright notice is kept.

How hard is agent-memory to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is agent-memory for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.