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-context-ratel

v0.1.0

Published

Ratel context engineering plugin for Pi — progressive capability disclosure, BM25 tool/skill retrieval, dynamic deferred loading, and system prompt pruning.

Readme

pi-context-ratel

Context engineering plugin for the Pi coding agent, powered by Ratel.

Cuts input token usage by ~70–90% on multi-skill, multi-tool agent setups by replacing up-front context loading with in-process BM25 progressive capability disclosure.


The Problem

Default Pi sessions inject:

  • Every discovered skill into <available_skills> in the system prompt (~3,000–8,000 tokens/turn).
  • All registered tool JSON schemas into the model request (~2,500–5,000 tokens/turn).

In a session with 25 tools and 40 skills, the agent pays 5,500–13,000 tokens of input overhead on every single turn.

How pi-ratel Fixes It

  1. System Prompt Pruning: Intercepts before_agent_start, indexes all skills into Ratel's SkillCatalog, and strips <available_skills> from the system prompt.
  2. Lean Tool Initial State: Keeps core tools (read, bash, edit, write) active; moves secondary & extension tools to Ratel's ToolCatalog.
  3. Dynamic Capability Discovery: Exposes search_capabilities (BM25 Rust engine).
  4. Dual-Activation:
    • Dynamic Tool Activation: Automatically calls pi.setActiveTools() with matched tools so the model can invoke them natively.
    • Direct Execution: invoke_tool allows instant calling within the same turn.
    • Skill Playbooks: get_skill_content loads markdown instructions on-demand.

Installation

Project-local (Recommended for testing)

pi -e ./extensions/index.ts

Permanent install

pi install npm:pi-context-ratel

Commands

  • /ratel status: View catalog sizes, active tool count, and estimated token savings.
  • /ratel search <query>: Test BM25 capability search directly in chat.
  • /ratel reload: Refresh tool and skill indexes from Pi and filesystem.
  • /ratel toggle: Toggle skill prompt pruning on/off for comparative benchmarks.

Configuration

Optional .pi/ratel.json in your project root:

{
  "enabled": true,
  "alwaysActiveTools": [
    "read",
    "bash",
    "edit",
    "write",
    "search_capabilities",
    "get_skill_content",
    "invoke_tool"
  ],
  "prunePromptSkills": true,
  "topKTools": 5,
  "topKSkills": 3,
  "enableDynamicActivation": true
}

Development & Testing

bun install
bun run typecheck
bun test
node /Users/sivaraman/.agents/skills/unlazy/scripts/gate-check.mjs GATES.md