Updated
The best memory for Pi in 2026
The best memory for Pi is Glen if more than one person, or more than one agent, works in the codebase, and pi-memory if you work alone and want Markdown notes that stay on your machine. Pi has no memory of past sessions built in. It keeps its core small and expects packages to add the rest, and its docs describe no memory feature. Glen's Pi package subscribes to Pi's lifecycle events, so it records every finished turn into one memory your org shares and adds the matching memories to each prompt before the model runs.
What Pi does ship is context files and saved sessions. It loads AGENTS.md or CLAUDE.md from ~/.pi/agent/, the working directory and every parent directory, and it writes each conversation to a JSONL file under ~/.pi/agent/sessions/ that you can resume, branch or compact. One fact in older comparisons is out of date: Pi had no built-in MCP support until version 0.99.0, released 2026-09-29, and now connects to stdio and Streamable HTTP servers with OAuth, so a memory tool that only offers an MCP server can reach Pi too. We compared six options on what each records from a Pi session, when recall reaches the model, and who else can read it.
Short answer
- A team, or several agents, on one codebase
- Glen
- Stable instructions with nothing to install
- AGENTS.md
- Solo, notes as Markdown files on your machine
- pi-memory
- One local store that Pi and your other agents share
- Engram
- Capture that doesn't wait for the agent to save
- Hindsight or Mem0
Pi memory tools at a glance
| # | Tool | Connects via | Captures | Team sharing | Price |
|---|---|---|---|---|---|
| 01 | Pi package (extension) plus a CLI | Every turn, automatically | Whole orgOrg-wide, filtered per user at recall | Free for 15,000 memories, no card | |
| 02 | Built in | Sessions saved as JSONL; nothing carried into a new session | Repo filesAGENTS.md through git; sessions stay on one machine | Free | |
| 03 | Pi package (pi install npm:pi-memory) | Notes the agent writes, plus a summary when you quit | One personOne machine; plain files under ~/.pi/agent/memory/ | Free, runs locally | |
| 04 | Pi package (gentle-engram), installed by engram setup pi | Prompts and compaction summaries automatically; observations when the agent saves | Shared spacesLocal SQLite; Git sync or a self-hosted Engram Cloud | Free; Engram Cloud is self-hosted | |
| 05 | Extension added by Hindsight's installer | Sessions written back automatically; git history seeded | Shared spacesOne bank per repo across agents; cloud, self-hosted or local | Free self-hosted; Cloud pay as you go, $5 credit | |
| 06 | Pi package (@mem0/pi-agent-plugin) | Automatic after each run; recall before each response | Shared spacesPer user, scoped to project, session or global | Free tier; paid is usage-based or custom |
How we ranked them
- Records Pi turns. A Pi extension can subscribe to before_agent_start, agent_settled and tool_result. A package built on those events records without the model deciding to; one that only registers tools stores what the agent chooses to write down.
- When recall reaches the model. before_agent_start can inject a message or change the system prompt before a run starts. Some packages use it on every prompt, some once per session, and some leave recall to a search tool the agent has to call.
- Leaves the machine. Pi's sessions live under ~/.pi/agent/sessions/ and most Pi memory packages write to a folder next to it. We checked whether a second laptop, or a teammate's agent, can read what was stored.
- Crosses agents. Many Pi users also run Claude Code, Codex or OpenCode. A fix found in one of them only helps the others if they read the same memory.
- Install route and price. Whether it installs with pi install, a vendor installer or an MCP entry, and the first paid tier, from each vendor's pricing page as of November 2026.
The 6 best memory tools for Pi

Glen
Our pickBest for: Teams where Pi runs next to Claude Code, Codex or Cursor on the same codebase.

