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-task-utils

v1.2.1

Published

Task persistence, listing, and pipeline chaining for opencode background subagents.

Downloads

546

Readme

opencode-task-utils

Task persistence, listing, pipeline chaining, and step management for opencode background subagents.

Tools

task_list — List tracked background tasks. Filter by chain_id or status.

task_save — Persist a subagent result to /tmp/opencode-tasks/{task_id}.md with metadata. Supports upsert (update existing entry) and all statuses: pending, running, completed, failed.

task_chain — Define a multi-step pipeline. Creates a chain plan and returns a structured execution guide. Use with task_step for automatic {previous} resolution between steps.

task_step — Advance a pipeline chain. Marks a step completed with your result, then returns the next step's prompt with {previous} resolved. When the last step completes, marks the chain done. Validates step ordering (no skipping, no re-advancing completed steps).

task_rm — Delete a task or entire chain from the registry. Provide exactly one of task_id (single task) or chain_id (entire pipeline). Optionally delete_file=true to remove the associated content file and chain directory. Idempotent — safe to call on already-deleted entries.

How It Works

task_chain(chain_id="pipeline", steps=[...])
  → Plan created with N steps

For each step:
  1. task(background=true, prompt=step_prompt)
  2. task_save(task_id, content=result, chain_id, step)
  3. task_step(chain_id, step=N, result=result)
     → Returns next step's prompt with {previous} resolved

task_list(chain_id="pipeline") → shows progress

Installation

npm install -g opencode-task-utils

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

"plugin": [
  "opencode-task-utils",
  // ... other plugins
]

Usage

Save a task result

task_save(task_id="research-001", content="...results...", title="Research findings")
→ Saved `research-001` to `/tmp/opencode-tasks/research-001.md` (4500 chars, status: completed)

Upsert — mark in-flight, then update:

task_save(task_id="long-job", content="started at ...", status="running")
→ Saved `long-job` ... (status: running)

# later:
task_save(task_id="long-job", content="...full result...", status="completed")
→ Saved `long-job` ... (status: completed)

List tracked tasks

task_list()
→ • `research-001` — Research findings (completed) 2026-05-29 12:00:00
  • `long-job` — long-job (running) 2026-05-29 12:05:00

Pipeline with task_step

task_chain(
  chain_id="report",
  steps=[
    {title: "Research topic", prompt: "Research {previous}"},
    {title: "Summarize", prompt: "Summarize in 3 bullets: {previous}"},
    {title: "Write report", prompt: "Write a report from: {previous}"}
  ],
  initial_input="Context about X"
)
→ Creates plan, returns step 1 prompt

# Execute step 1
task(background=true, prompt="Research Context about X")
task_save(task_id="report-step-1", content=<result>, chain_id="report", step=1)

# Advance chain — task_step resolves {previous} in step 2's prompt
task_step(chain_id="report", step=1, result=<result>)
→ Returns step 2 prompt with {previous} replaced by actual result

# Execute step 2 with the resolved prompt
task(background=true, prompt=<step 2 prompt>)
task_save(task_id="report-step-2", content=<result>, chain_id="report", step=2)
task_step(chain_id="report", step=2, result=<result>)
→ Returns step 3 prompt, or "All steps completed!" if done

Path validation

All IDs (task_id, chain_id) are validated: alphanumeric, hyphens, underscores only. Invalid IDs are rejected with a clear error message.

Concurrency

Registry writes use atomic file operations (write to .tmp, then rename) — safe against concurrent tool calls. Orphaned .tmp.* files from crashed sessions are cleaned up automatically on plugin init.

Content size limit

Warns if saved content exceeds 1MB. No hard limit — but large files impact tool response times.

Delete tasks or chains

# Single task
task_rm(task_id="research-001")
→ Deleted `research-001` from registry.

# Delete task + its content file
task_rm(task_id="research-001", delete_file=true)
→ Deleted `research-001` from registry and removed file.

# Delete entire chain + all its tasks
task_rm(chain_id="report")
→ Deleted chain `report` (3 tasks removed).

# Delete chain + content files + chain directory
task_rm(chain_id="report", delete_file=true)
→ Deleted chain `report` (3 tasks removed) with content files.

# Idempotent — safe to call again:
task_rm(task_id="research-001")
→ Task `research-001` not found in registry. Nothing to delete.

Testing

git clone https://github.com/SK-DEV-AI/opencode-task-utils
cd opencode-task-utils
./test.sh

52 integration tests covering: sanitizeId validation, atomicWrite concurrency, registry CRUD, chain plan management, task_rm deletion, corrupt/missing file resilience, and stale .tmp cleanup.