What problem does it solve?
@tanstack/ai-persistence ships contracts, not a database backend, so developers must implement the store interfaces themselves against their own database. This Skill defines the exact contracts, invariants, and conformance requirements needed to build a correct persistence adapter without subtle bugs like wiped histories or stuck approvals.
Core Features & Use Cases
- Store Contract Reference: Defines MessageStore (full-replace saveThread), RunStore (idempotent createOrResume, required findActiveRun), InterruptStore (insert-if-absent create), and MetadataStore (composite namespace/key identity).
- Composition & Shapes: Covers defineAIPersistence, named persistence shapes, and composePersistence overrides for mixing stores across backends.
- Conformance Testing: Explains runPersistenceConformance with skip and skipMethods declarations so omitted optional methods fail loudly instead of passing silently.
- Use Case: You are wiring TanStack AI chat persistence to Postgres and need to implement a RunStore that safely handles double-submits, reconnects via findActiveRun, and out-of-band cancellation via cancelRequested.
Quick Start
Ask the AI to implement a MessageStore and RunStore for your database following the ai-persistence store contracts and validate them with runPersistenceConformance.