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

@brianlan/opencode-loop

v0.3.0

Published

OpenCode plugin for session-scoped recurring loops

Readme

opencode-loop

An OpenCode plugin that lets you create, list, and delete session-scoped recurring loops (like cron jobs, but temporary).

Key difference from system cron

These loops live only in memory. They automatically disappear when:

  • The OpenCode TUI / process exits
  • The session is deleted

This is by design — perfect for temporary automation within a coding session without leaving background tasks behind.

Features

  • cron_create – Add a recurring loop using standard 5-field cron syntax
  • cron_compact_create – Schedule recurring session compaction
  • cron_list – View loops in the current session
  • cron_delete – Remove a loop by name

When a loop triggers, it sends a prompt back into the same OpenCode session, so the AI picks it up in the next loop turn. Schedules use standard five-field cron syntax and the OpenCode server's local timezone. The loop keeps the agent that created it. Due jobs wait until the session is idle, so they do not intentionally overlap an active turn.

Installation

Option A: bunx (zero-config)

Run this inside your project directory:

bunx @brianlan/opencode-loop install

This creates .opencode/plugins/opencode-loop.js automatically. Restart OpenCode and the plugin is ready.

Option B: npm package

bun add -d @brianlan/opencode-loop
# or: npm install -D @brianlan/opencode-loop

Then in opencode.json:

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

Option C: manual

Copy dist/index.js into .opencode/plugins/opencode-loop.js in your project.

Usage

Once installed, just ask OpenCode:

  • "Create a loop called healthcheck that runs every 5 minutes and tells me to run the test suite"
  • "List my loops"
  • "Delete the healthcheck loop"

Example behind the scenes:

cron_create(name="healthcheck", schedule="*/5 * * * *", command="Run the test suite and report any failures")

Every 5 minutes, the plugin injects a prompt into the current session:

[Scheduled loop triggered at 2026-06-18T12:05:00.000Z] "healthcheck": Run the test suite and report any failures

The AI then acts on it just like a normal user message.

To run once as soon as the current turn becomes idle and then continue on the normal cron schedule:

cron_create(
  name="healthcheck",
  schedule="*/5 * * * *",
  command="Run the test suite and report any failures",
  runImmediately=true
)

The initial run does not shift the cron schedule. If an immediate run and a scheduled occurrence both become due while the session is busy, they are coalesced into one pending run.

To compact the current session every two hours:

cron_compact_create(
  name="periodic-compact",
  schedule="0 */2 * * *",
  runImmediately=false
)

Compaction also waits for the session to become idle and uses the latest model recorded in that session.

Permissions

This plugin inherits the current agent's permission rules. It does not add any new permission surfaces — when the AI acts on a triggered prompt, it goes through the normal OpenCode tool-approval flow.

License

MIT