Agents & OrchestrationSûr100100/100

Tanstack IA Memory In Memory (TanStack)

Use when wiring inMemory() from @tanstack/ai-memory/in-memory — explains setup, options (embedder, extract, topK/minScore), when to pick it (dev/tests/single-process demos), and what NOT to use it for (multi-process or persistent).

ou envoie-le directement à ton agent.

Installer dans ton projet

$ curl -fsSL https://arboristhree.xyz/cli/install-skill.mjs -o /tmp/arboris-install-skill.mjs && node /tmp/arboris-install-skill.mjs tanstack-ai-memory-in-memory__tanstack-ai__packages-ai-memory-skills-2d9142cb0904
TanStack
TanStack/ai
Contenu à copier
---
name: tanstack-ai-memory-in-memory
description: Use when wiring inMemory() from @tanstack/ai-memory/in-memory — explains setup, options (embedder, extract, topK/minScore), when to pick it (dev/tests/single-process demos), and what NOT to use it for (multi-process or persistent).
metadata:
  origin: TanStack
---

# In-Memory Memory Adapter

Zero-dependency `recall`/`save` adapter backed by a `Map`. Records vanish on process
restart.

## When to use it

- Local development.
- Vitest / Playwright tests.
- Single-process demos where users don't need persistence.

## When NOT to use it

- Production multi-process deployments — every worker has its own `Map`; users get
  inconsistent memory.
- Anything that needs survival across restarts.

For production, use `redis()` (see the `tanstack-ai-memory-redis` skill).

## Setup

```ts
import { memoryMiddleware } from '@tanstack/ai-memory'
import { inMemory } from '@tanstack/ai-memory/in-memory'

const memory = inMemory()

// A static scope is fine for dev/tests; derive it from the session in real apps.
memoryMiddleware({
  adapter: memory,
  scope: { threadId: 'demo-thread', userId: 'alice' },
})
```

## Options

`inMemory(options?)` accepts:

- `topK` (default 6), `minScore` (default 0.15), `kinds` — recall tuning.
- `embedder: { embed(text): Promise<number[]> }` — enable semantic scoring (both
  `recall` and `save` embed through it).
- `extract(turn, scope)` — return derived facts to persist alongside the raw turn
  (e.g. call an LLM to pull out preferences). Without it, `save` stores the raw
  user/assistant messages and `recall` scores them lexically + by recency.
- `render(hits)` — replace the built-in prompt renderer.

## Capacity

The adapter scans every record in a scope per `recall`. Fine up to ~100k records; beyond
that, switch to Redis.
Colle ce Markdown dans ton agent ou utilise les boutons ci-dessus pour l’écrire dans ton projet.

Ce que fait Tanstack IA Memory In Memory (TanStack)

Local development.
Vitest / Playwright tests.
Single-process demos where users don't need persistence.
Production multi-process deployments — every worker has its own `Map`; users get

Comment utiliser Tanstack IA Memory In Memory (TanStack)

1
Copie le prompt
Un clic copie le prompt packagé (ou l'envoie à ton agent).
2
L'agent installe le skill
Il ajoute le SKILL.md et ses ressources à ton projet.
3
Activation automatique
Le skill s'active dès que le contexte correspond.

Déclencheurs pour Tanstack IA Memory In Memory (TanStack)

Dis simplement à ton agent quelque chose comme :

Applique le skill tanstack-ai-memory-in-memory__tanstack-ai__packages-ai-memory-skills-2d9142cb0904 à cette tâche
Utilise tanstack-ai-memory-in-memory__tanstack-ai__packages-ai-memory-skills-2d9142cb0904 pour améliorer cette implémentation
Passe en revue ce sujet avec tanstack-ai-memory-in-memory__tanstack-ai__packages-ai-memory-skills-2d9142cb0904

Skills liés à Tanstack IA Memory In Memory (TanStack)