Skip to main content
Glama

Recall

Long-term memory system for MCP-compatible AI assistants with semantic search and relationship tracking.

Features

  • Persistent Memory Storage: Store preferences, decisions, patterns, and session context

  • Semantic Search: Find relevant memories using natural language queries via ChromaDB vectors

  • MLX Hybrid Embeddings: Native Apple Silicon support via MLX for ~5-10x faster embeddings (automatic fallback to Ollama)

  • Memory Relationships: Create edges between memories (supersedes, relates_to, caused_by, contradicts)

  • Namespace Isolation: Global memories vs project-scoped memories

  • Context Generation: Auto-format memories for session context injection

  • Deduplication: Content-hash based duplicate detection

Installation

# Clone the repository
git clone https://github.com/yourorg/recall.git
cd recall

# Install with uv
uv sync

# On Apple Silicon: MLX embeddings work automatically (fastest option)
# On other platforms or as fallback: ensure Ollama is running
ollama pull mxbai-embed-large  # Required if not using MLX
ollama pull llama3.2           # Optional: session summarization for auto-capture hook
ollama serve

Usage

Run as MCP Server

uv run python -m recall

CLI Options

uv run python -m recall --help

Options:
  --sqlite-path PATH      SQLite database path (default: ~/.recall/recall.db)
  --chroma-path PATH      ChromaDB storage path (default: ~/.recall/chroma_db)
  --collection NAME       ChromaDB collection name (default: memories)
  --ollama-host HOST      Ollama server URL (default: http://localhost:11434)
  --ollama-model MODEL    Embedding model (default: mxbai-embed-large)
  --ollama-timeout SECS   Request timeout (default: 30)
  --log-level LEVEL       DEBUG, INFO, WARNING, ERROR, CRITICAL (default: INFO)

meta-mcp Configuration

Add Recall to your meta-mcp servers.json:

{
  "recall": {
    "command": "uv",
    "args": [
      "run",
      "--directory",
      "/path/to/recall",
      "python",
      "-m",
      "recall"
    ],
    "env": {
      "RECALL_LOG_LEVEL": "INFO",
      "RECALL_OLLAMA_HOST": "http://localhost:11434",
      "RECALL_OLLAMA_MODEL": "mxbai-embed-large"
    },
    "description": "Long-term memory system with semantic search",
    "tags": ["memory", "context", "semantic-search"]
  }
}

Or for Claude Code / other MCP clients (claude.json):

{
  "mcpServers": {
    "recall": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/path/to/recall",
        "python",
        "-m",
        "recall"
      ],
      "env": {
        "RECALL_LOG_LEVEL": "INFO"
      }
    }
  }
}

Environment Variables

Variable

Default

Description

RECALL_SQLITE_PATH

~/.recall/recall.db

SQLite database file path

RECALL_CHROMA_PATH

~/.recall/chroma_db

ChromaDB persistent storage directory

RECALL_COLLECTION_NAME

memories

ChromaDB collection name

RECALL_EMBEDDING_BACKEND

ollama

Embedding backend: mlx (Apple Silicon) or ollama

RECALL_MLX_MODEL

mlx-community/mxbai-embed-large-v1

MLX embedding model identifier

RECALL_OLLAMA_HOST

http://localhost:11434

Ollama server URL

RECALL_OLLAMA_MODEL

mxbai-embed-large

Ollama embedding model name

RECALL_OLLAMA_TIMEOUT

30

Ollama request timeout in seconds

RECALL_LOG_LEVEL

INFO

Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)

RECALL_DEFAULT_NAMESPACE

global

Default namespace for memories

RECALL_DEFAULT_IMPORTANCE

0.5

Default importance score (0.0-1.0)

RECALL_DEFAULT_TOKEN_BUDGET

4000

Default token budget for context

MCP Tool Examples

memory_store_tool

Store a new memory with semantic indexing. Uses fast daemon path when available (<10ms), falls back to sync embedding otherwise.

{
  "content": "User prefers dark mode in all applications",
  "memory_type": "preference",
  "namespace": "global",
  "importance": 0.8,
  "metadata": {"source": "explicit_request"}
}

