Product Build
AI Agent Memory: How We Built Squish, Open-Source Persistent Memory for AI Coding Agents
Squish is a memory system for AI coding agents, built by 4M Labs and available open-source at squishplugin.dev. AI coding tools create useful context every session: architectural decisions, implementation patterns, lessons learned. But that context vanishes when the session ends, the branch switches, or the task completes. Teams lose that knowledge and hit the same walls again. Squish solves this by giving AI agents durable, searchable project memory that persists across sessions and tools.
Visit AI Developer Tool↗The Problem
Every AI coding assistant has the same blind spot: context dies at the end of a session. A developer spends 30 minutes explaining why a certain pattern was chosen, the session ends, and the next session starts from zero. No tool existed that gave AI agents durable, searchable memory. Ad-hoc solutions (paste context into a file, hope the AI reads it) were fragile and did not survive refactors or branch switches. The problem wasn't that AI couldn't remember. Nothing existed to make it remember. Without a fix, teams would keep paying the re-discovery tax on every task.
What We Built
We built a SQLite-backed memory runtime with seven structured tools: squish_search for discovering relevant memories, squish_remember for storing new ones, squish_recall for retrieving specific knowledge, squish_learn for capturing success and failure patterns, squish_context for loading project-relevant memories into a session, squish_stats for monitoring system health, and squish_inspect for debugging why a memory was retained or routed. The architecture supports memory consolidation, pinning, linking, and staleness detection, so memory stays useful instead of rotting into noise. We integrated it as an MCP server so it works with any AI coding agent, not just a specific tool. Technical teams get memory that persists across sessions, branch switches, and handoffs.
Technical Architecture
SQLite backend for zero-config deployment and reliable embedded storage. TypeScript throughout for type safety across 7 API tools. MCP Server protocol for broad AI agent compatibility. Memory consolidation engine with dedup, staleness detection, and importance scoring. Structured memory types: observation, fact, decision, context, preference, note.
Key Technical Decisions
SQLite over Postgres for zero-config local-first deployment
MCP Protocol for vendor-agnostic AI agent integration
7-tool API surface covering search, store, recall, learn, context, stats, inspect
Memory consolidation to prevent knowledge decay
Open-source strategy for community adoption and vetting
Before & After
Before
Every AI session starts from zero, context lost between sessions, no persistent project knowledge
After
Durable memory across sessions, searchable project knowledge, automatic consolidation and staleness detection
Deliverables
The Results
Squish is live at squishplugin.dev. Open source. It is used internally across 4M Labs projects and available to the broader AI developer community. Teams no longer lose context between sessions. Memory sticks around and stays searchable. SQLite handles storage. MCP Protocol connects to any agent.
"Every AI session used to start from zero. Now decisions and patterns stick around."
— AI Developer Tool
Frequently Asked Questions
What is AI agent memory and why do AI agents need it?+
AI agent memory is a persistent storage layer that lets AI agents retain context across sessions. Without it, every new conversation starts from zero — agents forget user preferences, project architecture, past decisions, and learned patterns. Memory systems like Squish solve this by providing structured, searchable storage that agents can read from and write to during interactions.
How does Squish differ from using a vector database for AI memory?+
Vector databases provide semantic search but lack structured memory management. They store embeddings without understanding what type of memory it is (fact vs. decision vs. preference), how important it is, or when it became stale. Squish categorizes memories into 6 types, scores importance, runs consolidation (dedup, prune, summarize), and provides lifecycle tools (learn, context, stats) that vector stores do not.
What is MCP and how does Squish use it for AI agent integration?+
MCP (Model Context Protocol) is a standardized JSON-RPC interface for connecting AI models to tools and data sources. Squish implements MCP so it works with any compatible agent (Claude, Cursor, OpenCode, and others) out of the box. No framework-specific adapters needed — if your agent speaks MCP, it can use Squish's 7 memory tools immediately.
Can I use Squish for AI agents outside of coding?+
Yes. While Squish was built for coding agents, its memory architecture works for any AI agent that needs persistent context: customer support bots, sales agents, research assistants, or personal productivity tools. The 7-tool API (search, remember, recall, learn, context, stats, consolidate) is domain-agnostic. The SQLite backend means it runs anywhere without external dependencies.
Related Services
Build AI Agents That Remember
We build AI agents with persistent memory, tool use, and production-grade reliability. Talk to our team about your AI project.
Start a project→