pmem-agent
Persistent, concurrent-safe project memory for Claude Code agents.
Stores structured project facts in .claude/memory/project-memory.json. Multiple agents can read and write safely — all operations go through an exclusive file lock with stale-lock detection.
Install
pip (recommended — gives you pmem as a system command)
pip install pmem-agent
pmem setup # installs the Claude Code subagent to ~/.claude/agents/
npx (no install required)
npx pmem-agent
curl — Mac / Linux
curl -fsSL https://raw.githubusercontent.com/thechandanbhagat/pmem-agent/main/install.sh | bash
PowerShell — Windows
iwr -useb https://raw.githubusercontent.com/thechandanbhagat/pmem-agent/main/install.ps1 | iex
Clone and run
git clone https://github.com/thechandanbhagat/pmem-agent
cd pmem-agent
./install.sh # Mac/Linux
./install.ps1 # Windows (PowerShell)
Quick start
# 1. Mark your project root (run once)
cd ~/projects/my-app
pmem init-root
# 2. Write some facts
pmem write project '{"name":"my-app","type":"web-app"}'
pmem merge '{"tech_stack":{"languages":["TypeScript"],"frameworks":["React"]}}'
# 3. Read them back
pmem read
Multi-repo / monorepo
When several git repos share a common parent folder, one init-root at the
parent makes all subrepos share the same memory file automatically.
my-project/
├── .pmem-root ← root marker (gitignored)
├── .claude/
│ └── memory/
│ └── project-memory.json ← shared by ALL subrepos
├── api/ ← git repo
├── web/ ← git repo
└── mobile/ ← git repo
cd ~/projects/my-project
pmem init-root # one-time setup
# Now from any subrepo, pmem always hits the shared file:
cd ~/projects/my-project/api
pmem write tech_stack '{"languages":["TypeScript"]}'
cd ~/projects/my-project/web
pmem read tech_stack # same data
Env var override (useful in CI):
export PMEM_ROOT=/path/to/my-project
pmem read
Debug which file will be used:
pmem root
# Memory path: /path/to/my-project/.claude/memory/project-memory.json
# Source: .pmem-root marker at /path/to/my-project
Memory schema
{
"project": { "name": "", "description": "", "type": "", "root": "" },
"tech_stack": { "languages": [], "frameworks": [], "databases": [], "tools": [] },
"architecture": { "pattern": "", "key_decisions": [] },
"conventions": { "naming": "", "file_org": "", "test_pattern": "" },
"repos": {},
"current_goals": [],
"known_issues": [],
"_last_updated": "",
"_agents": {}
}
Using in Claude Code
After pmem setup, a project-memory subagent is available in Claude Code.
Spawn it at the start of any long-running task:
"Initialize project memory" — scans manifests, README, and directory layout, writes structured facts to
.claude/memory/project-memory.json.
"Load project context" — reads memory and summarises it before you start work.
"Remember that we decided to use Postgres instead of SQLite" — appends to
architecture.key_decisions.
Parallel agent coordination
When multiple Claude Code agents run in parallel, each registers itself on
startup and reads what peers are working on — preventing duplicate work.
The _agents key in memory is the coordination table; it is automatically
cleaned up when each agent finishes.
CLI reference
pmem setup Install Claude Code subagent to ~/.claude/agents/
pmem init-root Mark cwd as project root (shared by all subrepos)
pmem root Show resolved memory path
pmem read [key] Print all memory or one top-level key
pmem write <key> <value> Set key (value: JSON or plain string)
pmem merge <json> Deep-merge a JSON object into memory
pmem delete <key> Remove a top-level key
pmem reset Wipe all memory
pmem agent-register <id> <task> Register a running agent
pmem agent-update <id> <status> Update agent status
pmem agent-deregister <id> Unregister agent on completion
How it works
- Storage: plain JSON at
.claude/memory/project-memory.json - Locking:
O_CREAT|O_EXCLon a.locksidecar file — atomic on all major filesystems, no dependencies required - Stale locks: automatically cleared after 30 s so a crashed agent never permanently blocks others
- Root discovery: walks up from cwd looking for
.pmem-rootmarker or an existing memory file — works from any depth in a monorepo
Requirements
- Python 3.10+ (stdlib only — no dependencies)
- Claude Code (for the subagent)
License
MIT
Metadata
Release files for pmem-agent 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pmem_agent-1.0.0.tar.gz | 13.0 kB | Without provenance | Details for pmem_agent-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pmem_agent-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for pmem_agent-1.0.0-py3-none-any.whl |
Total release size: 22.9 kB
Release files / pmem_agent-1.0.0.tar.gz
| Download URL | pmem_agent-1.0.0.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
210b5040ea46bbb07cb97bde2f0e4f2c2d11d5f4ae823207a28df2f6ca4ba996
|
|
BLAKE2b-256 checksum How to use checksums |
bbe42778716046471b05657387e5c0f7f737faba97ed5efda9943026628032ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / pmem_agent-1.0.0-py3-none-any.whl
| Download URL | pmem_agent-1.0.0-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f6b245c28798ac6a2f5d7d995b0d79a3f91b9501c125d5e7de4dcd5eeda5996c
|
|
BLAKE2b-256 checksum How to use checksums |
3144c8d577bf59e10668468f4472ad487db2c3163f3c9280e52cbc77c66fb373
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Security for pmem-agent 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.