Response (fast path via daemon):

{
  "success": true,
  "queued": true,
  "queue_id": 42,
  "namespace": "global"
}

Response (sync path fallback):

{
  "success": true,
  "queued": false,
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "content_hash": "a1b2c3d4e5f67890"
}

daemon_status_tool

Check if the recall daemon is running:

{}

Response:

{
  "running": true,
  "status": {
    "pid": 12345,
    "store_queue": {"pending_count": 5},
    "embed_worker_running": true
  }
}

memory_recall_tool

Search memories by semantic similarity:

{
  "query": "user interface preferences",
  "n_results": 5,
  "namespace": "global",
  "memory_type": "preference",
  "min_importance": 0.5,
  "include_related": true
}

Response:

{
  "success": true,
  "memories": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "content": "User prefers dark mode in all applications",
      "type": "preference",
      "namespace": "global",
      "importance": 0.8,
      "created_at": "2024-01-15T10:30:00",
      "accessed_at": "2024-01-15T14:22:00",
      "access_count": 3
    }
  ],
  "total": 1,
  "score": 0.92
}

memory_relate_tool

Create a relationship between memories:

{
  "source_id": "mem_new_123",
  "target_id": "mem_old_456",
  "relation": "supersedes",
  "weight": 1.0
}

Response:

{
  "success": true,
  "edge_id": 42
}

memory_context_tool

Generate formatted context for session injection:

{
  "query": "coding style preferences",
  "project": "myproject",
  "token_budget": 4000
}

Response:

{
  "success": true,
  "context": "# Memory Context\n\n## Preferences\n\n- User prefers dark mode [global]\n- Use 2-space indentation [project:myproject]\n\n## Recent Decisions\n\n- Decided to use FastAPI for the backend [project:myproject]\n",
  "token_estimate": 125
}

memory_forget_tool

Delete memories by ID or semantic search:

{
  "memory_id": "550e8400-e29b-41d4-a716-446655440000",
  "confirm": true
}

Or delete by search:

{
  "query": "outdated preferences",
  "namespace": "project:oldproject",
  "n_results": 10,
  "confirm": true
}

Response:

{
  "success": true,
  "deleted_ids": ["550e8400-e29b-41d4-a716-446655440000"],
  "deleted_count": 1
}

Architecture

┌─────────────────────────────────────────────────────────────┐
│                     MCP Server (FastMCP)                     │
│  memory_store │ memory_recall │ memory_relate │ memory_forget │
└───────────────────────────┬─────────────────────────────────┘
                            │
              ┌─────────────┴─────────────┐
              │                           │
    ┌─────────▼─────────┐       ┌─────────▼─────────┐
    │   FAST PATH       │       │   SYNC PATH       │
    │   <10ms           │       │   MLX: <100ms     │
    └─────────┬─────────┘       │   Ollama: 10-60s  │
              │                 └─────────┬─────────┘
    ┌─────────▼─────────┐                 │
    │  recall-daemon    │       ┌─────────▼─────────┐
    │  (Unix socket)    │       │   HybridStore     │
    │                   │       └─────────┬─────────┘
    │  ┌─────────────┐  │                 │
    │  │ StoreQueue  │  │     ┌───────────┼───────────┐
    │  │ EmbedWorker │  │     │           │           │
    │  └─────────────┘  │     │           │           │
    └─────────┬─────────┘   ┌─▼─────┐ ┌───▼───┐ ┌─────▼─────┐
              │             │SQLite │ │Chroma │ │ Embedding │
              └─────────────►Store  │ │ Store │ │  Factory  │
                            └───────┘ └───────┘ └─────┬─────┘
                                                      │
                                          ┌───────────┴───────────┐
                                          │                       │
                                    ┌─────▼─────┐           ┌─────▼─────┐
                                    │    MLX    │           │  Ollama   │
                                    │  (Apple)  │           │ (Fallback)│
                                    └───────────┘           └───────────┘

The daemon provides fast (<10ms) memory storage by queueing operations and processing embeddings asynchronously. When the daemon is unavailable, the MCP server falls back to synchronous embedding via MLX (~100ms on Apple Silicon) or Ollama (10-60s on other platforms).

