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

v0.1.2

Published

OpenCode plugin for delegating low-cognitive tasks to cheap worker subagents. Reduces token waste, context pollution, and improves long-task stability.

Readme

opencode-delegation

OpenCode plugin that delegates low-cognitive-density tasks to a cheap worker subagent. Reduces token waste, context pollution, and improves long-task stability.

Problem

When running test suites, builds, log monitoring, or heavy search through an AI coding assistant, the main (strong) model wastes expensive tokens on low-cognition work — watching output scroll by, waiting for processes to finish, summarizing verbose logs. This pollutes the context window and burns budget on work a cheap model can handle.

Solution

The plugin configures a worker agent backed by a cheap model and a delegation-manager skill that guides the main model to use OpenCode's built-in task tool for long-running or high-output commands. The main model calls task({ subagent_type: "worker" }), which creates a visible subagent session in the UI. The plugin also trims oversized bash output and injects hints into the bash tool description.

┌─────────────────────────────────────────────┐
│           Main Agent (strong model)         │
│                                             │
│  1. Receives task                           │
│  2. Decides: delegate or handle myself?     │
│  3. If delegate → task({ subagent_type })   │
│  4. Subagent visible in UI                  │
│  5. Receives result                         │
│  6. Continues with high-value analysis      │
└──────────────────┬──────────────────────────┘
                   │
                   ▼
┌─────────────────────────────────────────────┐
│          Worker Agent (cheap model)         │
│                                             │
│  - Runs command, observes output            │
│  - Detects anomalies (errors, warnings)     │
│  - Summarizes if output > 200 lines         │
│  - Returns structured result                │
│  - Visible in UI for progress tracking      │
└─────────────────────────────────────────────┘

Installation

npm package

npm install --save-dev opencode-delegation

Add to your opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "small_model": "opencode/big-pickle",
  "plugin": ["opencode-delegation"],
  "agent": {
    "worker": {
      "description": "Executes low-cognitive-density tasks: run commands, observe output, detect anomalies, return structured results.",
      "mode": "subagent",
      "model": "opencode/big-pickle",
      "steps": 20,
      "permission": {
        "bash": "allow",
        "read": "allow",
        "edit": "deny",
        "task": "deny",
        "todowrite": "deny",
        "question": "deny",
        "webfetch": "deny",
        "glob": "allow",
        "grep": "allow"
      }
    }
  },
  "skills": {
    "paths": ["./node_modules/opencode-delegation/skill"]
  }
}

model is set to opencode/big-pickle by default. You can change it to any cheap model you prefer (e.g., "openai/gpt-4o-mini").

skills.paths is additive — it adds to the default skill scan paths, not replaces them. Your existing skills will still load.

.opencode directory (alternative)

If you prefer not to use npm, copy the files manually from the npm package (or from this repo):

# From the npm package
cp node_modules/opencode-delegation/agent/worker.md .opencode/agents/worker.md
cp -r node_modules/opencode-delegation/skill/delegation-manager .opencode/skills/delegation-manager

Or create them by hand — see agent/worker.md and skill/delegation-manager/SKILL.md in the repo.

OpenCode auto-discovers agents and skills from .opencode/agents/ and .opencode/skills/.

your-project/
├── .opencode/
│   ├── agents/worker.md
│   └── skills/delegation-manager/SKILL.md
└── ...

How it works

Skill-guided delegation

The delegation-manager skill teaches the main model when and how to delegate. It guides the model to call:

task({
  subagent_type: "worker",
  description: "short description",
  prompt: "what to do + what to focus on"
})

The subagent session is visible in the UI, so you can track progress.

Bash hint injection

The plugin's tool.definition hook adds a reminder to the bash tool's description: for long-running or high-output commands, prefer task with the worker agent.

Output trimming

If the main model runs bash directly and the output exceeds 300 lines, the plugin's tool.execute.after hook truncates it and attaches a summary (test counts, first error, stderr presence).

Worker agent

| Setting | Value | |---------|-------| | model | opencode/big-pickle (configurable) | | steps | 20 | | bash | allow | | read | allow | | glob | allow | | grep | allow | | edit | deny | | task | deny |

Worker can execute commands, read files, and search code. Cannot edit files, spawn sub-agents, or interact with the user.

Project structure

opencode-delegation/
├── src/
│   ├── plugin.ts                 # Plugin — hooks only (no custom tools)
│   ├── lifecycle/
│   │   ├── filter.ts             # Output extraction (test summary, errors, stderr)
│   │   └── monitor.ts            # Event monitoring (MVP stub)
│   └── ...
├── skill/
│   └── delegation-manager/
│       └── SKILL.md              # Guides main model to use task({ subagent_type: "worker" })
├── agent/
│   └── worker.md                 # Worker agent definition
└── ...

License

MIT