<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Joao Melo</title>
    <description>The latest articles on DEV Community by Joao Melo (@joaomelo-tech).</description>
    <link>https://dev.to/joaomelo-tech</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3938385%2F50d53043-30a8-4592-ada4-6af67b21dd33.jpg</url>
      <title>DEV Community: Joao Melo</title>
      <link>https://dev.to/joaomelo-tech</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joaomelo-tech"/>
    <language>en</language>
    <item>
      <title>Deep Dive into OpenCode Agent Orchestration</title>
      <dc:creator>Joao Melo</dc:creator>
      <pubDate>Mon, 18 May 2026 15:12:49 +0000</pubDate>
      <link>https://dev.to/joaomelo-tech/deep-dive-into-opencode-agent-orchestration-3ocd</link>
      <guid>https://dev.to/joaomelo-tech/deep-dive-into-opencode-agent-orchestration-3ocd</guid>
      <description>&lt;p&gt;The evolution of AI coding assistants has rapidly shifted from single-prompt chat interactions to autonomous, multi-agent systems. At the forefront of this movement is &lt;strong&gt;OpenCode&lt;/strong&gt;, a terminal-native AI engine built to read, write, test, and debug code directly within your local environment. &lt;/p&gt;

&lt;p&gt;While standard AI tools handle simple, isolated edits, solving complex software tickets—such as a multi-layered codebase refactor, writing matching integration tests, or updating complex deployment pipelines—requires orchestration. By dividing responsibilities into &lt;strong&gt;Agents, Sub-agents, Tools, and Skills&lt;/strong&gt;, the OpenCode ecosystem provides an enterprise-ready blueprint for true software autonomy.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Four Pillars of Agentic Autonomy
&lt;/h2&gt;

&lt;p&gt;To build an automated workflow, you must understand how its core layers pass context and execute logic.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Primary Agents (The Project Leads)
&lt;/h3&gt;

&lt;p&gt;Primary agents are the high-level controllers that you interface with during a terminal session. They maintain the overarching goal of the task and map out the step-by-step strategy.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Build Mode:&lt;/strong&gt; The default primary agent. It operates with full tool write privileges (file operations, system terminal access) and is optimized for heavy implementation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Plan Mode:&lt;/strong&gt; A restricted, read-only primary agent. It is designed purely for architectural analysis, brainstorming, and code review. It defaults to "ask before writing," ensuring it won't alter your filesystem while plotting a migration strategy.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Sub-agents (The Specialized Contractors)
&lt;/h3&gt;

&lt;p&gt;A primary agent's main bottleneck is its context window; loading massive dependency files or heavy documentation can cause the model to lose track of the core objective. Sub-agents are temporary, highly isolated assistants spun up to execute highly focused micro-tasks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;@explore&lt;/code&gt;:&lt;/strong&gt; A lightning-fast, read-only sub-agent built solely to navigate large codebases and locate files or specific structural patterns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;@scout&lt;/code&gt;:&lt;/strong&gt; A dedicated research sub-agent that safely clones external repositories or pulls down upstream documentation into a managed cache, cross-referencing logic without cluttering your local environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Custom Tools (The Hands)
&lt;/h3&gt;

&lt;p&gt;Tools are the deterministic functions and shell hooks that bridge an agent's reasoning loop with your physical system. When an AI generates a structured command, the underlying harness converts it into a concrete action, such as executing localized scripts or custom database query checkers stored inside your project's &lt;code&gt;.opencode/tools/&lt;/code&gt; folder.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Custom Skills (The Blueprints)
&lt;/h3&gt;

&lt;p&gt;While tools are functional mechanisms, &lt;strong&gt;Skills&lt;/strong&gt; represent specialized domain knowledge. Defined via the cross-platform &lt;strong&gt;Agent Skills Open Standard&lt;/strong&gt;, these are structured &lt;code&gt;SKILL.md&lt;/code&gt; markdown files containing YAML frontmatter that teach agents &lt;em&gt;how&lt;/em&gt; to execute a workflow according to specific rules.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real-World Architecture: The Automated Garage Platform
&lt;/h2&gt;

&lt;p&gt;To see how these four pillars interact outside of theoretical abstractions, consider a real-world project: an &lt;strong&gt;Automated Garage &amp;amp; Maintenance Platform&lt;/strong&gt;. This custom local stack is designed to track vehicle telemetry, manage analytics dashboards on Google Cloud, and orchestrate heavy vehicle detailing logs. &lt;/p&gt;

&lt;p&gt;Instead of relying on a generic LLM that might mix up infrastructure code with chemical equations, the environment is orchestrated using custom OpenCode components.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;       [User Prompt]
             │
             ▼
     @garage-lead (Agent)
             │
      ┌──────┴────────────────────────┐
      ▼                               ▼
