Back to Recipes

Agent Memory with Squish

Give your AI agents persistent, searchable memory across sessions using the Squish memory system.

Best for: Developers building AI agents that need to remember context

What You Get

  • -Squish MCP server setup
  • -Memory write/read integration
  • -Cross-session context retention
  • -Semantic memory search
  • -Memory consolidation strategy

Step by Step

1. Install and configure Squish MCP server

Follow docs at squishplugin.dev to install the Squish MCP server. Configure it with your project path. Test basic operations: remember, recall, search, and context via MCP inspector.

2. Create the memory toolkit for your agent

Give your agent access to Squish tools: squish_remember (store facts, decisions, observations), squish_recall (retrieve specific memory by ID), squish_search (semantic search across memories). Define clear guidelines for what to remember.

3. Implement auto-context loading

On agent startup, call squish_context to load relevant project context. Pass the agent's task description and user identity to filter relevant memories. Set a max context limit (e.g., top 10 memories).

4. Add memory consolidation

Implement a scheduled job (weekly) that: identifies low-confidence memories (confidence < 30), identifies memories older than 30 days with < 5 accesses, archives them using squish_forget or tier=cold, logs consolidation stats.

5. Build the memory inspector UI

Create a simple Next.js page that displays: total memory count by type, recent memories, search interface, memory detail view (content, type, confidence, created_at, access_count), and pin/unpin controls.

6. Add logging and monitoring

Log every memory operation: write, read, search result count, consolidation actions. Monitor: total memory size, API call frequency, average recall relevance score.

Stack

Squish (memory MCP)OpenAI/ClaudeNode.js/TypeScriptSQLiteMCP protocol

Build This

Copy this prompt and paste it into Claude Code, OpenCode, Codex, or Cursor to build this recipe.

Build me an agent memory system using Squish. It should: 1) Set up the Squish MCP server (follow the Squish docs at squishplugin.dev). 2) Give the agent tools to remember facts, decisions, and observations with squish_remember. 3) Give the agent tools to recall relevant memories with squish_search and squish_recall. 4) When the agent starts a new session, load relevant context automatically using squish_context. 5) Implement a memory consolidation strategy: archive old/low-confidence memories after 30 days. 6) Log memory operations for debugging. 7) Include a simple UI to inspect what the agent remembers.

Common Failure Modes

  • !Memory context gets too large and expensive
  • !Retrieval returns irrelevant memories
  • !Memory conflicts from contradictory information
  • !SQLite lock contention at scale

Implementation Notes

Pin critical memories (API keys, user preferences) to prevent consolidation. Monitor memory storage size. Tune search parameters per use case.

Want agent memory with squish running in your business?

4M Labs can deploy agent memory with squish as a production workflow:

  • Connected to your tools and data sources
  • Secured for your team with proper access controls
  • Deployed with monitoring and error handling
  • Documented for handoff and future maintenance
Book an Implementation Sprint