A practical multi-agent workflow for OpenCode that runs locally and coordinates a small AI dev team through shared context, scoped permissions, and specialized roles.
This setup includes:
- A planner that asks clarifying questions first
- A debater that checks whether there is a better plan
- An implementor that makes the code changes
- A reviewer that checks correctness and maintainability
- A tester that runs focused tests
- A linter that runs a project lint/check script
- A commit-message agent that prints a final commit message
The workflow uses:
AGENTS.mdfor shared rules across the projectWORKFLOW_STATE.mdfor persistent handoffs between agents- Per-agent permissions for safer edits and command execution
OpenCode supports project-specific agents in .opencode/agents/, lets you configure primary and subagent roles, and loads AGENTS.md from the project root as shared instructions. [page:1][page:2]
A single coding agent can do many things, but multi-step work often becomes messy when planning, implementation, review, testing, and documentation are mixed together.
This repo separates those concerns into focused agents with narrow responsibilities and a shared handoff file. The result is a workflow that is easier to inspect, easier to reuse, and easier to control.
The high-level flow looks like this:
User
↓
Planner
↓
Debater
↓
Implementor
↓
Reviewer
↓
Tester
↓
Linter
↓
Commit Message
-
Planner
- Reads the request
- Asks clarifying questions first
- Confirms scope and acceptance criteria
- Writes the implementation plan to
WORKFLOW_STATE.md
-
Debater
- Reviews the planner’s proposal
- Decides whether a meaningfully better plan exists
- Writes feedback into
WORKFLOW_STATE.md
-
Implementor
- Applies the approved plan
- Makes the smallest useful code changes
- Records changed files and implementation notes
-
Reviewer
- Reviews the implementation against the plan and acceptance criteria
- Flags risks, side effects, or incomplete work
-
Tester
- Runs the smallest relevant test set
- Records commands and results
-
Linter
- Runs the project’s lint/check script
- Records pass/fail and findings
-
Commit-message
- Reads the final diff and workflow state
- Prints a conventional commit message
.
├─ AGENTS.md
├─ WORKFLOW_STATE.md
└─ .opencode/
└─ agents/
├─ planner.md
├─ debater.md
├─ implementor.md
├─ reviewer.md
├─ tester.md
├─ linter.md
└─ commit-message.md
-
AGENTS.md- Shared rules for all agents in this project
- Loaded into OpenCode’s context for project-specific behavior [page:2]
-
WORKFLOW_STATE.md- Shared state and handoff record between agents
- Keeps planning, decisions, status, and outputs in one place
-
.opencode/agents/*.md- Project-specific agent definitions
- OpenCode uses the markdown filename as the agent name [page:1]
AGENTS.md acts like the project constitution.
It defines workflow-wide behavior, such as:
- all agents must read
WORKFLOW_STATE.md - all agents must update only the sections relevant to their role
- agents should prefer Context7 when docs lookup is useful
- the workflow order and handoff expectations
OpenCode explicitly supports a root AGENTS.md file for project-specific instructions. [page:2]
WORKFLOW_STATE.md acts like the workflow notebook.
Instead of relying only on chat history, agents use a persistent file to coordinate:
- clarified scope
- open questions
- constraints
- acceptance criteria
- plan
- debate notes
- implementation notes
- review findings
- test and lint results
- commit message draft
This makes the workflow more transparent and easier to debug.
Each agent gets only the permissions it needs.
For example:
- planner, debater, reviewer, tester, linter, and commit-message may only edit
WORKFLOW_STATE.md - implementor can edit code
- tester and linter can run only approved commands
- planner can invoke only the intended downstream agents
OpenCode supports per-agent permissions for edit, bash, webfetch, and task invocation. [page:1]
For an agent that should only update WORKFLOW_STATE.md:
permission:
edit:
"*": deny
"WORKFLOW_STATE.md": allowOpenCode supports granular path-based permissions, and the last matching rule takes precedence. [page:1]
For a linter that should run only a Python script:
permission:
edit:
"*": deny
"WORKFLOW_STATE.md": allow
bash:
"*": deny
"python scripts/lint.py*": allow
"python3 scripts/lint.py*": allowOpenCode also supports command-pattern rules for bash permissions. [page:1]
Each agent can use its own model and temperature.
Typical strategy:
- low temperature for planner, reviewer, tester, and linter
- slightly higher temperature for debater
- stronger model for planner and implementor
- faster or cheaper model for narrow support roles
OpenCode supports per-agent model, temperature, max_steps, and mode settings. [page:1]
This workflow can be extended with MCP tools such as:
- Context7 for up-to-date documentation lookup
If configured in OpenCode, these tools can be encouraged through AGENTS.md and agent prompts so the planner, implementor, and reviewer use them when helpful. OpenCode exposes MCP servers as tools once they are configured and enabled. [page:1]
Place:
AGENTS.mdin the project rootWORKFLOW_STATE.mdin the project root- all agent markdown files inside
.opencode/agents/
Update:
- test commands in
tester.md - lint/check commands in
linter.md - model IDs in each agent file
- any MCP-related instructions if you use Context7
Run OpenCode from the root of your repository so project-level rules and agents are picked up correctly.
Example:
opencode run --agent planner "Add a settings page where users can update their profile and notification preferences"The planner should:
- ask clarifying questions first
- write the clarified scope to
WORKFLOW_STATE.md - generate a plan
- hand off to the next agent
This setup works best when:
- the task is non-trivial
- you want a visible plan and review trail
- you care about safe permissions
- you want reusable workflow behavior across repos
It is especially useful for:
- feature work
- refactors
- bug fixes with multiple steps
- code review and validation flows
- local-first AI development setups
You can extend this repo with additional agents such as:
security-reviewerdocs-writerrelease-notesmigration-plannerperformance-reviewer
OpenCode lets you create additional agents and restrict which subagents can be invoked with task permissions. [page:1]
AGENTS.mdis for shared instructions, not shared memoryWORKFLOW_STATE.mdis the canonical handoff file- the agent markdown filename becomes the agent name
- the planner is intentionally clarification-first
- the debater is intentionally narrow: it reviews the plan and checks whether a better one exists
Built for OpenCode’s project-level agent system and rule files.
Relevant docs:
- OpenCode Agents: https://opencode.ai/docs/agents/
- OpenCode Rules: https://opencode.ai/docs/rules/
https://youtu.be/kE6x7xKy4lM?si=_dCDpZVN_vOZZSzL
MIT — feel free to copy, adapt, and share.