Long-session memory for Pi. It compresses old conversation/tool activity into compact "observations" and injects that memory back into context.
If you want the short version: install, run /om-status, and forget about it.
Put this extension at:
.pi/extensions/observational-memory/index.ts
Optional project config:
.pi/extensions/observational-memory/om-config.json
Run:
/om-status
You should see scope, observation/reflection counters, and token counts.
The extension auto-buffers turns and keeps memory in the background.
Run:
/om-observe
This is useful before a manual compaction or before switching topics.
- Observes recent turn history and tool actions.
- Compresses them into:
observationscurrentTasksuggestedResponse
- Injects memory into context on each LLM call.
- Reflects periodically to keep memory compact and clean.
- Persists state (session entries + optional SQLite).
| Command | What it does |
|---|---|
/om-status |
Show current OM state |
/om-observe |
Force observe now |
/om-observe --no-compact |
Observe now, skip compaction trigger |
/om-reflect |
Force reflection now |
/om-reflect --aggressive |
Stronger reflection/compaction |
/om-observations |
Print current memory block |
/om-config |
Show active config |
/om-config reload |
Reload config from file |
/om-config edit |
Edit config in Pi |
/om-config preset <simple|balanced|max-memory> |
Apply preset and save project config |
/om-clear |
Reset all OM state |
{
"memoryInjectionMode": "all",
"autoObservePendingTokenThreshold": 8000,
"enableReflection": true,
"reflectEveryNObservations": 3
}That’s enough for almost all use cases.
{
"memoryInjectionMode": "all",
"autoObservePendingTokenThreshold": 8000,
"enableReflection": true
}{
"memoryInjectionMode": "core_relevant",
"coreMemoryMaxTokens": 700,
"relevantObservationMaxItems": 24,
"relevantObservationMaxTokens": 1600
}{
"memoryInjectionMode": "all",
"recentTurnBudgetTokens": 16000,
"maxObservationItems": 1500
}- Project config:
.pi/extensions/observational-memory/om-config.json - Global config:
~/.pi/agent/extensions/observational-memory/om-config.json - Optional SQLite state:
~/.pi/agent/data/observational-memory.sqlite
Config load order:
- Project config
- Global config
- Code defaults
PI_OM_SCOPE=thread|resourcePI_OM_SQLITE=1PI_OM_SQLITE_PATH=/absolute/path/to/om.sqlitePI_OM_GEMINI_MODEL=gemini-2.5-flash
/om-statusshows zero progress- Run
/om-observemanually once.
- Run
- Memory feels stale
- Lower
autoObservePendingTokenThreshold(e.g. 6000).
- Lower
- Prompt cost too high
- Switch to
memoryInjectionMode: "core_relevant".
- Switch to
- Too many reflections
- Increase
reflectEveryNObservations.
- Increase
- Full config reference:
docs/config-reference.md