OpenCode
OpenCode is an open-source AI coding agent.
Installation
See the OpenCode installation guide.
Base Invocation
text
opencode run "<prompt>"Common Flags
| Flag | Type | Description |
|---|---|---|
--model | string | Model to use |
--bare | boolean | Minimal output mode |
Example
yaml
steps:
- name: review
action: harness.run
with:
provider: opencode
prompt: "Review the current branch and list problems"
model: claude-sonnet-4Generated invocation:
text
opencode run "Review the current branch and list problems" --model claude-sonnet-4YOLO 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: trueGenerated invocation:
text
opencode run "Implement the feature described in the issue" --autoFor CI/CD environments, you may also want to set the OPENCODE_API_KEY environment variable to avoid authentication prompts.
