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

opencode2-goal-plugin

v1.0.3

Published

Persistent session goals for OpenCode V2

Readme

OpenCode Goal Plugin

This OpenCode V2 plugin stores and tracks one persistent goal for each session. It provides the /goal command, four goal tools, evidence-gated completion, progress checkpoints, and automatic continuation with limits. It does not add a terminal user interface (TUI) indicator.

Installation

Add the plugin package and command configuration to your OpenCode V2 configuration file.

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": [
    {
      "package": "[email protected]",
      "options": {
        "autoContinue": true,
        "maxContinuations": 12,
        "continuationIntervalMs": 1500,
        "maxDurationMs": 3600000,
        "maxTokens": 120000,
        "noProgressTurns": 3
      }
    }
  ],
  "commands": {
    "goal": {
      "description": "Manage the session goal",
      "template": "Route this goal command through the matching goal controller tools. Arguments: $ARGUMENTS. With no arguments or status, call get_goal. A plain objective or create OBJECTIVE calls create_goal. pause, resume, and blocked BLOCKER call update_goal. For complete, call get_goal if needed, then copy an exact evidence candidate ID into structured evidence for update_goal. clear calls clear_goal. Never infer completion from prose."
    }
  }
}

Commands

Use the /goal command to manage session goals:

  • /goal Build and verify the feature: Creates a new session goal with the given objective.
  • /goal status: Returns the current goal status.
  • /goal pause: Pauses automatic continuation for the active goal.
  • /goal resume: Resumes execution for a paused or blocked goal.
  • /goal blocked <reason>: Sets the goal status to blocked and records the reason.
  • /goal complete {"source":"test","summary":"All tests passed","success":true,"toolCallID":"..."}: Completes the goal using structured evidence.
  • /goal clear: Deletes the session goal.

OpenCode V2 command transforms modify prompt templates. They do not execute direct command callbacks. The /goal command template instructs the model to route operations through get_goal, create_goal, update_goal, or clear_goal. OpenCode V2 plugin transforms can update existing commands, but they cannot register new commands. You must define the commands.goal object in your OpenCode V2 configuration file. Only goal tools modify the stored goal state.

Completion Evidence Workflow

Completion uses the exact OpenCode tool call ID from a successful non-goal tool in the same session.

  1. Run a verification tool, such as a test or build command, and confirm that it succeeds.
  2. Call get_goal if you need the ID.
  3. Copy an exact ID from the returned evidenceCandidates list.
  4. Call update_goal with action: "complete" and put that ID in evidence.toolCallID.

Do not use a command name, a descriptive label such as bun-publish-dry-run, or an ID from another session. The plugin rejects any value that is not a recent successful evidence candidate for the current session.

Persistence and Limits

The plugin stores goal data in an atomic JSON file at ${XDG_DATA_HOME:-~/.local/share}/opencode-goal-plugin/goals.json. It uses process queue locking for safe concurrent file writes. It sets directory permissions to 0700 and file permissions to 0600 on supported operating systems. Each goal record contains execution history, checkpoints, timestamps, active duration, continuation counts, and a token estimate. The plugin estimates token usage by dividing the length of serialized context messages by four. OpenCode V2 does not provide exact token count metrics to plugins. Goal completion requires evidence that references a recent successful tool call recorded during the same session.

The session.idle event triggers automatic goal continuation. The plugin verifies persisted goal state before each continuation prompt. It prevents concurrent continuation tasks for the same session. It stops continuation when execution reaches configured limits for continuations, active time, token estimates, or turns without progress. You can disable automatic continuation by setting autoContinue: false in the plugin options.