Daemon Setup (macOS)

The recall daemon provides fast (<10ms) memory storage by processing embeddings asynchronously. Without the daemon, each store operation blocks for 10-60 seconds waiting for Ollama embeddings.

Quick Install

# From the recall directory
./hooks/install-daemon.sh

This will:

  1. Copy hook scripts to ~/.claude/hooks/

  2. Install the launchd plist to ~/Library/LaunchAgents/

  3. Start the daemon automatically

Manual Install

# 1. Copy hook scripts
cp hooks/recall*.py ~/.claude/hooks/
chmod +x ~/.claude/hooks/recall*.py

# 2. Create logs directory
mkdir -p ~/.claude/hooks/logs

# 3. Install plist with path substitution
sed "s|{{HOME}}|$HOME|g; s|{{RECALL_DIR}}|$(pwd)|g" \
  hooks/com.recall.daemon.plist.template > ~/Library/LaunchAgents/com.recall.daemon.plist

# 4. Load the daemon
launchctl load ~/Library/LaunchAgents/com.recall.daemon.plist

Daemon Commands

# Check status
echo '{"cmd": "status"}' | nc -U /tmp/recall-daemon.sock | jq

# Stop daemon
launchctl unload ~/Library/LaunchAgents/com.recall.daemon.plist

# Start daemon
launchctl load ~/Library/LaunchAgents/com.recall.daemon.plist

# View logs
tail -f ~/.claude/hooks/logs/recall-daemon.log

Hooks Configuration

Add recall hooks to your Claude Code settings (~/.claude/settings.json). See hooks/settings.example.json for the full configuration.

Development

# Install dev dependencies
uv sync --dev

# Run tests
uv run pytest tests/

# Run tests with coverage
uv run pytest tests/ --cov=recall --cov-report=html

# Type checking
uv run mypy src/recall

# Run specific integration tests
uv run pytest tests/integration/test_mcp_server.py -v

Requirements

  • Python 3.13+

  • For Apple Silicon (recommended): MLX embeddings work automatically with mlx-embeddings package

  • For other platforms: Ollama with:

    • mxbai-embed-large model (required for semantic search)

    • llama3.2 model (optional, for session auto-capture hook)

  • ~500MB disk space for ChromaDB indices

License

MIT

Available Tools

19 tools
daemon_status_toolA

Check if the recall daemon is running and healthy.

The daemon provides fast (<10ms) memory storage by queueing operations and processing embeddings asynchronously.

Returns: Dictionary with: - running: Boolean indicating if daemon is running - status: Detailed status if running (uptime, queue stats, cache stats) - error: Error message if not running

Inputs: no named parameters. Returns: object

file_activity_addA

Record a file activity event.

Used by PostToolUse hooks to track what files have been accessed.

Args: file_path: Path to the file that was accessed action: Type of action (read, write, edit, multiedit) session_id: Optional session ID for grouping activities project_root: Optional project root directory file_type: Optional file type (e.g., 'python', 'typescript') metadata: Optional additional metadata

Returns: Result dictionary with success status and activity_id

Inputs: file_path (required), action (required), session_id, project_root, +2 more. Returns: object

file_activity_recentB

Get recently accessed files with aggregated activity.

Args: project_root: Filter by project root (optional) limit: Maximum number of files to return (default: 20) days: Look back this many days (default: 14)

Returns: Dictionary with success status and list of recent files

Inputs: project_root, limit, days. Returns: object

memory_analyze_healthA

Analyze the health of memories in the system.

Checks for unresolved contradictions, low-confidence memories, and stale memories that haven't been validated recently.

Args: namespace: Limit analysis to specific namespace (optional) include_contradictions: Check for contradictions (default: True) include_low_confidence: Find low-confidence memories (default: True) include_stale: Find stale memories (default: True) stale_days: Days without validation to consider stale (default: 30)

Returns: Dictionary with categorized issues and recommendations

Inputs: namespace, include_contradictions, include_low_confidence, include_stale, +1 more. Returns: object

