Personal Memory MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Personal Memory MCP Server remember that I prefer TypeScript over JavaScript for new projects"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Personal Memory Engine
A model-agnostic, local-first long-term memory engine for AI agents, powered by MCP.
Give Your AI Agents a Persistent Memory.
Personal Memory Engine stores durable user context in local SQLite, exposes it through an MCP stdio server, maintains a human-readable Markdown projection, and uses an optional OpenAI-compatible model only for language-understanding tasks such as memory extraction.
The project is designed around four principles:
Local ownership — SQLite and Markdown remain on the user's machine.
Evidence first — extracted memories require explicit user evidence.
Candidate review — uncertain or inferred information never writes directly to confirmed memory.
Provider independence — DeepSeek, OpenAI, or another compatible endpoint can be configured; storage and retrieval are provider-agnostic.
Contents
Related MCP server: MemoryAI
What problem it solves
AI agents lose useful context between sessions. Repeating background, preferences, goals, project decisions and learning progress wastes time and creates inconsistent answers. Personal Memory Engine provides a local, auditable memory layer that retrieves only task-relevant context and keeps uncertain extracted information under explicit review.
Current integrations
Codex — MCP stdio integration is implemented and tested end to end.
DeepSeek API — supported through the generic OpenAI-compatible chat adapter; no real external API key is included in the repository.
MCP-compatible agents — the server uses standard MCP stdio tools, but clients other than Codex have not yet been fully validated.
Core scenario
The core cross-session workflow is:
In session A, Codex calls
save_memorywith durable user information.The MCP server validates the write and stores it in local SQLite.
In a new session B, Codex calls
build_memory_contextorsearch_memorieswith the current task.The retriever returns only relevant top-K memories, including provenance and confidence.
Uncertain extracted information remains a pending candidate until the user confirms it.
Core features
Current version: 0.1.0
Implemented and tested:
SQLite with WAL, transactions, FTS5 keyword search, and history/audit records.
Create, read, update, soft delete, protected hard delete, tags, categories, and provenance.
Automatic memory candidate extraction with deterministic quality gating.
User fact / preference / plan / state / event / model-inference separation.
Long-term, current, transient, and unknown stability classes.
Same-fact paraphrase detection and local canonicalization.
Goal replacement with supersession and historical snapshots.
Current learning-progress handling without polluting profile memory.
Optional OpenAI-compatible semantic embeddings and hybrid retrieval.
MCP stdio server with 15 tools.
Backup, restore, JSON export, candidate review, and audit history.
The checked-in test suite currently contains 36 passing tests on Windows and WSL Ubuntu with Python 3.12. Real DeepSeek inference has not been exercised in this repository because no API key is included.
Demo
Actual terminal demonstration:
powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\smoke-mcp.ps1The run saves a synthetic memory through one MCP server process, restarts the server, retrieves the memory from a new session, and verifies pending extraction state.
No fabricated screenshot or GIF is included. A docs/demo/demo.gif asset can be added after recording the verified terminal flow.
Architecture
Codex / MCP client
|
| stdio
v
Personal Memory MCP Server
|
+-- Memory Manager
| +-- CRUD, consolidation, supersession, history
|
+-- Extraction Service
| +-- OpenAI-compatible adapter
| +-- quality gate and evidence checks
| +-- pending candidate review
|
+-- Hybrid Retriever
| +-- FTS5 keyword search
| +-- optional embeddings
| +-- importance, recency, context budget
|
+-- Storage
+-- SQLite as source of truth
+-- Markdown as generated projection
+-- backups and JSON exportMore detail:
Installation
Requirements:
Python 3.12 or newer
Windows 10/11, Linux, or WSL2
SQLite built with FTS5 (the standard Python SQLite build normally includes it)
Windows PowerShell
cd <PROJECT_ROOT>
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install --upgrade pip
.\.venv\Scripts\python.exe -m pip install -e ".[dev]"
$env:PME_DATA_DIR="$env:LOCALAPPDATA\personal-memory-engine"
.\.venv\Scripts\personal-memory.exe init
.\.venv\Scripts\python.exe -m pytestLinux / WSL2
cd <PROJECT_ROOT>
python3.12 -m venv .venv
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install -e '.[dev]'
export PME_DATA_DIR="$HOME/.local/share/personal-memory-engine"
.venv/bin/personal-memory init
.venv/bin/python -m pytestSetup script
powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\setup.ps1The default data directory is outside the repository. Source code and user memory remain separate.
Configuration
Copy the example values into your shell, IDE, or Codex environment:
.env.exampleNever commit a real .env file.
DeepSeek
DeepSeek exposes an OpenAI-compatible Chat Completions API. Example:
$env:DEEPSEEK_API_KEY="<YOUR_LOCAL_KEY>"
$env:PME_LLM_BASE_URL="https://api.deepseek.com"
$env:PME_LLM_MODEL="deepseek-flash"
$env:PME_LLM_JSON_MODE="true"The endpoint is configurable; no provider is hard-coded into the storage or retrieval layers.
Embeddings
DeepSeek's current chat API does not expose the embedding endpoint used by this project. To enable semantic retrieval, configure any OpenAI-compatible embedding service:
$env:PME_EMBEDDING_ENABLED="true"
$env:PME_EMBEDDING_BASE_URL="<OPENAI_COMPATIBLE_EMBEDDING_BASE_URL>"
$env:PME_EMBEDDING_API_KEY="<YOUR_LOCAL_KEY>"
$env:PME_EMBEDDING_MODEL="<EMBEDDING_MODEL>"Without an embedding provider, the hybrid retriever automatically uses local keyword retrieval.
See:
Codex MCP Integration
The project exposes an MCP stdio server through:
.venv/Scripts/personal-memory-mcp.exe # Windows
.venv/bin/personal-memory-mcp # Linux/WSLUse the registration script:
powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\install-codex-mcp.ps1
codex mcp list
codex mcp get personal_memoryThe script:
backs up the existing Codex configuration before modifying it;
refuses to overwrite an existing server unless
-Forceis supplied;registers the server with a server-scoped approval setting;
sets UTF-8 environment variables for Windows reliability.
A manual configuration example is available at codex/config.toml.example. Replace both PROJECT_ROOT and DATA_DIR placeholders.
After registration, start a new Codex session to load the MCP tools. See Codex integration.
Memory Model
Category | Purpose |
| Stable background, capabilities, and preferences |
| Long-term goals and plans |
| Current learning, project, and environment state |
| Decisions, events, conclusions, and reusable lessons |
Each memory or candidate can additionally carry:
assertion_type:user_fact,user_preference,user_plan,user_state,episodic_event, ormodel_inferencestability:long_term,current,transient, orunknownquality_scoreobserved_atsource_refevidence, conversation hash, and extractor metadata
Automatic extraction produces pending candidates only. Confirmation is required before a candidate becomes confirmed memory.
MCP Tools
Tool | Purpose |
| Search relevant active memories |
| Return a bounded context block |
| Retrieve stable profile memories |
| Retrieve project context |
| Retrieve learning state |
| Explicitly save confirmed information |
| Update content with optional optimistic version check |
| Soft delete by default; hard delete requires confirmation |
| Retrieve immutable history |
| Filter by category, status, and tags |
| Extract pending candidates with quality gating |
| Review candidates |
| Accept only after explicit user confirmation |
| Reject with audit trail |
| Inspect storage and integrity statistics |
CLI
.\.venv\Scripts\personal-memory.exe init
.\.venv\Scripts\personal-memory.exe search "project architecture" --json
.\.venv\Scripts\personal-memory.exe list --category goal
.\.venv\Scripts\personal-memory.exe backup
.\.venv\Scripts\personal-memory.exe exportBackups are stored outside the source tree by default. Restore requires the literal confirmation value RESTORE, and a pre-restore backup is created automatically.
Testing
.\.venv\Scripts\python.exe -m pytest
.\.venv\Scripts\python.exe scripts\evaluate.py
.\.venv\Scripts\python.exe scripts\evaluate_memory_quality.py
powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\smoke-mcp.ps1
powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\test-codex-e2e.ps1The tests cover CRUD, persistence, FTS synchronization, conflict handling, backups, automatic memory quality, paraphrase detection, short-term learning progress, credential rejection, and Codex-native MCP calls. See Testing and Test report.
Privacy and Security
API keys and tokens are never included in this repository.
Runtime databases, WAL/SHM files, Markdown memory mirrors, logs, backups, and local Codex configuration are excluded by
.gitignore.Credential-like content is rejected before memory storage.
Hard delete requires the exact memory ID.
Restore requires explicit confirmation and checksum/integrity validation.
Historical snapshots and audit records remain local.
Markdown is a generated projection, not a retrieval source.
Read PRIVACY.md and SECURITY.md before deploying.
Current limitations
The current release is single-user and local-first.
SQLite is not encrypted at rest.
Codex is the only fully validated MCP client.
DeepSeek support is implemented but has not been tested with a real external API key in this repository.
Embedding retrieval is optional and disabled by default.
Automatic extraction remains model-assisted; the deterministic quality gate reduces risk but does not eliminate extraction errors.
The Markdown mirror is generated output and must not be edited as a source of truth.
See Roadmap for planned work.
Community
Repository Layout
src/memory_engine/ application source
tests/ automated tests
docs/ architecture, security, operations, and evaluation
examples/ fictional example memories
scripts/ setup, smoke, evaluation, and backup scripts
codex/ Codex MCP and agent configuration examplesLicense
Personal Memory Engine is licensed under the Apache License 2.0.
Copyright 2026 Personal Memory Engine contributors.
Available Tools
15 toolsaccept_candidateA
Accept a pending candidate only after explicit user confirmation.
Inputs: candidate_id (required), user_confirmed. Returns: object
build_memory_contextB
Return a bounded, ready-to-inject memory context block rather than the entire store.
Inputs: query (required), top_k, category, max_chars. Returns: object
delete_memoryB
Soft-delete by default. Hard deletion requires confirmation equal to the exact memory_id.
Inputs: memory_id (required), hard, confirmation. Returns: object
extract_memoriesB
Extract quality-gated pending candidates; never writes directly into confirmed memory.
Inputs: conversation (required), source_ref, observed_at. Returns: object
get_learning_progressC
Find current and historical learning progress for a subject.
Inputs: subject (required). Returns: object
get_memory_historyC
Show immutable history snapshots for a memory.
Inputs: memory_id (required), limit. Returns: object
get_memory_statsA
Return local storage, category, candidate, history, and integrity statistics.
Inputs: no named parameters. Returns: object
get_project_contextC
Return relevant state, goals, decisions, and episodes for a named project.
Inputs: project_name (required). Returns: object
get_user_profileA
Return active profile memories such as background, capabilities, and stable preferences.
Inputs: no named parameters. Returns: object
list_memoriesC
List memories with optional category, status, and tag filters.
Inputs: tags, limit, status, category. Returns: object
reject_candidateB
Reject a pending extraction candidate while retaining an audit trail.
Inputs: candidate_id (required), reason. Returns: object
review_pending_memoriesB
List extracted candidates awaiting user confirmation.
Inputs: limit. Returns: object
save_memoryC
Explicitly save durable information stated by the user. Duplicate/conflict rules run locally.
Inputs: content (required), category (required), tags, project, +8 more. Returns: object
search_memoriesC
Search relevant active memories using hybrid retrieval (keyword fallback when embeddings are absent).
Inputs: query (required), top_k, category. Returns: object
update_memoryA
Update content of an existing memory. Pass expected_version to protect against stale overwrites.
Inputs: content (required), memory_id (required), expected_version. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Most tools have clearly distinct purposes: CRUD on memories, a pending-candidate workflow, and read-only retrieval helpers. A few boundaries blur — search_memories vs list_memories vs build_memory_context all retrieve memories, and extract_memories vs review_pending_memories require reading descriptions to tell apart. Descriptions do resolve the ambiguity, so misselection is unlikely but possible.
Every tool follows a strict verb_noun snake_case pattern (search_memories, get_user_profile, save_memory, accept_candidate, list_memories). Verbs are used meaningfully and consistently across the whole surface.
15 tools sits at the top of the well-scoped range but each maps to a real operation: memory CRUD, candidate lifecycle, history/stats, and scoped context retrieval. Nothing appears redundant or speculative for a personal memory server.
Strong lifecycle coverage: create/read/update/soft-delete, versioning, history, candidate extraction-review-accept-reject, plus stats and bounded context assembly. Gaps exist — there is no direct get_memory_by_id (only search/list), and soft-deleted memories have no restore/undelete operation.
Maintenance
Related MCP Connectors
Persistent memory for AI agents. Search and store durable facts, preferences and decisions.
Persistent memory layer for AI clients: store, recall, and correct context across tools.
Persistent AI memory with semantic search, conflict detection, and ticketing.
Persistent memory for AI agents. Semantic search, memory graph, W3C DID identity.
Related MCP Servers
- AlicenseBqualityCmaintenanceEnables AI agents to maintain a local, event-sourced long-term memory with semantic retrieval, decision confidence checks, and proactive recalls, ensuring data never leaves the machine.233MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to automatically capture durable knowledge and retrieve only relevant, token-bounded context from a secure local-first long-term memory, with support for progressive disclosure, snapshots, health diagnostics, and background tasks.Apache 2.0
- FlicenseNot gradedqualityAmaintenanceEnables AI coding agents to read and write persistent, local-first memory so project decisions, preferences, and cross-project guidelines survive across sessions and can be retrieved by semantic search. Optionally also exposes a task queue for autonomous execution that draws on the same stored context.-
- AlicenseAqualityAmaintenanceEnables AI agents to search, retrieve, save, forget and give feedback on plain-Markdown memories that carry sources, dates and trust levels, while holding agent-written memories in a human review queue. Also supports session handoffs, entity and topic lookup, and audit history so learned context persists and stays verifiable.883 npm3MIT