CP Memory
Why CP Memory
For reproducible package, protocol and recall checks, see verification evidence and limits.
Local first: memory stays in
~/.cp-memory/memory.dbby default.Governable: inspect, review, correct, scope, or retire memory instead of silently overwriting it.
MCP-ready, Codex-enhanced: the stdio MCP server is the portable baseline; the Codex plugin adds Skills and lifecycle Hooks.

Related MCP server: nuzo-memory
Quick Start — Portable MCP
With Python 3.10+ and uv installed, any stdio MCP client can start CP Memory with:
uvx cp-memory-mcpThe public package passed a clean-cache MCP handshake with all 40 tools and a write/search/correct flow. See MCP client setup for Codex, Claude Code, Cursor, VS Code, and Gemini CLI examples.
For the enhanced Codex integration with lifecycle Hooks and Skills, install the plugin:
codex plugin marketplace add CJhuochai/cp-memory
codex plugin add cp-memory@cp-memoryRestart Codex after installation and approve the lifecycle Hooks if prompted.
See The Result In 30 Seconds
Tell Codex a project rule, such as: “Releases must start on a branch, run tests, and merge through a PR.”
In a later session, CP Memory restores the relevant rule from the local primary store so Codex can continue following it.
If the rule is wrong, preserve correction history and mark the old record wrong, stale, or scoped instead of silently overwriting it.
CP Memory is a local-first memory plugin for Codex. It stores facts, preferences, ongoing work, episodes, decisions, and conversation checkpoints in a local SQLite database, then restores relevant context through MCP tools and lifecycle hooks.
The goal is not to remember as much as possible. The goal is memory that remains trustworthy after long-term use: explainable, reviewable, correctable, and governable.
Current Capabilities
Context restore: restores relevant local-primary memory on startup and eligible prompts.
Automatic extraction: conservatively creates long-term personal memory candidates from explicit statements.
Project scope: prioritizes current-project memories with
repo:,project:, andworkspace:scopes.Reviewable governance: supports review inbox, review digests, conflict suggestions, correction states, and startup reminders.
Safe maintenance: weekly maintenance runs health checks, governance preflight, and low-risk expiry cleanup only.
30-Second Example
You tell Codex:
Remember this: releases for this project must start on a branch, run tests, and merge through a PR.In a later session, you ask:
What are the release rules for this plugin?CP Memory restores the relevant memory from the local primary store first, and Codex follows that rule. If the memory is wrong, you can mark it wrong, mark it stale, or write a corrected version.
See more anonymized examples in docs/examples.md.
For a GIF, short video, or launch post, use the sanitized 30-second demo script.
Install
For any stdio MCP client, use the verified public package:
uvx cp-memory-mcpClient-specific commands and JSON files are in docs/mcp-clients.md.
For Windows, the recommended path is GitHub Marketplace installation:
codex plugin marketplace add CJhuochai/cp-memory
codex plugin add cp-memory@cp-memoryRestart Codex after installation. If Codex asks you to trust hooks, approve the CP Memory lifecycle hooks in the hooks view.
For macOS/Linux, use the source installer. It creates a private Python runtime for the plugin and installs the MCP dependency:
git clone https://github.com/CJhuochai/cp-memory.git
cd cp-memory
sh ./install.shRestart Codex when it finishes. Do not treat GitHub Marketplace installation on macOS/Linux as an equivalently verified path: Marketplace does not run install.sh, so it does not create that private runtime.
Platform Support
Platform | Recommended installation | Verified coverage |
Windows | GitHub Marketplace; | Unit tests, isolated installation validation, and GitHub Actions CI passed |
macOS | Source installer: | GitHub Actions macOS CI passed unit tests and isolated install/MCP startup validation |
Linux | Source installer: | GitHub Actions Ubuntu CI passed unit tests and isolated install/MCP startup validation |
Manual smoke testing of real Codex desktop Hook injection on macOS/Linux is still pending access to physical devices. This release is accepted through three-platform CI; the boundary does not affect the installer and MCP-startup checks already covered, but it is not a substitute for full desktop manual acceptance.
Safety
Do not commit your real
memory.db, logs, private summaries, or environment files.Automatic extraction is intentionally conservative. Generated memories can be reviewed, corrected, marked stale, or marked wrong.
When memories need review, the current version injects a reminder into assistant context. It is not a user-facing popup or visible review panel, and it does not auto-delete memory or auto-resolve conflicts.
Weekly maintenance runs health checks, governance preflight, and low-risk expiry cleanup only; long-term personal memories, tasks, and decisions are protected by default.
Examples and screenshots use sanitized content, so you do not need to expose your real memory database.
Comparison
If you have seen other memory projects, start with docs/comparison.md. CP Memory's main difference is Codex lifecycle integration plus memory governance, not just storage and search.
Roadmap
See docs/roadmap.md for future directions. The roadmap prioritizes local-first behavior, explainability, correctability, and privacy safety.
See CHANGELOG.md for version history.
Local Development
Windows users normally do not need to run install.ps1. It is mainly for local development, refreshing the personal marketplace cache, and migrating old global hook wiring from earlier versions.
For local macOS/Linux development, run:
sh ./install.sh
sh ./scripts/test-install.shPython 3 with python3 on PATH is required. The installer creates a private virtual environment in the plugin directory and installs runtime dependencies; this is the currently verified installation path for macOS/Linux.
Run the test suite:
python -m unittest discover -s tests -p test_cp_memory.pyValidate the installer in an isolated temporary profile without touching your real Codex configuration:
powershell -ExecutionPolicy Bypass -File .\scripts\test-install.ps1License
MIT
Available Tools
40 toolsmemory_addC
Add or update a memory fact. Supports explicit category and optional long-form content payload.
Inputs: value (required), entity (required), property (required), tags, +4 more. Returns: result
memory_alias_addC
Add or update an alias for a canonical entity.
Inputs: alias (required), entity (required), tags. Returns: result
memory_alias_listA
List aliases, optionally filtered by canonical entity.
Inputs: limit, entity. Returns: result
memory_auto_extract_cleanupA
Preview or apply cleanup for auto-extracted noise records that look like implementation explanations rather than real user memory. Prefer action=mark_wrong for safer governance; use delete only when you really want to remove rows.
Inputs: limit, action, dry_run. Returns: result
memory_conflictsB
Find possible conflicting memories, including duplicate facts and personal-memory contradictions.
Inputs: limit. Returns: result
memory_correctB
Mark a memory as corrected, stale, wrong, scoped, or confirmed; optionally replace its value.
Inputs: id (required), status (required), value, reason. Returns: result
memory_decision_addB
Record an architecture or technical decision and mirror it into facts with strong metadata.
Inputs: title (required), context (required), decision (required), rationale. Returns: result
memory_decision_listA
List recorded decisions, most recent first.
Inputs: limit. Returns: result
memory_episode_consolidateC
Preview or apply conservative Episode consolidation into long-term personal memories.
Inputs: episode_id (required), limit, dry_run, subject. Returns: result
memory_explainB
Explain a memory record, including meta, payload, and relations.
Inputs: id, entity, property. Returns: result
memory_governance_reportB
Build a non-destructive governance acceptance report over the current memory.db, including auto-extract review queue, conflict samples, corrected samples, and restore probes.
Inputs: limit. Returns: result
memory_healthB
Return CP Memory health, migration state, FTS state, and active task.
Inputs: no named parameters. Returns: result
memory_inspectC
Inspect a memory record in a user-friendly way, including where the preview, payload, and relations live.
Inputs: id, entity, property. Returns: result
memory_link_addC
Create an explicit memory relation between two records.
Inputs: relation (required), source_id (required), target_id (required), source_kind (required), +1 more. Returns: result
memory_link_listC
List explicit memory relations.
Inputs: relation, source_id, target_id, source_kind, +1 more. Returns: result
memory_listB
List recent facts, optionally filtered by category.
Inputs: limit, category. Returns: result
memory_maintenanceC
Run memory maintenance: backfill meta, rebuild indexes, and optionally expire low-value records.
Inputs: limit, expire, dry_run. Returns: result
memory_personal_addC
Add or update a long-term personal assistant memory using Profile, Preference, Relationship, Ongoing, Episode, or BeliefDecision.
Inputs: key (required), value (required), subject (required), memory_type (required), +9 more. Returns: result
memory_personal_deriveB
Derive a long-term personal memory from an existing Episode and link it back to the source episode.
Inputs: key (required), value (required), subject (required), episode_id (required), +6 more. Returns: result
memory_personal_listC
List personal assistant memories, optionally filtered by the six-model memory type.
Inputs: limit, subject, memory_type. Returns: result
memory_personal_resolveB
Resolve a personal-memory conflict by confirming or merging one winner and marking other memories stale, wrong, or scoped with audit links.
Inputs: winner_id (required), scope, reason, loser_ids, +3 more. Returns: result
memory_personal_reviewC
Return a user-facing personal memory review dashboard with counts, recent memories, conflicts, and consolidation candidates.
Inputs: limit, subject. Returns: result
memory_probeA
Get all facts about an entity. Aliases resolve to the canonical entity first.
Inputs: entity (required). Returns: result
memory_recallB
CP Memory-first recall入口。任何记忆相关问题都先查 CP Memory 主库,再根据主库命中质量决定是否补查 Codex 自带 memory 作为辅助背景。
Inputs: query (required), limit, intent, allow_auxiliary. Returns: result
memory_removeA
Delete a fact by ID, including its metadata, payload, and graph links.
Inputs: id (required). Returns: result
memory_restore_contextB
Build a compact restored context for startup, history recovery, or project continuation.
Inputs: prompt, max_chars. Returns: result
memory_review_applyA
Apply one explicit memory review action: confirm, wrong, stale, scoped, or skip. This never physically deletes memory.
Inputs: id (required), action (required), scope, reason. Returns: result
memory_review_digestA
Return a Markdown memory review digest with recent memories, pending auto-extracts, conflicts, stale candidates, and resolution suggestions.
Inputs: limit, subject. Returns: result
memory_review_inboxB
Show a small actionable inbox for pending memory review. This previews items only and never deletes memory.
Inputs: limit, subject. Returns: result
memory_schemaA
Return CP Memory schema explanations and whether FTS is available.
Inputs: no named parameters. Returns: result
memory_searchC
Search memories using FTS when available, with OR ranking by default or strict AND matching.
Inputs: query (required), mode, limit, category. Returns: result
memory_statsB
Get memory statistics across facts, payloads, decisions, workflows, aliases, and relations.
Inputs: no named parameters. Returns: result
memory_task_doneC
Mark the current task as complete with a result summary.
Inputs: result. Returns: result
memory_task_getA
Get the current active task.
Inputs: no named parameters. Returns: result
memory_task_setC
Set the current active task.
Inputs: task_name (required), description. Returns: result
memory_touchC
Mark matching memories as accessed, optionally by IDs.
Inputs: ids, query. Returns: result
memory_updateC
Update an existing fact value, confidence, category, or content payload.
Inputs: id (required), value (required), content, category, +2 more. Returns: result
memory_workflow_getA
Get a saved workflow by name.
Inputs: name (required). Returns: result
memory_workflow_listB
List saved workflows.
Inputs: category. Returns: result
memory_workflow_saveC
Save a reusable workflow or procedure.
Inputs: name (required), steps (required), category. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 40 tools
Several tools have unclear boundaries: memory_add vs memory_update vs memory_personal_add overlap, and memory_correct, memory_review_apply, and memory_personal_resolve all support similar marking actions. The review cluster (memory_personal_review, memory_review_digest, memory_review_inbox) and retrieval cluster (memory_search, memory_recall, memory_restore_context) also create confusion.
Most tools follow a memory_<noun>_<verb> pattern, but there are notable exceptions like memory_add, memory_list, memory_recall, memory_restore_context, memory_review_digest, and memory_review_inbox. The naming is readable and consistently prefixed with memory_, but the mixed verb/noun order and noun-only names prevent a higher score.
At 40 tools, this server is overbuilt for a coherent tool set. Many tools could be consolidated, especially the review, correction, and inspection clusters, which inflate the count without adding clear distinct value.
The core memory lifecycle is well covered with add, update, remove, search, inspect, aliases, links, conflicts, maintenance, and governance tools. Minor gaps exist in subdomains such as workflows, decisions, aliases, and links, where add/list/save exists but dedicated remove/update operations are missing or indirect.
Maintenance
Related MCP Connectors
Persistent, inspectable memory for AI agents with lineage, correction, and a hosted MCP endpoint.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Persistent memory for AI agents across Claude, ChatGPT and any MCP client.
Governed personal world model and memory for your AI agent. Pair once, connect over MCP.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceA local-first MCP memory server providing persistent, searchable memory for AI agents, powered by SQLite.1Functional Source , Version 1.1, ALv2 Future
- AlicenseNot gradedqualityFmaintenanceLocal-first, auditable memory for AI agents. Provides durable context for MCP hosts with SQLite storage, CLI, and MCP tools for memory management.2Apache 2.0
- AlicenseNot gradedqualityBmaintenancePersistent long-term memory for MCP clients. Store and recall semantic facts, episodic events, and task state with vector-based relevance search. Write what matters, retrieve what's needed — memory that persists across sessions and agents, backed by a local SQLite store with optional embeddings for meaning-based lookup. Simple file-based storage, no external services required.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to store and recall durable facts, decisions, and lessons over MCP using hybrid semantic and keyword search, typed memories, graph relations, sessions, and time-travel queries. Runs locally with no server process or API key, persisting everything to files that both agents and a CLI can share.28 npmMIT