memory_apply_toolA

Record that a memory is being applied.

Creates a validation event to track when a memory is used in practice. This starts the TRY phase of the validation loop.

Args: memory_id: ID of the memory being applied context: Description of how/where the memory is being applied session_id: Optional session identifier

Returns: Result with event ID or error

Inputs: memory_id (required), context (required), session_id. Returns: object

memory_check_supersedesA

Check if a memory should supersede another based on validation history.

A newer memory supersedes an older one when it consistently succeeds where the older one failed on similar topics.

Args: memory_id: ID of the (potentially newer) memory to check create_edge: Whether to create SUPERSEDES edge (default: True)

Returns: Result with superseded memory ID if applicable

Inputs: memory_id (required), create_edge. Returns: object

memory_context_toolB

Fetch relevant memories and format them for context injection.

Args: query: Optional search query to filter relevant memories project: Project namespace (auto-detected from cwd if not specified) token_budget: Maximum tokens for context (default from RECALL_DEFAULT_TOKEN_BUDGET config)

Returns: Dictionary with success status and formatted markdown context

Inputs: query, project, token_budget. Returns: object

memory_count_toolA

Count memories with optional filters.

Provides a quick count of memories in the system, optionally filtered by namespace and/or memory type.

Args: namespace: Filter by namespace (optional, e.g., 'global' or 'project:myapp') memory_type: Filter by type (optional, e.g., 'preference', 'decision', 'golden_rule')

Returns: Dictionary with count and applied filters

Inputs: namespace, memory_type. Returns: object

memory_detect_contradictionsA

Detect memories that contradict a given memory.

Uses semantic search to find similar memories, then LLM reasoning to determine if they actually contradict each other.

Args: memory_id: ID of the memory to check for contradictions similarity_threshold: Minimum similarity for considering contradictions (default: 0.7) create_edges: Whether to create CONTRADICTS edges (default: True)

Returns: Result with list of contradicting memory IDs and edges created

Inputs: memory_id (required), similarity_threshold, create_edges. Returns: object

memory_edge_forget_toolA

Delete edges (relationships) between memories.

Supports three deletion modes:

  1. Direct ID: Delete a specific edge by its ID

  2. Memory-based: Delete all edges connected to a memory

  3. Pair: Delete edge(s) between two specific memories

Args: edge_id: Specific edge ID to delete (direct deletion mode) memory_id: Memory ID to delete all connected edges (memory-based mode) source_id: Source memory ID for pair deletion mode target_id: Target memory ID for pair deletion mode relation: Filter by relation type (optional). Valid: relates_to, supersedes, caused_by, contradicts direction: For memory_id mode: 'outgoing', 'incoming', or 'both' (default: 'both')

Returns: Result dictionary with: - success: Boolean indicating operation success - deleted_ids: List of edge IDs that were deleted - deleted_count: Number of edges deleted - error: Error message (if failed)

Examples: Delete by edge ID: edge_id=42 Delete all edges for memory: memory_id="mem_123" Delete specific relation: source_id="mem_123", target_id="mem_456", relation="contradicts"

Inputs: edge_id, memory_id, source_id, target_id, +2 more. Returns: object

memory_forget_toolA

Delete memories by ID or semantic search.

Golden rules (type=golden_rule or confidence >= 0.9) are protected from deletion unless force=True is specified.

Args: memory_id: Specific memory ID to delete (direct deletion mode). query: Search query to find memories to delete (search deletion mode). input: Smart parameter that auto-detects if value is an ID or query. namespace: Filter deletion to specific namespace (optional). n_results: Number of search results to delete in query mode (default: 5). confirm: If True, proceed with deletion (default: True). force: If True, allow deletion of golden rules (default: False).

Returns: Result dictionary with success status, deleted_ids, and deleted_count.

Note: If both memory_id and query are None but input is provided, the function auto-detects whether input is a memory ID or search query.

Inputs: memory_id, query, input, namespace, +3 more. Returns: object

memory_inspect_graph_toolA

Inspect the graph structure around a memory node.

