pi-session-memory
Local-first cross-session transcript search and native Pi session migration for Pi, Claude Code, and Codex
Package details
Install pi-session-memory from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-session-memory- Package
pi-session-memory- Version
0.6.1- Published
- Sep 22, 2026
- Downloads
- 1,276/mo · 1,276/wk
- Author
- shengxiao04
- License
- MIT
- Types
- extension
- Size
- 56 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-session-memory
Install
pi install npm:pi-session-memory
A local-first Pi extension for on-demand cross-session transcript search across Pi, Claude Code, and Codex, plus native project-session migration to Pi /resume sessions.
What it does
- Indexes local Pi, Claude Code, and Codex JSONL transcript turns in local SQLite.
- Provides
recall_memoryfor literal raw-history search that returns every match. - Provides
fetch_sessionfor read-only expansion of the smallest useful transcript range. - Synchronizes changed history at Pi session start;
/memory-backfillperforms an explicit full rescan. - Migrates current-project Claude Code or Codex sessions into separate native Pi sessions.
- Matches equivalent Windows project CWDs during migration, including
\\versus/, drive-letter case, and trailing separators.
Search results are derived from stored source transcripts only and are never automatically injected into model context. Put project rules and preferences in AGENTS.md.
Commands
| Command | Description |
|---|---|
/pi-session-memory-helper |
Show cross-session search and migration help. |
/memory-status |
Show locally indexed session and turn totals. |
/memory-search <query> |
Search locally indexed raw transcript history. |
/memory-backfill |
Explicitly rescan historical Pi, Claude Code, and Codex JSONL. |
/project-session-migration |
Convert current-project Codex sessions for /resume. |
/project-claude-session-migration |
Convert current-project Claude Code sessions for /resume. |
Agent tools
| Tool | Use when |
|---|---|
recall_memory |
The user explicitly asks about a prior discussion, or agrees to history search. Use 2–8 specific literal entities. |
fetch_session |
A recall excerpt lacks needed context. Fetch the smallest useful range. It is read-only. |
get_memory_stats |
The user asks how much local history is indexed. |
backfill_memory |
The user explicitly asks to import, backfill, or rescan history. |
migrate_codex_project_sessions |
The user wants to continue current-project Codex work through /resume. |
migrate_claude_project_sessions |
The user wants to continue current-project Claude Code work through /resume. |
Flow
session_start -> syncChangedHistory() -> SQLite raw transcript index
recall_memory -> matching raw transcript turns -> fetch_session (optional, read-only)
project migration command/tool -> native Pi session JSONL -> /resume
History remains on the local machine, by default in ~/.pi/agent/memory.db. Deleting that database removes only the index; restarting Pi rebuilds it from local source JSONL files.
Migration compatibility
Migration selects sessions whose recorded project CWD is equivalent to the current Pi project CWD. On Windows, C:\\Work\\app\\, C:/Work/app, and differences only in path letter case are treated as the same project. Migrated sessions are written using the current Pi project CWD, so they appear under that project in /resume.
Development
npm test # core database, raw recall, importer, and migration regression suite