Harness-aware
--root is the OpenCode session location. AGENTS.md, opencode.json(c), .opencode/, and project skills load from it.
A Node runner that connects to your already-running OpenCode server through
@opencode/client, loads a harness root, executes a single delegated
session in the background, and leaves you a durable result artifact.
Quick start
The server stays yours: the runner only discovers it, opens a session, and streams the work back.
Clone into the Hermes plugins directory, install the one runtime dependency, validate, and enable.
cd "${HERMES_HOME:-$HOME/.hermes}/plugins"
git clone https://github.com/jpolvora/opencode-delegate.git
cd opencode-delegate
npm install --omit=dev
hermes plugins validate .
hermes plugins enable opencode-delegate
Write the brief inside the harness root, then start the runner as a Hermes background process.
mkdir -p ./repo/.hermes/tasks
cat > ./repo/.hermes/tasks/review.md <<'EOF'
Review the current diff. Report bugs, missing tests,
and security risks. Do not edit files.
EOF
# In Hermes:
terminal(
command='"$PLUGIN/bin/opencode-delegate" \
--root ./repo \
--instructions .hermes/tasks/review.md \
--model review --agent plan',
workdir="./repo",
background=true,
notify_on_complete=true
)
--server <url>.
Why this shape
Built for long tasks that should outlive the chat turn that started them.
--root is the OpenCode session location. AGENTS.md, opencode.json(c), .opencode/, and project skills load from it.
Launched with Hermes terminal(background=true, notify_on_complete=true). Poll the process log or wait for the completion turn.
Reasoning, text, tool calls, retries, and permission decisions are streamed as they happen — in text or NDJSON.
Every run leaves result.json, events.jsonl, run.log, and meta.json under a profile-scoped run directory.
Pass --session ses_... to continue an OpenCode session. The run artifact records the session, model, and usage.
Non-interactive runs reject prompts by default and record them. --auto is explicit and intended for trusted harnesses only.
Flow
The runner starts event subscription before prompting, so no reasoning is missed.
result.json, exit by outcome.Dispatcher contract
The skill teaches Hermes the exact background dispatch, log parsing, and result-reading loop.
The plugin ships opencode-delegate and registers opencode-delegate:dispatch.
# Hermes sees it in the local skill list
opencode-delegate
# Or load the namespaced plugin skill
skill_view("opencode-delegate:dispatch")
It covers model aliases, resume, cancellation, permission rejection, timeout handling, and artifact review.
Everything needed to audit or replay the turn is colocated.
~/.hermes/plugin-data/opencode-delegate/runs/<run_id>/ ├── meta.json plan, root, instructions, pid ├── events.jsonl app + raw OpenCode events ├── run.log human-readable mirror └── result.json ok, outcome, text, tools, usage
Configuration
Defaults live in config.json; per-profile overrides live in plugin data.
{
"provider": "opencode-go",
"model": "deepseek-v4.1-flash",
"models": {
"fast": "opencode-go/minimax-m3.1-flash",
"review": "opencode-go/deepseek-v4-pro"
},
"agent": "build",
"timeout_seconds": 3600,
"heartbeat_seconds": 30,
"auto_approve": false
}
# Empty URL = discover the registered service
OPENCODE_SERVER_URL=
# Optional overrides
OPENCODE_DELEGATE_MODEL=opencode-go/deepseek-v4.1-flash
OPENCODE_DELEGATE_AGENT=build
OPENCODE_DELEGATE_TIMEOUT=3600
# Or pass explicitly
opencode-delegate --server http://host:4096 ...
--model fast uses the alias; provider/model#variant selects a variant such as #max.
Boundaries
No hidden server management, no credential scraping, no surprise approvals.
The server is already running and authenticated. The runner only reads the service registration for its connection details.
Instructions are resolved inside --root. Absolute paths and symlink escapes are rejected before the prompt is sent.
Permission asks are rejected in non-interactive runs and recorded in result.permissions. Use --auto only when the harness is trusted.