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-optical-optimization

v0.2.0

Published

Render OpenCode V2 checkpoints, optional prompt references, and selected skills as PNGs.

Readme

Optical Optimization for OpenCode V2

OpenCode streams and saves its usual compaction summary. When a vision-capable model continues the session, this plugin replaces the outgoing text checkpoint with locally rendered PNG pages. The pages contain both the finished summary and the recent conversation OpenCode retained with it. You can also opt in specific loaded skills and reference sections of your own system and agent prompts.

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": ["[email protected]"]
}

Requires OpenCode V2 2.3.x (tested against 2.3.0). No credentials, proxy, or external rendering service are required. Remove the plugin entry to return to stock behavior. Existing checkpoints can immediately be replayed as text again. If you used opencode-optical-compaction, replace its config entry rather than loading both packages.

What changes

  • The first normal request after a completed summary compaction gets PNGs and a short caption instead of the checkpoint text. Later requests replay the same bytes for that checkpoint. Manual, automatic, and installed background summaries use the same handoff. Cache keys, hints, and other messages are unchanged. Text and images are inherently different inputs: the checkpoint portion of a previously cached text request cannot be reused as an image.
  • New turns and attachments remain intact. Older messages and attachments are represented exactly as OpenCode serialized them for the checkpoint; this does not restore details OpenCode already shortened or omitted.
  • Summary generation, native compaction, and the visible transcript are unchanged. Models configured for native compaction (including OpenAI Responses) and models not advertising PNG/vision receive the normal request. OpenAI models configured for summary compaction are eligible.
  • The renderer uses a bundled font dependency and processes content locally. Pages are only cached in memory and sent to the session's chosen model in the normal request. A failed lookup or render, unsupported characters, or an oversized checkpoint leaves the original text intact instead of truncating it.

Opt in to prompt references and skills

{
  "plugins": [{
    "package": "[email protected]",
    "options": {
      "agents": ["build"],
      "systemSources": ["core/instructions", "api/handbook"],
      "skills": ["demo"]
    }
  }]
}
  • System and agent prompts: Wrap only optional reference data in an <optical-reference name="catalog"> block, with the opening and closing </optical-reference> tags on their own lines. agents matches exact agent IDs. systemSources matches the core/instructions source (project instructions) or exact api/<key> session instruction entries. Unmarked instructions stay in the system role. OpenCode 2.3.0 only supports text in that role, so the plugin sends marked references as a leading user image message and leaves a text pointer in the system prompt. Do not mark rules, permission instructions, or anything that depends on system priority.
  • Loaded skills: skills matches exact IDs. The plugin renders the bodies of selected or explicitly attached skills once they are in context. With the built-in Anthropic route it also renders verified skill tool results in place; other routes keep tool-returned skills as text. Skill discovery, admission, permissions, tool calls, and skill file paths are unchanged.
  • These options default to off. Native compaction, text-only models, changed or unverified sources, and content that cannot be rendered fall back to text. Existing cache keys and hints are not rewritten. Replacing an earlier prefix with media can cause a cache miss even with the same key.

This is an experiment in visual compression, not a byte-exact or guaranteed cost saving mode. A model can misread code, IDs, and punctuation. Image token cost and OCR quality vary by model; the plugin does not predict either. For exact values, refer back to the original transcript or re-send them as new text.

Skill relay benchmark

Two fresh minion runs answered the same 18 questions on three skills (Testing on the Toilet, Rune Authoring, Git Repository Management). One received only six rendered PNG pages via the image read tool; the other received plain text. Under strict scoring, the PNG relay scored 17/18 (94.4%) versus 18/18 (100%) for text. The PNG relay recovered the doubles order and mock rule, but could not read the exact phrase order/getter traffic. This is a single readback comparison, not a test of executing skill instructions, provider token savings, or latency.

The stock OpenCode V2 2.3.0 transcript still shows the text summary. Its plugin API has no display-only image slot on the compaction row. The plugin does not create a synthetic message to simulate one because that would add transcript content back to model context.

Development

bun install --frozen-lockfile
bun run check
npm pack --dry-run

Inspired by AgentOCR (ACL 2026 paper) and image-token-compression. This plugin does not use optical self-compression training and does not rewrite unrelated regions of the prompt.