Skip to main content
Glama

Agent Memory

Persistent memory system for AI agents. Store, search, and consolidate knowledge across sessions via an MCP server.

Works with any MCP-compatible client: Claude Code, Cursor, Windsurf, Cline, or custom agents.

pip install agent-memory-server

Quick Start

For Claude Code Users

# 1. Add the MCP server
claude mcp add --transport stdio agent-memory -- uvx agent-memory-server

# 2. Install the agent skill (teaches Claude when to use memory)
npx skills add khanglvm/agent-memory -g

For Other Clients

Configure in your client's MCP settings:

{
  "mcpServers": {
    "agent-memory": {
      "type": "stdio",
      "command": "uvx",
      "args": ["agent-memory-server"]
    }
  }
}

Related MCP server: Kirok

Features

9 Tools for memory management:

  • store_memory — Save facts, preferences, procedures, episodes

  • search_memory — Semantic search across memories

  • update_memory — Modify existing memories

  • delete_memory — Remove outdated memories

  • list_memories — Browse memories by namespace

  • get_memory_stats — View statistics

  • consolidate_memories — Find patterns and insights

  • ingest_text — Ingest raw text

  • ingest_file — Ingest files (within allowed paths)

4 Resources for read-only access:

  • memory://stats — Global statistics

  • memory://recent/{namespace} — Last 10 memories

  • memory://namespaces — All namespaces

  • memory://consolidations/{namespace} — Recent insights

Organize memories by namespace (e.g., global, project:myapp) and category (fact, preference, procedure, episode).

Installation

Via pip:

pip install agent-memory-server

From source:

git clone https://github.com/khanglvm/agent-memory.git
cd agent-memory
pip install -e ".[dev]"

With custom config:

agent-memory-server --config ~/.agent-memory/config.yaml

Configuration

Zero-config default: SQLite at ~/.agent-memory/memory.db with recency search.

Enable semantic search with embedding provider:

embedding:
  provider: openai
  api_key: ${OPENAI_API_KEY}
  model: text-embedding-3-small

consolidation:
  provider: openai
  api_key: ${OPENAI_API_KEY}
  model: gpt-4o-mini

Alternatives: Ollama (local, no API key) or disable embeddings entirely.

Environment variables override config with AGENT_MEMORY_ prefix:

export AGENT_MEMORY_EMBEDDING__PROVIDER=ollama
export AGENT_MEMORY_SERVER__TRANSPORT=http

Transport

Default: stdio (used by MCP clients).

HTTP mode for remote agents:

agent-memory-server --transport http --host 0.0.0.0 --port 8888

Requires bearer token for non-localhost:

AGENT_MEMORY_AUTH_TOKEN=secret agent-memory-server --transport http --host 0.0.0.0

Multi-Device Setup (Hub-Spoke via Tailscale)

For multi-device setups where a central Mac Mini serves as the memory hub:

On the hub (Mac Mini):

# Start with HTTP transport, vault sync, and auth
AGENT_MEMORY_AUTH_TOKEN=your-secret agent-memory-server \
  --transport http --host 0.0.0.0 --port 8888

Configure config.yaml:

server:
  transport: http
  http_host: 0.0.0.0
  http_port: 8888
  auth_token: ${AGENT_MEMORY_AUTH_TOKEN}
  tls_cert: /path/to/cert.pem    # Optional: Tailscale HTTPS
  tls_key: /path/to/key.pem

vault:
  enabled: true
  vault_path: ~/Vault
  sync_folder: memory-vault
  write_on_store: true
  api_port: 8889

On dev Macs (spokes):

# Quick setup via script
./scripts/setup-client.sh https://macmini.tail:8888

# Or manually add to Claude Code MCP config:
# ~/.claude/settings.json or .mcp.json
{
  "mcpServers": {
    "agent-memory": {
      "type": "http",
      "url": "https://macmini.tail:8888/mcp",
      "headers": {
        "Authorization": "Bearer ${AGENT_MEMORY_AUTH_TOKEN}"
      }
    }
  }
}

Requirements:

  • Tailscale installed on all devices (free personal plan)

  • Same tailnet for hub and spokes

  • AGENT_MEMORY_AUTH_TOKEN env var set on all devices

See Obsidian Agent Memory Plugin for Obsidian vault sync.

Architecture

Three layers:

  • API Layer: 9 MCP tools + 4 resources via stdio or HTTP

  • Processing: Pluggable embedding providers (OpenAI/Ollama/None) and consolidation LLMs

  • Storage: SQLite + sqlite-vec for vector search, automatic fallback to recency search

Development

pip install -e ".[dev]"
pytest tests/ -v          # Run tests
ruff check src/ tests/    # Lint
python -m agent_memory    # Run server

Documentation

License

MIT

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides AI agents with persistent, searchable long-term memory across sessions, enabling storage, full-text retrieval, updates, GDPR-compliant deletion, session summaries, and cross-referencing with per-namespace isolation.
      -
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to capture, classify, synthesize, and retrieve persistent knowledge through MCP and REST APIs, so multiple agents can share memory and improve across sessions. It provides full-text, semantic, and hybrid search with token-optimized context retrieval from sources like Obsidian, code, transcripts, and terminal sessions.
      10 npm
      MIT