Skip to content

feat(opencode): dispatch recipes + model flag #153

Description

@slowdini

Part of the OpenCode enhancement-parity track (see #113 for the baseline + progressive-enhancement model; per-enhancement wiring guide in docs/progressive-enhancements.md).

harnesses/opencode.toml currently declares no [dispatch] block and no [model] table, so run --harness opencode prints generic manual-opencode run guidance and --agent-model/--judge-model are recorded as provenance only (README support table footnote ¹).

Work

Add a [dispatch] block (exec_template, parallel_command_template, judge_command_template, next_steps_template, manifest_template, capture_prefix = "opencode") plus [model] flag = "-m" to harnesses/opencode.toml. These must land together: descriptor validation ties judge_command_template's $model_arg to a declared model flag.

Verified CLI facts (opencode v1.18.3 docs + packages/opencode/src/cli/cmd/run.ts)

  • opencode run --dir <dir> resolves the project instance against <dir> and chdirs there, so staged .opencode/skills in the env are discovered.
  • Piped stdin is appended to the message (Bun.stdin.text() when stdin is not a TTY) — recipes must detach with </dev/null>, same as codex.
  • Headless permission asks are auto-rejected unless --auto is passed. The dispatch prompt lives outside the task env dir, and external_directory defaults to ask, so recipes need --auto (explicit deny rules are still enforced under --auto — relevant once the write guard lands).
  • --format json streams raw JSON events (tool_use / text / step_finish / error) to stdout; there is no --output-last-message — the final message is recovered from text events by transcript ingest.
  • -m takes models in provider/model format; the value passes through verbatim.

Proposed template shape

opencode run --dir <eval-root> --format json --auto{model_arg} \
  "Read the file at <dispatch_prompt_path> and follow its instructions exactly. When you finish, make your final response your closing summary." \
  </dev/null \
  > <outputs_dir>/opencode-events.jsonl \
  2> <outputs_dir>/opencode-stderr.log

(parallel + judge variants per the codex descriptor's structure; next_steps_template points at eval-magic ingest --harness opencode.)

Acceptance

  • [dispatch] + [model] declared; eval-magic harness lint opencode clean
  • Golden fixtures blessed (GOLDEN_BLESS=1 cargo test golden_) covering RUNBOOK/dispatch-manifest/next-steps for --harness opencode
  • One live opencode run per the recipe in a scratch env verifies: staged skills discovered, events file ingests cleanly, model flag honored
  • docs/opencode-notes.md updated; README support table flips Dispatch recipes and Model flag to ✅ and footnote ¹ is removed
  • cargo test, cargo clippy --all-targets -- -D warnings, cargo fmt --check green

Sequenced after the transcript-ingest work so next_steps_template can reference ingest (avoids blessing the handoff text twice).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions