ai-core/client-persistence

Browser chat persistence that saves conversation data for a chat thread in browser storage. It can restore the transcript after a reload and, in supported cases, reconnect to an unfinished response.

In plain words
What is it for?
Saving and restoring chat threads with local storage, session storage, or IndexedDB, including pending interruptions and in-progress responses.
Why use it?
It prevents users from losing chat history or pending work when a page reloads. Different storage choices control whether data lasts for a tab, browser restart, or longer.

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

Made for: Claude Code, Codex.

Per session 141 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,538 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.00141 $0.02538
Opus 5 $0.00071 $0.01269
Sonnet 5 $0.00028 $0.00508
Haiku 4.5 $0.00014 $0.00254

Measured 2d ago against content hash 7c2875bca921, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ai-core/client-persistence 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/skills/ai-core/client-persistence/SKILL.md · 278 lines

How it starts

The opening of the file, as written. The whole thing — 278 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Client Persistence

Builds on ai-core, and on ai-core/chat-experience for useChat itself.

No extra package. The adapters below ship in the framework packages (@tanstack/ai-react and friends, re-exported from @tanstack/ai-client), so browser persistence needs nothing installed beyond what a chat UI already has. The server half is a separate package — see @tanstack/ai-persistence and its ai-persistence/server skill.

A ChatClient / useChat keeps messages in memory. The persistence option stores one record per threadId so a reload can repaint the transcript, restore a pending interrupt, and rejoin an in-flight run.

Import adapters from the framework package (not @tanstack/ai-client unless vanilla JS):

import {
  useChat,
  fetchServerSentEvents,
  localStoragePersistence,
  sessionStoragePersistence,
  indexedDBPersistence,
} from '@tanstack/ai-react'

Adapters

Adapter Survives Notes
localStoragePersistence() Reloads + browser restarts Sync hydrate; quota-bound; JSON codec default
sessionStoragePersistence() Reloads in the same tab Cleared when tab/session ends
indexedDBPersistence() Reloads + restarts Async open (first paint may be empty briefly); structured clone

All default to the chat persisted-state shape — no type argument or codec required for normal use.

Mode A — cache everything (client-authoritative)

function Chat() {
  const { messages, sendMessage } = useChat({
    threadId: 'support-chat', // stable — required
    connection: fetchServerSentEvents('/api/chat'),
    persistence: localStoragePersistence(),
  })
  // ...
}

Bare adapter ≡ full transcript + resume pointer. Browser owns history; server (if any) mirrors when you post non-empty messages.

Read the full file on GitHub · 278 lines

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 · 278 lines · 141 tokens per session scan A 7c2875bca921

Subscribe to this mod's changes

ai-core/client-persistence is a skill published in the GitHub repository TanStack/ai (3,045 stars, last pushed 2d ago), licensed MIT. It adds 141 tokens to every session and 2,538 once invoked, about $0.0007 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.

Related

Other skills, from other repositories

storybook

Storybook is the fidelity oracle, not the runtime. The converter bundles the package's compiled dist/ into dsbundle.js - the same bundle the claude.ai/design agent builds with - and generates each preview by compiling the story source module itself (hooks, fixtures, local helpers - the whole closure comes along), with…

asgeirtj/system_prompts_leaks · 0 tokens

save-as-pdf

Reformat the current HTML design into a paginated, paper-ready PDF. The "Instant" export already gives the user a PDF at the design's native pixel size — this path is for when they want real pages.

asgeirtj/system_prompts_leaks · 9 tokens

tmux

Remote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output.

HKUDS/nanobot · 22 tokens

claude-in-chrome

Automates your Chrome browser to interact with web pages - clicking elements, filling forms, capturing screenshots, reading console logs, and navigating sites. Opens pages in new tabs within your existing Chrome session. Requires site-level permissions before executing (configured in the extension).

asgeirtj/system_prompts_leaks · 57 tokens

verify

Verify that a code change actually does what it's supposed to by exercising it end-to-end and observing behavior — drive the affected flow, not just tests or typecheck. Run before committing nontrivial changes; bootstraps this repo's project verify skill if none exists yet. Don't invoke it on a diff that only touches…

asgeirtj/system_prompts_leaks · 95 tokens

develop-web-game

Use when Codex is building or iterating on a web game (HTML/JS) and needs a reliable development + testing loop: implement small changes, run a Playwright-based test script with short input bursts and intentional pauses, inspect screenshots/text, and review console errors with rendergametotext.

netease-youdao/LobsterAI · 64 tokens