Performs read-only breadth-first search from the origin memory, collecting all nodes and edges within max_depth hops. Returns structured data for visualization including Mermaid diagram generation.

Args: memory_id: ID of the memory to start inspection from max_depth: Maximum number of hops to traverse (default: 2) direction: Edge traversal direction - "outgoing", "incoming", or "both" (default: "both") edge_types: Optional list of edge types to include (None means all). Valid types: relates_to, supersedes, caused_by, contradicts include_scores: If True, compute relevance scores for paths (default: True) decay_factor: Factor by which relevance decays per hop (default: 0.7) output_format: Output format - "json" or "mermaid" (default: "json")

Returns: Dictionary with: - success: Boolean indicating operation success - origin_id: The starting memory ID - nodes: List of node dicts with id, content_preview, type, confidence, importance - edges: List of edge dicts with id, source_id, target_id, edge_type, weight - paths: List of path dicts with node_ids, edge_types, total_weight, relevance_score - stats: Dict with node_count, edge_count, max_depth_reached, origin_id - mermaid: Mermaid diagram string (only when output_format='mermaid') - error: Error message (if failed)

Inputs: memory_id (required), max_depth, direction, edge_types, +3 more. Returns: object

memory_list_toolA

List memories with filtering and pagination.

Browse memories in the system with optional filters and pagination. Useful for auditing, exploring, or debugging memory contents.

Args: namespace: Filter by namespace (optional) memory_type: Filter by type (optional) limit: Maximum number of results (default: 100, max: 1000) offset: Number of results to skip for pagination (default: 0) order_by: Field to sort by (default: 'created_at', options: 'created_at', 'accessed_at', 'importance', 'confidence') descending: Sort in descending order (default: True)

Returns: Dictionary with list of memories and pagination info

Inputs: namespace, memory_type, limit, offset, +2 more. Returns: object

memory_outcome_toolA

Record the outcome of a memory application and adjust confidence.

Records whether applying a memory succeeded or failed, creating a validation event and adjusting confidence accordingly.

Args: memory_id: ID of the memory that was applied success: Whether the application was successful error_msg: Optional error message if failed session_id: Optional session identifier

Returns: Result with updated confidence and promotion status

Inputs: memory_id (required), success (required), error_msg, session_id. Returns: object

memory_recall_toolA

Recall memories using semantic search with optional multi-hop graph expansion.

Performs semantic search using ChromaDB vector similarity, applies filters, and optionally expands results via graph edges using configurable multi-hop traversal.

Args: query: Search query text (will be embedded with mxbai query prefix) n_results: Maximum number of primary results (default: 5) namespace: Filter by namespace (optional, e.g., 'global' or 'project:myapp') memory_type: Filter by memory type (optional, e.g., 'preference', 'decision') min_importance: Minimum importance score filter (0.0 to 1.0, optional) include_related: If True, include related memories via graph edges (default: False) max_depth: Maximum number of hops for graph expansion (default: 1) max_expanded: Maximum number of expanded memories to return (default: 20) decay_factor: Factor by which relevance decays per hop (default: 0.7) include_edge_types: Optional list of edge types to include (None means all). Valid types: relates_to, supersedes, caused_by, contradicts exclude_edge_types: Optional list of edge types to exclude (None means none). Valid types: relates_to, supersedes, caused_by, contradicts

Returns: Dictionary with: - success: Boolean indicating operation success - memories: List of primary memory dicts with id, content, type, etc. - total: Total count of primary memories returned - score: Average similarity score of primary memories (or None) - expanded: List of expanded memory dicts (when include_related=True) with: - id: Memory ID - content: Memory content - type: Memory type - relevance_score: Combined relevance score (0.0 to 1.0) - hop_distance: Number of edges traversed to reach this memory - path: List of edge types in traversal order - explanation: Human-readable relevance explanation

Inputs: query (required), n_results, namespace, memory_type, +7 more. Returns: object

memory_relate_toolA

Create a relationship between two memories.

Args: source_id: ID of the source memory target_id: ID of the target memory relation: Type of relationship (relates_to, supersedes, caused_by, contradicts) weight: Edge weight (default: 1.0)

