pi-session-memory

extensionmaintained

Local-first cross-session transcript search and native Pi session migration for Pi, Claude Code, and Codex

by — · v0.6.1 · published 4d ago

$ pi install npm:pi-session-memory
downloads/mo
0
stars
0
last push
4d ago
open issues
0

Signals

license: MITtestspi manifest: missinginstall size: —deps: 0peer deps: 0

Download trend

1.5K downloads · last 12 weeks (weekly)

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_memory for literal raw-history search that returns every match.
  • Provides fetch_session for read-only expansion of the smallest useful transcript range.
  • Synchronizes changed history at Pi session start; /memory-backfill performs 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

CommandDescription
/pi-session-memory-helperShow cross-session search and migration help.
/memory-statusShow locally indexed session and turn totals.
/memory-search <query>Search locally indexed raw transcript history.
/memory-backfillExplicitly rescan historical Pi, Claude Code, and Codex JSONL.
/project-session-migrationConvert current-project Codex sessions for /resume.
/project-claude-session-migrationConvert current-project Claude Code sessions for /resume.

Agent tools

ToolUse when
recall_memoryThe user explicitly asks about a prior discussion, or agrees to history search. Use 2–8 specific literal entities.
fetch_sessionA recall excerpt lacks needed context. Fetch the smallest useful range. It is read-only.
get_memory_statsThe user asks how much local history is indexed.
backfill_memoryThe user explicitly asks to import, backfill, or rescan history.
migrate_codex_project_sessionsThe user wants to continue current-project Codex work through /resume.
migrate_claude_project_sessionsThe 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