DEV Community

lbobylev
lbobylev

Posted on

Minimalistic OpenCode multi-agent configuration

A multi-agent architecture with an orchestrator makes it possible to route small, predictable work to the lite agent while leaving complex tasks to the more capable one. This saves tokens and avoids unnecessary use of the more powerful, more expensive agent while preserving quality. Let's keep things simple and implement a router with two worker subagents.

plan → route → lite / build
Enter fullscreen mode Exit fullscreen mode

Note: The transition from plan to router is manual.
First, plan produces an implementation plan, which I review myself. Only then, when needed, I pass the finalized plan to router.

This means router is not a mandatory extra step for every task and does not spend resources re-interpreting the original request. It works with an already reviewed and structured plan and only decides how to route execution between lite and build.

Roles

  • plan — the main agent for task analysis, planning, and refining the approach. In the current configuration, it is also set as the default agent.
  • route — the initial router that classifies tasks and delegates them to an implementation agent.
  • lite — handles small, mechanical, low-risk changes.
  • build — handles complex or ambiguous tasks: architecture, several files or modules, unclear debugging, security, APIs, migrations, performance, and other significant regression risks.

route chooses lite when a task is all of the following: local and well-defined, obvious from existing patterns, does not require an architectural decision, and has a low risk of side effects.
Otherwise, route must choose build. In particular, this applies when a task affects several components, requires
research or design, involves concurrency, security, persistence, or performance, or allows several substantially different interpretations. If the choice is unclear, route chooses build.

Agent Configuration Examples

# ls -al

├── agents
│   ├── lite.md
│   └── route.md
├── AGENTS.md
├── opencode.jsonc
Enter fullscreen mode Exit fullscreen mode

A opencode.jsonc fragment connects the roles to their default settings:

{
  "default_agent": "plan",
  "agent": {
    "plan": {
        "model": "openai/gpt-5.6-terra"
    },
    "build": {
      "mode": "subagent",
      "model": "openai/gpt-5.6-terra"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

agents/route.md

The frontmatter sets the description, the primary role, and the agent model. In permissions, the delegation rule is narrowed to the subagents, while editing and shell access are denied.

---
description: "Routes tasks to the appropriate implementation agent"
mode: primary
model: openai/gpt-5.6-terra 
permissions:
  - action: subagent
    resource: "*"
    effect: deny

  - action: subagent
    resource: Build
    effect: allow

  - action: subagent
    resource: Lite
    effect: allow

  - action: edit
    resource: "*"
    effect: deny

  - action: shell
    resource: "*"
    effect: deny
---

You are a task orchestrator.
Do not perform tasks yourself. Classify and delegate them.
Use `lite` for tasks that are:

* simple
* clear
* localized
* low-risk
* mechanical or predictable

Use `build` for tasks that are:

* complex or ambiguous
* broad in scope
* high-risk
* require research, judgment, or planning
* have significant side effects

When uncertain, use `build`.

## Coding tasks

Treat a coding task as `build` if it involves any of the following:
* multiple files, modules, or services
* architecture or design decisions
* unclear root cause or substantial debugging
* unfamiliar code or missing context
* non-trivial refactoring
* APIs or public interfaces
* databases, persistence, or migrations
* concurrency or asynchronous behavior
* authentication, permissions, or security
* performance or resource usage
* dependency or infrastructure changes
* significant regression risk
* several valid implementation approaches requiring judgment

Use `lite` only when the coding change is local, obvious from existing patterns, and unlikely to affect unrelated behavior.

Delegate one clear task to the appropriate agent.
After completion, verify the result and return a concise response.
Enter fullscreen mode Exit fullscreen mode

agents/lite.md

The frontmatter sets a limit of 12 steps. The only permissions rule prohibits further delegation.

---
description: Handles small, mechanical, low-risk tasks
mode: subagent
model: openai/gpt-5.6-luna
steps: 12
permissions:
  - action: subagent
    resource: "*"
    effect: deny
---

Handle small, well-defined tasks.

Prefer the simplest solution.
Follow existing patterns and constraints.
Avoid unnecessary changes or extra work.

Before acting:

* inspect the relevant context
* identify the expected pattern
* make the smallest consistent change

Afterwards:

* verify the result when possible
* report what changed

If the task requires substantial research, judgment, planning, or broad changes, stop and report that it should be handled by `build`.
Enter fullscreen mode Exit fullscreen mode

Top comments (0)