Returns: Result dictionary with success status and edge_id

Inputs: source_id (required), target_id (required), relation (required), weight. Returns: object

memory_store_toolA

Store a new memory with semantic indexing, deduplication, and automatic relationship inference.

FAST PATH: If daemon is running, queues for async embedding (<10ms response). The daemon handles embedding and storage in the background.

Auto-linking behavior:

  • ALWAYS works using embedding similarity (no LLM required)

  • Creates 'relates_to' edges for memories above similarity_threshold

  • If LLM available, upgrades edge types to supersedes/contradicts/caused_by

  • Set auto_link=False to disable automatic edge creation

Args: content: The memory content text memory_type: Type of memory (preference, decision, pattern, session) namespace: Scope of the memory (default from RECALL_DEFAULT_NAMESPACE config) importance: Importance score from 0.0 to 1.0 (default from RECALL_DEFAULT_IMPORTANCE config) metadata: Optional additional metadata as dict auto_link: If True, automatically create edges to similar memories (default: True) similarity_threshold: Minimum similarity for auto-linking, 0.0-1.0 (default: 0.6) max_auto_links: Maximum auto-created edges per memory (default: 5) use_llm_classification: If True, use LLM to refine edge types (default: True)

Returns: Result dictionary with: - success: Boolean indicating operation success - queued: True if queued via daemon (fast path) - queue_id: Queue ID if queued via daemon - id: Memory ID (if sync path used) - content_hash: Content hash for deduplication (sync path only) - auto_relationships: List of automatically inferred relationships (sync path only) - error: Error message (if failed)

Inputs: content (required), memory_type, namespace, importance, +6 more. Returns: object

memory_validate_toolA

Validate a memory and adjust its confidence score.

Adjusts confidence based on whether the memory was useful:

  • Success: confidence += adjustment (max 1.0)

  • Failure: confidence -= adjustment * 1.5 (min 0.0)

Automatically promotes to GOLDEN_RULE when confidence reaches 0.9.

Args: memory_id: ID of the memory to validate success: Whether the memory application was successful adjustment: Base confidence adjustment (default: 0.1)

Returns: Result with old/new confidence, promotion status, or error

Inputs: memory_id (required), success (required), adjustment. Returns: object

validation_history_toolA

Get validation event history for a memory.

Shows the history of validation events (applied, succeeded, failed) for a specific memory. Useful for understanding why a memory has its current confidence score.

Args: memory_id: ID of the memory to get history for event_type: Filter by event type (optional: 'applied', 'succeeded', 'failed') limit: Maximum number of events to return (default: 50)

Returns: Dictionary with validation events and summary statistics

Inputs: memory_id (required), event_type, limit. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 19 tools

    Disambiguation4/5

    Most tools have distinct purposes focused on different aspects of memory management (storage, retrieval, analysis, relationships, validation), but there is some potential overlap between memory_validate_tool and memory_outcome_tool (both adjust confidence based on success/failure) and between memory_forget_tool and memory_edge_forget_tool (both handle deletion). The descriptions help clarify differences, but an agent might occasionally confuse these pairs.

    Naming Consistency5/5

    Tool names follow a highly consistent snake_case pattern with clear verb_noun structure (e.g., memory_store_tool, memory_recall_tool, file_activity_add). All tools start with a category prefix (daemon_, file_, memory_, validation_) followed by an action and sometimes a suffix like _tool, creating a predictable and readable naming scheme throughout the set.

    Tool Count3/5

    With 19 tools, the count is on the higher side for a memory management system, bordering on heavy. While the tools cover a broad range of functionalities (storage, retrieval, analysis, relationships, validation, file tracking, daemon status), some could potentially be consolidated (e.g., validation-related tools) to reduce complexity without losing capability.

    Completeness5/5

    The tool set provides comprehensive coverage for memory management, including full CRUD operations (store, list, recall, forget), relationship management (relate, edge_forget, inspect_graph), validation lifecycle (apply, outcome, validate, history), health analysis, and file activity tracking. There are no obvious gaps; agents can perform complete workflows from memory creation to validation and cleanup.

    Related MCP Connectors