{"_id":"pi-mem-cc","name":"pi-mem-cc","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"pi-mem-cc","version":"0.1.0","description":"Automatic observer-based memory for pi — silently compresses every tool call into searchable structured observations, injects relevant past context at session start.","keywords":["pi-package","pi","pi-coding-agent","memory","observer","agent"],"license":"Apache-2.0","type":"module","engines":{"node":">=20"},"scripts":{"typecheck":"tsc --noEmit"},"pi":{"extensions":["./src/index.ts"]},"peerDependencies":{"@earendil-works/pi-ai":"*","@earendil-works/pi-coding-agent":"*","typebox":"*"},"dependencies":{"better-sqlite3":"^11.3.0"},"devDependencies":{"@earendil-works/pi-agent-core":"^0.79.8","@types/better-sqlite3":"^7.6.11","@types/node":"^22.0.0","typescript":"^5.6.0"},"_id":"pi-mem-cc@0.1.0","gitHead":"215fa545179fc35fa833dcbc4411536ff7435b02","_nodeVersion":"24.10.0","_npmVersion":"11.6.0","dist":{"integrity":"sha512-VV/eJOUvGx67tSBxQwtLq7fug1jldZxQjLEqBEcR17kz5UxlcTtA2QN2dJMgwZ/RoAlOd6flIepwrRtsgj5NEg==","shasum":"919f6596e37a64eca53dc215cf0e5e0cc045556f","tarball":"https://registry.npmjs.org/pi-mem-cc/-/pi-mem-cc-0.1.0.tgz","fileCount":15,"unpackedSize":54082,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAzG26QnX/nXNCbH1coS+Fai+fOanwbUk3/FP6UJgTVKAiAYT0do3wqNkBAAsuCsKsIuHqUCVsTpkS19e+pvrj6wJA=="}]},"_npmUser":{"name":"victorchen04","email":"chenkaixuan94@outlook.com"},"directories":{},"maintainers":[{"name":"victorchen04","email":"chenkaixuan94@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-mem-cc_0.1.0_1781963759887_0.04647266457058685"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-20T13:55:59.845Z","0.1.0":"2026-06-20T13:56:00.023Z","modified":"2026-06-20T13:56:00.270Z"},"maintainers":[{"name":"victorchen04","email":"chenkaixuan94@outlook.com"}],"description":"Automatic observer-based memory for pi — silently compresses every tool call into searchable structured observations, injects relevant past context at session start.","keywords":["pi-package","pi","pi-coding-agent","memory","observer","agent"],"license":"Apache-2.0","readme":"# pi-mem-cc\n\n**Automatic observer-based memory for [pi](https://github.com/badlogic/pi-mono) coding agent.**\n\nInspired by [claude-mem](https://github.com/thedotmack/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.\n\n## What's different from `pi-memory` (jayzeng)?\n\n| | `pi-memory` | `pi-mem-cc` |\n|---|---|---|\n| Memory capture | **Manual** — agent/user calls `memory_write` | **Automatic** — every tool call observed |\n| Storage | Plain markdown files | SQLite + FTS5 |\n| Search | Optional qmd (external dep) | Built-in hybrid (keyword + recency) |\n| Injection | Agent must call `memory_read` | Auto-injected at session start |\n| Use case | Personal knowledge book | Cross-session continuity |\n\nUse both. They cover different needs.\n\n## Install\n\n```bash\npi install npm:pi-mem-cc\n```\n\nThen `/reload`.\n\n## Tools registered\n\n| Tool | Purpose | Token cost |\n|---|---|---|\n| `mem_search` | Get compact index of matching observations | ~50-100 tok/result |\n| `mem_timeline` | Get chronological context around an observation id | variable |\n| `mem_get` | Fetch full observation details by IDs | ~500-1000 tok/each |\n\n**3-layer progressive disclosure** — `search` first, `timeline` for context, `get` only for filtered IDs.\n\n## Storage\n\n```\n~/.pi/agent/memory/pi-mem-cc.db   # SQLite (observations, summaries, FTS5)\n```\n\n## How it works\n\n1. **session_start** → register session in DB\n2. **before_agent_start** → query top-K relevant past observations (recency × project match), append markdown to system prompt\n3. **tool_result** → fire-and-forget compress into `<observation>` via observer LLM, write to DB\n4. **agent_end** → fire-and-forget compress turn into `<summary>` via observer LLM, write to DB\n\nThe observer LLM uses the **same model as the active session** — no extra API key needed.\n\n## Configuration\n\nNo configuration. Uses your active session model.\n\n## License\n\nApache-2.0\n","readmeFilename":"README.md","_rev":"1-5d7e8e5cd4e6786ade9b8ed8b9458646"}