Skip to content

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.

Manifest entry
./pi-hermes-memory
Runtime surface
Mixed (commands, tools, shortcuts)

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 upstream PI_CODING_AGENT_DIR env var is deliberately ignored so memory never silently points at ~/.pi/agent.
  • Session search uses SQLite; the bundled better-sqlite3 runtime 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_search over an unlimited-capacity extended store, with optional target (memory, user, project, failure) and category filters.
  • session_search across past conversations, indexed automatically during the session and on shutdown, with a bounded startup backfill.
  • skill_manage for 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

  1. 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 / pathType, default, and valuesDescription
memoryModestring
Default: policy-only
How the memory policy is injected into the system prompt.
reviewEnabledboolean
Default: true
Enables background review nudges and session flush.
reviewTransportstring
Default: direct
direct (in-process completeSimple) or subprocess (pi -p) for LLM-driven memory operations.
sessionSearch.variantstring
Default: legacy
legacy snippet search or anchors mode reading session JSONL directly.

Command, tool, and shortcut controls

Key / pathDescription
/memory-insightsShow everything stored in memory and the user profile.
/memory-skillsOpen the interactive skills manager.
/memory-consolidateManually trigger memory consolidation.
/memory-interviewPre-fill the user profile with a few questions.
/memory-switch-projectList project memories and entry counts.
/memory-index-sessionsImport past Pi sessions into the search database.
/memory-sync-markdownBackfill Markdown memories into the SQLite search store.
/memory-preview-contextPreview the memory policy blocks appended to the system prompt.
/learn-memory-toolSkill that teaches how to use the memory system.

Source evidence

  • src/extensions/pi-hermes-memory/src/config.ts
  • src/extensions/pi-hermes-memory/src/tools/memory-tool.ts
  • src/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_search finds 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 / toolDescription
memory_add / memory_replace / memory_removeAgent tools for durable memory writes.
memory_searchSearch the extended memory store.
session_searchSearch past conversations.
skill_manageCreate, view, patch, update, and delete procedural skills.
/memory-insightsShow everything stored in memory and the user profile.
/memory-skillsInteractive skills manager (search, multi-select, move, delete).
/memory-consolidateManually trigger memory consolidation to free space.
/memory-interviewAnswer a few questions to pre-fill the user profile.
/memory-switch-projectList project memories and their entry counts.
/memory-index-sessionsImport past Pi sessions into the search database.
/memory-sync-markdownBackfill Markdown memories into the SQLite search store.
/memory-preview-contextPreview the memory policy blocks appended to the system prompt.
/learn-memory-toolSkill 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>/.

Source evidence

Selesai version: 0.10.0