PowerMem Documentation

repository·main·Indexed 20 days ago

https://github.com/oceanbase/powermem

A persistent, self-evolving memory engine for AI agents featuring a persistent memory layer for LLM applications. PowerMem uses hybrid retrieval (vector, graph, full-text) and LLM-driven distillation to create structured 'Experience' and 'Skill' layers. It supports multiple storage backends including SQLite and OceanBase/seekdb, and provides integrations for Claude Code, MCP clients, and VS Code-compatible IDEs such as Cursor, Windsurf, and GitHub Copilot.

Tokens
198.7K
Snippets
526
Records
740
Agent score
71%

What's inside PowerMem

  1. Overview of PowerMem

    main

    PowerMem is a persistent, self-evolving memory system designed for AI agents and applications. It moves beyond simple chat history by combining vector, full-text, and graph retrieval with LLM-driven memory extraction and Ebbinghaus-style time decay.

    Key features include:

    • Intelligent Memory Lifecycle: Uses LLMs to extract, update, merge, and decay memories to prevent them from becoming static noise.
    • Two-Layer Distillation: Implements an Experience + Skill distillation model, allowing agents to learn reusable workflows (Skills) from past interactions (Experience).
    • Hybrid Retrieval: Provides integrated vector, full-text, graph, and recency-based search signals.
    • Multi-modal Support: Handles text, image, and audio signals.
    • Versatile Integration: Supports a Python SDK, HTTP server, Model Context Protocol (MCP), CLI, and various AI client plugins (e.g., Claude Code, Cursor, VS Code).
  2. Overview of the PowerMem Benchmark suite

    main

    The PowerMem Benchmark suite provides tools for evaluating PowerMem's performance. It consists of two primary components:

    1. Benchmark Server: A REST API server built with FastAPI that exposes memory operations via an API for testing purposes. Located in the server/ directory.
    2. LOCOMO Load Testing: A comprehensive benchmarking and load testing tool that utilizes the LOCOMO dataset to evaluate performance and metrics. Located in the locomo/ directory.
  3. What is PowerMem?

    main

    PowerMem is a persistent, self-evolving memory layer designed for AI applications and agents. It combines vector, full-text, and graph search with LLM-driven memory extraction and Ebbinghaus-style temporal decay.

    Key features include:

    • Two-layer distillation of Experience + Skill: A self-evolving memory mechanism.
    • Multi-agent isolation: Support for separating memory across different agents.
    • User profiles: Built-in support for managing user-specific context.
    • Multimodal support: Standard handling of text, image, and audio signals.
    • Hybrid Search: A 4-path hybrid search mechanism.
  4. Explore PowerMem Core APIs

    main

    PowerMem provides several specialized API surfaces depending on your integration needs:

    • Memory API: For performing synchronous memory operations.
    • AsyncMemory API: For performing asynchronous memory operations.
    • Agent APIs: For managing memory across multi-agent systems.
    • MCP API: For integrating PowerMem as a Model Context Protocol (MCP) server for AI assistants.
    • HTTP API Server: For interacting with PowerMem via a RESTful HTTP interface.
  5. What is Multi-Agent Memory?

    main

    Multi-agent memory allows for the creation of isolated memory spaces for different AI agents while supporting collaboration. This architecture is useful for:

    • Customer support systems: Separating support, sales, and technical agents.
    • Development teams: Managing multiple agents working on the same project.
    • Enterprise applications: Isolating different departments with interconnected memories.
    • Complex workflows: Maintaining individual agent context while accessing shared information.

    Core Concepts

    • Memory Isolation: Each agent has a private memory space to prevent interference.
    • Cross-Agent Collaboration: Agents can search across all memories to share information.
    • Agent Identification: Memories are tagged with an agent_id to track ownership.
    • Flexible Search: Ability to search within a single agent's memory or across all agents.
  6. Overview of UserMemory capabilities

    main

    UserMemory is an advanced user profile management module that builds upon the base Memory module. It provides four core capabilities:

    1. Conversation storage: Stores user conversations as event memories.
    2. Profile extraction: Uses an LLM to automatically extract user-related information (e.g., basic info, interests, work background) from conversations.
    3. Profile management: Provides mechanisms to save, update, and query user profiles.
    4. Joint search: Allows for searching memories while optionally including profile information in the results.

    It works by managing two internal components: a Memory instance for conversation events and a UserProfileStore for user profiles.

  7. Key concepts of the Ebbinghaus Forgetting Curve in PowerMem

    main

    When working with memory decay and retention in PowerMem, keep these core principles in mind:

    1. Time-based decay: Memories naturally decay over time following the Ebbinghaus curve.
    2. Retention scoring: Calculate retention scores based on the time elapsed since the memory was created or last accessed.
    3. Weighted search: For improved retrieval, combine semantic similarity scores with retention scores.
    4. Spaced repetition: Use the forgetting curve to schedule optimal review times to maximize long-term retention.
    5. Practical applications: These patterns are useful for building learning systems, recommendation engines, and memory optimization tools.
  8. Configure PowerMem storage backend (SQLite vs OceanBase)

    main

    PowerMem supports two primary storage backends:

    1. SQLite (Default): Zero external dependencies, works out of the box for coding agent scenarios. Requires powermem[server,extras] which includes sentence-transformers for local embedding.
    2. OceanBase/seekdb: Recommended for production and cluster deployments. Requires setting the environment variable POWERMEM_INIT_DATABASE_PROVIDER=oceanbase before running the initialization command. Requires powermem[server,seekdb] which includes pyseekdb.
  9. How memory isolation works in multi-agent setups

    main

    Memory isolation ensures that different AI agents maintain separate, private memory spaces to prevent interference.

    Core Mechanics

    • Automatic Tagging: When you instantiate a Memory object with an agent_id, all memories added through that instance are automatically tagged with that ID.
    • Default Search Scope: By default, searches performed via a specific Memory instance are automatically filtered to only return memories belonging to that agent_id.
    • Privacy: This architecture prevents agents from accidentally accessing or being influenced by the memories of other agents.
    • Cross-Agent Access: While isolated by default, you can still perform cross-agent searches by explicitly providing different agent_id values in your search parameters when required for collaboration.
  10. Understand the LOCOMO Benchmark evaluation metrics

    main

    The LOCOMO benchmark evaluates memory techniques using five key metrics:

    1. BLEU Score: Measures similarity between the model's response and the ground truth.
    2. F1 Score: Measures the harmonic mean of precision and recall.
    3. LLM Score: A binary score (0 or 1) where an LLM judge evaluates response correctness.
    4. Token Consumption: The total number of tokens used to generate the final answer.
    5. Latency: The time taken for both the search process and response generation.
  11. How Multimodal Capability works in PowerMem

    main

    Multimodal capability allows PowerMem to process non-text inputs by automatically converting them into text descriptions. These descriptions are then stored as searchable memories.

    Supported Media Types:

    • Images: Extracts information and generates text descriptions.
    • Image URLs: Processes online image links.
    • Audio: Converts speech to text.
    • Audio URLs: Processes online audio links.
    • Mixed Content: Handles composite messages containing text, images, and audio simultaneously.
  12. Understand the PowerMem backend strategy

    main

    PowerMem uses a tiered backend priority to ensure connectivity across different client types:

    1. HTTP API Server (Primary): The system first attempts to reuse an existing healthy HTTP API server. You can check health via: curl -s -m 5 http://localhost:8848/api/v1/system/health If no server is running, start it using: powermem-server --host 0.0.0.0 --port 8848

    2. MCP Transport (Fallback): If the HTTP API is unavailable, the system falls back to MCP-only mode. The mcp-client/ path uses powermem-mcp directly, preferring SSE on port 8848. powermem-mcp sse 8848

    Installation Note: When installing via pip, use powermem[server] for runtime dependencies for both HTTP API and MCP transports. For embedded seekdb storage and embedder, use powermem[server,seekdb].

    # Check health
    curl -s -m 5 http://localhost:8848/api/v1/system/health
    
    # Start server
    powermem-server --host 0.0.0.0 --port 8848
    
    # Fallback to MCP SSE
    powermem-mcp sse 8848