Custom Agents

Define specialized agents for specific workflows in your repository.

Overview

Agents are AI assistants with tailored expertise. Create them in .opencode/agents/ to customize behavior for your project.

Creating an Agent

Create .opencode/agents/reviewer.md:

---
name: Security Reviewer
description: Reviews code for security vulnerabilities
tools: [read, grep, webfetch]
---

Check for:
- Authentication and authorization issues
- Input validation problems
- SQL injection and XSS risks
- Hardcoded secrets
- Insecure dependencies

Provide severity ratings (Critical/High/Medium/Low).

Agent Configuration

FieldDescription
nameDisplay name
descriptionWhat the agent does
toolsAllowed tools (optional)

Available Tools

  • read — Read files
  • write — Create files
  • edit — Modify files
  • bash — Run commands
  • grep — Search code
  • glob — Find files
  • webfetch — Fetch URLs

Example Agents

Code Reviewer

---
name: Code Reviewer
description: Reviews code quality
tools: [read, grep, glob]
---

Review for:
- Code quality and readability
- Potential bugs
- Performance issues
- Test coverage

Don't make changes — just report findings.

Test Writer

---
name: Test Writer
description: Generates tests
tools: [read, write, edit, bash]
---

Generate tests for:
- Unit tests for all functions
- Edge cases
- Error scenarios

Use the project's testing framework.

Documentation Writer

---
name: Docs Writer
description: Writes documentation
tools: [read, write, glob]
---

Create:
- API documentation
- Usage examples
- README sections

Keep it concise and practical.

Using Agents in Forkline

Agents defined in .opencode/agents/ are available in all runners for that repository.

Reference them in prompts:

Use the Security Reviewer to audit the authentication module.

Resources