Skip to content

Add the opencode Harness (OpenCode) #439

Closed

Description

@JacobStephens2

Parent

#432

What to build

harness opencode runs a Command's sessions on OpenCode, with MiMo-V2.6-Pro, or any other Model the user's OpenCode providers route, wherever the other Harnesses can be chosen, including [harness.opencode] and Setup. It reuses three earlier pieces: the instruction-file fallback link (agy), skill-tool loading and the read after exit (Muse), and the tree-stop.

Facts: the harness candidates research note, §6. Flags and environment: ADR 0013.

Acceptance criteria

  • Each session runs opencode run --standalone --format json --auto, with the prompt on stdin, never as an argument, and OPENCODE_DISABLE_AUTOUPDATE=1. The same applies to every Resume and to the check.

  • The Model and Effort are passed as -m <provider>/<model>#<effort>.

  • Before any work, the Model and Effort are checked with a minimal standalone test call. A provider.no-route error is reported as a bad Model or Effort. Setup checks its answer the same way and proposes no default Model.

  • The Factory skills are linked into .agents/skills/. The prompt tells the model to load the skill with its skill tool, and a warning is written when the stream has no tool_use of the skill tool for that skill.

  • When the worktree root has CLAUDE.md and no AGENTS.md, AGENTS.md is linked to CLAUDE.md there and kept out of git.

  • Once the session exits, opencode session export --standalone <id> is read:

    • an outcome of failed fails the session whatever the exit code;
    • the final message is the last assistant message's last text part;
    • the usage is the sum over the assistant messages.

    When the export fails, the final message falls back to the stream's last text and no usage is shown.

  • The session id comes from the stream. A Resume runs -s <id>, only ever with an id read from the stream.

  • Interrupting a Run stops the session and its shell command, and nothing is left running.

  • A fake opencode in the test harness reads its prompt from stdin, sometimes drops its last step_finish, and answers session export. A sessions scenario test covers the above, including an exported outcome of failed with exit 0.

  • The docs list OpenCode: it never reads CLAUDE.md or ~/.claude/, --standalone adds 2–3 s per session, and it takes the Model id from the user's provider config.

Blocked by

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, ready for an AFK agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions