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

v0.3.0

Published

Advisor tool plugin for OpenCode — consults a stronger model in a forked session and returns concise guidance

Downloads

32

Readme

opencode-advisor

Advisor tool plugin for OpenCode.

Adds an explicit advisor tool that consults a stronger model in a temporary forked session and returns concise strategic guidance.

This is an advisor-pattern approximation, not Claude's native server-side advisor API.

Install

npm install opencode-advisor

Add to ~/.config/opencode/opencode.jsonc (or your project's .opencode/opencode.jsonc):

{
  "plugin": ["opencode-advisor@latest"]
}

Quick start

  1. Install the plugin.
  2. Create either ~/.config/opencode/plugins/advisor-config.json for a global default or .opencode/plugins/advisor-config.json inside a project for a local override.
  3. Set advisorModel to the stronger model you want to consult.
  4. Start opencode normally — the plugin will inject guidance telling the model to call advisor only when genuinely blocked.

Typical usage

The model will usually call the tool with inputs like:

{
  "question": "What boundary should own validation in this refactor?",
  "blocker": "Parser and repository still depend on each other, so I cannot split the module safely.",
  "attempted": "I first extracted helper functions and then tried interface-based decoupling, but both versions still leave a circular dependency.",
  "context": "Current module mixes parsing, validation, and persistence. I already found circular dependencies between parser.ts and repository.ts."
}

How it works

The plugin registers a custom advisor tool.

When the model calls advisor, the plugin:

  1. forks the current session at the current message,
  2. sends a focused prompt to a stronger model,
  3. returns the advisor's text back as a tool result,
  4. deletes the temporary advisor session.

This gives you a practical advisor workflow inside opencode without patching core internals.

parent session
  └─ advisor tool call
      ├─ fork current session
      ├─ prompt stronger model
      ├─ collect text response
      └─ delete temporary advisor session

Configuration

You can place advisor-config.json in either of these locations:

  • Global: ~/.config/opencode/plugins/advisor-config.json
  • Project-local: .opencode/plugins/advisor-config.json

Precedence is:

  1. Environment variables
  2. Project-local config
  3. Global config
  4. Built-in defaults

Example:

{
  "advisorModel": "anthropic/claude-opus-4-5",
  "advisorSystem": null,
  "maxAdvisorCalls": 1,
  "debug": false
}

Fields

| Field | Type | Description | |---|---|---| | advisorModel | string \| null | Model to use in provider/model format. If null, the forked session uses its default model. | | advisorSystem | string \| null | Optional custom system prompt for the advisor session. | | maxAdvisorCalls | number | Per-session call budget. Defaults to 1. 0 means unlimited. | | debug | boolean | Print initialization and advisor call logs. |

Example model setups

{ "advisorModel": "anthropic/claude-opus-4-5" }
{ "advisorModel": "github-copilot/claude-opus-4.6" }
{ "advisorModel": "openai/o3" }

Environment variables

| Variable | Values | Description | |---|---|---| | ADVISOR_MODEL | provider/model | Override advisorModel | | ADVISOR_SYSTEM | string | Override advisorSystem | | ADVISOR_MAX_CALLS | integer | Override per-session advisor call budget | | ADVISOR_DEBUG | true | Enable debug logging |

Usage notes

  • The plugin injects a system prompt telling the model when to call advisor.
  • advisor is intended for genuine blockers after the model has already tried at least one concrete approach.
  • Calls should include the decision to make, the blocker, and what has already been attempted.
  • No custom agent files are required for this plugin.
  • The per-session advisor call budget is cleared automatically when the session is deleted.
  • This plugin does not provide Claude-native advisor_tool_result, single-request sub-inference, or native advisor billing semantics.

Limitations

  • Each advisor call is an extra session round-trip.
  • The advisor runs in a forked opencode session, not inside the provider's native server-side tool loop.
  • Native Claude advisor API behavior is out of scope without opencode core/provider support.

Development

Run tests with:

bun test

Packaging note

This package is intended for the opencode/Bun plugin loader. The published entrypoint intentionally points to index.ts rather than a separate transpiled CommonJS build.

License

MIT