npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@husniadil/pi-mem

v0.1.0

Published

Pi extension that bridges to claude-mem for persistent cross-session memory

Readme

@husniadil/pi-mem

npm version CI License: MIT Node

Pi extension that bridges to claude-mem for persistent cross-session memory. Mirrors Claude Code's memory UX inside pi: auto-injects context at session start (with TUI banner), captures pi events as observations, and exposes the full 3-layer memory workflow (mem_searchmem_timelinemem_get_observations) to the agent.

Important: Maintainer Non-Support

claude-mem's maintainer has explicitly declined to add first-class pi support. This package uses claude-mem's rawAdapter fallback (default: return rawAdapter in src/cli/adapters/index.ts) — a switch fallback, not a public API. Any breaking change in claude-mem can break pi-mem with no notice. Pin to claude-mem 13.x and don't file pi-mem bugs against claude-mem.

Prerequisites

  • claude-mem installed (npx claude-mem install)
  • Node ≥ 22
  • pi ≥ 0.74

Install

pi install npm:@husniadil/pi-mem

Restart pi. The extension auto-loads.

How It Works

  1. session_start: pi-mem verifies claude-mem is installed, starts the worker if needed, fetches recent observations via worker-service.cjs hook pi context, and displays the TUI banner via ctx.ui.notify(...).
  2. before_agent_start (every turn): re-injects the cached context into systemPrompt, wrapped in <claude-mem-context>...</claude-mem-context>. Identical content across turns → LLM prompt cache hits.
  3. message_end / tool_result / agent_end: fire-and-forget subprocess spawns to log events as claude-mem observations.
  4. Agent tools (HTTP to claude-mem worker — mirrors the Claude Code MCP 3-layer workflow):
    • mem_search({query, limit?})GET /api/search. Returns a categorized markdown table of matching observations/sessions/prompts with IDs in | #<id> | cells. Limit caps each category, so total results can be up to 3× limit.
    • mem_timeline({anchor?|query?, depth_before?, depth_after?, project?})GET /api/timeline. Step 2 of the workflow: returns N items before/after an anchor for context. Anchor accepts observation ID (number), session ID (S<id>), or ISO timestamp. XOR with query — provide one or the other, not both. Defaults: depth_before=10, depth_after=10.
    • mem_get_observations({ids, orderBy?, limit?, project?})POST /api/observations/batch. Step 3: fetch the full 23-field records (title, narrative, facts, files_modified, etc.) for IDs surfaced by mem_search. Output is raw JSON (matches Claude Code's MCP get_observations 1:1). Non-existent IDs silently dropped.

Configuration

Pi-mem-specific env vars (genuinely pi-specific):

| Env Var | Default | Notes | | ------------------------- | ------- | ---------------------------------------------- | | PI_MEM_ENABLED | true | Master kill switch | | PI_MEM_CAPTURE | true | Disable capture, keep inject + search | | PI_MEM_SPAWN_TIMEOUT_MS | 30000 | Per-subprocess timeout | | PI_MEM_LOG_LEVEL | warn | silent / error / warn / info / debug |

Inherited from claude-mem (transparent — no pi-mem env var introduced):

| Env Var | Purpose | | ----------------------------------------- | -------------------------------------------------------------------------------------------------- | | CLAUDE_CONFIG_DIR | Root for worker path discovery (default $HOME/.claude) | | CLAUDE_MEM_WORKER_PORT | Worker HTTP port (default 37700 + (uid % 100)) | | CLAUDE_MEM_WORKER_HOST | Worker host (default 127.0.0.1) | | CLAUDE_PLUGIN_ROOT | Claude Code-injected plugin path | | CLAUDE_MEM_DATA_DIR | claude-mem data dir | | CLAUDE_MEM_CONTEXT_SHOW_TERMINAL_OUTPUT | Controls whether the TUI banner appears (set to true in ~/.claude-mem/settings.json to enable) |

Troubleshooting

  • claude-mem is not installed — run npx claude-mem install.
  • claude-mem worker failed to start — try npx claude-mem start manually. Inspect with npx claude-mem status.
  • No TUI banner — set CLAUDE_MEM_CONTEXT_SHOW_TERMINAL_OUTPUT=true in ~/.claude-mem/settings.json (claude-mem only emits systemMessage when this is on).
  • Memory feels stale — pi-mem caches the auto-injected context once per session at session_start, so newly captured observations won't appear in systemPrompt until you restart the pi session. The mem_search / mem_timeline / mem_get_observations tools are unaffected — they always hit live HTTP endpoints and reflect current corpus state, so use them when you need up-to-date results mid-session.

License

MIT