pi-claude-memory
Pi extension that reads and writes Claude Code's auto-memory store, so both agents share one memory
Package details
Install pi-claude-memory from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-claude-memory- Package
pi-claude-memory- Version
0.1.1- Published
- Aug 10, 2026
- Downloads
- 70/mo · 0/wk
- Author
- elecnix
- License
- MIT
- Types
- extension
- Size
- 22.9 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./extensions"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-claude-memory
A pi extension that reads and writes Claude Code's own memory store. Not a parallel store, not a sync job — the same files, so a memory saved in either agent is immediately visible to the other.
Why
Claude Code keeps one memory per file under
~/.claude/projects/<cwd-slug>/memory/, with a MEMORY.md index holding one
pointer line per memory. Cross-agent memory tools generally stand up a new
store and teach both agents to use it, which leaves your existing memories
behind and gives Claude Code two memory systems at once. This extension just
uses the directory that is already there.
What it does
Mirrors Claude Code's two-tier design, so a large store stays cheap:
- Index injected once per session. The
MEMORY.mdpointer lines are added to pi's system prompt at the first turn — titles and one-line hooks only, never the bodies. - Bodies read on demand.
memory_readfetches one memory when the index suggests it is relevant.
Tools
| Tool | Purpose |
|---|---|
memory_read |
Read one memory by name |
memory_write |
Save or update a memory, registering it in the index |
memory_list |
List every memory with its description |
Tool output is compact by default and expands with ctrl+o
(app.tools.expand), matching pi's built-in tools: memory_write shows the
new body — or a diff against the previous body when updating an existing
memory — and memory_read shows the full body in place of the one-line
description.
Install
pi install npm:pi-claude-memory
Or install from a specific Git ref (e.g. a branch or tag):
pi install git:github.com/elecnix/pi-claude-memory@v0.1.1
Or load it directly for a one-off:
pi -e /path/to/pi-claude-memory/extensions/claude-memory/index.ts
Scoping
The memory directory is a function of the working directory: Claude Code
slugifies the absolute path by replacing / and . with -. So
/Users/you/Source/app.git maps to
~/.claude/projects/-Users-you-Source-app-git/memory/.
This means memories do not follow you between projects — the same rule that applies in Claude Code. Starting pi in a different directory gives you a different store.
File format
Written files match what Claude Code writes, so both agents parse them:
---
name: prefers-tabs
description: Uses tabs, not spaces
metadata:
node_type: memory
type: feedback
---
Indent with tabs in this project.
**Why:** The user said so.
**How to apply:** Match tabs when editing.
type is one of user, feedback, project, or reference.
Development
npm test
Tests cover the store logic and depend on nothing but Node — pi and typebox are only needed to run the extension itself.
Prior art
There is a healthy ecosystem of memory extensions for pi. Every one of them gives pi its own memory. This extension exists because none of them read the store Claude Code already writes.
Cross-agent memory layers
These advertise both Claude Code and pi, and are the closest existing options.
Both work by standing up a new shared store that each agent is taught to
use — neither reads ~/.claude/projects/*/memory/. If you want one store
across many agents and are willing to migrate, prefer these over this
extension; they are far more capable.
- memorix — cross-agent memory layer
over MCP, supporting Claude Code, Codex, Cursor, Gemini CLI, pi, and more.
Ships a genuine pi package
with a session-hook extension and skills, not just MCP compatibility. Stores
in
~/.memorix/data/. The most complete option in this space. - paxm — provider-neutral persistent memory in Go, for Codex, Claude Code, OpenCode, pi, and MCP clients. Its pi support is generic MCP; there is no pi-specific integration code.
Memory extensions for pi
Each keeps its own store, in its own format:
- VandeeFeng/pi-memory-md —
the closest relative in format: markdown files with
descriptionfrontmatter, much like Claude Code's. Uses its owncore/user/directory layout, so it cannot be pointed at a Claude Code memory directory as-is. - samfoy/pi-memory — learns corrections, preferences, and patterns from sessions.
- jayzeng/pi-memory — daily logs, scratchpad, optional semantic search.
- chandra447/pi-hermes-memory — Hermes-style persistent memory and learning loop.
- elpapi42/pi-observational-memory — observational memory aimed at making sessions feel endless.
- k0valik/pi-blackhole — combines algorithmic compaction with observational memory.
Related
- elecnix/pi-subagents — supports
opt-in per-agent persistent memory under a dedicated
agent-memory/namespace, scoped to a recurring custom agent rather than to a project.
Sources
- pi extensions documentation
— the
before_agent_startsystem-prompt hook,registerTool, andwithFileMutationQueue, which this extension uses to keep concurrent index writes from clobbering each other. - pi context files
— pi already discovers
AGENTS.mdandCLAUDE.md, so instruction files are shared between the two agents out of the box. Memory files are not, which is the gap this fills. - Claude Code memory documentation
—
CLAUDE.mddiscovery and precedence.
The on-disk memory layout this extension targets (MEMORY.md index plus one
file per memory, with name/description/metadata.type frontmatter) is not
formally documented. It was derived by reading a live store, and is pinned by
the tests in tests/. It may change without notice.
License
MIT