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-plugin-compaction-prompt

v0.3.1

Published

Customize OpenCode's compaction prompt to preserve important context and omit unnecessary details.

Readme

opencode-plugin-compaction-prompt

Compact fearlessly with priority-aware compaction.

When you work across multiple features, OpenCode's default compaction doesn't know how to distinguish active work from older discussions, so it gives them equal priority. This can make important current details easy to lose.

Customize OpenCode's compaction prompt for priority-aware compaction, deciding which messages are prioritized or discarded in the next session. Specify which discussions to discard and which decisions, files, and snippets to prioritize in the summary.

GitHub · npm

Install

opencode plugin -g opencode-plugin-compaction-prompt

This installs the plugin in your global OpenCode configuration. To install it for one project only, omit -g.

You can also add it manually to your global opencode.jsonc:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": [
    [
      "opencode-plugin-compaction-prompt",
      {
        "memoryFile": ".opencode/compaction.md",
        "mode": "append",
        "completionMarker": "opencode-plugin-compaction-prompt: Custom compaction done."
      }
    ]
  ]
}

Create .opencode/compaction.md in the project when you have project-specific context to preserve. The file is optional.

/plugin-compaction-init

  • Writes the memory file at the configured memoryFile path with a top instruction line and ## Keep and ## Discard sections containing classification rules for which messages to preserve or drop.
  • Recommended: pass user instructions to extend the default rules with concrete topics — specific areas of discussion you want kept or dropped.

Options

| Option | Default | Description | | ------------------ | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- | | memoryFile | .opencode/compaction.md | File resolved relative to the active worktree. | | mode | append | Append instructions to OpenCode's default prompt, or use replace to provide a complete prompt. | | prompt | "" (empty) | Additional instructions used together with memoryFile; both are included in the compaction instructions. | | completionMarker | opencode-plugin-compaction-prompt: Custom compaction done. | Exact text the model is asked to append at the end of the summary. |

Append mode is the recommended default because it preserves OpenCode's built-in compaction behavior. Replace mode is available when the complete prompt needs to be controlled by this plugin.

When neither a prompt nor a memory file is available, the plugin asks the model to echo opencode-plugin-compaction-prompt: No custom compaction applied. instead.

Development

bun install
bun test
bun run typecheck
bun run build
bun run pack:check

The npm package exposes the compiled entrypoint at dist/index.js and TypeScript declarations at dist/index.d.ts.

Publishing

Update the changelog

Add the changes for the new version to CHANGELOG.md.

Verify the release

bun run format:check
bun test
bun run typecheck
bun run build
bun run pack:check

Publish the release

npm version minor -m "chore: release v%s"
git push origin main --follow-tags
VERSION="$(node -p "require('./package.json').version")"
gh release create "v$VERSION" --generate-notes
npm publish

Use npm version patch or npm version major when appropriate. npm publish rebuilds dist/ automatically.

Compatibility

The plugin uses OpenCode's experimental.session.compacting hook. OpenCode may change experimental plugin APIs between releases; test the package against the OpenCode version you support.