2026-09-12 18:56:00 +02:00
2026-09-09 10:40:59 +02:00
2026-09-09 11:18:03 +02:00
2026-09-12 10:29:24 +02:00
2026-09-12 18:56:00 +02:00
2026-09-12 18:56:00 +02:00
2026-09-09 09:56:21 +02:00
2026-09-09 09:56:21 +02:00
2026-09-09 09:56:21 +02:00
2026-09-09 09:56:21 +02:00
2026-09-09 09:56:21 +02:00
2026-09-12 10:29:24 +02:00
2026-09-09 11:18:03 +02:00
2026-09-12 09:51:04 +02:00
2026-09-12 10:29:24 +02:00
2026-09-12 18:56:00 +02:00
2026-09-12 09:51:04 +02:00
2026-09-12 10:29:24 +02:00

stanp-opencode

OpenCode V2 plugin providing a coordinate agent and fast/good/deep worker pairs, with GPT routing or explicit custom model assignments. Your default agent and the built-in build agent remain unchanged.

Install the latest release

Requires OpenCode V2 2.0.2 (opencode2), Bun 1.3.14+, Bash, curl, jq, and sha256sum (Linux/WSL). The native plugin API is pinned to @opencode/plugin@2.0.2; use the matching stable OpenCode release.

Run the installer without sudo:

curl -fsSL https://git.krtss.de/StanPonomarev/stanp-opencode/raw/branch/main/install.sh | bash

From a checkout, run bash install.sh directly. Rerun the same script to upgrade to the latest published, non-prerelease Gitea release.

The installer downloads stanp-opencode.tgz and its SHA-256 checksum, verifies and extracts the self-contained archive, then activates the plugin only after importing and checking both the native V2 server and TUI exports. Download, extraction, and validation failures leave the previous active plugin untouched. The checksum detects corruption; it is not a signature independent of the release server.

Installation defaults to ~/.config/opencode and respects XDG_CONFIG_HOME. Override it explicitly when needed:

OPENCODE_CONFIG_DIR=/path/to/opencode-config bash install.sh

The installer atomically replaces the package directory at plugins/stanp-opencode and adds its default GPT configuration to opencode.json. Existing unrelated JSON settings and opencode.jsonc are preserved. It does not create symlinks, install package dependencies, install OpenCode itself, or configure provider credentials.

Restart opencode2 after installation (or opencode2 service restart for an existing service). Connect your provider, then select coordinate in the agent picker. The default configuration uses OpenAI GPT models; agents are only enabled when the required models are available.

Install from a local checkout

To build and install the current checkout instead of downloading a release, install Bash, jq, and Bun 1.3.14+, then run:

bash /path/to/stanp-opencode/install-local.sh

The script may be invoked from any working directory. It runs bun install --frozen-lockfile (which may access the package registry) and bun run build in the checkout containing the script on every run. It validates the native V2 and TUI bundles, copies them into the same installed package layout as the release installer, and preserves existing plugin options, unrelated opencode.json settings, and opencode.jsonc. Dependency installation, build, validation, and configuration parsing failures leave the currently installed plugin and configuration untouched.

The configuration directory defaults to ~/.config/opencode, respects XDG_CONFIG_HOME, and can be overridden explicitly:

OPENCODE_CONFIG_DIR=/path/to/opencode-config bash /path/to/stanp-opencode/install-local.sh

Restart opencode2 after installation (or opencode2 service restart).

Configure

See GPT configuration and custom model assignments. When using the installer, point the example's plugin package entry at the installed package directory rather than the unpublished npm package name. Configured local plugin paths must be directories; pointing at plugins/stanp-opencode.js causes OpenCode to reject that configured entry and auto-load the file without its options:

{
    "plugins": [
        {
            "package": "./plugins/stanp-opencode",
            "options": {
                "mode": "gpt",
                "provider": "openai",
                "lunaPriority": true,
            },
        },
    ],
}

