This guide is for agent authors/operators using Pi-Memory in Pi workflows.
If pi-memory is not on PATH, use the installed binary directly:
- macOS / Linux:
~/.pi/memory/pi-memory - Windows:
%USERPROFILE%\.pi\memory\pi-memory.exe
If you want one portable override, set PI_MEMORY_BIN.
- Log decisions when choices are made, not at the end of the week.
- Log findings with source and confidence whenever possible.
- Log lessons immediately after the fix is confirmed.
- Keep entities high-signal.
- Sync
MEMORY.mdbefore or after major compaction/handoff points. - Use
--projectexplicitly when project attribution matters more than convenience. - Keep
--session-idwhen you care about traceability back to Pi sessions.
pi-memory state <project>
pi-memory query --type decision --limit 10
pi-memory search "keyword"
pi-memory sync MEMORY.md --limit 15pi-memory log decision "Adopt X" \
--choice "Use X in the production path" \
--rationale "Lower complexity and proven behavior" \
--tags "architecture"pi-memory log finding "SDK exposes model_select event" \
--source "docs/extensions.md" \
--category "architecture" \
--confidence verifiedpi-memory log lesson "Compaction resumed without user intent" \
--why "Intent was not captured before compaction" \
--fix "Store last non-command input and resume with it"pi-memory log entity "SessionManager" \
--type concept \
--description "Pi session tree manager"Pi-Memory auto-detects project names from:
PI_MEMORY_PROJECT- git remote name / repo context
- working directory basename
The extension also uses the MEMORY.md header when present.
When accuracy matters more than convenience, prefer:
pi-memory sync MEMORY.md --project my-project
pi-memory state my-project
pi-memory ingest-session session.jsonl --project my-projectpi-memory ingest-session ~/.pi/agent/sessions/.../session.jsonl --dry-run
pi-memory ingest-session ~/.pi/agent/sessions/.../session.jsonl
pi-memory sessions --limit 20Recommended review pattern:
- dry-run first
- inspect extracted counts
- ingest for real if signal quality looks reasonable
- query recent decisions/findings/lessons/entities
- clean up noisy records if needed
/compact-threshold
/compact-threshold 75%
/compact-threshold reset
/compact
Optionally record the change in memory:
pi-memory state <project> --summary "Compaction threshold set to 75%"Before ending a session, ask:
- searchability — can critical terms be found via
search? - traceability — do important records carry
--session-id? - continuity — is
MEMORY.mdsynced if the repo uses it? - signal quality — did we avoid noisy/duplicate entity spam?
- project correctness — do records belong to the intended project?
pi-memorynot found- use the absolute binary path or set
PI_MEMORY_BIN
- use the absolute binary path or set
- wrong project name
- pass
--projectexplicitly - or set
PI_MEMORY_PROJECT
- pass
MEMORY.mddidn’t update- verify the marker pairs exist exactly
- ingest extracted noisy records
- use
--dry-runfirst and review counts before writing
- use