tanstack-ai-memory-hindsight

A memory adapter that connects TanStack AI to Hindsight, a hosted service that stores and retrieves information for conversations. It also lets the model retain, recall, and reflect on memories through tools.

In plain words
What is it for?
Adding per-user and per-thread memory to an AI application, including saving, recalling, and reflecting on past conversation information.
Why use it?
It lets conversations reuse relevant information across turns and separates memory storage and ranking from the application.

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-hindsight
Any agent
npx skills add TanStack/ai --skill tanstack-ai-memory-hindsight
Clone the repo
git clone --depth 1 https://github.com/TanStack/ai

Made for: Claude Code, Codex.

Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 445 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.00057 $0.00445
Opus 5 $0.00028 $0.00222
Sonnet 5 $0.00011 $0.00089
Haiku 4.5 $0.00006 $0.00044

Measured 2d ago against content hash 120db339ad5a, 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-hindsight 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 2d ago.

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-hindsight/SKILL.md · 41 lines

What it actually says

Hindsight Memory Adapter

Hosted recall/save adapter backed by Hindsight. Hindsight owns extraction and ranking server-side, buckets memory into per-conversation "banks" ({tenantId|_}__{user}__{threadId}), and — uniquely — exposes LLM tools through recall so the model can retain/recall/reflect directly.

Setup

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

const memory = hindsight({ user: currentUserId }) // baseUrl defaults to HINDSIGHT_URL

memoryMiddleware({ adapter: memory, scope })

@vectorize-io/hindsight-client is an optional peer dependency, loaded lazily on first use — install it where you use hindsight().

Options

  • user — durable user id for the bank key (falls back to scope.userId).
  • baseUrl — Hindsight server URL (default HINDSIGHT_URL or http://localhost:8888).
  • budget — recall budget: 'low' | 'mid' | 'high' (default 'mid').
  • onToolRetain / onToolRecall — callbacks fired when the model uses the memory tools.

Scope fields: bank id is {tenantId|_}__{user}__{threadId}. namespace is ignored.

Tools

recall returns hindsight_retain, hindsight_recall, and hindsight_reflect in its tools plus a toolGuidance block. memoryMiddleware merges them into the run so the model can manage long-term memory itself.

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. 2d ago First seen · 41 lines · 57 tokens per session scan A 120db339ad5a

Subscribe to this mod's changes

tanstack-ai-memory-hindsight is a skill published in the GitHub repository TanStack/ai (3,056 stars, last pushed today), licensed MIT. It adds 57 tokens to every session and 445 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.