This relative path assumes the configuration file is in the selected global config directory. Use an absolute path in project configuration. Remove any old V1 plugin entry when migrating; V2 uses plugins. lunaPriority requests priority service where supported and can increase cost; set it to false to use the provider default.

The plugin supplies session-local todoread and todowrite tools when no other plugin provides them. In OpenCode V2 2.0.2, custom tools cannot open permission prompts: an ask or deny rule blocks these todo tools rather than bypassing the rule. Explicitly allow them if you want to use them.

The plugin also adds an MCP server named playwright unless one with that exact name is already configured; existing configurations are preserved, including disabled servers. It first looks from the current project directory through its ancestors for an executable declared as playwright-mcp by an installed @playwright/mcp package, then checks PATH for an executable whose resolved package is genuinely @playwright/mcp. This direct MCP installation is preferred and is launched without a package runner.

If the MCP package is absent but an installed playwright package, an @playwright/test package with its playwright dependency available, or a genuine playwright package CLI on PATH is found, the plugin configures npx -y @playwright/mcp@latest. The ordinary CLI is only evidence that Playwright is local; it is never run as an MCP server. Detection performs no network access and launches nothing, but the first MCP connection requires npx, registry access to download/update @playwright/mcp@latest, Node.js supported by that package, and browser binaries and system dependencies.

Only when neither Playwright MCP nor ordinary Playwright is verified locally does OpenCode start the official Microsoft image over stdio with docker run -i --rm --init --pull=always mcr.microsoft.com/playwright/mcp. Setup does not start the container. The fallback requires Docker when OpenCode first connects, may pull the image then, and currently supports only headless Chromium. If npx, Docker, registry access, or other runtime prerequisites for the selected path are unavailable, the Playwright MCP connection fails without preventing the rest of the plugin from loading. Configure your own server named playwright (it may be disabled) to override automatic selection.

When an MCP server named codegraph is already configured, its tools are exposed directly to coordinate and retain the built-in build agent's matching allow, ask, and deny rules. The plugin does not configure or start a missing server, and no other MCP server is exposed this way.

ChatGPT subscription quota

When OpenCode's active openai integration uses ChatGPT OAuth, the plugin reads the same account usage endpoint as Codex. It queries before a session's first model request (including a resumed session and child sessions), about every 60 seconds, and when session execution completes, fails, is interrupted, or becomes idle. API-key connections and other providers make no quota requests and show no quota UI.

The automatically loaded TUI plugin adds each valid window returned by OpenAI to the sidebar, including named/model-specific limits. Absent or malformed windows are hidden. OpenAI's current Codex contract does not provide a per-window "informational" or "not enforced" flag, so an explicitly returned five-hour window is shown for every plan, including Pro; silently discarding it based only on plan and duration would misrepresent the authoritative response. Each line shows the latest remaining account quota and the estimated percentage points consumed while the root session family is active. A root session and all of its subagents share one baseline, so child activity is included without counting the same account delta once per child.

The estimate is based on changes in OpenAI's account-wide percentages, not token accounting. Concurrent ChatGPT/Codex use outside the session can therefore skew it upward. If multiple independent root sessions run concurrently, the account delta is inherently indivisible and may be attributed to each active root. Polling can miss usage immediately before a reset, and OpenAI may round the source percentages. Inactive session totals stay frozen, and a resumed family refreshes before becoming active so unrelated idle-time usage is excluded. Last successful values provide the baseline through temporary request failures. Tokens and account identifiers are never exposed through plugin RPC or written to plugin storage; only quota values, session IDs, and a one-way account fingerprint are persisted.

Uninstall

Remove plugins/stanp-opencode from the selected config directory and remove any explicit configuration entry for it, then restart OpenCode.

S
Description
opencode plugin for personal use by StanPonomarev
Readme
412 KiB
3.3.0
Latest
2026-10-10 15:17:49 +02:00
Languages
TypeScript 98.9%
Shell 1.1%