Purpose (issue #2909 acceptance row "Spike loads on both hosts"): capture
in-repo evidence that one dual-shape build ({ id, server, setup }) loads on
a real OpenCode 1 host (>= 1.18.29) and a real OpenCode 2 host, that each host
invokes exactly the entrypoint it is documented to invoke, and that a
registered hook fires on each host. The production plugin already ships the
dual shape (src/index.ts default export; ADR-0003), so the spike loads the
REAL built plugin — a stronger claim than the minimal { id, server, setup }
package the issue sketched.
- v1:
opencode 1.19.0(C:\OpenCode\opencode.exe) — satisfies the issue's= 1.18.29 floor (the issue text's "1.18.31" was npm-latest at filing time, 2026-09-21; the v1 line has since moved to 1.19.0).
- v2:
opencode v2.0.29(@opencode/clinpm platform binary at%APPDATA%\npm\node_modules\@opencode\cli\node_modules\@opencode\cli-windows-x64\bin\opencode.exe). The npm.cmdshim refuses to run on this machine ("postinstall script was not run" — npm allow-scripts policy); invoking the platform binary directly is behavior-identical (the postinstall only copies that binary overbin/opencode.exe).
- Load routes (both validated live before capture):
- v1: project
opencode.json{"plugin": ["file:E:/ZCode/opencode-swarm-dev"]}(the repository IS the package:package.json#main→dist/index.js). - v2: project
.opencode/plugins/local-spike.jscontainingimport plugin from "file:///E:/ZCode/opencode-swarm-dev/dist/index.js"; export default plugin;(v2 discovers local plugin modules from.opencode/plugins/; the migration guide's file-shim route — config-array absolute paths are ignored by v2).
- v1: project
- Attribution hygiene: the developer's global OpenCode config also lists
opencode-swarmas a plugin, which would load a second (npm-cached) instance and taint entrypoint attribution. Every run therefore setsXDG_CONFIG_HOMEto a scratch directory containing an emptyopencode/config.json(noplugin/pluginsentries). Auth and data directories are untouched, so model turns still execute. Each run uses a FRESH temp project (no pre-materialized.swarm/). - Entrypoint attribution is by ablation, not by assumption: each ablated
package is a WRAPPER module (
dist/index.jsimporting the pristine bundle, spread-copying the default export, and deleting exactly one key —serverorsetup). Every ablated artifact is pre-validated in Node BEFORE any host run: the default-export key set must equal pristine-minus-exactly-the- intended-key withidretained; a parse failure or wrong key set aborts as a harness error and never becomes a host verdict. Expected outcomes:- v1 + no
setup→ still loads (setupis inert on the v1readV1Pluginpath, which consults onlyid/server/tui). - v1 + no
server→ plugin dropped (no banner, host continues). - v2 + no
server→ still loads (the v2 decoder ignores excess keys and matches the{id, setup}branch). - v2 + no
setup→ the host's literal decode error:Plugin must export a default definition with an id and an effect or setup function.
- v1 + no
- Captured host output is HOME-PATH-REDACTED at capture time
(backslash and forward-slash
Users/<name>segments becomeUsers/<user>) before it reaches any committed artifact. Every verdict additionally requires positive evidence that the host ran (clean exit, no timeout, non-empty capture; the v1 negative ablation leg also requires the host's own drop record). - Every log binds its build: the
dist/index.jssha256 recorded at capture time, the host-reported version string, and the run timestamp. Marker lines (HOST:,ENTRYPOINT:,HOOK-FIRED:,WARNINGS:,ABLATION:) are generated byrun-spike.mjsfrom PARSED host output, not hand-written. Limitation (disclosed):dist/is gitignored, so the sha is CAPTURE-TIME provenance - CI asserts each log carries a well-formed binding line, not that it matches a rebuildable artifact; authenticity rests on this repo's review gates, not on mechanical post-merge verification. HOOK-FIRED:lines cite hook-path evidence only (never the bundled-skills copy, which is a post-resolution side effect): on v1, theconfighook's registration of the swarm agents inopencode agent list; on v2, the sessioncontexthook (src/host/v2/guidance.tsonV2ContextEvent→seedV1SessionState) writing.swarm/sessionstate during a TOOL-FREE prompt turn (the onlyseedV1SessionStatecall site reachable on a tool-free, non-compacting turn).
- v1 1.19.0: plugin loaded (
[opencode-swarm] running v7.197.3),confighook fired (swarm agents registered), entrypointserver()confirmed by both ablations MATCHing. Seelogs/v1-host.log,logs/v1-nosetup-ablation.log,logs/v1-noserver-ablation.log. (Banner note, #3405: since the #3405 fix the raw stderr banner is opt-in —OPENCODE_SWARM_VERSION_BANNER=1— and this harness sets it inisolatedEnv()so the banner-detection regexes keep matching on fresh runs; the captured logs above predate that change.) - v2 2.0.29: plugin loaded via the local shim (
loading plugin id=...local-spike.js), banner,.swarm/fully materialized (invariant 4 directory injection — state under the project root, notprocess.cwd()), sessioncontexthook wrote state on the tool-free turn, model replied. Entrypointsetup(ctx)confirmed by both ablations MATCHing. Seelogs/v2-host.log,logs/v2-noserver-ablation.log,logs/v2-nosetup-ablation.log. - First-turn window measurements:
logs/first-turn-window-v1-run*.json— summarized in ADR-0003's appendix (the durable record). The v2 timing attempt was discontinued (v2 relays neither session lifecycle lines nor plugin stdout; see the ADR appendix) and its null-field artifacts were removed at review. - Regeneration: re-running overwrites the committed logs and JSON rows in place (fresh timestamps and a fresh measurement batch); the ADR appendix records the batch of note.
- v1: none observed on the isolated runs (the "Ignored N invalid config keys" advisory seen with the developer's real user config does not appear under the isolated scratch config).
- v2 (exploratory runs only):
sqlite-vec extension not available — dense retrieval disabled(Cannot find module '@sqlite/sqlite-vec/package.json' from the repodist/index.js) — a pre-existing optional-dependency gap when running from a repo checkout rather than the packed npm tarball; non-fatal, dense retrieval falls back. Observed during the non-isolated exploratory boot (user-config environment); the committed isolated run's parser reportedWARNINGS: none observed. Also note the npm.cmdshim postinstall guard described under Hosts.
bun run build # dist/index.js must exist (the harness also builds if missing)
node spikes/v2-dual-shape/run-spike.mjs --measure
The harness is self-contained: it resolves the repo root from its own
location, creates all scratch projects/packages under os.tmpdir(), removes
them afterwards, and exits non-zero listing any leg that failed its
expectation. Override host paths with SPIKE_V1_BIN / SPIKE_V2_BIN on
machines where the binaries live elsewhere.