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

v0.3.1

Published

OpenCode plugin that observes session events and captures patterns for continuous learning

Readme

opencode-learning

OpenCode plugin that observes session events and writes append-only JSONL for later pattern extraction.

What it does

Watches your OpenCode sessions and captures structured observations:

  • User messages — what you asked, truncated to a short summary (100 chars)
  • Tool calls — which tools ran, args (content dropped from write/edit, commands truncated for bash), duration, success
  • Compaction — when the session compacted
  • Session end — total tool count, whether files were modified, session duration, observations dropped

Observations are written to .opencode/learning/observations.jsonl in your project root. Nothing is sent anywhere. Nothing is auto-applied. This is the raw signal you can mine later for patterns about how you and your agents actually work.

Install

npm install opencode-learning

Add to your ~/.config/opencode/opencode.jsonc:

{
  "plugin": ["opencode-learning"]
}

What lands in your repo

On first load, the plugin creates:

.opencode/
  .gitignore           # excludes everything by default
  learning/
    observations.jsonl # append-only event log

The .opencode/ directory is shared with other OpenCode plugins and output (artifacts, investigations). Its .gitignore keeps everything out of git by default.

Safety

  • Every hook is wrapped in safeExecute. A throw in most OpenCode hooks kills your session — this plugin catches and logs all errors instead.
  • Self-event filtering. Every observation carries source: "learning". The event handler is structurally filtered to only session.idle and session.compacted — every other event type is ignored without inspection. This prevents feedback loops if a future version emits its own events.
  • Content dropping. write and edit tool args have their content fields (content, oldString, newString) dropped entirely — file contents never enter the log. Bash command fields are truncated to 100 chars.
  • Text truncation. User message text is truncated to 100 characters. No pattern-based redaction — the observations file lives locally in your own repo.
  • Init failure resilience. If storage init fails (read-only filesystem, etc.), hooks still register and run — observations are silently dropped rather than crashing the session.
  • File rotation. The observations file rotates at 10MB, keeping one backup (.1.jsonl).

Observation shape

{"ts":"2026-04-30T01:23:45.678Z","type":"user_message","session":"abc","source":"learning","agent":"operate","parent":null,"text":"Read foo.ts and check f…<32 more>"}
{"ts":"...","type":"tool_call_start","session":"abc","source":"learning","agent":"operate","tool":"read","call_id":"xyz","args":{"filePath":"/path/to/foo.ts"}}
{"ts":"...","type":"tool_call_end","session":"abc","source":"learning","agent":"operate","tool":"read","call_id":"xyz","success":true,"duration_ms":12}
{"ts":"...","type":"compaction","session":"abc","source":"learning"}
{"ts":"...","type":"session_end","session":"abc","source":"learning","duration_ms":300000,"tool_count":42,"files_modified":true,"observations_dropped":0}

Extracting patterns

The /extract command analyzes accumulated observations and surfaces repeating workflow patterns as proposals. Copy commands/extract.md from this repo to your OpenCode commands directory:

cp commands/extract.md ~/.config/opencode/commands/extract.md

Then run /extract in any OpenCode session. It scans observation files across your projects, identifies consistent behaviors (workflow sequences, delegation preferences, tool idioms), and presents proposals for codifying them into AGENTS.md, skills, or commands.

See commands/extract.md for the full command.

Performance

Hook handlers are budgeted to <5ms p99. Measured: p50=0.035ms, p99=0.090ms, max=0.5ms over 1000 iterations. Storage is sync fs.appendFileSync — well under the 5ms budget.

License

MIT