# Repository Briefing: CodeAbra/iai-personal-memory-engine
> Source: https://repoforai.com/repo/CodeAbra/iai-personal-memory-engine (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/CodeAbra/iai-personal-memory-engine
- **Category**: RAG, Data & Memory (知识库 / 爬虫 / 记忆层)
- **Primary Language**: Python
- **License**: MIT
- **Engineering Health**: A+ (91/100 · Maintenance 35/35 · Adoption 16/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v3.3.0 (2026-10-22) — https://github.com/CodeAbra/iai-personal-memory-engine/releases
- **Review Snapshot**: 2026-12-03
- **Deployment / Stack Signals**: Self-Hosted, Local AI, MCP, CLI
- **Momentum**: 925 ★ total (+0 24h / +2 7d) · 113 forks
- **Topics**: `agent-memory`, `ai-memory`, `claude`, `claude-code`, `codex`, `cursor`, `encrypted`, `episodic-memory`, `gemini`, `llm-memory`, `local-first`, `long-term-memory`
- **When to Use**: Best for: A single developer or researcher who wants searchable, verbatim agent history on one machine, can use host hooks, and needs old and corrected facts to remain distinguishable. Skip if: You need shared or cross-device memory, uniform per-turn injection across hosts, or a policy that prohibits plaintext capture buffers and caches.

## Overview
```text
### Architecture & Core Mechanics
This is a single-user, local-first memory layer, not a networked vector database. Host hooks append turns to a session buffer without embedding or engine RPC on the capture path. The background daemon embeds, deduplicates, encrypts, and indexes records, then clusters and consolidates them during idle time. Clients can query the store through MCP over stdio or the `iai` CLI. Where the host supports it, hooks also inject bounded context at session start and on later turns.

Hippo combines encrypted records, a vector index, and a graph in one store. MOSAIC provides Leiden-family community detection with stable community identities, while Lilli HD provides hyperdimensional representations and structural recall. The Python 3.11/3.12 package depends on NumPy, SciPy, and Numba. Native embedding and graph kernels live in the Rust workspace, whose dependencies include PyO3, Candle, `tokenizers`, and `safetensors`. The daemon uses a Unix socket on macOS/Linux and a token-protected ephemeral loopback port on Windows.

### Key Capabilities & Differentiators
Episodic memory retains timestamped, write-once fragments; semantic memory summarizes related episodes; procedural memory learns ten bounded behavioral parameters. The local, LLM-free recall path combines semantic similarity, graph evidence, recency, temporal validity, and lexical evidence. A correction closes the old record’s validity interval and links a successor rather than overwriting the original. `memory_recall` can return both `hits` and `anti_hits`. The 15 memory MCP tools cover recall, capture, correction, claim checking, and inspection; `iai upload` accepts documents, Office files, e-books, code, configuration files, and directories.

The included benchmarks report Rescue@10 after contradiction and historical-verbatim hit@10 of 1.000 each, with a flat-cosine baseline of about 0.71 for historical-verbatim retrieval. With the product embedder, LongMemEval-S reaches R@5 of 0.962 and R@10 of 0.978. On the author’s store, automatic context packs averaged about 350 tokens versus about 2,850 for the agent-search round trip they replaced. That comparison is workload-specific and does not apply to explicit `memory_recall`, whose default response budget is 1,500 tokens.

### Trade-offs & Limitations
Compared with a flat cosine index, versioned records and graph evidence support historical questions and contradiction handling, at the cost of a resident daemon and a more involved storage lifecycle. Against mempalace v3.3.6, the matched `all-MiniLM-L6-v2` run ties at 0.966 R@5 and 0.978 R@10. Choose on host integration and historical semantics, not a benchmark lead. Recall is typically weak for roughly the first ten sessions. The default store is English-first, and changing embedding generations requires an explicit migration.

Records use AES-256-GCM at rest, but the transient capture spool and injection caches are plaintext. The store and key both live under `~/.iai-mcp/` and must be backed up together with appropriate access controls. There is no account, telemetry pipeline, or cross-machine sync. Local recall does not make the default installation offline: the REM step can invoke `claude -p` through an existing Claude subscription, and the version check and first-use model download also use the network. Automatic context injection is a disclosure path to the host and potentially its model provider; encryption at rest does not govern that path.

### Hardware & Deployment Guide
The package targets Python 3.11 or 3.12. For Claude Code, install `iai-pme`, register the marketplace, install `iai-memory@iai-pme`, and verify with `iai-mcp daemon status` and `iai-mcp doctor`. Other hosts can initialize encryption with `iai-mcp crypto init`, install the background service with `iai-mcp daemon install`, and install hooks where supported. The macOS/Linux all-in-one source build also requires Git, Node.js 18+, and Rust. Check the daemon after setup: it stays running after the MCP session ends and can be stopped with `iai-mcp daemon stop`.

New stores default to the native format; upgrades preserve the existing format, and legacy SQLite migration is explicit via `iai-mcp migrate-to-lilli`. For offline operation, plan local model provisioning before setting `IAI_MCP_EMBED_OFFLINE=1`, and disable the version check and REM step with `IAI_MCP_VERSION_CHECK=0` and `IAI_MCP_REM_DISABLED=1`. Release v3.2.2 added the `iai-mcp-server` launcher alongside a context-injection milestone. In v3.3.0, `iai-tools` ships separately as a console script, an `iai-mcp tools` subcommand, and an MCP server for code indexing, session events, and command execution without the memory engine.
```

## Key Capabilities
```text
- Capture path: Hooks write to a session buffer without waiting on embedding or engine RPC; the daemon processes captures asynchronously.
- Historical recall: Corrections close the old validity interval and link a new record; recall can return both `hits` and `anti_hits`.
- Native storage: Hippo combines encrypted records, a vector index, and a graph; MOSAIC tracks community identity across clustering passes.
- Host integration: Claude Code and Codex CLI support ambient hooks; Cursor has no per-turn text injection, and OpenClaw uses tools on demand.
- Matched benchmark: Both engines reach LongMemEval-S R@10 of 0.978 with `all-MiniLM-L6-v2`; no advantage over mempalace v3.3.6 is shown on that metric.
- Local administration: `iai brain` exposes graph neighborhoods and contradictions; `iai-mcp doctor` diagnoses setup and prints the legacy-store migration command when applicable.
```

## Quick Start / Clone
```bash
curl -fsSL https://raw.githubusercontent.com/CodeAbra/iai-personal-memory-engine/main/scripts/bootstrap.sh | bash
```