tryglen.com - Connects to Pi
- Pi package (extension) plus a CLI
- Captures
- Every turn, automatically
- Shared with your team
- Org-wide, filtered per user at recall
Pi has no hooks file, so Glen's package, @tryglen/pi, is an extension that subscribes to Pi's lifecycle events and runs one glen CLI command per event. On before_agent_start it sends your prompt and workspace context (repo, branch, agent name) to your Glen org and injects the matching memories as a hidden message before the model runs. On agent_settled it records the finished turn: your prompt and the final answer. A bash tool_result that follows git commit links the commit to the session, which is how glen code-search takes a line of code back to the conversation that wrote it. Every command fails open, so a Glen outage can't block a pi session.
What gets recorded belongs to the org, not to ~/.pi on one laptop. Pi turns share one store with teammates' Claude Code, Codex and Cursor sessions and with public Slack channels, GitHub, tickets, docs and call transcripts from Fireflies, Fathom and Granola. Access control runs per observation at recall, and when a newer decision contradicts an older one the older one stops surfacing. We have not benchmarked Pi. Our published numbers come from Codex, where the plugin injects recall the same way: replaying the last 100 merged PRs of a workspace with Codex 5.5, runs with Glen used 29% fewer tokens and reached a merged change 21% faster.
Strengths
- Recall is in context before the model reads each prompt
- One memory shared with Claude Code, Codex and Cursor sessions
- glen incognito keeps recall and records nothing; glen off stops both
- The package also ships Glen's skills, available in pi as /skill:<name>
Limits
- Hosted only; there is no self-hosted build
- The extension needs the glen CLI installed next to pi
- Pays off once two or more people, or two agents, record into it
Managed service · Free for 15,000 memories, no card
Set up Glen in Pi →
Pi AGENTS.md + saved sessions
Best for: Instructions every pi session should load, and picking up yesterday's conversation.

pi.dev - Connects to Pi
- Built in
- Captures
- Sessions saved as JSONL; nothing carried into a new session
- Shared with your team
- AGENTS.md through git; sessions stay on one machine
Pi doesn't learn from one session to the next. What it loads on every run is context files. In ~/.pi/agent/, then in each directory from the filesystem root down to where you started pi, it takes the first of AGENTS.override.md, AGENTS.md or CLAUDE.md that it finds and adds the contents to the system prompt. They load even in a project you haven't trusted, the docs name no size cap, and --no-context-files turns them off. SYSTEM.md and APPEND_SYSTEM.md, in ~/.pi/agent/ or a project's .pi/ folder, replace or extend the system prompt itself.
Sessions are the other half. Every conversation is saved as a JSONL file under ~/.pi/agent/sessions/, grouped by working directory, unless you pass --no-session. pi --continue reopens the latest session for the current directory and /resume opens a picker. Entries are stored as a tree, so /tree, /fork and /clone branch from an earlier point without losing the path you left. When context comes within 16,384 tokens of the model's window (the default), Pi compacts: it summarises older messages, keeps roughly the last 20,000 tokens, and leaves the original entries in the file. All of that continues one conversation. A new session starts with the context files and nothing else.
Strengths
- Free, MIT-licensed and already there
- Reads an existing CLAUDE.md where there is no AGENTS.md
- Sessions resume, branch and compact without losing the original entries
Limits
- Nothing from a past session reaches a new one
- Context files hold only what someone writes by hand
- Session files stay on the machine that wrote them
Built into Pi (MIT) · Free
Visit pi.dev ↗
pi-memory
Best for: Solo developers who want Pi to keep notes as Markdown files they can read and edit.

github.com - Connects to Pi
- Pi package (pi install npm:pi-memory)
- Captures
- Notes the agent writes, plus a summary when you quit
- Shared with your team
- One machine; plain files under ~/.pi/agent/memory/
With about 95,000 npm downloads in the past month, pi-memory was the most-downloaded memory package we found in Pi's gallery at pi.dev/packages. It stores everything as Markdown under ~/.pi/agent/memory/: MEMORY.md for long-term facts, SCRATCHPAD.md for open items, and a daily/ folder of append-only logs. The agent writes through memory_write and scratchpad tools, an LLM call writes an exit summary when you quit, and a handoff note is saved when Pi compacts. At session start the scratchpad, today's and yesterday's logs and MEMORY.md go into the system prompt, capped at 16,000 characters, and by default they aren't re-rendered on each turn, so the prompt cache holds.
Search is optional. memory_search needs qmd installed, and then offers keyword, semantic and hybrid modes over the same files. The default directory is one per user, so notes from every repo land in the same files. It's MIT-licensed with about 230 GitHub stars and costs nothing. There is no sync or team layer beyond committing the files yourself.
Strengths
- Plain Markdown you can read, edit and commit
- No account and no server; qmd is optional
- memory_forget keeps a recovery record that memory_restore can undo
Limits
- One machine and one person
- Stores what the agent writes down, not every turn
- Search needs qmd installed separately
Open source (MIT) · Free, runs locally
Visit github.com ↗
Engram
Best for: Developers who want one local memory that Pi, Claude Code, Codex and OpenCode all read and write.

