OpenCode Multi-Agent Orchestration Guide
Orchestrate Spring Boot features with 4 specialized agents (orchestrator + coder + reviewer + docs) using a production-grade folder structure.
Summary
๐ฏ Why This Architecture
- Separation of concerns: Each agent has one job
- Persistent memory: Project facts + run logs
- Skills: Reusable agent capabilities
- Audit trail: Every step logged
- Scalable: Works for any Java/Spring project
๐ Project Structure
your-spring-boot-project/
โโโ AGENTS.md # Global workflow rules [REQUIRED]
โโโ .opencode/agents/
โ โโโ orchestrator.md # Primary coordinator
โ โโโ coder.md # Code implementation
โ โโโ reviewer.md # Quality gate
โ โโโ docs.md # Documentation
โโโ memory/
โ โโโ project.md # Architecture facts [REQUIRED]
โ โโโ conventions.md # Code style rules
โโโ runs/ # Auto-generated logs [REQUIRED FOLDER]
โโโ skills/ # Agent superpowers [REQUIRED]
โโโ log-run.SKILL.md # Log phase results
โโโ spring-boot-coder.SKILL.md # Spring patterns
โโโ security-review.SKILL.md # Review checklist
โโโ api-docs.SKILL.md # Doc templates
๐ Quick Setup
๐ File Contents
AGENTS.md (Root)
# Spring Boot Agent Workflow
## Process
1. **Orchestrator** plans + coordinates
2. **Coder** implements minimal changes
3. **Reviewer** validates correctness/security
4. **Docs** updates README/api.md
## Memory Rules
- Read `memory/project.md` + `memory/conventions.md`
- Log to `runs/run-N.md` after each phase
- Never break existing functionality
## Success Criteria
- Tests pass: `mvn test`
- Linting passes: `mvn spotless:check`
- Security review clean
- Docs updatedmemory/project.md
memory/conventions.md
๐ง Agent Configurations
.opencode/agents/orchestrator.md
---
description: Orchestrates coder, reviewer, and docs agents while logging each step.
mode: primary
model: opencode/gpt-5.1-codex
temperature: 0.2
permission:
edit: allow
bash: allow
webfetch: ask
task: allow
skills:
"*": allow
hidden: false
---
You coordinate the workflow. Use skills/log-run after each phase.
1. Read AGENTS.md + memory/
2. Plan implementation steps
3. @coder โ implement
4. @reviewer โ validate
5. @docs โ document
6. Log everything to runs/.opencode/agents/coder.md
---
description: Implements features following Spring Boot patterns.
mode: subagent
model: opencode/gpt-5.1-codex
temperature: 0.1
permission:
edit: allow
bash: allow
webfetch: ask
task: deny
skills:
"spring-boot-*": allow
"log-run": allow
---
Read memory/ files. Make minimal, safe changes.
Use spring-boot-coder skill. Add tests..opencode/agents/reviewer.md
---
description: Security and quality review gate.
mode: subagent
model: opencode/claude-sonnet-4-20250514
temperature: 0.3
permission:
edit: deny
bash: deny
webfetch: ask
task: deny
skills:
"security-review": allow
---
Use security-review skill. Block CRITICAL issues.
Format: SEVERITY | ISSUE | FILE:LINE | FIX.opencode/agents/docs.md
โก Skills
skills/log-run.SKILL.md
skills/spring-boot-coder.SKILL.md
skills/security-review.SKILL.md
skills/api-docs.SKILL.md
๐ฎ Usage
๐ Troubleshooting
| Issue | Fix |
|---|---|
| Agent not found | Check .opencode/agents/*.md syntax |
| Permission denied | Adjust permission: in headers |
| Skills ignored | Verify skills/*.SKILL.md naming |
| No logs | Orchestrator needs bash: allow |
๐ Next Level
- GitHub Actions:
opencode @orchestratorin CI - API wrapper: Spring Boot calling
opencodesubprocess - Team sharing: Commit structure to repo[^2][^1]
This = repeatable, auditable AI development workflow.