Speck.js: AI Agents with Persistent Memory in One Line of Code
Source: Dev.to
Introduction
Adding AI to web apps typically requires a lot of boilerplate: state for messages, loading states, error handling, API calls, stream management, history tracking, and more. Speck.js eliminates all of that.
The snippet above renders a complete chat interface with streaming responses, conversation history, and error handling—without any state management, useEffect, or boilerplate code.
Features
Persistent Memory (v0.4.1)
Speck.js introduces built‑in persistent memory, allowing agents to remember conversations across browser sessions, page refreshes, and even system reboots.
- Session IDs are stored in
localStorage. - Conversations are saved to a local SQLite database via libSQL.
- The last 100 interactions are automatically loaded into context.
- Each agent maintains isolated memory through the
idprop.
Automatic Component Discovery
Speck.js components auto‑discover each other, removing the need for manual imports.
The compiler resolves dependencies automatically.
Getting Started
npm create speck-app@latest my-app
cd my-app
npm run dev
- Add your Anthropic API key to the
.envfile. - Start building AI‑native applications immediately.
Tooling Support
- VS Code Extension – Syntax highlighting and IntelliSense for
.speckfiles. - Hot Reload – Instant compilation on save.
- Built‑in Dev Server – API proxy included for seamless Claude integration.
Website:
npm package: create-speck-app (npm i -g create-speck-app)
Documentation:
Roadmap
- Semantic memory recall via vector search.
- Multi‑agent coordination.
- Additional agent types beyond chat.
Feedback welcome – what features would be most valuable to you?