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-rtk

v0.1.4

Published

RTK token reduction extension for pi-coding-agent - reduces LLM token consumption 60-90% by intelligently filtering tool output

Downloads

546

Readme

RTK Plugin for Pi-Coding-Agent

A token reduction plugin for pi-coding-agent that intelligently filters tool output to reduce token consumption by 60-90% while preserving essential information.

Based on the RTK (Rust Token Killer) specification from RTK.

Features

  • Source Code Filtering: Remove comments and normalize whitespace (minimal) or keep only signatures (aggressive)
  • Build Output Filtering: Remove compilation noise, keep only errors and warnings
  • Test Output Aggregation: Summarize test results, show failures only
  • Git Compaction: Compact diffs, status, and log output
  • Search Result Grouping: Group grep results by file with counts
  • Linter Aggregation: Summarize lint errors by rule and file
  • ANSI Stripping: Remove color codes and formatting
  • Smart Truncation: Intelligently truncate large outputs

Installation

Recommended: install the package via the pi package manager.

Using pi install (recommended)

pi install npm:pi-rtk

Or add the package to your pi agent config to load automatically. Edit ~/.pi/agent/settings.json and include:

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

If you need to install manually (older pi versions), you can clone into the extensions directory:

git clone https://github.com/mcowger/pi-rtk ~/.pi/agent/extensions/pi-rtk

Configuration

Create ~/.pi/agent/rtk-config.json:

{
  "enabled": true,
  "logSavings": true,
  "showUpdateEvery": 10,
  "techniques": {
    "ansiStripping": true,
    "truncation": { "enabled": true, "maxChars": 10000 },
    "sourceCodeFiltering": { "enabled": true, "level": "minimal" },
    "smartTruncation": { "enabled": true, "maxLines": 200 },
    "testOutputAggregation": true,
    "buildOutputFiltering": true,
    "gitCompaction": true,
    "searchResultGrouping": true,
    "linterAggregation": true
  }
}

Filter Levels

  • minimal: Remove comments, normalize whitespace
  • aggressive: Keep only signatures and structure

Source code filtering can be toggled independently of its level via commands or the rtk_configure tool.

Commands

  • /rtk-stats - Show token savings statistics
  • /rtk-on / /rtk-off - Enable/disable token reduction
  • /rtk-clear - Clear metrics history
  • /rtk-what - Show current technique configuration
  • /rtk-toggle-ansiStripping - Toggle ANSI stripping
  • /rtk-toggle-truncation - Toggle output truncation
  • /rtk-toggle-sourceCodeFiltering - Toggle source code filtering
  • /rtk-toggle-smartTruncation - Toggle smart truncation
  • /rtk-toggle-testOutputAggregation - Toggle test output aggregation
  • /rtk-toggle-buildOutputFiltering - Toggle build output filtering
  • /rtk-toggle-gitCompaction - Toggle git compaction
  • /rtk-toggle-searchResultGrouping - Toggle search result grouping
  • /rtk-toggle-linterAggregation - Toggle linter aggregation

Agent Tool

The rtk_configure tool is registered for use by the AI agent to programmatically adjust any RTK parameter at runtime. This is particularly useful when file edits fail due to text-matching errors: the agent can temporarily disable sourceCodeFiltering, re-read the file, apply the edit, and re-enable filtering.

Supported Languages

  • TypeScript/JavaScript
  • Python
  • Rust
  • Go
  • Java
  • C/C++

Token Savings

| Output Type | Expected Savings | |-------------|------------------| | Source code | 60-90% (aggressive mode) | | Build output | 70-90% | | Test results | 50-80% | | Git output | 60-80% | | Search results | 40-60% |

Architecture

The plugin intercepts tool_result events and applies appropriate filtering based on:

  • Tool type (bash, read, grep)
  • Command context (build, test, git, etc.)
  • File extension for source code

Metrics are tracked in-memory and can be viewed with /rtk-stats.

License

MIT - Based on the RTK specification