engram.gentlemanprogramming.com - Connects to Pi
- Pi package (gentle-engram), installed by engram setup pi
- Captures
- Prompts and compaction summaries automatically; observations when the agent saves
- Shared with your team
- Local SQLite; Git sync or a self-hosted Engram Cloud
A single Go binary with SQLite and FTS5 full-text search holds Engram's memory at ~/.engram/engram.db, and Pi is one of the 14 agents its setup command targets. engram setup pi installs gentle-engram, a Pi package that talks to a local Engram server over HTTP and gives the agent native mem_* tools, so Engram needs no MCP entry in Pi. The extension captures each prompt longer than 10 characters at before_agent_start, scans tool results for structured learnings, and archives Pi's compaction summary so the next turn can recover it.
Recall is up to the model. The package adds a Memory Protocol to the system prompt that tells it to call mem_context and mem_search, and to save decisions and root causes with mem_save, so what's stored is a set of curated topics and not a transcript. Sharing is opt-in: Git sync exports compressed chunks, and Engram Cloud is a server you host yourself. Engram is MIT-licensed with about 8,300 GitHub stars, and it's free, funded through GitHub Sponsors.
Strengths
- Free and local under MIT
- One store for Pi, Claude Code, Codex, OpenCode and other agents
- Pi's compaction summary is archived and handed back on the next turn
Limits
- Recall and most saves depend on the model following the protocol
- Team sharing means running Git sync or your own Engram Cloud server
- Needs the engram binary as well as the Pi package
Open source (MIT) · Free; Engram Cloud is self-hosted
Visit engram.gentlemanprogramming.com ↗
Hindsight
Best for: Developers who want sessions and git history ingested with no save step.

hindsight.vectorize.io - Connects to Pi
- Extension added by Hindsight's installer
- Captures
- Sessions written back automatically; git history seeded
- Shared with your team
- One bank per repo across agents; cloud, self-hosted or local
Hindsight ingests without being asked: its coding-agents package writes each session back to a memory bank and seeds that bank from the repo's git history in the background. For Pi, npx @vectorize-io/hindsight-coding-agents install pi adds an extension entry to ~/.pi/agent/settings.json and a companion skill in ~/.pi/agent/skills, with native hindsight_* tools and no MCP. That installer is the only supported route; Hindsight's docs say pi install is deliberately not set up for it. By default the extension injects one memory synthesis on the first prompt of a session and refreshes a list of Hindsight's curated pages on each turn; the agent reads or searches those pages with its tools.
Memory is one bank per repository, shared by every agent Hindsight is installed in, so what Pi picks up in a repo is there for Claude Code or Codex in the same repo. The installer asks where the bank lives: Hindsight Cloud, a server you run, or a local daemon. Hindsight is MIT-licensed with about 63,400 GitHub stars. Cloud accounts start with $5 of credit and then pay by usage, with no monthly or per-seat fee, and self-hosting is free. The coding-agents docs cover sharing a bank between agents and repos, not access rules between teammates.
Strengths
- Sessions and commits are ingested with no save step
- One bank per repo, shared with the other agents you run
- MIT, with cloud, self-hosted and local daemon options
Limits
- The memory synthesis is injected once per session by default; later recall is a tool call
- Cloud use is metered by tokens
- Local daemon mode needs uv and an LLM key for extraction
Open source (MIT) · Free self-hosted; Cloud pay as you go, $5 credit
Visit hindsight.vectorize.io ↗
Mem0
Best for: Teams that already use Mem0 as the memory layer in their own product.

