← Catalog

pi-mem-cc

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

Package

Install

Install with PiG

pig install npm:pi-mem-cc

Install with Pi

pi install npm:pi-mem-cc
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.1.0 (README.md). PiG does not review it.

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)?

(blank)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 disclosure — search 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