@gcp-provisioner (Sub-agent)    @detailing-planner (Sub-agent)
      │                               │
      ├─► [cloud-native-standards]    ├─► [surface-prep-guidelines]
      │   (Skill)                     │   (Skill)
      │                               │
      └─► terraform_apply()           └─► query_inventory()
          (Tool)                          (Tool)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Custom Setup
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Custom Agent (&lt;code&gt;@garage-lead&lt;/code&gt;):&lt;/strong&gt; The master coordinator. It is injected with a high-level system prompt via &lt;code&gt;AGENTS.md&lt;/code&gt; to understand vehicle diagnostics and infrastructure boundaries, routing incoming tasks to specialized sub-agents.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Custom Sub-agents:&lt;/strong&gt; * &lt;code&gt;@gcp-provisioner&lt;/code&gt;: A sub-agent restricted entirely to the &lt;code&gt;/infrastructure&lt;/code&gt; directory, tasked with handling cloud deployments.

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;@detailing-planner&lt;/code&gt;: A domain-specific sub-agent engineered to sequence vehicle restoration, paint protection steps, and chemical ratios.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;The Custom Tools:&lt;/strong&gt; Bespoke local scripts exposed to the AI, including &lt;code&gt;read_obd2_telemetry()&lt;/code&gt; (extracting temperature and exhaust errors from a local diagnostic database), &lt;code&gt;query_inventory()&lt;/code&gt; (checking active stocks of parts and detailing products), and a restricted &lt;code&gt;terraform_apply()&lt;/code&gt; hook.&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;The Custom Skills:&lt;/strong&gt; Bound via localized markdown files to inject strict operational guardrails:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;cloud-native-standards&lt;/code&gt;: Forces the infrastructure sub-agent to ensure any new cloud services are isolated to internal traffic and use proper service accounts.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;surface-prep-guidelines&lt;/code&gt;: Hardcodes strict domain-specific physical rules. It instructs the agent that &lt;strong&gt;V-Floc&lt;/strong&gt; is a neutral pH shampoo (never to be used as an all-purpose cleaner/APC) and explicitly dictates that &lt;strong&gt;V-04&lt;/strong&gt; and &lt;strong&gt;Sinergy&lt;/strong&gt; are entirely different products, preventing chemical layering hallucinations.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Execution Loop
&lt;/h3&gt;

&lt;p&gt;When a user inputs: &lt;em&gt;"Check the vehicle telemetry, provision a dashboard for the data, and build a detailing checklist for the weekend,"&lt;/em&gt; the orchestrator executes a multi-threaded autonomous loop:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;code&gt;@garage-lead&lt;/code&gt; triggers &lt;code&gt;read_obd2_telemetry()&lt;/code&gt; to assess the vehicle's cooling and exhaust metrics.&lt;/li&gt;
&lt;li&gt; The agent dispatches &lt;code&gt;@gcp-provisioner&lt;/code&gt;, which reads the &lt;code&gt;cloud-native-standards&lt;/code&gt; skill and uses &lt;code&gt;terraform_apply()&lt;/code&gt; to safely stand up an internal analytics dashboard on Google Cloud.&lt;/li&gt;
&lt;li&gt; Simultaneously, &lt;code&gt;@detailing-planner&lt;/code&gt; wakes up, calls &lt;code&gt;query_inventory()&lt;/code&gt; to check available products, pulls the &lt;code&gt;surface-prep-guidelines&lt;/code&gt; skill, and generates a precise step-by-step cleaning log—ensuring the interior APC teardown and the neutral pH exterior wash happen in the exact sequence required to avoid material damage.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  OpenCode vs. Claude Code: Quick Comparison
&lt;/h2&gt;

&lt;p&gt;For engineering teams evaluating terminal-native automation, OpenCode and Anthropic's &lt;strong&gt;Claude Code&lt;/strong&gt; share similar design principles, but their execution philosophies differ:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Architectural Component&lt;/th&gt;
&lt;th&gt;OpenCode Framework&lt;/th&gt;
&lt;th&gt;Claude Code CLI&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Model Integration&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Fully model-agnostic; supports 75+ cloud and local engines (Ollama, OpenRouter).&lt;/td&gt;
&lt;td&gt;Proprietary ecosystem; heavily optimized for Anthropic's native Claude models.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;The Skills Standard&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Natively implements the cross-platform &lt;strong&gt;Agent Skills Open Standard&lt;/strong&gt; (&lt;code&gt;SKILL.md&lt;/code&gt;).&lt;/td&gt;
&lt;td&gt;Developed the initial &lt;strong&gt;Agent Skills Open Standard&lt;/strong&gt; for progressive token context reduction.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tool Execution&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Executes localized scripts, binary hooks, and raw shell commands out of the box.&lt;/td&gt;
&lt;td&gt;Integrates heavily with the &lt;strong&gt;Model Context Protocol (MCP)&lt;/strong&gt; to talk to local or remote servers.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Task Isolation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Relies on community plugins or wrapper workspaces (e.g., Superset) for multi-branch tasks.&lt;/td&gt;
&lt;td&gt;Natively splits complex tasks into parallel executions using automated Git worktrees.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Modern software automation is shifting away from simple text completion toward structured agent networks. As demonstrated by the automated garage platform, separating high-level strategy (Primary Agents) from isolated research (Sub-agents), and pairing execution mechanics (Tools) with architectural rules (Skills) allows developers to step back from manual code writing and step into the role of a systems manager over a highly efficient AI factory.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>opensource</category>
      <category>agents</category>
    </item>
  </channel>
</rss>
