omp packages

pi-claude-store0.1.3

Pi extension that reads and writes Claude Code's auto-memory store, keyed the way Claude Code keys it (canonical git root, Claude Code's sanitizePath)

yg-codes Published 11 days ago MIT ~740 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-claude-store

A pi extension that reads and writes Claude Code's own memory store — the same files, so a memory saved in either agent is immediately visible to the other. Not a parallel store, not a sync job.

Derived from elecnix/pi-claude-memory (MIT, Copyright (c) 2026 Nicolas Marchildon) with the path-resolution layer ported from kuitos/opencode-claude-memory (MIT, Copyright (c) 2025 kuitos). See NOTICE for the derivation record.

What it does

Mirrors Claude Code's two-tier design, so a large store stays cheap:

  • Index injected once per session. The MEMORY.md pointer lines are added to pi's system prompt at the first turn — titles and one-line hooks only, never the bodies.
  • Bodies read on demand. memory_read fetches one memory when the index suggests it is relevant.

Tools

Tool Purpose
memory_read Read one memory by name
memory_write Save or update a memory, or delete it with an empty/null body
memory_list List every memory with its description

Tool output is compact by default and expands with ctrl+o (app.tools.expand). memory_write shows the new body — or a diff when updating — and memory_read shows the full body.

Keying: the difference from upstream

Claude Code keys the store by the canonical git root and slugifies it with sanitizePath() (every non-alphanumeric character becomes a dash, with a djb2 hash suffix past 200 characters). pi-claude-memory 0.1.x instead slugified the raw cwd with only / and . replaced, which silently splits the store whenever:

  • the path contains _, spaces, or other non-alphanumerics,
  • pi is launched from a repository subdirectory, or
  • pi runs inside a git worktree (upstream issue #14).

This extension ports Claude Code's exact resolution (sanitizePath, findGitRoot, resolveCanonicalRoot from the kuitos port, which reproduces Claude Code's own implementations byte for byte), so pi, Claude Code, and the opencode plugin all resolve the identical store directory — worktrees included.

The memory-file parser also matches Claude Code's memoryScan.ts rules: frontmatter is only recognised when the closing --- appears within the first 30 lines, and both the current metadata.type nesting and the older top-level type: layout are read.

Scoping

Memories are per-project and do not follow you between directories — the same rule that applies in Claude Code. Outside a git repository the store is keyed by the directory itself.

Install

pi install npm:pi-claude-store

Development

npm test

Tests have zero dependencies beyond Node (v22.6+ for native TypeScript stripping). They port both upstream suites — elecnix's 37 store tests and kuitos's path-resolution fixtures — and are the tripwire for Claude Code changing the on-disk memory format.

License

MIT. Contains code derived from two MIT projects; see NOTICE.