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

v0.1.4

Published

opencode v2 plugin for HarnMem, the cross-harness agent memory: byte-stable session-context injection, five native memory tools, and per-turn journaling — in-process, zero runtime dependencies. One shared store of plain, human-editable Markdown under ~/.h

Readme

HarnMem logo

opencode-harnmem — HarnMem memory for opencode

Cross-harness persistent memory for opencode v2.x, powered by @harnmem/core. One store (~/.harnmem/), shared with the pi / DSH / Claude / Codex adapters: a preference or decision captured in one harness is visible in every other one on the next session start.

What it does

  • Stable injection — a session.hook("context") callback pushes a byte-stable snapshot of your hottest memories as a system part. Empty store ⇒ zero parts pushed. The snapshot is computed once per session and only rebuilt after a write or at day rollover, so prompt caching stays intact across turns.
  • Five native tools — harnmem_search, harnmem_read, harnmem_write, harnmem_forget, harnmem_status registered through tool.transform. No MCP child process: the tools run in-process against the vendored core.
  • Per-turn journaling — every session.hook("prompt") appends the transcript tail (capped: 400 messages × 4,000 chars) to the shared session journal, deduplicated by signature, so another harness (or a future harnmem CLI extraction pass) can mine this session later. Two caveats, both inherent to the hook firing before the current turn's messages exist: single-turn CLI runs journal nothing, and the final turn of any session is captured only when that session continues later (--continue / TUI resume). Extraction with an in-process LLM (ctx.generate.text) is planned for v0.2; the journal is written today regardless.
  • Subagent-safe — child sessions (parentID set) run read-only: no injection, no journaling, and the write tool answers read-only instead of writing.

Install

The one-command path (opencode >= 2):

opencode plugin add opencode-harnmem

This installs the npm package and adds it to the global ~/.config/opencode/opencode.json ("plugins" key). Alternatives:

Add the package to your project opencode.json:

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

From a checkout, point the entry at the package directory (verified to load local packages):

{ "plugin": ["D:/projects/harnmem/packages/opencode-harnmem"] }

@harnmem/core is vendored into vendor/core/ at build time (pnpm build in this package), so the plugin directory is self-contained. Requires opencode >= 2 (the { id, setup } plugin contract); on opencode 1.x the plugin prints one line and does not load.

Configuration

Environment first, then files — malformed config is ignored, never fatal:

  1. HARNMEM_DISABLED, HARNMEM_READONLY, HARNMEM_DEBUG, HARNMEM_AUTO_EXTRACT, HARNMEM_INJECT, HARNMEM_OPENCODE_MAX_INJECT_TOKENS, HARNMEM_HOME
  2. ~/.harnmem/config.json (shared with every adapter)
  3. <project>/.harnmem.json

Injection is capped at 10,000 bytes with deterministic line-based truncation (same rule as the Claude adapter).

Notes

  • Tools map bare non-object arguments onto their single required key (probed: opencode can deliver args as a raw string) and every tool call degrades to a friendly text result instead of an error.
  • All failures are swallowed at the plugin boundary: a broken store can never wedge a session.
  • Design and verification evidence: docs/research/opencode-plugin.md (contract probe log included).

License

MIT — see LICENSE.