Persistent memory
The pi-hermes-memory extension gives Selesai durable memory: facts, preferences, corrections, and reusable procedures survive across sessions, and every past conversation is searchable.
Bundled with Selesai
Loaded automatically with Selesai; no per-extension npm install is required.
Setup and prerequisites
- This extension is bundled with Selesai. It is loaded automatically; you do not need to install it separately.
- Memory is stored under the Selesai agent directory (
~/.selesai/agent/pi-hermes-memory/), routed through the host agent-dir resolver. The upstreamPI_CODING_AGENT_DIRenv var is deliberately ignored so memory never silently points at~/.pi/agent. - Session search uses SQLite; the bundled
better-sqlite3runtime dependency is installed with the package.
What it sets up
- Memory write tools (
memory_add,memory_replace,memory_remove) that the agent calls proactively when you correct it, share a preference, or reveal durable environment or project facts. memory_searchover an unlimited-capacity extended store, with optional target (memory,user,project,failure) and category filters.session_searchacross past conversations, indexed automatically during the session and on shutdown, with a bounded startup backfill.skill_managefor saving reusable procedures as Pi-native skills (global or project scope).- Background learning: a review nudge every 10 turns or 15 tool calls, correction detection that saves immediately, session flush on compact/shutdown, and auto-consolidation when memory hits its character limit.
- Secret scanning: API keys and tokens are blocked from being saved.
What you can configure
Persistent memory stores facts, preferences, corrections, and skills across sessions, with session search and configurable review/flush behavior.
Configuration locations and precedence
- Memory storage
~/.selesai/agent/pi-hermes-memory/ (agent dir)
Memory, skills, and the SQLite search store live under the Selesai agent directory; project memories are per project under projects-memory/.
Settings
| Key / path | Type, default, and values | Description |
|---|---|---|
memoryMode | string Default: policy-only | How the memory policy is injected into the system prompt. |
reviewEnabled | boolean Default: true | Enables background review nudges and session flush. |
reviewTransport | string Default: direct | direct (in-process completeSimple) or subprocess (pi -p) for LLM-driven memory operations. |
sessionSearch.variant | string Default: legacy | legacy snippet search or anchors mode reading session JSONL directly. |
Command, tool, and shortcut controls
| Key / path | Description |
|---|---|
/memory-insights | Show everything stored in memory and the user profile. |
/memory-skills | Open the interactive skills manager. |
/memory-consolidate | Manually trigger memory consolidation. |
/memory-interview | Pre-fill the user profile with a few questions. |
/memory-switch-project | List project memories and entry counts. |
/memory-index-sessions | Import past Pi sessions into the search database. |
/memory-sync-markdown | Backfill Markdown memories into the SQLite search store. |
/memory-preview-context | Preview the memory policy blocks appended to the system prompt. |
/learn-memory-tool | Skill that teaches how to use the memory system. |
Source evidence
src/extensions/pi-hermes-memory/src/config.tssrc/extensions/pi-hermes-memory/src/tools/memory-tool.tssrc/extensions/pi-hermes-memory/src/tools/session-search-tool.ts
What you can do
- Ask in plain language:
What did we discuss about auth?—session_searchfinds it instantly. - Correct the agent and have the correction saved as a durable lesson.
- Inspect everything stored:
/memory-insights. - Manage skills interactively:
/memory-skills. - Pre-fill your user profile:
/memory-interview. - Import past sessions and backfill Markdown memories:
/memory-index-sessions,/memory-sync-markdown. - Preview what memory context is injected into the system prompt:
/memory-preview-context.
Commands, tools, and shortcuts
| Command / tool | Description |
|---|---|
memory_add / memory_replace / memory_remove | Agent tools for durable memory writes. |
memory_search | Search the extended memory store. |
session_search | Search past conversations. |
skill_manage | Create, view, patch, update, and delete procedural skills. |
/memory-insights | Show everything stored in memory and the user profile. |
/memory-skills | Interactive skills manager (search, multi-select, move, delete). |
/memory-consolidate | Manually trigger memory consolidation to free space. |
/memory-interview | Answer a few questions to pre-fill the user profile. |
/memory-switch-project | List project memories and their entry counts. |
/memory-index-sessions | Import past Pi sessions into the search database. |
/memory-sync-markdown | Backfill Markdown memories into the SQLite search store. |
/memory-preview-context | Preview the memory policy blocks appended to the system prompt. |
/learn-memory-tool | Skill that teaches how to use the memory system. |
Limits and safety
- Core Markdown memory is size-limited; when full and consolidation cannot free space, the write fails rather than silently spilling into SQLite-only storage.
- Secrets are blocked from being saved by content scanning.
- Session search is bounded per startup for the incremental backfill; bulk imports are available manually.
- Memory and skills live under the Selesai agent directory; project memories are stored per project under
~/.selesai/agent/projects-memory/<project>/.