OpenCode agents
OpenCode agents are Markdown files in .opencode/agents/ (or ~/.config/opencode/agents/ for every project) whose frontmatter sets the description, mode, model and permissions, and whose body becomes the agent's system prompt. An agent runs as the primary agent of a session, as a subagent the main agent launches, or as either.
An example
This read-only reviewer is adapted from OpenCode's own documentation. The main agent can launch it to review changes, and its permissions stop it editing files or running shell commands:
---
description: Reviews changes for correctness and regressions
mode: subagent
permissions:
- action: edit
resource: "*"
effect: deny
- action: shell
resource: "*"
effect: deny
---
Review the current changes. List findings in severity order
with file and line references.
Save it as .opencode/agents/reviewer.md and ask your primary agent to use the reviewer subagent.
Where agent files go
.opencode/agents/<name>.mdfor one project. OpenCode looks for.opencodedirectories from the current directory up to the project root.~/.config/opencode/agents/<name>.mdfor every project.- A nested path becomes part of the ID:
.opencode/agents/team/reviewer.mdisteam/reviewer. - Agents can also be defined in JSON under
agentsin any OpenCode config file, with the same fields.
Modes
| Mode | Behaviour |
|---|---|
| primary | Runs as the main agent for a session. The default for a new custom agent. |
| subagent | Runs only in a child session, launched through the subagent tool. |
| all | Runs either as a primary agent or as a subagent. |
Subagents start with fresh context, in the foreground or the background. The parent's subagent permissions decide which agents it may launch, and the child runs with its own permissions.
The built-in agents
| Agent | Mode | What it does |
|---|---|---|
| build | primary | The default coding agent. |
| plan | primary | Explores and plans without editing normal project files. |
| general | subagent | Research and multi-step work with broad tool access; cannot launch more subagents. |
| explore | subagent | Searches and reads code or web sources without editing files. |
You can override a built-in by defining an agent with the same ID, for example to make git push ask before it runs in the build agent.
Rules, and moving from Claude Code
Agents are separate from rules. Project-wide instructions go in AGENTS.md, which OpenCode reads from the project and from ~/.config/opencode/AGENTS.md. For people coming from Claude Code, OpenCode falls back to CLAUDE.md when there is no AGENTS.md, and reads skills from ~/.claude/skills/.
Agent files do not carry over as they are. Claude Code subagents list their tools in a tools field; OpenCode agents use permission rules with an action, a resource and an effect. A set of agents used in both tools needs both formats, either written by hand or generated from one source.
Where Luros fits
Luros writes each of its twenty-six agents in both formats at once, .opencode/agents/ with OpenCode permissions and .claude/agents/ for Claude Code, from one source, so the two never drift apart.
We make Luros, so weigh this section accordingly. Everything above it stands on the sources below.
Luros is built for a founder with no marketing team, not for general agent set-up. If that is you, request an invite.
Request an inviteOne email. We will tell you when there is a place for you, and nothing else.
Questions people ask
- Where are OpenCode agents stored?
- In .opencode/agents/ in a project, or ~/.config/opencode/agents/ for every project. They can also be defined under agents in an OpenCode config file.
- What is the difference between a primary agent and a subagent in OpenCode?
- A primary agent runs a session. A subagent runs in a child session that a primary agent launches, with fresh context and its own permissions.
- Can OpenCode use Claude Code agents?
- Not file for file. OpenCode reads CLAUDE.md and Claude Code skills as fallbacks, but agent files use a different permissions format.
- How do I stop an OpenCode agent editing files?
- Give it a permission rule with action edit, resource "*" and effect deny. Do the same for shell to stop it running commands.
- Does OpenCode read AGENTS.md?
- Yes. AGENTS.md is its rules file, read from the project and from ~/.config/opencode/AGENTS.md.
Related guides
- AGENTS.md vs CLAUDE.md
- Claude Code agents vs skills
- AI marketing agents
- Every guide · Tool comparisons
Sources
- OpenCode docs: Agents, checked 25/11/2026
- OpenCode docs: Rules, checked 25/11/2026
Tools in this area change quickly. Every fact here comes from the sources above as they stood on the date shown; if one has moved on, the source is right and this page is out of date.