tanstack-ai-memory-mem0

A hosted memory adapter that connects TanStack AI to a running mem0 server, which extracts, ranks, and stores useful information from conversations.

In plain words
What is it for?
Use it to save conversation turns and recall relevant memories through `memoryMiddleware`, configuring the mem0 server, user, search threshold, and access token.
Why use it?
It lets the mem0 server handle memory extraction and search over plain HTTP, so the application does not need a separate SDK dependency or its own ranking logic.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/tanstack/ai/tanstack-ai-memory-mem0
Any agent
npx skills add TanStack/ai --skill tanstack-ai-memory-mem0
Clone the repo
git clone --depth 1 https://github.com/TanStack/ai

Made for: Claude Code, Codex.

Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 404 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00051 $0.00404
Opus 5 $0.00026 $0.00202
Sonnet 5 $0.00010 $0.00081
Haiku 4.5 $0.00005 $0.00040

Measured yesterday against content hash cfd6851b370e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tanstack-ai-memory-mem0 scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packages/ai-memory/skills/tanstack-ai-memory-mem0/SKILL.md · 37 lines

What it actually says

mem0 Memory Adapter

Hosted recall/save adapter backed by a mem0 server. mem0 owns extraction and ranking server-side. Talks to the server over plain HTTP — no SDK peer dependency.

Setup

import { memoryMiddleware } from '@tanstack/ai-memory'
import { mem0 } from '@tanstack/ai-memory/mem0'

const memory = mem0({ user: currentUserId }) // baseUrl defaults to MEM0_URL

memoryMiddleware({ adapter: memory, scope })

Requires a running mem0 server (self-hosted or hosted). Point it via baseUrl (or MEM0_URL); pass apiKey (or MEM0_ADMIN_API_KEY) when secured.

Options

  • user — mem0 user_id (falls back to scope.userId, then 'demo-user').
  • baseUrl — mem0 server URL (default MEM0_URL or http://localhost:8000).
  • apiKey — bearer token (default MEM0_ADMIN_API_KEY).
  • rerank (default true), threshold (default 0.1) — search tuning.

Scope fields: requests send user_id and run_id (scope.threadId). tenantId and namespace are not sent — encode multi-tenant isolation into user if needed.

save posts the { user, assistant } turn to /memories; recall queries /search and renders the results into the system prompt. mem0 exposes no LLM tools.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 37 lines · 51 tokens per session scan A cfd6851b370e

Subscribe to this mod's changes

tanstack-ai-memory-mem0 is a skill published in the GitHub repository TanStack/ai (3,045 stars, last pushed 2d ago), licensed MIT. It adds 51 tokens to every session and 404 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.