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

opencode-rtk-plugin

v0.1.3

Published

OpenCode v2 plugin that rewrites shell commands through rtk to cut LLM token usage by 60-90%.

Readme

opencode-rtk-plugin

An OpenCode v2 plugin that routes every shell command through rtk, cutting LLM token usage by 60-90% on common dev commands.

OpenCode sends tool output back to the model. rtk compresses that output (git, grep, ls, test runners, build logs, and more) into a token-efficient form before the model ever sees it. This plugin wires the two together.

Why

  • Smaller context, lower cost. Command output is the biggest hidden token sink in an agent loop.
  • No prompt changes. Rewriting happens in the shell hook, transparently.
  • Single source of truth. All rewrite rules live in rtk rewrite; this plugin is a thin delegating adapter, so rules never drift.

Requirements

  • OpenCode v2 (opencode --version reports 2.x).
  • rtk >= 0.23.0 on PATH — see rtk-ai/rtk: brew install rtk

Install

From npm

opencode plugin add opencode-rtk-plugin

From GitHub

opencode plugin add github:nabheet/opencode-rtk-plugin

Or add it to opencode.json(c) directly:

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": ["opencode-rtk-plugin"]
}

Manual

Copy this directory to .opencode/plugins/opencode-rtk-plugin/ (project) or ~/.config/opencode/plugins/opencode-rtk-plugin/ (global), then list it:

{
  "plugins": [{ "package": "./.opencode/plugins/opencode-rtk-plugin" }]
}

Options

{
  "plugins": [
    {
      "package": "opencode-rtk-plugin",
      "options": {
        "binary": "rtk",
        "timeoutMs": 5000,
        "enabled": true
      }
    }
  ]
}

| Option | Default | Description | | ----------- | ------- | ------------------------------------ | | binary | "rtk" | Path or name of the rtk executable. | | timeoutMs | 5000 | Per-rewrite timeout in milliseconds. | | enabled | true | Set false to disable the plugin. |

How it works

The plugin registers one OpenCode v2 shell hook:

ctx.shell.hook("create.before", (event) => {
  // event.command is the command about to run; mutate it to rewrite
})

For each shell command it runs rtk rewrite <command> and replaces the command with rtk's output when it differs. If rtk is missing, times out, or errors, the original command runs unchanged.

Compatibility

  • Targets OpenCode v2 (plugins config + id/setup plugin definition). OpenCode v1 used a different plugin API and is not supported.
  • rtk ships hooks for Claude Code, Codex, Cursor, Gemini CLI, Copilot and others. OpenCode is not among them, so this plugin fills that gap.

Prereleases

Every push to a PR publishes an installable beta to the npm beta dist-tag:

opencode plugin add opencode-rtk-plugin@beta

Releases (maintainers)

All publishing happens in GitHub Actions via npm trusted publishing (OIDC provenance). Never publish from a local shell.

.github/workflows/ci.yml is the single workflow file (npm allows one trusted publisher per package; the workflow filename must stay ci.yml):

  • test — lint + plugin-export smoke check on main and PRs (Node 24).
  • push to main → publish job publishes the next patch to latest, pushes a vX.Y.Z tag, and opens a GitHub release. The version is derived from the last published latest, so repeated merges never collide; an intentional minor/major bump in package.json is honored.
  • tag v*-beta* → publish job publishes beta + a prerelease GitHub release.
  • every PR push → prerelease job publishes <version>-beta.<run_number> to beta (same-repo, non-draft, non-dependabot PRs; re-runs deduped).
  • manual dispatch → next -beta.X staging publish from main, no git change.

License

MIT — see LICENSE. rtk itself is Apache-2.0 and is not bundled or vendored here.