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-agent-modes

v0.3.0

Published

OpenCode plugin to switch agent modes between performance and economy presets

Readme

opencode-agent-modes

npm license npm downloads npm version OpenCode Plugin TypeScript

OpenCode plugin to switch agent models between performance and economy modes.

[!NOTE] Primary Use Case: When approaching your token limit, switch to pre-defined economy models to extend your session until your quota resets. Changes take effect after restarting opencode.

Features

  • Switch between different model presets (performance, economy, or custom)
  • Configurable presets with user-defined models
  • Toast notifications for mode changes

Supported Agents

| Agent Type | Description | | --------------------- | ----------------------------------------------------------------------------------------------- | | opencode agents | Standard agents (build, plan, etc.) | | oh-my-opencode agents | Optional - applies if oh-my-opencode is installed |

Installation

Add the plugin to your opencode.json:

{
  "plugin": ["opencode-agent-modes@latest"]
}

The following command files are automatically copied to ~/.config/opencode/command/ when the plugin initializes:

  • mode-performance.md
  • mode-economy.md
  • mode-status.md
  • mode-list.md

Usage

Available Commands

  • /mode-performance - Switch to high-performance models
  • /mode-economy - Switch to cost-efficient free models
  • /mode-status - Show current mode and configuration
  • /mode-list - List all available mode presets

Available Tools

  • mode_switch - Switch to a specified mode preset
  • mode_status - Display current mode settings
  • mode_list - List all available presets

Configuration

The plugin configuration is stored at ~/.config/opencode/agent-mode-switcher.json.

On first run, the plugin automatically generates this file by:

  1. Reading current models from opencode.json for the "performance" preset
  2. Setting opencode/glm-4.7-free for the "economy" preset

Example Configuration

[!TIP] The oh-my-opencode section is optional. Omit it if you don't use oh-my-opencode.

{
  "currentMode": "performance",
  "showToastOnStartup": true,
  "presets": {
    "performance": {
      "description": "High-performance models for complex tasks",
      "opencode": {
        "build": { "model": "github-copilot/gpt-5.2" },
        "plan": { "model": "github-copilot/gpt-5.2" }
      },
      "oh-my-opencode": {
        "Sisyphus": { "model": "anthropic/claude-opus-4-5-20251101" }
      }
    },
    "economy": {
      "description": "Cost-efficient free model for routine tasks",
      "opencode": {
        "build": { "model": "opencode/glm-4.7-free" }
      },
      "oh-my-opencode": {
        "Sisyphus": { "model": "opencode/glm-4.7-free" }
      }
    }
  }
}

Model Priority

When both global model and agent-specific opencode settings are configured, the priority is:

agent.<name>.model > model (global)

Agent-specific settings override the global model setting.

Custom Presets

To add a custom preset (e.g., "premium"):

  1. Add the preset to ~/.config/opencode/agent-mode-switcher.json:

    {
      "presets": {
        "premium": {
          "description": "High-end models for critical tasks",
          "opencode": {
            "build": { "model": "anthropic/claude-opus-4-5-20251101" }
          }
        }
      }
    }
  2. Create a command file at ~/.config/opencode/command/mode-premium.md:

    ---
    description: "Switch to premium mode (high-end models)"
    ---
    
    Use mode_switch tool to switch agent mode to "premium".
  3. Restart opencode to apply changes.

[!INFO]

  • Changes require an opencode restart to take effect
  • Custom mode presets can be added by editing the configuration file
  • Built-in command files (mode-performance.md, mode-economy.md, etc.) are overwritten on every plugin startup. Do not modify them directly.
  • Custom command files (e.g., mode-premium.md) are not affected by this overwrite and will persist across restarts.

Development

This project uses Bun as the runtime and package manager.

Prerequisites

  • Bun v1.0 or later

Setup

# Clone the repository
git clone https://github.com/j4rviscmd/opencode-agent-modes.git
cd opencode-agent-modes

# Install dependencies
bun install

# Run tests
bun test

# Type check
bun run typecheck

# Lint & format
bun run lint
bun run format

# Build
bun run build