@tanstack/ai-code-mode-snippets has 163 recorded weekly downloads on npm, a decrease of 91.6% over the past 30 days.
It ranks #1620 of 2,251 tracked npm listings by weekly downloads.
PluginStats has 121 daily observations since Jun 19, 2026; the latest is from Oct 17, 2026.
About @tanstack/ai-code-mode-snippets
@tanstack/ai-code-mode-snippets
Persistent snippet library for TanStack AI Code Mode - LLM-created reusable code snippets.
Overview
The Snippets System extends Code Mode with persistent, LLM-creatable reusable code snippets. Snippets are TypeScript functions that the LLM can create, catalog, and invoke across sessions—enabling compounding capability over time.
Installation
Usage
Testing
This package includes a CLI for testing the snippets system. The tests verify the complete snippets lifecycle:
1. First run (Snippet Creation): LLM uses execute_typescript to solve a problem and registers a reusable snippet 2. Second run (Snippet Reuse): LLM calls the saved snippet directly without needing execute_typescript
Running the Simulated Test
The simulated test uses a mock adapter with predetermined responses for fully deterministic testing. No API key required.
Running the Live Test
The live test uses a real LLM (OpenAI or Anthropic) to verify the snippets flow with actual LLM responses.
Setup
1. Copy the environment example file:
2. Edit test-cli/.env.local and add your API key:
Run the test
CLI Commands
API Reference
codeModeWithSnippets(options)
Creates Code Mode tools and system prompt with snippets integration.
Options:
• config - Code Mode tool configuration (driver, tools, timeout, memoryLimit) • adapter - Text adapter for snippet selection (should be a cheap/fast model) • snippets.storage - Snippet storage implementation • snippets.maxSnippetsInContext - Maximum snippets to load into context (default: 5) • messages - Current conversation messages • snippetsAsTools - Whether to include snippets as direct tools (default: true)
Returns:
• toolsRegistry - Mutable ToolRegistry containing execute_typescript, snippet management tools, and selected snippet tools • systemPrompt - System prompt documenting available snippets and external functions • selectedSnippets - Snippets that were selected for this request
Storage
The worker/browser-safe in-memory storage (createMemorySnippetStorage) is re-exported from the root entry. The Node-only file storage (createFileSnippetStorage) imports node:fs / node:path, so it is only available from the /storage subpath — keeping the root export safe to import from Cloudflare Workers and browser bundlers:
createFileSnippetStorage(options)
Git-friendly file-based storage:
createMemorySnippetStorage(options)
In-memory storage for testing.
Trust Strategies
Snippets track execution success and promote trust levels over time:
| Trust Level | Description |
| untrusted | Newly created, not yet proven | | provisional | 10+ executions with ≥90% success | | trusted | 100+ executions with ≥95% success |
Available strategies:
• createDefaultTrustStrategy() - Earn trust through successful executions • createAlwaysTrustedStrategy() - Trust immediately (dev/testing) • createRelaxedTrustStrategy() - Faster promotion • createCustomTrustStrategy(options) - Custom thresholds
License
MIT
Description from the npm listing.
- ai
- ai-sdk
- typescript
- tanstack
- code-mode
- snippets
- agents
- llm
- sandbox
- tool-calling
- tanstack-intent
Where @tanstack/ai-code-mode-snippets sits in the listing
Each band is one page of 20. Weekly downloads on a log scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Recent observations
Full history (121)Similar npm AI SDKs plugins
Data source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@tanstack/ai-code-mode-snippets. First seen Oct 16, 2026; last successful collection Oct 18, 2026. See the methodology.