HarnessRouter Community Edition: the self-hosted, Apache-2.0 edition of the unified interface for agent harnesses. Run Codex, Claude Code, Hermes, PI, DSH, and more through one API, with sessions, streaming, files, cancellation, and failure handling. Implements the Unified Harness Protocol (UHP), an open standard. Your keys, your infrastructure.
Python agent-apiagent-frameworkagent-harnessai-agentsai-infrastructurecoding-agentconformance-testingdeepseek-harnessharness-engineeringhermesllmopen-protocolopen-sourceopen-standardpi-coding-agentself-hosteduhpunified-apiunified-harness-protocolunified-interface
fix: opencode reads AGENTS.md, and the console base lists had drifted
richard-epsilla1a4c3bfc1082
diff --git a/runner/server.py b/runner/server.pyindex 538487be..e76420f1 100644--- a/runner/server.py+++ b/runner/server.py@@ -758,10 +758,15 @@ _AGENTS_END = "<!-- harness-skills:end -->"def _agent_doc_path(cwd: str, backend: str) -> pathlib.Path:- """The agent's instruction file: AGENTS.md for Codex, Hermes, Pi and dsh (all four read+ """The agent's instruction file: AGENTS.md for Codex, Hermes, Pi, dsh and opencode (all readAGENTS.md from the cwd — pi as a context file before its trust gate, dsh via its- dsh-agent-instructions workspace loader), CLAUDE.md for Claude Code."""- return pathlib.Path(cwd) / ("AGENTS.md" if backend in ("codex", "hermes", "pi", "dsh") else "CLAUDE.md")+ dsh-agent-instructions workspace loader, opencode via instruction-context.ts, whose discovery+ targets are literally ["AGENTS.md"]), CLAUDE.md for Claude Code.++ Getting this wrong is silent: the file is written either way, and a backend that does not read+ the name we chose simply never sees the harness's instructions."""+ return pathlib.Path(cwd) / (+ "AGENTS.md" if backend in ("codex", "hermes", "pi", "dsh", "opencode") else "CLAUDE.md")def _write_agent_doc(cwd: str, backend: str, agent_doc: str | None, skills_meta: list[dict]) -> None:diff --git a/runner/tests/test_opencode_normalize.py b/runner/tests/test_opencode_normalize.pyindex 75fae31d..90244a18 100644--- a/runner/tests/test_opencode_normalize.py+++ b/runner/tests/test_opencode_normalize.py@@ -194,3 +194,12 @@ def test_a_prompt_starting_with_a_dash_is_not_read_as_a_flag():auth = Auth(api_key="k", base_url="https://relay.example/v1")cmd = _build_opencode("openai-api", auth, "gpt-5.4", "--version", d, {})assert cmd[-2:] == ["--", "--version"]+++def test_opencode_instructions_go_to_agents_md_not_claude_md():+ """opencode's discovery targets are literally ["AGENTS.md"] (core/src/instruction-context.ts).+ Writing CLAUDE.md instead fails SILENTLY: the file lands, and the backend never reads it, so+ the harness's instructions vanish with no error anywhere."""+ from server import _agent_doc_path # noqa: PLC0415+ assert _agent_doc_path("/ws", "opencode").name == "AGENTS.md"+ assert _agent_doc_path("/ws", "claude").name == "CLAUDE.md"diff --git a/ui/src/app/(app)/harnesses/[id]/page.tsx b/ui/src/app/(app)/harnesses/[id]/page.tsxindex 94c6ff63..80a9cbab 100644--- a/ui/src/app/(app)/harnesses/[id]/page.tsx+++ b/ui/src/app/(app)/harnesses/[id]/page.tsx@@ -185,7 +185,7 @@ export default function HarnessSettingsPage() {<section className="form-section"><div><h3>Agent instructions</h3><p>Persistent role, conventions, constraints, and output contract loaded on every Task.</p></div><div className="field-stack">- <div className="field"><label htmlFor="hsInstructions">{['codex', 'hermes', 'pi', 'dsh'].includes(base?.id || draft?.base || '') ? 'AGENTS.md' : 'CLAUDE.md'}</label>+ <div className="field"><label htmlFor="hsInstructions">{['codex', 'hermes', 'pi', 'dsh', 'opencode'].includes(base?.id || draft?.base || '') ? 'AGENTS.md' : 'CLAUDE.md'}</label><textarea id="hsInstructions" rows={7} disabled={readOnly}value={oob ? oob.systemPrompt : (draft?.systemPrompt || '')}onChange={(e) => upd({ systemPrompt: e.target.value })} />diff --git a/ui/src/app/(app)/harnesses/page.tsx b/ui/src/app/(app)/harnesses/page.tsxindex 4c2df51f..8d282399 100644--- a/ui/src/app/(app)/harnesses/page.tsx+++ b/ui/src/app/(app)/harnesses/page.tsx@@ -57,13 +57,18 @@ export default function HarnessesPage() {.filter((r) => {if (baseFlt === 'all') return true;const b = baseOf(r).toLowerCase();- if (baseFlt === 'codex') return b.includes('codex');- if (baseFlt === 'hermes') return b.includes('hermes');+ // Stored records carry either the base id or its display name in `runtime`, so the two+ // whose id and name differ need their own line. Everything else matches on its id, which+ // is what keeps this working when a base is added.+ if (baseFlt === 'claude-code') return b.includes('claude');+ if (baseFlt === 'dsh') return b === 'dsh' || b.includes('deepseek');// 'pi' must be an exact-ish match: substring would also catch every base that merely// contains the letters (nothing today, but 'claude' teaches the lesson cheaply).if (baseFlt === 'pi') return b === 'pi' || b.startsWith('pi ');- if (baseFlt === 'dsh') return b === 'dsh' || b.includes('deepseek');- return b.includes('claude');+ // NOT a `return b.includes('claude')` default. That made every unrecognised filter value+ // silently mean Claude Code, so a base added to the dropdown without a matching branch here+ // would quietly list the wrong rows instead of listing none.+ return b.includes(baseFlt);}).filter((r) => healthFlt === 'all' || (healthFlt === 'review') === isDegraded(r));@@ -93,11 +98,11 @@ export default function HarnessesPage() {value={q} onChange={(e) => setQ(e.target.value)} /><select className="select" aria-label="Filter by Base Harness" value={baseFlt} onChange={(e) => setBaseFlt(e.target.value)}><option value="all">All Base Harnesses</option>- <option value="codex">Codex</option>- <option value="claude">Claude Code</option>- <option value="pi">Pi</option>- <option value="dsh">DeepSeek Harness</option>- <option value="hermes">Hermes</option>+ {/* Derived from OOB so a new base cannot be missing here: the hardcoded list had+ already drifted once, offering five options for six bases. */}+ {OOB.filter((o) => o.status === 'ready').map((o) => (+ <option key={o.id} value={o.id}>{o.name}</option>+ ))}</select><select className="select" aria-label="Filter Harnesses by health" value={healthFlt} onChange={(e) => setHealthFlt(e.target.value)}><option value="all">All health</option>@@ -205,7 +210,9 @@ export default function HarnessesPage() {? 'Minimal, steerable harness with four core tools, best when you want a lean agent you can shape.': o.id === 'dsh'? 'DeepSeek\u2019s own agent runtime, best for deep-reasoning work on the DeepSeek model family.'- : 'Best for long-context analysis, document workflows, and structured review.'}</span></span>+ : o.id === 'opencode'+ ? 'Open source terminal agent, best when you want a widely used harness that runs any model you have configured.'+ : 'Best for long-context analysis, document workflows, and structured review.'}</span></span><span className="base-choice-models">{oobDefaultModel(o)} default</span></label>))}