phonowell/invoke-opencode-acp
Save 50-90% tokens in Claude Code by delegating complex tasks to OpenCode subagent. Uses free alternative models with slightly lower reasoning capability for significant cost savings.
Deep Analysis
OpenCode ACP子代理技能,委托复杂任务节省50-90% token,多语言文档
Core Features
Technical Implementation
- 50-90%节省 - token优化
- 并行 - 保持响应
- 免费token - 替代模型
- 批量操作 - 多文件
- 多语言 - 中英日文档
- 代码重构
- 文档更新
- 测试生成
- Bug修复
- 批量操作
- 能力折衷 - 替代模型
- 需OpenCode
- 质量变化
invoke-opencode-acp
A skill for Claude Code CLI that saves thousands of tokens by delegating complex tasks to OpenCode subagent.
Note: This is a skill for the Claude Code CLI tool, not a standalone application. You must have Claude Code installed to use it.
Requirements: This skill requires OpenCode (via ACP protocol) and Node.js to function.
What This Skill Does
Delegates complex tasks to a separate AI agent (OpenCode) through the ACP protocol, saving your main Claude conversation from consuming excessive tokens.
Think of it as hiring a specialized contractor: you provide the objective, they do the work independently, and you get the results without all the back-and-forth that would fill your conversation history.
Benefits
Massive Token Savings
- Without this skill: Main Claude reads every file → analyzes → edits → repeats. Each iteration consumes thousands of tokens.
- With this skill: Send objective to subagent → subagent works independently → get final results. Only the summary enters your conversation.
Typical savings: 50-90% fewer tokens for complex tasks.
Important Trade-off
How it achieves savings: OpenCode subagent uses free tokens to call alternative models (e.g., GLM-4.7, Qwen) instead of your paid Claude tokens.
What this means:
- ✅ Token savings: You pay nothing for the subagent's work
- ⚠️ Capability trade-off: Alternative models have lower reasoning ability compared to Claude
- ⚠️ Quality variance: Results may be less nuanced or require review
Best use cases:
- Code refactoring and formatting (straightforward)
- Documentation updates and generation
- Test code generation
- Bug fixes with clear requirements
- Batch file operations
Consider alternatives for:
- Complex architecture decisions
- Nuanced code reviews
- Sensitive logic changes
- Tasks requiring deep domain expertise
Faster Task Completion
- Main Claude stays responsive for other tasks
- Subagent works in parallel
- No context window limitations for the subtask
Better for Complex Workflows
Perfect for:
- Multi-file refactoring: "Add type hints to all Python files"
- Batch operations: "Update all documentation files"
- Code reviews: "Review the entire codebase for security issues"
- Git workflows: "Create a pull request with these changes"
How It Works
- You describe the task (one sentence is enough)
- OpenCode subagent receives your objective and works independently
- Results are saved to a file (not your conversation)
- You get a concise summary in your main conversation
The subagent can read files, make edits, run tests, and more—just like a full developer—without consuming your main conversation's context.
Installation
Prerequisites
You need three things installed:
- Claude Code CLI (already installed if you're using this)
- OpenCode CLI (
npm install -g opencode) - Node.js (comes with most systems)
Quick Install
# 1. Install OpenCode (if not already)
npm install -g opencode
# 2. Copy the skill to Claude
cp -r skills/invoke-opencode-acp ~/.claude/skills/
# 3. Verify it works (optional)
node ~/.claude/skills/invoke-opencode-acp/tests/test_acp_client.js
Verify Installation
Check that OpenCode is installed:
opencode --version
Check that the skill exists:
ls ~/.claude/skills/invoke-opencode-acp/SKILL.md
Usage
Simply tell Claude what you want done:
"Refactor all Python files in this project to use type hints"
Claude will delegate the task to OpenCode subagent and return the results.
Timeout guidelines (OpenCode is slow):
- Simple tasks (math, short answers): 180s (3min) minimum
- Medium tasks (single file, ~100 lines): 600s (10min) minimum
- Complex tasks (multi-file, refactoring): 1800s (30min) minimum
Example tasks:
- "Refactor the entire codebase"
- "Update the README.md with new instructions"
- "Add type hints to all Python files"
- "Run security audit on the codebase"
Real-World Examples
Example 1: Large Refactoring
Your request: "Add type hints to all Python files in this project"
Without this skill:
- Claude reads each file (10,000 tokens)
- Claude edits each file (15,000 tokens)
- Claude verifies changes (8,000 tokens)
- Total: ~33,000 tokens consumed
With this skill:
- You send the objective (50 tokens)
- Subagent works independently (0 tokens in your conversation)
- You get a summary (200 tokens)
- Total: ~250 tokens consumed
Savings: 99% token reduction!
Example 2: Code Review
Your request: "Review the entire codebase for security vulnerabilities"
Without this skill:
- Claude reads every source file (25,000 tokens)
- Claude analyzes and documents (12,000 tokens)
- Total: ~37,000 tokens
With this skill:
- Objective + summary (~300 tokens)
- Total: ~300 tokens
Savings: 99% token reduction!
Example 3: Batch Documentation Updates
Your request: "Update all .md files to include the new license header"
Without this skill:
- Claude reads 20 markdown files (15,000 tokens)
- Claude edits each file (20,000 tokens)
- Total: ~35,000 tokens
With this skill:
- Objective + summary (~250 tokens)
- Total: ~250 tokens
Savings: 99% token reduction!
When to Use
✅ Use this skill for:
- Tasks affecting 2+ files
- Refactoring or restructuring
- Batch operations (find and replace across many files)
- Code reviews across the entire codebase
- Multi-step tasks requiring research and analysis
- Git workflows (commit, push, pull request)
❌ Don't use for:
- Single file quick edits
- Simple text replacements
- Tasks requiring integration with your main conversation
How This Is Different
vs. Normal Claude Tasks
| Aspect | Normal Claude | With invoke-opencode-acp |
|---|---|---|
| Context usage | Full file contents | Just objective |
| Token consumption | High (thousands) | Low (hundreds) |
| Your conversation | Shows all steps | Shows only results |
| Speed | Sequential | Parallel |
| Best for | Simple tasks | Complex tasks |
vs. Other Solutions
- Claude Projects: Still uses main context window (limited tokens)
- Manual delegation: Requires copy-pasting, no automation
- invoke-opencode-acp: Automated delegation with minimal context usage
Troubleshooting
"opencode command not found"
npm install -g opencode
"Skill not enabled"
- Check the skill is in
~/.claude/skills/invoke-opencode-acp/ - Restart Claude Code
- Enable in Claude Code settings
Task timeout
- Increase the
-tparameter value - See timeout guidelines in Usage section
- OpenCode can be slow, especially for complex tasks
Technical Details (For the Curious)
This skill uses the ACP (Agent Control Protocol) to communicate with OpenCode:
- Launches
opencode acpvia Node.js child_process - Creates a dedicated session via JSON-RPC
- Sends your task via
session/prompt - Streams results via
session/updateevents - Filters out
<thinking>tags - Returns only the final output
Implementation: skills/invoke-opencode-acp/acp_client.js (192 lines)
License
MIT License - See LICENSE for details.
中文版本:README.zh.md
日本語版本:README.ja.md
Related Skills
wshobson/agents
wshobsonIntelligent automation and multi-agent orchestration for Claude Code
The most comprehensive Claude Code plugin ecosystem, covering full-stack development scenarios with a three-tier model strategy balancing performance and cost.
ComposioHQ/awesome-claude-skills
ComposioHQA curated list of awesome Claude Skills, resources, and tools for customizing Claude AI workflows
The most comprehensive Claude Skills resource list; connect-apps is a killer feature.
code-yeongyu/oh-my-opencode
code-yeongyuThe Best Agent Harness. Meet Sisyphus: The Batteries-Included Agent that codes like you.
Powerful multi-agent coding tool, but note OAuth limitations.
nextlevelbuilder/ui-ux-pro-max-skill
nextlevelbuilderAn AI SKILL that provide design intelligence for building professional UI/UX multiple platforms
Essential for designers; comprehensive UI/UX knowledge base.
thedotmack/claude-mem
thedotmackA Claude Code plugin that automatically captures everything Claude does during your coding sessions, compresses it with AI (using Claude's agent-sdk), and injects relevant context back into future sessions.
A practical solution for Claude's memory issues.
OthmanAdi/planning-with-files
OthmanAdiClaude Code skill implementing Manus-style persistent markdown planning — the workflow pattern behind the $2B acquisition.
Context engineering best practices; an open-source implementation of Manus mode.

