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

pi-acm

v0.3.3

Published

Active Context Management for pi — sliding window context management as a distributable pi extension

Readme

pi-acm

Active Context Management for pi — sliding window context management as a distributable pi extension.

Keeps long-running sessions coherent by sliding the context window forward instead of chopping history and generating lossy AI summaries. Critical messages survive via inception pinning. Expensive tool outputs get surgically trimmed. The LLM always knows its token position.

Install

pi install npm:pi-acm

Or add to .pi/settings.json:

{
  "packages": ["npm:pi-acm"]
}

Quick Start

Once installed, ACM runs automatically. Every turn you'll see a footer status line:

ACM: 187k/200k (93%) | ↑3 ✂12

And the LLM receives a hidden <context-status> tag before each turn.

Common commands

/acm              — show full context map
/pin <id>         — pin a message as inception
/unpin <id>       — remove pin
/prune <id>       — hide a message from context
/mark <id> <0-10> — set priority
/hunt             — find the biggest token consumers
/diagnose         — check session health

Common tool calls (LLM-initiated)

acm_map                                    — context breakdown
acm_hunt                                   — find bloat
acm_pin({ id: "a1b2c3d4" })               — pin a message
acm_prune({ id: ["a1b2c3d4", "e5f6..."] }) — prune multiple
acm_snipe({ id: "a1b2", strategy: "truncate", max_chars: 200 })
acm_compact({ dry_run: true })             — preview sliding window
acm_compact({ keep_active_minutes: 30 })   — commit
acm_diagnose()                             — health check

How It Works

ACM is a pure pi extension — no pi-mono core modifications. It uses:

  • context event — filters messages before each LLM call (prune, snipe, pin prepend, window boundary)
  • session_before_compact — intercepts compaction and applies sliding window instead of AI summary
  • before_agent_start — injects the <context-status> whisper and ACM system prompt reminder
  • turn_start/end — tracks active working time for chess-clock compaction
  • pi.appendEntry() — persists all ACM metadata as sidecar JSONL entries (session file untouched)

Architecture

extensions/index.ts          Entry point
src/
  state.ts                   AcmState type, loadState, saveState
  entry-map.ts               entry ID ↔ context message mapping
  context-filter.ts          context event handler (pipeline)
  snipe-apply.ts             snipe strategy implementations
  token-counter.ts           gpt-tokenizer estimates
  chess-clock.ts             active time tracking
  compaction.ts              session_before_compact handler
  whisper.ts                 before_agent_start handler
  id-resolver.ts             partial ID prefix matching
  tools/
    observe.ts               acm_map, acm_hunt, acm_diagnose
    control.ts               acm_pin, acm_unpin, acm_prune, acm_mark
    snipe.ts                 acm_snipe
    compact.ts               acm_compact
  ui/
    commands.ts              user-facing slash commands
    status.ts                footer status widget
skills/acm/SKILL.md          LLM instructions
tests/                       vitest unit tests

Configuration

Default config in .pi/settings.json or ~/.pi/agent/settings.json:

{
  "acm": {
    "autoCompactOnPercent": 85,
    "keepActiveMinutes": 30
  }
}

(Config is stored in ACM sidecar entries — see src/state.ts for the full AcmConfig shape.)

What Gets Preserved

  • Session JSONL is never modified — all changes are in-memory (applied at context event time)
  • Pinned messages survive everything — they prepend context regardless of window boundary
  • Pruned/sniped content is always accessible via pi's session viewer or the raw .jsonl file

License

MIT