mem0.ai - Connects to Pi
- Pi package (@mem0/pi-agent-plugin)
- Captures
- Automatic after each run; recall before each response
- Shared with your team
- Per user, scoped to project, session or global
Mem0 publishes an official Pi package, and it does both halves on its own: before an agent response it searches the project's memories and injects the relevant ones, and after agent_end it sends the user and assistant text to Mem0, which extracts facts from it. pi install npm:@mem0/pi-agent-plugin adds the package. It needs a MEM0_API_KEY from app.mem0.ai, set in the environment or in ~/.pi/agent/mem0-config.json. The agent also gets a mem0_memory tool, and six slash commands, among them /mem0-search, /mem0-remember and /mem0-forget, let you manage memories by hand.
Project scope is the default and is keyed to the git root, so every subdirectory of a monorepo shares one pool; session and global scopes are available when you want them. The Mem0 project is Apache 2.0 with about 69,500 GitHub stars, though the Pi package is young, with about 500 npm downloads in the past month. Hosted pricing is a free tier metered in adds and retrievals, then usage billing or a custom contract, with graph memory on the Custom plan. Memories belong to a user ID, and Mem0's docs don't describe sharing them across a team.
Strengths
- Recall and capture both run without the agent calling a tool
- Installs with pi install; Apache 2.0
- One SDK for Pi and for code you write against Mem0
Limits
- Needs a Mem0 API key from the hosted platform
- No published paid price for new accounts
- Team sharing isn't described
Open source (Apache 2.0) · Free tier; paid is usage-based or custom
Visit mem0.ai ↗
Set up Glen in Pi
Glen goes into Pi as a Pi package whose extension calls the glen CLI. You need Node.js and a Glen account; the free plan covers 15,000 memories with no card.
1. Install the CLI and sign in
The extension runs a glen command on each Pi event, so install the CLI globally and sign in first.
bashnpm install -g @tryglen/cli glen login2. Add the package to pi
glen install runs this step for you when it detects pi. Afterwards restart pi, or run /reload in an open session, and check that pi list includes npm:@tryglen/pi.
bashpi install npm:@tryglen/pi3. Work, then check what it recalls
From the next prompt, matching memories are injected before the model runs and each finished turn is recorded. glen status shows the active org and mode, and you can search memory yourself from the terminal.
bashglen search "why the retry queue caps at five attempts"
Which one should you pick?
Pi leaves memory out of its core, so the first decision is whether you need any. For rules that rarely change, AGENTS.md is enough, and pi --continue covers picking up where you stopped. If you work alone and want Pi to remember across sessions, pi-memory keeps notes in Markdown you can open, and Engram is the next step when your other agents should read the same local store. Hindsight and Mem0 capture without the agent deciding to save, in exchange for a service you run or pay for.
None of those reach a teammate unless you run a sync or a server for it. Glen's Pi package is built on the same extension events the local packages use. It records every teammate's turns into one org memory next to their Claude Code, Codex and Cursor sessions, Slack and GitHub, and injects what matches before each prompt, filtered to what each person is cleared to see. If you're the only person and Pi is your only agent, that store has little in it yet, and a local package will serve you better.
FAQ
- Does Pi have memory?
- Not across sessions. Pi loads context files (AGENTS.md or CLAUDE.md) on every run and saves each conversation so you can resume it with pi --continue or /resume, but a new session knows nothing about earlier ones. Its docs describe no memory feature; that comes from a Pi package such as pi-memory, Engram's gentle-engram, Mem0's plugin or Glen's @tryglen/pi.
- Where does Pi store sessions?
- As JSONL files under ~/.pi/agent/sessions/, grouped by working directory. Change the location with --session-dir, the PI_CODING_AGENT_SESSION_DIR environment variable or the sessionDir setting, and pass --no-session for a run that isn't saved.
- Does Pi read CLAUDE.md?
- Yes. In each directory Pi takes the first of AGENTS.override.md, AGENTS.md or CLAUDE.md, so a CLAUDE.md is read wherever there is no AGENTS.md beside it. It checks ~/.pi/agent/ first, then every directory from the filesystem root down to the working directory.
- Does Pi support MCP?
- Yes, since version 0.99.0, released 2026-09-29. Pi connects to stdio and Streamable HTTP servers with OAuth, reads them from ~/.pi/agent/mcp.json and a trusted project's .pi/mcp.json, and adds them with pi mcp add. The legacy SSE transport is rejected. Before that release MCP came from extensions such as pi-mcp-adapter, which still replaces the built-in support if it is installed.
- Does Glen record my Pi sessions?
- Yes. With @tryglen/pi installed, each finished turn is recorded on Pi's agent_settled event and matching memories are injected on before_agent_start. Run glen incognito to keep recall and record nothing, or glen off to stop both.
- Do claude-mem and Supermemory work with Pi?
- claude-mem has an installer target for it: npx claude-mem install --ide pi places an extension in ~/.pi/agent/extensions/claude-mem/. Its docs say automatic capture was source-reviewed for Pi 1.0.2 and 1.0.4 and that other versions need a compatibility check; Pi was at 1.6.1 on 2026-11-25. We found no official Supermemory package for Pi. The Pi packages on npm that use Supermemory are community projects.