Per-repository memories with a session-injected index. Source: extensions/memory.ts.
- Memories live under
memory/in pi's agent directory (~/.pi/agent, relocated byPI_CODING_AGENT_DIR), keyed on the repository root, so subdirectory sessions and every worktree of one repository share a store (as Claude does; this is pi's own store, separate from Claude's). - The index is injected each session within Claude's 200-line/25KB bound; YAML frontmatter and block HTML comments are stripped before it counts or loads.
- A save landing near the index read limit reminds Claude to shorten it; over the limit the write still succeeds and an error tells Claude to rewrite the index, per Claude's contract. A memory written with frontmatter gets a
modified:ISO timestamp; the tool asks for Claude's documentedtypevocabulary (user/feedback/project/reference). - Honors
autoMemoryEnabled(settings) andCLAUDE_CODE_DISABLE_AUTO_MEMORY(env) to turn it off, andautoMemoryDirectory(absolute or~/) to relocate the store; managed policy settings win over the file chain. autoMemoryStorage: "claude"(user settings, project settings once the project is approved, or managed settings) selects the store Claude Code itself keeps,<claude config>/projects/<project>/memory/, read and written in place, so both tools share one set of memories. The directory is derived as Claude Code derives it (claudeMemoryDir), includingCLAUDE_CONFIG_DIR,CLAUDE_CODE_REMOTE_MEMORY_DIRandCLAUDE_CODE_PROJECT_DIR_NAME. A save from pi keeps the index in Claude's shape and gives a new file thenameanddescriptionfrontmatter Claude reads; the type is written undermetadataonly when the saved content carries atype:field. Known differences:originSessionIdis not written, a save replaces the whole file, andCLAUDE_COWORK_MEMORY_PATH_OVERRIDEis not read. An explicitautoMemoryDirectorywins over the storage mode, and nothing is moved or merged when the mode changes./memoryprints the store, index, and every documented memory-file location (user and project CLAUDE.md, CLAUDE.local.md, the.claude/CLAUDE.mdalternate), including files that do not exist yet./memory editpicks one of them and opens it in your editor, the one pi's own external editor uses (itsexternalEditorsetting, thenVISUAL, thenEDITOR), with the terminal handed over; the editor writes the file itself, so its bytes are never normalised. A symlinked file is listed with its real target. It needs the interactive UI.