tanstack-ai-memory-hindsight

Configures the Hindsight hosted memory adapter for per-conversation recall and retain tools.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @tanstack/ai-memory, @vectorize-io/hindsight-client.

What problem does it solve?

Wiring long-term memory into a TanStack AI agent requires choosing an adapter, scoping memory correctly per user and thread, and exposing memory operations to the model. This Skill guides the setup of the Hindsight hosted adapter so memory is bucketed per conversation and the model can retain, recall, and reflect on its own.

Core Features & Use Cases

  • Hosted memory adapter: Connects memoryMiddleware to a Hindsight server that owns extraction and ranking server-side, bucketing memory into per-conversation banks keyed as {tenantId|_}__{user}__{threadId}.
  • Model-facing memory tools: Exposes hindsight_retain, hindsight_recall, and hindsight_reflect tools through recall, letting the model manage long-term memory directly during a run.
  • Configurable recall: Supports a budget option (low, mid, high) and onToolRetain/onToolRecall callbacks to observe the model's memory operations.
  • Use Case: Add persistent memory to a multi-user chat app so each user's conversation thread recalls prior context automatically, with the model deciding what to retain.

Quick Start

Set up the Hindsight memory adapter by calling hindsight with the current user id and passing it to memoryMiddleware with my scope.

Frequently Asked Questions about tanstack-ai-memory-hindsight

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

FAQPage Schema
How do I add long-term memory to a TanStack AI agent?

Create the adapter with hindsight({ user }) from @tanstack/ai-memory/hindsight and pass it to memoryMiddleware({ adapter, scope }). The Hindsight server handles extraction and ranking, and the model gains retain, recall, and reflect tools.

How does Hindsight scope memory per conversation?

Hindsight buckets memory into banks keyed as {tenantId|_}__{user}__{threadId}, derived from the scope passed to memoryMiddleware. The namespace scope field is ignored by this adapter.

Does the Hindsight adapter require extra dependencies?

Yes, @vectorize-io/hindsight-client is an optional peer dependency loaded lazily on first use. Install it wherever you call hindsight(), and set the server URL via the baseUrl option or the HINDSIGHT_URL environment variable.

Can the model manage its own memory with Hindsight?

Yes, recall returns hindsight_retain, hindsight_recall, and hindsight_reflect tools plus toolGuidance, which memoryMiddleware merges into the run. You can observe usage with the onToolRetain and onToolRecall callbacks.

How do I control Hindsight recall budget?

Pass the budget option to hindsight() with 'low', 'mid', or 'high'; the default is 'mid'. This tunes how much memory the recall operation returns to the model.