Skip to content

OpenCode

OpenCode is an open-source AI coding agent.

Installation

See the OpenCode installation guide.

Base Invocation

text
opencode run "<prompt>"

Common Flags

FlagTypeDescription
--modelstringModel to use
--barebooleanMinimal output mode

Example

yaml
steps:
  - name: review
    action: harness.run
    with:
      provider: opencode
      prompt: "Review the current branch and list problems"
      model: claude-sonnet-4

Generated invocation:

text
opencode run "Review the current branch and list problems" --model claude-sonnet-4

YOLO Mode

OpenCode runs non-interactively by default when using run mode. For fully autonomous execution without any interactive prompts, ensure you are using the run subcommand and not the interactive TUI:

yaml
steps:
  - name: auto-implement
    action: harness.run
    with:
      provider: opencode
      prompt: "Implement the feature described in the issue"
      auto: true

Generated invocation:

text
opencode run "Implement the feature described in the issue" --auto

For CI/CD environments, you may also want to set the OPENCODE_API_KEY environment variable to avoid authentication prompts.

See Also

Released under the MIT License.