tanstack-ai-memory-redis

Configures a Redis-backed memory adapter for TanStack AI recall and save operations.

3.1k|316|Updated Oct 8, 2025
One-click install
npx skills add https://github.com/TanStack/ai --skill tanstack-ai-memory-redis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tanstack-ai-memory-redis
Source: https://github.com/TanStack/ai/tree/main/packages/ai-memory/skills/tanstack-ai-memory-redis
Command: npx skills add https://github.com/TanStack/ai --skill tanstack-ai-memory-redis

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @tanstack/ai-memory, ioredis, redis.

What problem does it solve?

It provides a production-ready way to persist and retrieve conversational memory for TanStack AI agents using a plain Redis instance, without requiring a vector database or dedicated index infrastructure.

Core Features & Use Cases

  • Flexible Client Setup: Connect with ioredis directly or wrap a node-redis v4+ client using the fromNodeRedis helper.
  • Scoped Storage Model: Records are indexed by tenantId, userId, and threadId with escaped scope values, keeping multi-tenant memory cleanly separated.
  • Client-Side Ranking: Recall scores records with lexical matching, optional cosine similarity, recency, and importance signals, configurable via topK, minScore, kinds, and embedder options.
  • Use Case: A support chatbot serving multiple customers can store per-thread memories in Redis and recall the most relevant facts at the start of each conversation using memoryMiddleware.

Quick Start

Set up the Redis memory adapter by passing an ioredis client to redis() from @tanstack/ai-memory/redis and wiring it into memoryMiddleware with your scope.

Frequently Asked Questions about tanstack-ai-memory-redis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Redis memory for TanStack AI?

Create a Redis client with ioredis, pass it to redis() from @tanstack/ai-memory/redis with a key prefix, then wire the adapter into memoryMiddleware with your scope. For node-redis v4+, wrap the client with fromNodeRedis first.

ioredis vs node-redis for TanStack AI memory adapter?

ioredis works directly with the redis() adapter since it exposes the lowercase RedisLike API. node-redis v4+ uses camelCase methods like sAdd, so it must be wrapped with fromNodeRedis or you get a client.sadd is not a function error.

Does the Redis memory adapter require a vector index?

No, the adapter works with plain Redis and no vector index. Ranking happens client-side using lexical matching, optional cosine similarity via an embedder, recency, and importance signals.

Why are my memory records not visible across processes?

Records are invisible across processes when each process uses a different REDIS_URL or key prefix. Ensure every process connects to the same Redis instance and passes the identical prefix option to redis().

What are the scaling limits of client-side memory ranking?

Client-side ranking loads every record for a scope into Node.js and scores it, which works well up to roughly 10k records per scope. Beyond that, write a vector-index-aware adapter against the same recall and save contract.

What happens to malformed JSON records in Redis memory?

A record whose JSON fails to parse is skipped during recall and left in place, never deleted automatically. The adapter emits a one-time console.warn per bad id, and you must fix or delete the offending record key manually.