Repository navigation
Description
Description
Currently, opencode run is called without additional flags:
cmd = [self.binary, "run", prompt]There is no way to set global defaults for --model, --agent, --pure, etc. that apply to all agents in all workflows.
A general configuration layer is needed that serves as the base for every opencode run invocation — before per-agent overrides (#22) take effect.
Design
1. New Dataclass: OpenCodeOptions
@dataclass
class OpenCodeOptions:
model: Optional[str] = None
agent: Optional[str] = None
variant: Optional[str] = None
pure: bool = False
log_level: Optional[str] = None
extra_args: list[str] = field(default_factory=list)
def to_cli_args(self) -> list[str]:
args = []
if self.model:
args += ["-m", self.model]
if self.agent:
args += ["--agent", self.agent]
if self.variant:
args += ["--variant", self.variant]
if self.pure:
args += ["--pure"]
if self.log_level:
args += ["--log-level", self.log_level]
args += self.extra_args
return args2. Storage Locations (Override Order)
CLI > Workflow JSON > config.json > opencode built-in
(a) Global in config.json:
{
"opencode_defaults": {
"model": "anthropic/claude-sonnet-4",
"agent": "plan",
"pure": true
}
}(b) Workflow-specific (overrides global):
{
"loop_agents": ["amala", "vera"],
"opencode_defaults": {
"model": "openai/gpt-4o"
}
}(c) CLI override:
python openloop.py --cli --workflow wf.json --opencode-defaults "agent=plan"3. Config Extension
core/config.py – Config gets opencode_defaults: OpenCodeOptions.
4. WorkflowConfig Extension
core/engine.py – WorkflowConfig also gets opencode_defaults.
5. Runner Extension
OpenCodeRunner.run() accepts opts: Optional[OpenCodeOptions] = None and calls opts.to_cli_args().
6. Engine Merging
In execute_workflow_data(): Config defaults as base, merge workflow defaults (workflow wins).
7. GUI Extension
Settings dialog or config panel with fields for Model, Agent, Variant, Pure, Log-Level.
Sub-Issues (ToDo)
- Configuration System (core/config.py) #1 Data Model –
OpenCodeOptionsdataclass incore/runner.pywithto_cli_args() - Core State Management (core/state.py, core/parser.py) #2 Config –
opencode_defaultsfield inConfig+ serialization - Agent Definition Loader (core/agent.py) #3 WorkflowConfig –
opencode_defaultsfield + serialization - Subprocess Runner (core/runner.py) #4 Runner –
OpenCodeRunner.run()accepts and usesOpenCodeOptions - Execution Engine (core/engine.py) #5 Engine – Merge logic, pass to runner
- Main Entry Point (openloop.py) #6 CLI – New
--opencode-defaultsflag - Example Agents & Workflow #7 GUI – Settings dialog for defaults
- Tkinter GUI (ui/app.py) #8 Integration Tests
Distinction from #22
This issue defines the global base. Issue #22 builds on this and allows per-agent overrides. The complete merge order is:
Config (opencode_defaults) > Workflow (opencode_defaults) > Agent (agent_options) > Runner
Activity
feat: OpenCode defaults (#23), update config/doc naming, fix tests
maddes8cht commentedon Jul 20, 2026
Implemented and merged into main.
[-]Globale OpenCode-Defaults (opencode_defaults) für Model, Agent, Variant, Pure etc.[/-][+]Global OpenCode Defaults (opencode_defaults) for Model, Agent, Variant, Pure, etc.[/+]