Building AI agents: OpenCode and Claude Code in one repo

Agent vs chatbot

A chatbot answers; an agent acts. The difference is the loop: the agent reads the goal, picks a tool, observes the result, and repeats until the goal is done or it gets stuck and asks for help. If your system cannot call tools and see results, it is a chatbot with good marketing.

This page is tool-agnostic: the roles and the operating rules work the same in OpenCode and Claude Code. The exact file formats and frontmatter live in the dedicated guides: OpenCode agents and Claude Code subagents. Read this page for the why, then open the guide for the tool you use.

Same roles, two tools

Both tools converged on the same four roles: a cheap triage that reads and routes, a builder that edits and tests, a read-only reviewer that judges the diff, and an orchestrator that fans work out to children. Only the file names differ:

PieceOpenCodeClaude Code
Project instructionsAGENTS.md + opencode.jsoncCLAUDE.md, or AGENTS.md when no CLAUDE.md exists
Agent definition.opencode/agents/<name>.md.claude/agents/<name>.md
Model per roleprovider/model#variantalias (opus, sonnet, haiku) or full id
Tool limitsordered permissions rules, last match winstools / disallowedTools lists and permission rules
Subagent callsubagent tool, @nameAgent tool; ask for the subagent by name
Skills.opencode/skills/ (also reads .claude/skills/).claude/skills/<name>/SKILL.md
Commands.opencode/commands/*.mdskills; .claude/commands/*.md still works
MCPmcp block in the configclaude mcp add, .mcp.json

The roles map to the model split used across this section: the free OpenCode model for triage, GPT 6 Luna for building, Claude Opus 5.5 for review. Cheap reads, standard builds, expensive verdicts.

Share skills, split agents

Skills are the portable half. They follow the Agent Skills open standard, and OpenCode also reads .claude/skills/ as a compatibility location — so that directory is the one place both assistants load the same procedures. Agents are the local half: agent files name tools and models in tool-specific formats, so they stay separate.

repo/ ├── AGENTS.md shared instructions ├── .claude/skills/ read by OpenCode and Claude Code │ ├── api-review/SKILL.md │ └── test-writer/SKILL.md ├── .opencode/agents/ OpenCode roles │ ├── triage.md │ ├── builder.md │ └── reviewer.md └── .claude/agents/ Claude Code roles ├── code-reviewer.md └── test-runner.md

A combined workflow

Run two assistants on one repo when the roles genuinely differ, not to double the noise. A pattern that pays off:

Handoff happens through files, not chat: commit decisions to AGENTS.md, plans and tasks to markdown, and let each tool read its own session history. Do not edit the same file in two sessions at once; when parallel edits are unavoidable, use worktree isolation in Claude Code or a separate checkout in OpenCode. And skip the ceremony for small fixes: one agent plus a good skill beats a two-tool pipeline.

Make the agents run

A correct agent file does nothing by itself. Two more things must happen: the assistant has to load the project config, and a person or command has to select the role. Most tickets titled "agents created, agents unused" are one of those two — or a model id that stopped resolving.

Permissions are the trap that looks like a broken model: rules are ordered and the last match wins, and an agent denied the one tool its job needs answers with an apology instead of an error. Re-read the rules before the first eval.

From demo to production

Demos survive on the happy path; production is everything else. Graduate in this order, with a concrete gate per step:

Repeat until the numbers, not impressions, say it is ready. Keep one working setup until the new behavior is verified; changing instructions mid-flight makes every measurement meaningless.

Memory that survives restarts

Short-term memory (the running trace) dies with the process; decisions must land in files to survive. Keep three stores: global user rules, repo-root rules in AGENTS.md for both tools, and nested files for areas that need their own rules. Claude Code can layer a CLAUDE.md on top and keeps its own auto memory; OpenCode reloads the shared files on start.

# AGENTS.md - Run the narrowest test before every commit. - Keep database queries in src/database. - Do not edit generated files directly.

Keep the root file short and verifiable; a procedure that outgrows it belongs in a skill. Edits to instruction files apply before the next request in both tools; newly added nested files load on demand when work reaches that directory.

Evals before opinions

Ten fixed tasks with checkable outcomes beat a hundred demo impressions. Starter suite for the four roles, run in both tools:

Run the suite on every prompt, tool or model change and keep the history: a two-point drop after an improvement is the norm, not the exception. Try the same suite on the free OpenCode model, Luna and Opus once — the gap tells you which role deserves the expensive model.

Detailed guides per tool

Article author: Arthur Isaev

Banner image