Skip to main content

CP Memory logo

CP Memory

Local-first, governable memory for AI coding agents.
Remember project rules across sessions, recall only what matters, and correct bad memory without hiding history.

简体中文 | English

License: MIT Local first MCP server Cross-platform CI


Why CP Memory

  • Local first: memory stays in ~/.cp-memory/memory.db by 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.

CP Memory 30-second demo

Quick Start — Codex Enhanced Integration

The currently verified one-command path is the Codex plugin:

codex plugin marketplace add CJhuochai/cp-memory
codex plugin add cp-memory@cp-memory

Restart Codex after installation and approve the lifecycle Hooks if prompted.

Portable MCP status: This repository now includes the cp-memory-mcp Python package and validates it in a clean environment. The public uvx cp-memory-mcp command will be documented only after the package is uploaded to PyPI and smoke-tested from the registry.

See The Result In 30 Seconds

  1. Tell Codex a project rule, such as: “Releases must start on a branch, run tests, and merge through a PR.”
  2. In a later session, CP Memory restores the relevant rule from the local primary store so Codex can continue following it.
  3. 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.

CP Memory architecture

CP Memory recall demo

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:, and workspace: 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.

CP Memory governance loop

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 Windows, the recommended path is GitHub Marketplace installation:

codex plugin marketplace add CJhuochai/cp-memory
codex plugin add cp-memory@cp-memory

Restart 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.sh

Restart 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; install.ps1 for local development Unit tests, isolated installation validation, and GitHub Actions CI passed
macOS Source installer: sh ./install.sh GitHub Actions macOS CI passed unit tests and isolated install/MCP startup validation
Linux Source installer: sh ./install.sh 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.sh

Python 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.py

Validate the installer in an isolated temporary profile without touching your real Codex configuration:

powershell -ExecutionPolicy Bypass -File .\scripts\test-install.ps1

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cp_memory_mcp-1.8.0.tar.gz (50.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cp_memory_mcp-1.8.0-py3-none-any.whl (40.1 kB view details)

Uploaded Python 3

File details

Details for the file cp_memory_mcp-1.8.0.tar.gz.

File metadata

  • Download URL: cp_memory_mcp-1.8.0.tar.gz
  • Upload date:
  • Size: 50.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cp_memory_mcp-1.8.0.tar.gz
Algorithm Hash digest
SHA256 9fd4d1f7b73860e6f18dc945efc28582b6d256796f239864b60af779588893b0
MD5 dda1806a69456e41ef4c775aeadd0a42
BLAKE2b-256 b40192179f224c7ba8510e93d3f79d82961194eb58e4e72f04bb18e7258ec9b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for cp_memory_mcp-1.8.0.tar.gz:

Publisher: publish-pypi.yml on CJhuochai/cp-memory

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cp_memory_mcp-1.8.0-py3-none-any.whl.

File metadata

  • Download URL: cp_memory_mcp-1.8.0-py3-none-any.whl
  • Upload date:
  • Size: 40.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cp_memory_mcp-1.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 72ea21bedcbdfcc6ffe42034e2e20fb4777ac3688b04823eecb350b92a90b6e6
MD5 b2d6d72ff09334554303a0a1af2bbe62
BLAKE2b-256 3abb58c6162b651dab3f158e54f27b935ae5c80b4cfe499d7c9e586e0704f9da

See more details on using hashes here.

Provenance

The following attestation bundles were made for cp_memory_mcp-1.8.0-py3-none-any.whl:

Publisher: publish-pypi.yml on CJhuochai/cp-memory

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.8.1

2 files

This release

1.8.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page