Problem
OpenCode supports named agents via opencode run --agent <name>, allowing users to define agents with different system prompts and permission profiles. For example:
- Planner agent: read-only analysis (
edit: ask, bash: ask), system prompt instructs "never edit files"
- Implementer agent: full editing (
edit: allow, bash: allow), system prompt instructs writing production code
This maps perfectly to roborev's review/fix workflow split — use a conservative read-only agent for reviews, and a capable editing agent for fixes.
However, roborev's OpenCode integration invokes:
opencode run --format json [--model MODEL] [prompt]
There is no mechanism to pass --agent <name> through to the OpenCode CLI. This means roborev always gets whichever agent OpenCode defaults to, regardless of whether the job is a review or a fix.
Why this matters
In non-interactive mode (opencode run --format json), OpenCode auto-approves permission prompts — so edit: ask becomes effectively allow. But the system prompt still governs behavior. A Planner agent whose instructions say "never edit files" will refuse to make changes even when permissions allow it.
This creates a deadlock for the fix workflow:
- The default agent (Planner) won't edit files due to its system prompt
- The agent that can edit (Implementer) can't be selected by roborev
The workaround today is to use a different top-level agent for fixes (e.g., fix_agent = "claude-code"), which defeats the purpose of having OpenCode's agent system.
Proposed solutions
Any of these would resolve the issue (in rough order of preference):
1. Per-workflow OpenCode agent config keys
# .roborev.toml or global config
opencode_agent = "implementer" # default for all opencode workflows
review_opencode_agent = "planner" # override for reviews
fix_opencode_agent = "implementer" # override for fixes
roborev would then invoke opencode run --agent <name> --format json ....
2. Generic per-agent extra args
A more general mechanism that works for any agent:
# Extra CLI args appended when invoking a specific agent
[agent_args]
opencode = "--agent implementer"
# Or per-workflow
[review_agent_args]
opencode = "--agent planner"
[fix_agent_args]
opencode = "--agent implementer"
3. opencode_cmd config key
Similar to the existing claude_code_cmd, codex_cmd, and cursor_cmd keys — allow overriding the command used to invoke OpenCode:
opencode_cmd = "/path/to/wrapper-script"
This is the least ergonomic option but would unblock the use case immediately.
Environment
- roborev v0.37.0
- OpenCode (latest, installed via
opencode-ai npm package)
- OpenCode agents defined in
~/.config/opencode/agent/ with distinct system prompts and permissions
Problem
OpenCode supports named agents via
opencode run --agent <name>, allowing users to define agents with different system prompts and permission profiles. For example:edit: ask,bash: ask), system prompt instructs "never edit files"edit: allow,bash: allow), system prompt instructs writing production codeThis maps perfectly to roborev's review/fix workflow split — use a conservative read-only agent for reviews, and a capable editing agent for fixes.
However, roborev's OpenCode integration invokes:
There is no mechanism to pass
--agent <name>through to the OpenCode CLI. This means roborev always gets whichever agent OpenCode defaults to, regardless of whether the job is a review or a fix.Why this matters
In non-interactive mode (
opencode run --format json), OpenCode auto-approves permission prompts — soedit: askbecomes effectivelyallow. But the system prompt still governs behavior. A Planner agent whose instructions say "never edit files" will refuse to make changes even when permissions allow it.This creates a deadlock for the fix workflow:
The workaround today is to use a different top-level agent for fixes (e.g.,
fix_agent = "claude-code"), which defeats the purpose of having OpenCode's agent system.Proposed solutions
Any of these would resolve the issue (in rough order of preference):
1. Per-workflow OpenCode agent config keys
roborev would then invoke
opencode run --agent <name> --format json ....2. Generic per-agent extra args
A more general mechanism that works for any agent:
3.
opencode_cmdconfig keySimilar to the existing
claude_code_cmd,codex_cmd, andcursor_cmdkeys — allow overriding the command used to invoke OpenCode:This is the least ergonomic option but would unblock the use case immediately.
Environment
opencode-ainpm package)~/.config/opencode/agent/with distinct system prompts and permissions