dsh-opencode-acp: Delegate opencode as an ACP subagent in DSH

Preface

When running the main agent in DeepSeek Harness (DSH), a common requirement is: hand off an independent piece of work to another toolchain to complete, without stuffing the other party’s tool calls and reasoning process into the current conversation context, and without inflating the main session’s token bill. The community already has approaches for hooking up external agents via ACP (Agent Client Protocol); opencode ships with its own models, tools, and free tier, and v2 provides an acp subcommand. The plugin dsh-opencode-acp (maintainer wangqingdhuo, category: client) connects opencode to DSH as an ACP subprocess: the main agent keeps its own model and context, the delegation tool only passes task text and a working directory to opencode, and the final answer is returned back — along with a settings page and run records.

What This Is

dsh-opencode-acp is a DSH plugin (npm package name dsh-opencode-acp, current documented version 0.1.1, MIT license). It registers the delegation tool subagent_opencode for each agent under a specified profile, and provides a Settings → OpenCode delegation configuration page on the client. The subprocess talks to the plugin through opencode acp using NDJSON JSON-RPC over stdio; opencode uses its own models, tools, and login state, and the main session only receives the final result in the form of assistant text.

Core Features

Delegation tool subagent_opencode

Returns the subtask id immediately after invocation; the completion notification carries opencode’s final answer. The subprocess only receives the task description and working directory — not the main conversation history.

Settings page and persistence

Settings are read before each delegation begins; saved changes apply to the next run, with no need to restart DSH. Configuration is written to $DSH_HOME/opencode-acp/settings.json; the most recent 100 run records are kept in runs.json in the same directory, including the opencode session id, model, duration, tool call count, and token usage.

Configurable items (summary)

Group Item Meaning
Model main model Select from opencode’s list of used models, or enter a model id directly
Model small model Model used for titles and small tasks (leave empty to let opencode decide)
Model health check Run opencode --version to check that the executable is available
Execution permission allow auto-answers permission requests, reject denies them
Execution working directory Follow the invoking session, or use a fixed path
Advanced command / args opencode executable and acp arguments
Advanced grace Wait time for process cleanup (milliseconds)
Advanced env Extra environment variables (JSON object)

Models are decided on the opencode side: the ACP protocol does not pass model parameters, so the plugin passes configuration by injecting OPENCODE_CONFIG_CONTENT into the subprocess (the docs note that v2’s opencode acp ignores the OPENCODE_CONFIG file path).

Execution mode and limitations

  • Each delegation starts a new process, incurring a cold start of a few seconds; external ACP subagents cannot continue a conversation, so for multi-round delegation you should use DSH’s built-in subagent.
  • Only assistant text is returned; opencode’s tool traffic, reasoning, and planning stay within its own sub-session and are not fed back into the main context.
  • The subprocess runs as the current user and is not constrained by the DSH sandbox, similar to @deepseek-ai/dsh-subagent-acp — treat it as “opencode can do whatever your local machine user can do”.

Environment and Dependencies

Component Requirement
DeepSeek Harness >=0.2.1-rc.1 <0.3.0 (engines.dsh declaration; installation is refused on a version mismatch)
opencode v2, with the acp subcommand available (opencode --version, opencode acp --help)
opencode login opencode auth login has been executed; the subprocess reuses the login and free models

Windows, macOS, and Linux are supported. Default command: on Windows, the npm global install path of opencode; on other systems, opencode from PATH; if it is installed elsewhere, override it under Advanced → command.

Installation and Enabling

Install from the DSH plugin directory page, or run in the terminal (commands from the project README):

# from npm (prebuilt, no build step)
dsh plugin --profile default add dsh-opencode-acp

# or from a tarball
dsh plugin --profile default add ./dsh-opencode-acp-0.1.1.tgz

After installation, restart or refresh DSH. Each agent in the profile will have the tool subagent_opencode, and an OpenCode delegation page will appear in settings.

Uninstall:

dsh plugin --profile default remove dsh-opencode-acp

Removing the plugin package removes the tool and settings page; the $DSH_HOME/opencode-acp directory must be deleted manually to clear local configuration and history.

Typical Usage

State the delegation intent in the conversation, or let the model call the tool directly. README example:

Delegate to subagent_opencode: in this repo, add a unit test for parseDuration and report what you changed.

The main agent still uses the model configured in DSH; opencode completes the implementation and test-related operations in a separate process, and finally returns the change description as the completion result.

How It Works (Schematic)

DSH agent ── subagent_opencode ──► ctx.subagents ──► dsh-opencode-acp (provider "opencode")
                                                        │ spawn: opencode acp
                                                        ▼
                                              ACP over stdio (NDJSON JSON-RPC)
                                       initialize → session/new → session/prompt
                                                        │
                                     ◄── agent_message_chunk, usage_update

The host side is index.js (ACP client, provider, storage, /.dsh-opencode-acp routes); the browser side is client.js (registers settings.section through the client module table). Both are injected into Cordis by cordis.patch.yml.

Suitable Scenarios and Notes

Suitable for developers who want to “outsource” an entire in-repo task to opencode within a DSH conversation, and need to check session ids and token usage. Not suitable for scenarios that require multi-round follow-up questions with the same opencode session (use the built-in subagent instead).

Before installing, it is recommended to read the source code and MIT license in the GitHub repository; delegation executes external processes with local user permissions, so choose allow or reject in settings according to your environment’s permission policy.

The DSH ecosystem emphasizes “everything is a plugin”; the SkillHub plugin directory is a community site with no official affiliation with DeepSeek / High-Flyer.

Conclusion

dsh-opencode-acp connects opencode to DSH as an ACP subagent: the main session stays lightweight, and delegation comes with tools, settings, and run records. To learn more, visit the directory page wangqingdhuo/dsh-opencode-acp and the source code github.com/wangqingdhuo/dsh-opencode-acp.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye