DEV Community

Peter Pagano@SpeckOs
Peter Pagano@SpeckOs

Posted on

Speck.js: AI Agents with Persistent Memory in One Line of Code

Adding AI to web apps typically requires 50+ lines of boilerplate. State for messages, loading states, error handling, API calls, stream management, history tracking — the list goes on.

Speck.js eliminates all of that.

One Line. Full AI Chat.

<Agent.Chat purpose="You are a helpful assistant" />
Enter fullscreen mode Exit fullscreen mode

That's a complete chat interface with streaming responses, conversation history, and error handling. No state management. No useEffect. No boilerplate.

Persistent Memory — A Framework First

Speck.js v0.4.1 introduces something no other framework offers: built-in persistent memory.

<Agent.Chat 
  id="support-bot"
  purpose="You are a helpful assistant"
  memory={true}
/>
Enter fullscreen mode Exit fullscreen mode

With memory={true}, agents remember conversations across browser sessions. Page refreshes, browser restarts, even system reboots — the memory persists. No external database configuration required.

How Memory Works

  • Session IDs stored in localStorage
  • Conversations saved to local SQLite via libSQL
  • Last 100 interactions automatically loaded into context
  • Each agent maintains isolated memory via the id prop

Zero Imports

Speck.js components auto-discover each other:

<App>
  <Header />
  <ChatBot />
  <Footer />
</App>
Enter fullscreen mode Exit fullscreen mode

No import statements. The compiler resolves dependencies automatically.

Getting Started

npm create speck-app@latest my-app
cd my-app
npm run dev
Enter fullscreen mode Exit fullscreen mode

Add an Anthropic API key to .env and start building AI-native applications immediately.

Developer Tools

Speck.js includes full tooling support:

  • 🧩 VS Code Extension — Syntax highlighting and IntelliSense for .speck files
  • Hot Reload — Instant compilation on save
  • 🛠️ Built-in Dev Server — API proxy included for seamless Claude integration

Links

On the Roadmap

  • Semantic memory recall via vector search
  • Multi-agent coordination
  • Additional agent types beyond chat

Feedback welcome. What features would be most valuable?

Top comments (0)