omp packages

@yandy0725/pi-memory4.4.1

File-system driven persistent memory layer for pi coding agent

GitHub Actions Published 2 days ago MIT ~2.7K downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-memory

English | 中文

Persistent memory for the pi coding agent: project knowledge (facts, preferences, debugging history) kept as plain Markdown files, available across sessions and across harnesses. Memory lives on disk, not in the conversation.

Install

pi install npm:@yandy0725/pi-memory

Requires pi 1.5.0 or newer (@earendil-works/pi-coding-agent peer range is >=1.5.0).

Or add it to ~/.pi/agent/settings.json:

{ "packages": ["npm:@yandy0725/pi-memory"] }

Configure a model first

// ~/.pi/agent/memory.json
{ "defaults": { "model": "provider/model-id" } }

There is no bundled default model, and it does not fall back to the parent session's model: defaults.model must resolve in your registry. dream always needs it; autoSurfacing / extractMemories need it when enabled. A missing model makes session_start report a config error and initialise nothing.

What it does

  • One memory tool — add / replace / remove / list / search. One memory per file, name is the lookup key, and add with an existing name overwrites it.
  • MEMORY.md in the system prompt — the memory_index section is frozen for the whole session, so pi's section diff appends nothing per turn and the provider prefix cache keeps hitting.
  • Auto-surfacing — one lightweight side query per turn picks relevant memories and injects their bodies inside <relevant_memories>.
  • Automatic extraction (off by default) — after each turn a sub-session picks out what is worth remembering and writes it through the same tool.
  • /dream — a headless tidy-up: merge duplicates, resolve contradictions, rebuild the index.
  • /deep-dream — manual cross-project pass: reads the memory of every project (full entry bodies go to the configured model), never modifies the sources, and writes a candidate report you copy into your global AGENTS.md yourself. See the reference.
  • Cross-device sync (on by default) — push this project's memory to a git remote and share it with another machine working on the same repository (see below).
  • Runs natively on Windows; no WSL needed.

Cross-device sync (enabled by default)

Set sync.remote to push this project's memory entries to a git remote so another machine working on the same repository shares them:

// ~/.pi/agent/memory.json
{ "sync": { "remote": "git@github.com:you/project-memory.git" } }
  • No configured or initialized remote: in a git project startup reports a non-fatal sync configuration error and does not contact a remote; local memory keeps working. A non-git project only gets the unsupported-environment notice. To disable sync, set { "sync": { "enabled": false } } in memory.json.
  • There is no init command: the next session start with this config clones into <memoryDir>/.sync/repo and records a baseline.
  • Prepare the remote yourself (an empty repository is fine) and make sure git can clone/push it non-interactively — pi-memory stores no credentials.
  • Only entry *.md files sync: MEMORY.md, .lock, .backups/ and sessions/ stay local.
  • If both sides rewrite the same memory, both are kept: the other becomes a deterministic conflict copy that /dream merges later.
  • On the first sync of a project that already has local entries, expect one info notice (pi-memory sync notice: …) that same-named entries may land as conflict copies. It is not a failure and it does not repeat for that baseline.
  • Manual convergence: /memory sync pull / push / status (strict dry-run) / remote <url>.

Full semantics: cross-device sync.

Commands

Command What it does
/memory Memory dir, index capacity, entry count, module status, lock holder
/memory unlock Clear a .lock left behind by a crash
/memory sync [status|pull|push|remote <url>|unlock] Sync status and manual convergence
/dream Tidy the memory (confirms first, then snapshots the whole directory)
/deep-dream Analyze every project's memory into a candidate report (confirms first; sources stay read-only)

Full tool and argument reference: tool reference.

Where memory lives

<memoryDir>/<git|local>/<project>/

The default root is $XDG_DATA_HOME/simple-memory on Linux and macOS (~/.local/share/simple-memory when XDG_DATA_HOME is unset or relative) and %LOCALAPPDATA%\simple-memory on Windows. The disk format (entry frontmatter, MEMORY.md, .lock, .backups/) is defined by memory-core; memoryDir overrides the root, but it is per-harness configuration — with dsh, override it to the same value on that side too.

The index is frozen for the whole session: memories written this session appear in the system prompt only after a compaction or in the next session. The tool's return value is the confirmation that the write happened.

Docs

  • Reference (in Chinese): full configuration, cross-device sync, internals, tool and command reference
  • Repository: memory-core / dsh-memory and how to develop

MIT