Create a custom agent
agents & rules
// what it does
opencode agent create scaffolds an agent interactively, or write the Markdown yourself: the filename becomes the agent name, YAML frontmatter sets description, mode (primary/subagent/all), model, and permission, and the body is the system prompt. Put it in ~/.config/opencode/agents/ for all projects or .opencode/agents/ for one repo.
// shell
$ opencode agent create$ opencode agent list$ ~/.config/opencode/agents/review.md// gotcha
The directory is agents/ (plural) — a file in agent/ is ignored. mode decides where it appears: subagent agents are @-invoked and do not show up in the Tab cycle.