What is projectmem?
projectmem is a local-first memory and judgment layer for AI coding agents.
It records a project's issues, fix attempts (failed, partial and worked), fixes
and decisions as plain files inside the repository. At the start of each session
it gives Claude Code, Codex, Cursor, Antigravity or Claude Desktop a short summary
of what the project already learned. Before the agent edits or commits a file, it
warns when an approach on that file has already failed.
- For: developers who work with AI coding agents and are tired of re-explaining
the project, and of watching the agent retry a fix that failed last week.
- Local-first: memory lives in
.projectmem/ in your repo. No cloud, no
account, no API key, no telemetry.
- One MCP server for every project: 19 tools, set up once per client with
pjm init --agent <client>.
- Typed events, not chat logs: issue, hypothesis, attempt, fix, decision and
note. That structure is what makes the warnings possible.
- Small at session start: about 3,700 to 7,600 tokens, measured on nine real
projects.
- Open source: MIT licence, Python 3.10+, macOS, Linux and Windows. Described
in the paper arXiv:2606.12329.
https://github.com/user-attachments/assets/e055988e-7253-4ba9-92fc-95d3d4bcd763
Why AI coding agents need memory
Every new session starts from zero. The agent forgets yesterday's decisions,
retries debugging approaches that already failed, and spends thousands of tokens
re-reading source files to rebuild context it had the day before.
Telling the agent to check its notes first is not enough. On one real project,
agents looked up a file's history before only 11% of 8,355 edits, even though
their instructions asked for it every time
(measurements in #37). So
projectmem brings the lessons to the agent: right before an edit, and again at
git commit.
Git records what changed. projectmem records why: what was tried, what failed,
and what was decided.
Quick start
New to projectmem
Install projectmem
pipx install projectmem # or: pip install projectmem
Connect your AI client
cd your-project
pjm init --agent claude-code # or: codex, cursor, antigravity, claude-desktop
pjm init creates .projectmem/ and installs three git hooks. --agent adds
the projectmem MCP server to that client's config, once for every project, and
for Claude Code and Codex also the edit hook that shows a file's lessons before
each edit. Your other MCP servers and settings are left as they are.
Start a new session
Start a new session, or fully quit and reopen a desktop app: MCP servers only
load on start. Your agent then loads the project's memory itself. In each new
repository after that, pjm init is all it takes.
Rather let your AI do it? Paste this into Claude Code, Codex or Cursor:
Set up projectmem for this project: install it with `pipx install projectmem`
(or `pip install projectmem`), then run `pjm init --agent <client>` here with
the client you are running in: claude-code, codex, cursor, antigravity or
claude-desktop. Show me the output, then tell me to start a new session.
Already using projectmem? Upgrade
This works from any earlier version. Your existing MCP setup keeps working:
since 0.3.0 one MCP server serves every project.
Update projectmem
pip install -U projectmem # or: pipx upgrade projectmem
Find and register projects from older versions
pjm doctor --fix
Refresh each project
pjm init # run once in each project; your memory is kept
This refreshes the project's agent instructions and hooks.
Connect another AI client (optional)
pjm init --agent cursor # or: claude-code, codex, antigravity, claude-desktop
The clients you already set up are not touched. On Claude Code and Codex this
also installs the edit hook that shows a file's lessons before every edit, so
run it once there if you set projectmem up before 0.3.6. A client that is
already connected stays as it is, unless its entry points to an old install,
which is updated.
Check your setup with pjm doctor
pjm doctor looks where code usually lives (~/Developer, ~/code,
~/projects, cloud folders, and every drive on Windows) and reports:
- projects with memory that aren't registered yet, so the MCP server can't
reach them.
pjm doctor --fix registers them; pjm project register <path>
adds one it missed.
- registered projects whose memory is gone, such as a moved or deleted repo.
- client configs still pinned to one repository with
--root, cwd or
PROJECTMEM_ROOT, the most common reason a new project is invisible to your
agent. A pin may be deliberate, so remove it by hand.
- your version.
pjm doctor --online also checks PyPI for a newer release;
projectmem makes no network calls otherwise.
More ways in
- Another MCP client, or prefer to paste the config yourself? Run
pjm init
without --agent; it prints the config with your Python path filled in. See
Connect a client by hand.
- Coming from agentmemory or mem0?
pjm import <export.json> --from agentmemory (or --from mem0) brings your
decisions, lessons and past failures over. See
Import from another memory tool.
- Want every step with real output? Follow
the complete setup guide,
or the 15-minute TUTORIAL.md on your own
project.
What your agent sees
Right before it edits a file (Claude Code and Codex, through the edit hook):
projectmem lessons for src/auth/refresh.ts:
Open issues on this file:
- #0001 Token refresh races under parallel requests
Earlier attempts (1 failed, 1 partial), newest first:
~ Retry on 401 halves the failures (#0001, 2026-11-28)
x Wrapped the refresh call in a mutex (#0001, 2026-11-28)
Decisions on this file:
- Refresh tokens rotate per user and are never shared (2026-11-28)
Each file is shown once per session, and a file without lessons adds nothing.
Other clients get the same lessons from the precheck_file tool.
At git commit, from the pre-commit hook:
$ git commit -m "switch auth to JWT"
projectmem: Pre-Commit Check
─────────────────────────────────────────────
src/auth/middleware.py
WARN What already failed here (2 attempts):
✗ tried switching to JWT middleware (2d ago)
✗ patched session timeout to 60min (5d ago)
WARN HIGH CHURN: 5 changes in last 30 days
WARN 1 possibly-stale memory cites this file
decision [evt_9db5a3f8…] "auth uses session
cookies, 30min timeout" — predates 7 commits
Confirm it still holds, or retire it:
pjm decision "..." --supersedes <id>
─────────────────────────────────────────────
3 warning(s). Review before committing.
Need quiet for a refactor? pjm precheck --snooze 2h pauses the warnings, and
the pause itself is logged.
How projectmem helps
- Stops repeated dead ends. Failed and partial attempts are stored per file
and shown before the next edit or commit on that file, however long ago they
happened.
- Starts every session where the last one ended.
start_session() returns
the rules, the memory summary and the current plan in one call. pjm brief
gives you the same picture in one screen.
- Keeps decisions current. A decision that cites a file is checked against
that file's git history and flagged when the code has moved on. A newer
decision retires an older one with
--supersedes; nothing is ever deleted.
- Shares what the team learned. The distilled files are committed, so a
teammate's agent knows the project's history after
git clone.
- Carries library lessons across projects. Gotchas about a library live in
~/.projectmem/global/ and reach new projects that use the same stack.
- Works with agents that have no MCP.
pjm export --claude-md writes the
decisions, gotchas and a "these already failed" list into CLAUDE.md or
.cursorrules.
- Shows the history.
pjm visualize opens a local dashboard of every case
the project solved and what failed on the way, and pjm dashboard gives one
view across all your projects without copying their data anywhere.
See your project's memory
pjm visualize opens a local dashboard for one project, and pjm dashboard
opens one view across all of them. Both are built from the files in
.projectmem/ on your machine; nothing is uploaded.
How it works
your agent (MCP tools) ─┐
pjm CLI ────────────────┼──▶ .projectmem/events.jsonl ──▶ summary.md, PROJECT_MAP.md, issues/
git hooks ──────────────┘ append-only log, local distilled, small, committed
│
start_session(), precheck_file(file_path), edit hook, pre-commit ◀┘
- Capture. The agent logs work through MCP tools (
log_issue,
record_attempt, record_fix, add_decision, add_note), you can do the
same with pjm log, pjm attempt and friends, and the git hooks classify
commits and reverts. Secrets are redacted before anything touches disk.
- Distill. Every write rebuilds
summary.md and the issue files from the
append-only events.jsonl. The agent reads the small files, never the raw log.
- Use. At session start the agent loads the summary. Before an edit or a
commit, projectmem checks the file's history and warns.
Session-start cost, measured on 0.3.5 with the cl100k_base tokenizer on nine
real projects of 9 to 238 events:
| Access mode |
Tokens per session |
How it works |
| No projectmem (baseline, estimate) |
5,000 – 20,000+ |
The agent re-reads source files every session |
| MCP (recommended) |
~3,700 – 7,600 at session start |
start_session() once, then get_issue(issue_id) or precheck_file(file_path) only when relevant |
| Markdown only |
~3,700 – 7,600 |
The agent reads the three distilled files |
pjm wrap (estimate) |
500 – 2,000 |
A pre-built context block within a budget you set |
AI_INSTRUCTIONS.md is about 3,300 tokens in every project; the summary ranged
from about 400 to 3,500 tokens and the project map from about 100 to 900.
What's new in 0.3.7
- One command connects your AI client.
pjm init --agent claude-code (or
codex, cursor, antigravity, claude-desktop) writes the MCP config for
you, plus the edit hook for Claude Code and Codex.
pjm import from agentmemory and mem0. Decisions, lessons and past
failures come over; raw activity stays behind.
- Private keys are redacted whole, not just their first line. Contributed by
@bardrop
(#38).
- Backfill handles a
| in a commit message, so pjm init imports your git
history again. Reported by @Fonsi44
(#39).
Earlier releases: 0.3.6 added the edit hook and start_session(), and 0.3.0 one
MCP server for every project. Every release is in the
changelog.
How it compares
| Capability |
projectmem |
claude-mem |
agentmemory |
mem0 |
Letta |
| Core focus |
Memory + judgment |
Session capture |
Memory engine |
Chat / user memory |
Agent harness |
| Warns before a commit from a file's own failure history |
✅ |
❌ |
❌ |
❌ |
❌ |
| Checks memory for staleness against git history |
✅ |
❌ |
🟡 links sessions to commits; time decay |
❌ |
❌ |
| Failed attempts as typed events |
✅ worked / partial / failed |
🟡 bugfix type |
🟡 captures tool failures |
❌ |
❌ |
| Keeps superseded memories (no deletion) |
✅ |
? |
🟡 versioned, but decay can evict |
✅ add-only since v3 |
✅ git-versioned memory |
| Cross-project lessons |
✅ stack-scoped with a manifest |
🟡 opt-in flag |
🟡 cross-project search |
🟡 user-scoped |
🟡 per agent |
| Runs locally with no LLM API key |
✅ |
🟡 local store, LLM compression |
✅ keyless mode |
❌ self-host needs a key |
🟡 local mode |
| Native MCP server |
✅ 19 tools |
✅ |
✅ 54 tools |
🟡 hosted only |
❌ MCP client |
| Price · licence |
Free · MIT |
Free · Apache-2.0, paid Pro |
Free · Apache-2.0 |
Free tier · Apache-2.0, paid cloud |
Free tier · Apache-2.0, paid cloud |
✅ yes · 🟡 partial · ❌ not found in the project's own docs · ? not documented. Snapshot taken 2026-10-02 from each project's README, docs and changelog; design capabilities, not benchmark results. Corrections welcome — open an issue.
FAQ
Does projectmem send my code or memory to the cloud?
No. Everything stays in .projectmem/ in your repository and in
~/.projectmem/ for cross-project lessons. There is no account and no telemetry,
and the MCP server is a local process your client starts. The only network call
projectmem can make is an update check you turn on with pjm doctor --online.
Which AI coding tools does it work with?
Claude Code, Codex, Cursor, Antigravity and Claude Desktop are set up with
pjm init --agent, and any other MCP client works with the config pjm init
prints. The edit hook runs in Claude Code and Codex; other clients get the same
lessons from the precheck_file tool.
How is it different from CLAUDE.md, AGENTS.md or Cursor rules?