Researcher agent: what it is and how to create one in OpenCode

Contents
What a researcher agent is
Where it fits
Create the agent file
Permissions for research
System prompt that works
How to launch it
Report format
Evals
Limits and failure modes

What a researcher agent is

A researcher agent is a read-only subagent whose only job is to gather facts and return them as a sourced report. It reads code and documents, searches the web, compares sources and stops. It does not edit files, does not run builds, does not decide anything. The parent session asks one question, keeps working while the child runs, and gets back a compact answer where every claim carries a source: a file:line reference or a URL.

It is an agent, not a chatbot, because it has the loop: it plans a search, calls a tool, reads the result and repeats until the question is answered or the budget is spent. It is not a builder because the write permissions are denied — research output is text, and the only side effect is the report itself.

Where it fits

Reach for a researcher in four cases:

When answers must come from one fixed corpus instead of roaming, use RAG — a researcher roams, RAG answers from one index. Model split follows the usual trio: quick lookups on the free OpenCode model, daily research on Luna, hard multi-hop questions on Opus.

Create the agent file

Project agents live in .opencode/agents/; the nested path becomes the id. Minimal place in the demo project from Real project skeleton:

my-app/ ├── opencode.jsonc ├── .opencode/agents/ │ ├── researcher.md │ └── team/orchestrator.md ├── .opencode/commands/ │ └── research.md └── .opencode/skills/

The complete file, frontmatter plus a system prompt body:

--- description: Gathers facts from code and docs, returns a sourced report mode: subagent model: opencode/gpt-6-luna steps: 10 permissions: - action: edit resource: "*" effect: deny - action: shell resource: "*" effect: deny - action: webfetch resource: "*" effect: allow - action: websearch resource: "*" effect: allow --- Research the question with tools, never from memory. Prefer repo sources first, then official docs, then the open web. End every claim with a source: file:line or URL. If two sources disagree, show both and say which is newer. Answer in three sections: Findings, Gaps, Next steps. Stop when the budget is spent or the question is answered.

Field notes:

Permissions for research

The core read tools — read, glob, grep — stay available because nothing denies them; everything that changes the world is denied explicitly. Rules are ordered and the last match wins:

System prompt that works

Four rules survive contact with real tasks: sources on every claim, repo before web, disagreement shown instead of resolved silently, and a fixed three-section answer. The three sections matter more than they look — Findings forces compression, Gaps gives the parent a way to trust the silence, Next steps turns the report into the next prompt instead of a dead end. One question per run: a researcher asked for three things returns three half-reports.

How to launch it

Ask the parent in plain language:

Use the researcher subagent to map how retries are configured in this repo and in the official docs

The parent stays usable while the child runs and the report lands in the parent session. For a repeatable entry point, pin it in a command file, .opencode/commands/research.md:

--- description: Research one question with the read-only researcher agent: researcher model: opencode/gpt-6-luna subagent: true --- Research: $ARGUMENTS Return Findings, Gaps, Next steps with a source on every claim.

Run it as /research how webhooks are signed in the billing service. Command model beats agent model beats session model, so an explicit pin always wins.

Report format

Fix the skeleton and reports become comparable across runs and models:

Findings - Retries live in src/http/client.py:88 (backoff, 5 attempts). - The docs pin the same default: https://example.com/api#retries Gaps - Jitter policy is undocumented; client.py:102 shows a constant. Next steps - Ask the analyst to measure the real retry rate from prod logs.

External URLs stay real links with rel="nofollow" when the report is pasted into an article or an issue. A report with no Gaps section is a red flag — the researcher either stopped early or is inventing confidence.

Evals

Five fixed questions with checkable outcomes, run on every prompt or model change:

The last case is the important one: an agent that admits an empty result is worth more than one that fills silence with a plausible citation.

Limits and failure modes

Article author: Arthur Isaev

Related articles
AI
Creating and developing agents
Researcher agent
Analyst agent
Agent setup audit: the aredel case
Writing skills for AI assistants
OpenCode coding agent
RAG: answers from your own documents
Banner image

Search this site

Channel @aofeed Chat @aofeedchat

Contacts and cooperation:
I recommend our hosting beget.com
Write to info@aredel.com if you:
1. Want to write an article for our site or translate an article into your native language.
2. Want to place thematically relevant ads on the site.
3. Ads on my site pass maximum censorship. If you see an ad block unsuitable for school-age children, shocking or misleading - please contact us by e-mail
4. Found a mistake, inaccuracy, bug, etc. on the site. ... .......
5. Articles can be shared on social media by clicking a network icon: