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

@gramatr/opencode-plugin

v0.22.1

Published

grāmatr lifecycle plugin for OpenCode — maps OpenCode plugin events to grāmatr hooks via the connected MCP client (route_request injection, session continuity, git-gate).

Readme

@gramatr/opencode-plugin

Real-time intelligent context engineering, in OpenCode.

Install in 30 seconds

Add both entries to your opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "gramatr": {
      "type": "remote",
      "url": "https://api.gramatr.com/mcp",
      "enabled": true
    }
  },
  "plugin": [
    "@gramatr/opencode-plugin"
  ]
}

Restart OpenCode. It will fetch the plugin from npm at startup (no global install required) and prompt you through OAuth Device Authorization (RFC 8628) on first connect — visit the short URL, paste the user code, you're in. Works in SSH, WSL, and CI where browser redirects can't reach the client. Tokens are stored by OpenCode's MCP client; the plugin never handles raw credentials.

If you don't have a grāmatr account yet, sign up at gramatr.com.

What this gets you

  • Cheaper, faster prompts. A multi-head classification pipeline pre-routes each request and replaces the tens-of-thousands-token system prompt you'd otherwise hand-maintain. The effect compounds the longer you work.
  • Consistent behavior across sessions. The same contract — directives plus quality gates — runs on every prompt, so your AI acts the same on session 200 as on session 1.
  • Continuity across tools. A session you start in OpenCode resumes cleanly in Claude Code, Cursor, or the web — the handoff is persisted by the same backend.
  • Auditable safety rails. Per-prompt hard gates (e.g. git push --force to main is blocked locally before the tool runs).

What this package is

@gramatr/opencode-plugin is a lifecycle plugin for OpenCode. It maps OpenCode's plugin events (session.created, message.updated, tool.execute.before, session.idle, session.compacted) to grāmatr hooks — pre-classifying every prompt through the remote MCP server at api.gramatr.com/mcp, restoring session continuity on start, and enforcing git-gate hard rules before destructive shell commands run. The same intelligent context engineering layer used across Claude Code, ChatGPT, Cursor, Codex, and Gemini.

How it works

OpenCode
   │
   ├── plugin: @gramatr/opencode-plugin  ──┐
   │                                       │ lifecycle events
   │                                       │ (session.created, message.updated, …)
   │                                       ▼
   └── mcp.gramatr (remote, OAuth) ──► api.gramatr.com/mcp
                                       (route_request, load_handoff,
                                        save_reflection, …)

The plugin is a thin connector: every grāmatr hook is invoked against the already-connected remote MCP server declared in the mcp block — there is no local binary, no execSync, no shell-out. Guidance from the server is injected into the active session as a noReply system message so the model sees it before formulating its next response.

When OpenCode's plugin API exposes a typed client.callTool(), the connector will switch to direct MCP tool invocation and drop the prompt-injection path.

Requirements

  • OpenCode with @opencode-ai/plugin ≥ 1.0.0
  • Node.js ≥ 22
  • Network access to https://api.gramatr.com/mcp

Links

License

See LICENSE in this package.