Agent SkillsTanStack/ai › tanstack-ai-memory-in-memory

tanstack-ai-memory-in-memory

GitHub

基于 Map 的零依赖内存适配器,适用于本地开发、测试及单进程演示。数据随进程重启丢失,不支持多进程或持久化场景。支持 topK、embedder 等配置,容量建议不超过十万条记录。

packages/ai-memory/skills/tanstack-ai-memory-in-memory/SKILL.md TanStack/ai

Trigger Scenarios

需要在本地开发环境进行快速原型验证 编写 Vitest 或 Playwright 单元测试 运行不需要持久化存储的单进程演示程序

Install

npx skills add TanStack/ai --skill tanstack-ai-memory-in-memory -g -y
More Options

Non-standard path

npx skills add https://github.com/TanStack/ai/tree/main/packages/ai-memory/skills/tanstack-ai-memory-in-memory -g -y

Use without installing

npx skills use TanStack/ai@tanstack-ai-memory-in-memory

指定 Agent (Claude Code)

npx skills add TanStack/ai --skill tanstack-ai-memory-in-memory -a claude-code -g -y

安装 repo 全部 skill

npx skills add TanStack/ai --all -g -y

预览 repo 内 skill

npx skills add TanStack/ai --list

SKILL.md

Frontmatter
{
    "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)."
}

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

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

const memory = inMemory()

memoryMiddleware({ adapter: memory, scope })

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.

Version History

  • 05280a5 Current 2026-07-30 23:52

Same Skill Collection

.claude/skills/gap-analysis/SKILL.md
packages/ai-code-mode/skills/ai-code-mode/SKILL.md
packages/ai-mcp/skills/ai-mcp/SKILL.md
packages/ai-memory/skills/tanstack-ai-memory-hindsight/SKILL.md
packages/ai-memory/skills/tanstack-ai-memory-honcho/SKILL.md
packages/ai-memory/skills/tanstack-ai-memory-mem0/SKILL.md
packages/ai-memory/skills/tanstack-ai-memory-redis/SKILL.md
packages/ai-memory/skills/tanstack-ai-memory/SKILL.md
packages/ai-persistence/skills/ai-persistence/build-cloudflare-adapter/SKILL.md
packages/ai-persistence/skills/ai-persistence/build-cloudflare-artifact-store/SKILL.md
packages/ai-persistence/skills/ai-persistence/build-custom-adapter/SKILL.md
packages/ai-persistence/skills/ai-persistence/build-drizzle-adapter/SKILL.md
packages/ai-persistence/skills/ai-persistence/build-prisma-adapter/SKILL.md
packages/ai-persistence/skills/ai-persistence/server/SKILL.md
packages/ai-persistence/skills/ai-persistence/SKILL.md
packages/ai-persistence/skills/ai-persistence/stores/SKILL.md
packages/ai/skills/ai-core/ag-ui-protocol/SKILL.md
packages/ai/skills/ai-core/chat-experience/SKILL.md
packages/ai/skills/ai-core/custom-backend-integration/SKILL.md
packages/ai/skills/ai-core/debug-logging/SKILL.md
packages/ai/skills/ai-core/locks/SKILL.md
packages/ai/skills/ai-core/middleware/SKILL.md
packages/ai/skills/ai-core/SKILL.md
packages/ai/skills/ai-core/tool-calling/SKILL.md
.claude/skills/triage-github/SKILL.md
packages/ai-sandbox/skills/ai-sandbox/SKILL.md
packages/ai/skills/ai-core/adapter-configuration/SKILL.md
packages/ai/skills/ai-core/client-persistence/SKILL.md
packages/ai/skills/ai-core/media-generation/SKILL.md
packages/ai/skills/ai-core/structured-outputs/SKILL.md

Metadata

Files
0
Version
1cb04d5
Hash
15645031
Indexed
2026-07-30 23:52

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-01 11:32
浙ICP备14020137号-1 $bản đồ khách truy cập$