The Problem

AI agents and applications lack persistent, structured memory. Session context is lost between runs, and existing memory solutions are either too simplistic (key-value stores) or too rigid (fixed schemas). PowerMem addresses this by providing a memory layer that combines multiple retrieval strategies—vector, full-text, and graph—with LLM-driven extraction and time-based decay, so agents can recall relevant information without rebuilding context every session.

What This Does

PowerMem is a persistent memory system for AI agents, exposed through a Python SDK (src/powermem/), a CLI (pmem), an HTTP API server with a React dashboard (src/server/, dashboard/), and an MCP server. The core memory.py module handles the orchestration: it auto-configures providers, manages the underlying store, and exposes add, search, delete, and list operations.

The repository also contains a set of self-contained projects beyond the core library: a Go-based Claude Code plugin (apps/claude-code-plugin/), a TypeScript VS Code extension (apps/vscode-extension/), a LOCOMO benchmark suite (benchmark/locomo/), and a benchmark server (benchmark/server/main.py). These are independent projects sharing the core memory design, not one monolith.

How It Is Wired

Execution starts in src/powermem/cli/main.py at the memory function. From there, the shortest path to an external effect is memory -> delete_all, which makes a network call via self.client.get—three hops from entry to leaving the process. The benchmark server (benchmark/server/main.py) starts at reset and reaches delete_col, hitting the database via self.connection.execute in two hops. The CLI's cli function reaches _install_shell_completion, which writes to the filesystem via os.makedirs.

The call graph shows clear hot spots. search is called from 132 distinct places, delete_all from 57, and PGVectorStore from 50—these are the functions with the widest blast radius. The module graph confirms this: src/powermem/core/memory.py has 18 imports and is depended on by 4 modules, with an instability score of 0.82. The src/server/models/errors.py module is a hub with 15 dependents and zero imports—stable but high-churn risk. The CLI modules (main.py, commands/config.py, commands/interactive.py) participate in a circular import cycle, which will complicate any refactoring.

How To Use It

Setup:

git clone https://github.com/moses-y/powermem
cd powermem
pip install -e .

Configuration: Copy .env.example to .env and set LLM and embedding credentials. The default database is SQLite. Run pmem config init for interactive setup.

Running it:

pmem memory add "User prefers dark mode" --user-id user123
pmem memory search "preferences" --user-id user123
powermem-server --host 0.0.0.0 --port 8000

Real-World Use

A customer-support agent that needs to remember user preferences across sessions:

from powermem import Memory, auto_config

memory = Memory(config=auto_config())
memory.add("User prefers dark mode and dislikes phone calls", user_id="user123")
results = memory.search("communication preferences", user_id="user123")

Code Health & Issues

Static analysis found 168 findings (40 high, 128 medium). The most significant:

  • High - Deep nesting (33 occurrences) - src/server/utils/metrics.py, src/powermem/core/memory.py (indentation depth 8); fix with early returns/guard clauses.
  • High - Oversized files (8) - src/powermem/core/memory.py at 1662 lines; split by responsibility.
  • High - Duplicated code blocks - 1885 repeated 6-line blocks across 165 files, notably in apps/vscode-extension/src/writers/ (claude.ts, cursor.ts, codex.ts); extract shared helpers.
  • High - Import cycle members (6) - src/powermem/cli/main.py and its commands; break the cycle.
  • Medium - Broad exception handling (10) - src/powermem/utils/utils.py, config_loader.py; catch specific exceptions.
  • High - Unsafe CI/CD practices - Third-party GitHub Actions pinned to tags (docker/setup-qemu-action@v3), no lockfile for pyproject.toml, no least-privilege token permissions, no dependency scan.

The Bottom Line

PowerMem is a functional, multi-faceted memory system with solid test coverage (47 test files) and good documentation (171 doc files). The core library is the strongest part; the plugins and benchmark are useful but contribute to the code duplication and complexity. The CI/CD security gaps and deep nesting in core files are the main concerns for anyone planning to extend it. Suitable for teams building AI agents that need persistent, queryable memory with minimal setup.