A Claude Code skill that delegates tasks to an OpenCode "intern" agent via ACP (Agent Communication Protocol). This enables Claude Code to offload tasks to a secondary AI agent running in OpenCode using any model you like.
OpenCode can read AGENTS.md in the same manner Claude Code does, so you can seamlessly share project context between both systems. You could even point the OpenCode Rules to the CLAUDE.md file
An added benefit of this setup is OpenCode automatically uses skills in the .claude/skills directory so there's no need for duplicating files, and both agents can share the same working space and methodologies.
To avoid nested callbacks that Claude looses sight of, make sure to deny permission to the OpenCode-intern skill in the OpenCode config.
For more portability and less token use, you could transpose a basic prompt in to the OpenCode.json file directly rather than point to a markdown file.
- Claude Code installed
- OpenCode installed and available in PATH
- Python 3.8+
- The
OpenCode.jsonis currently configured to use the free OpenCode Zen Minimax M2.1 model through Zen, but obviously you can configure it with any you like.
Copy the following to your project root:
OpenCode.json -> your-project/OpenCode.json
.OpenCode/ -> your-project/.OpenCode/
Copy the skill folder to your Claude Code skills directory:
.claude/skills/OpenCode-intern/ -> your-project/.claude/skills/OpenCode-intern/
Or to your global skills directory:
- macOS/Linux:
~/.claude/skills/OpenCode-intern/ - Windows:
%USERPROFILE%\.claude\skills\OpenCode-intern\
The default configuration uses the free OpenCode Zen model, so no API key is required to get started.
In Claude Code, use phrases like:
- "Use the intern to refactor this function"
- "Ask the intern to write tests for this module"
- "Delegate this task to the intern"
Claude Code will invoke the skill, which communicates with OpenCode via ACP to execute the task.
OpenCode-intern-skill/
├── README.md # This file
├── OpenCode.json # OpenCode configuration
├── .OpenCode/
│ └── prompts/
│ └── intern.md # Intern agent system prompt
└── .claude/
└── skills/
└── OpenCode-intern/
├── skill.md # Skill definition
└── scripts/
└── acp_client.py # ACP protocol client
The intern agent has a minimal permission configuration:
"permission": {
"skill": {
"OpenCode-intern": "deny"
}
}The OpenCode-intern: deny entry prevents recursive self-calls. You can extend this to allow or deny other skills and bash commands as needed.
The intern agent's behaviour is defined in .OpenCode/prompts/intern.md. Key characteristics:
- Precision over initiative: Executes exactly what is specified
- No autonomous decisions: Reports blockers instead of making assumptions
- Scope boundaries: Works strictly within defined parameters
- Silent efficiency: Minimal commentary unless requested
The acp_client.py script handles communication with OpenCode:
python acp_client.py <project_path> "<prompt>" --json| Parameter | Description |
|---|---|
project_path |
Absolute path to the project directory |
prompt |
The task to delegate to the intern |
--agent |
Agent name (default: "intern") |
--timeout |
Timeout in seconds (default: 300) |
--json |
Output results as JSON |
{
"success": true,
"response": "Agent's response text",
"tools": [
{"name": "bash", "status": "completed"},
{"name": "read", "status": "completed"}
],
"errors": []
}Edit .OpenCode/prompts/intern.md to adjust:
- Execution philosophy
- Processing protocol
- Ambiguity handling
For smaller token usage, you can embed the prompt directly in OpenCode.json instead of referencing a file:
{
"agent": {
"intern": {
"prompt": "You are the Intern. Execute tasks precisely as specified. Report blockers instead of making assumptions."
}
}
}| Error | Solution |
|---|---|
| "OpenCode not found" | Ensure OpenCode is installed and in PATH |
| "Timeout" | Increase --timeout or break task into smaller pieces |
| "Session error" | Check OpenCode logs |
| "Init failed" | Verify OpenCode version supports ACP protocol |