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

@rehydra/opencode

v0.6.5

Published

Rehydra plugin for OpenCode — anonymizes secrets in LLM context using native plugin hooks

Downloads

569

Readme

@rehydra/opencode

Prevent your coding agent from leaking secrets to LLM providers.

This plugin intercepts the conversation between OpenCode and the LLM. Secrets from your .env files are replaced with placeholders before they leave your machine, and transparently restored before any tool (shell commands, file writes, etc.) executes locally.

The LLM never sees real secret values. Your tools run with them.

Install

npm install @rehydra/opencode

Add to opencode.json:

{
  "plugin": ["@rehydra/opencode"]
}

By default, the plugin reads .env in your project root. Secrets with values of 4+ characters are detected and scrubbed.

Configuration

For custom settings, create .opencode/plugins/rehydra.ts:

import { createRehydraPlugin } from "@rehydra/opencode";

export default createRehydraPlugin({
  // Scan multiple env files
  envFiles: [".env", ".env.local", ".env.production"],

  // Always redact these values, even if not in .env
  redactValues: ["sk-live-abc123..."],

  // Minimum value length to consider a secret (default: 4)
  minValueLength: 6,

  // Disable detection of specific PII types
  disableTypes: ["URL", "IP_ADDRESS"],
});

What gets detected

  • Environment variable values from .env files
  • API keys, tokens, and credentials (pattern-based)
  • AWS access keys and secret keys
  • JWTs, private keys, connection strings
  • Any values passed via redactValues

How it works

The plugin uses five OpenCode hooks:

| Hook | What it does | |---|---| | messages.transform | Scrubs secrets from all message text before it reaches the LLM | | system.transform | Tells the LLM to treat placeholders as real values | | tool.execute.before | Restores real values in tool arguments before local execution | | tool.execute.after | Restores real values in displayed tool output | | text.complete | Restores real values in LLM response text shown to you |

Everything runs locally. No data leaves your machine except the scrubbed conversation sent to the LLM provider.

Logging

Plugin activity is logged to OpenCode's log directory (~/.local/share/opencode/log/). Run with --log-level DEBUG for detailed output.

INFO service=rehydra scrubbed={"ENV_VAR_SECRET":2} messageCount=3 scrubbed 2 secret(s) from messages
INFO service=rehydra tool=bash callID=call_abc123 rehydrated PII tags in tool args

Rehydra

This plugin is part of Rehydra, an open-source SDK for PII anonymization and rehydration. Rehydra combines regex-based pattern matching with NER-based detection and supports any LLM provider via fetch wrappers, proxy servers, or framework plugins.

Full documentation at docs.rehydra.ai.

License

MIT