Hello, I'm Rijul. I'm building git-lrc, a micro AI code reviewer that runs on every commit. It's free and source-available on GitHub. Star git-lrc to help more developers discover the project. Do give it a try and share your feedback
OpenCode is one of the popular coding agents available right now.
I've been using it as my daily driver for a while, and there are still many of its features that I haven't explored yet.
In this article, we'll take a look at the agent functionality in OpenCode.
There are two types of agents in OpenCode:
- Primary agents
- Subagents
Primary Agents
These are the main agents that you interact with directly.
There are two types of primary agents:
Build
This is the primary agent with all the tools enabled.
This is what you would normally use when you want the agent to actually work on your codebase.
Plan
This agent is more restricted.
If you want to repeatedly plan and think through something before actually going into execution mode, this is the agent you can use.
The idea is to separate planning from execution.
Subagents
Subagents are specialized assistants that primary agents can invoke for specific tasks.
For example, instead of having the primary agent explore an entire codebase itself, it can delegate that task to a specialized subagent.
You can also invoke these specialized agents directly using @.
OpenCode comes with three built-in subagents.
General
A general-purpose subagent designed for research and multi-step tasks.
You can use it when you want to delegate a task that requires some investigation or multiple steps.
Explore
This is a read-only agent designed for exploring codebases.
For example, if you want to find files based on patterns or understand how something is implemented across a project, this is the agent you can use.
Since it is read-only, it can explore the codebase without making changes.
Scout
Scout is another read-only agent.
It is useful for researching external documentation or comparing external code, such as another repository or upstream implementation.
So if you need to investigate something outside your current codebase, Scout can be useful.
Creating Your Own Agent in OpenCode
You can also create your own agents in OpenCode.
Agents can be defined using JSON in opencode.json or using Markdown files.
For global agents, you can place them under:
~/.config/opencode/agents/
For project-specific agents, you can use:
.opencode/agents/
For example, let's create a copywriter.md agent:
---
description: Writes clear, engaging, and audience-focused copy
mode: subagent
model: anthropic/claude-sonnet-4-20250514
temperature: 0.7
permission:
edit: deny
bash: deny
---
You are in copywriting mode. Focus on:
- Clear and engaging writing
- Matching the tone to the target audience
- Strong messaging and compelling language
- Concise structure and readability
- Preserving the intended meaning and voice
Produce polished, ready-to-use copy without making direct changes.
This creates a specialized copywriting agent.
You can then invoke it using:
@copywriter
The filename becomes the agent name, so copywriter.md becomes @copywriter.
This is where things start getting interesting.
Instead of repeatedly explaining to the main agent how you want a particular task to be handled, you can create a specialized agent with its own instructions, model, temperature, and permissions.
Wrapping Up
So that's it for agents in OpenCode.
We looked at:
- Primary agents
- Build and Plan modes
- Subagents
- The built-in General, Explore, and Scout agents
- Creating your own custom agents
There are several other features in OpenCode that are worth exploring.
The more we understand these features, the more we can customize OpenCode around our own workflow.
AI agents write code fast. They also silently remove logic, change behavior, and introduce bugs -- without telling you. You often find out in production.
git-lrc fixes this. It hooks into git commit and reviews every diff before it lands. 60-second setup. Completely free.
Any feedback or contributors are welcome! It's online, source-available, and ready for anyone to use.
Give it a ⭐ star on Github


Top comments (0)