pi-mem-cc

extension

Automatic observer-based memory for pi — silently compresses every tool call into searchable structured observations, injects relevant past context at session start.

by · v0.1.0 · published 1mo ago

$ pi install npm:pi-mem-cc
downloads/mo
106
stars
last push
open issues

Signals

license: Apache-2.0testspi manifest: missinginstall size: —deps: 0peer deps: 0

Download trend

287 downloads · last 12 weeks (weekly)

README

pi-mem-cc

Automatic observer-based memory for pi coding agent.

Inspired by claude-mem for Claude Code, but built natively for pi's extension API. Silently watches every tool call, compresses it into a structured observation, stores it in SQLite, and re-injects relevant past context at session start.

What's different from pi-memory (jayzeng)?

pi-memorypi-mem-cc
Memory captureManual — agent/user calls memory_writeAutomatic — every tool call observed
StoragePlain markdown filesSQLite + FTS5
SearchOptional qmd (external dep)Built-in hybrid (keyword + recency)
InjectionAgent must call memory_readAuto-injected at session start
Use casePersonal knowledge bookCross-session continuity

Use both. They cover different needs.

Install

pi install npm:pi-mem-cc

Then /reload.

Tools registered

ToolPurposeToken cost
mem_searchGet compact index of matching observations~50-100 tok/result
mem_timelineGet chronological context around an observation idvariable
mem_getFetch full observation details by IDs~500-1000 tok/each

3-layer progressive disclosuresearch first, timeline for context, get only for filtered IDs.

Storage

~/.pi/agent/memory/pi-mem-cc.db   # SQLite (observations, summaries, FTS5)

How it works

  1. session_start → register session in DB
  2. before_agent_start → query top-K relevant past observations (recency × project match), append markdown to system prompt
  3. tool_result → fire-and-forget compress into <observation> via observer LLM, write to DB
  4. agent_end → fire-and-forget compress turn into <summary> via observer LLM, write to DB

The observer LLM uses the same model as the active session — no extra API key needed.

Configuration

No configuration. Uses your active session model.

License

Apache-2.0