GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — opencode-swarm/spikes/v2-dual-shape at main · ZaxbyHub/opencode-swarm

Expand file tree

/

v2-dual-shape

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

v2-dual-shape

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
logs
logs
 
 
README.md
README.md
 
 
run-spike.mjs
run-spike.mjs
 
 

README.md

Outline

Spike: dual-shape plugin on both OpenCode hosts (#2909 / ADR-0003)

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.

Hosts (documented versions)

  • 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/cli npm platform binary at %APPDATA%\npm\node_modules\@opencode\cli\node_modules\@opencode\cli-windows-x64\bin\opencode.exe). The npm .cmd shim 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 over bin/opencode.exe).

Method

  • 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.js containing import 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).
  • Attribution hygiene: the developer's global OpenCode config also lists opencode-swarm as a plugin, which would load a second (npm-cached) instance and taint entrypoint attribution. Every run therefore sets XDG_CONFIG_HOME to a scratch directory containing an empty opencode/config.json (no plugin/plugins entries). 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.js importing the pristine bundle, spread-copying the default export, and deleting exactly one key — server or setup). 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 with id retained; 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 (setup is inert on the v1 readV1Plugin path, which consults only id/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.
  • Captured host output is HOME-PATH-REDACTED at capture time (backslash and forward-slash Users/<name> segments become Users/<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.js sha256 recorded at capture time, the host-reported version string, and the run timestamp. Marker lines (HOST:, ENTRYPOINT:, HOOK-FIRED:, WARNINGS:, ABLATION:) are generated by run-spike.mjs from 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, the config hook's registration of the swarm agents in opencode agent list; on v2, the session context hook (src/host/v2/guidance.ts onV2ContextEvent → seedV1SessionState) writing .swarm/session state during a TOOL-FREE prompt turn (the only seedV1SessionState call site reachable on a tool-free, non-compacting turn).

Results (2026-10-16 capture)

  • v1 1.19.0: plugin loaded ([opencode-swarm] running v7.197.3), config hook fired (swarm agents registered), entrypoint server() confirmed by both ablations MATCHing. See logs/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 in isolatedEnv() 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, not process.cwd()), session context hook wrote state on the tool-free turn, model replied. Entrypoint setup(ctx) confirmed by both ablations MATCHing. See logs/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.

Warnings

  • 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 repo dist/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 reported WARNINGS: none observed. Also note the npm .cmd shim postinstall guard described under Hosts.

Re-run

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.

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.