| name | opencode-orchestrator |
|---|---|
| description | Delegate complex coding, refactoring, research, or multi-step development tasks to OpenCode, an autonomous AI coding agent running in the terminal. |
Use the /use-opencode slash command to invoke this skill:
/use-opencode
This will guide you through constructing an optimal handoff to OpenCode.
| Use OpenCode When | Stay in Antigravity When |
|---|---|
| Multi-file refactoring across 15+ files | Quick single-file edits |
| Long-running code generation tasks | Answering questions about code |
| Tasks requiring Plan Mode review | Browser-based testing |
| Deep codebase exploration | Tasks needing current conversation context |
| Specialized model requirements | Interactive debugging with user |
### Core Features - **Autonomous Execution**: Runs independently, editing files, executing commands, and managing its own context - **Plan Mode**: Reviews and explains proposed changes before execution - **Multi-Provider Support**: Access to OpenAI, Anthropic, Google Gemini, AWS Bedrock, Groq, Azure OpenAI - **Session Management**: Persistent conversations with save/restore functionality - **Auto-Compact**: Automatic context summarization when approaching token limits - **LSP Integration**: Language Server Protocol support for code intelligence - **Project Awareness**: Reads `AGENTS.md` for project-specific conventions
- File read/write/search operations
- Shell command execution
- Code analysis and refactoring
- Git operations
- Web search and URL reading
<handoff_instructions>
OpenCode does NOT share Antigravity's conversation context. You must explicitly provide:
- File Paths: Absolute paths to all relevant files
- Task Context: Background information and requirements
- Constraints: Any specific approaches to use or avoid
- Success Criteria: Clear definition of done
opencode run "YOUR_DETAILED_PROMPT"| Flag | Purpose | Example |
|---|---|---|
-m MODEL |
Specify model | -m github-copilot/claude-sonnet-4 |
-a AGENT |
Use custom agent | -a code-reviewer |
--plan |
Force Plan Mode | Review before execution |
</handoff_instructions>
<prompt_template> Structure prompts with clear sections for best results:
<context>
Project: [Project name and type]
Working Directory: [Absolute path]
Related Files: [List of relevant file paths]
</context>
<background>
[Any necessary context not obvious from files]
</background>
<task>
[Clear, specific task description]
</task>
<requirements>
- [Specific requirement 1]
- [Specific requirement 2]
</requirements>
<constraints>
- [What to avoid or preserve]
</constraints>
<success_criteria>
- [How to know the task is complete]
</success_criteria>
</prompt_template>
<model_guidance> Choose models based on task characteristics:
opencode run -m github-copilot/claude-sonnet-4 "..."
# or
opencode run -m github-copilot/gemini-3-pro "..."opencode run -m github-copilot/gpt-4o "..."opencode modelsIf no -m flag is provided, OpenCode uses the model configured in:
~/.opencode.json$XDG_CONFIG_HOME/opencode/.opencode.json./.opencode.json(project-local) </model_guidance>
### Multi-File Refactoring ```bash opencode run -m github-copilot/claude-sonnet-4 " Working Directory: /home/user/project Files: src/api/*.ts, src/services/*.ts Refactor all API handlers to use async/await instead of Promise chains. Add proper error handling with custom error classes. - Preserve existing functionality - Add JSDoc comments to all public functions - Update corresponding test files
<success_criteria>
- All Promise.then() chains converted to async/await
- Error handling uses ApiError class from src/errors.ts
- All tests pass </success_criteria> "
### Code Review Delegation
```bash
opencode run "
<context>
Repository: /home/user/project
Branch: feature/new-auth
Compare against: main
</context>
<task>
Review the changes in the current branch compared to main.
Focus on security, performance, and code quality.
</task>
<requirements>
- Check for SQL injection vulnerabilities
- Identify N+1 query patterns
- Note any breaking API changes
</requirements>
<success_criteria>
- Written review summary in REVIEW.md
- Critical issues clearly flagged
- Suggested improvements provided
</success_criteria>
"
opencode run -m github-copilot/gpt-4o "
<context>
Project: /home/user/project
Tech Stack: Node.js, PostgreSQL, Redis
</context>
<task>
Research caching strategies for our API endpoints and create an implementation plan.
</task>
<requirements>
- Consider Redis caching patterns
- Evaluate cache invalidation strategies
- Account for our microservices architecture
</requirements>
<success_criteria>
- CACHING_PLAN.md created with recommendations
- Code examples for key patterns
- Migration steps outlined
</success_criteria>
"<antigravity_integration>
When delegating from Antigravity to OpenCode:
- Prepare Context: Gather all relevant file paths and requirements
- Construct Prompt: Use the structured template above
- Execute Handoff: Run via
run_commandtool - Monitor Output: Read OpenCode's logs and final result
- Verify Results: Check file changes and run tests
- Continue Work: Resume in Antigravity with updated codebase
OpenCode may create its own files (plans, documentation). After handoff:
- Check for new files in the working directory
- Review any generated documentation
- Incorporate findings into Antigravity artifacts if relevant
Return work to Antigravity when:
- Browser testing is needed
- User interaction is required
- Results need integration with current conversation
- Visual verification is needed </antigravity_integration>
### Common Issues
| Issue | Cause | Solution |
|---|---|---|
ProviderModelNotFoundError |
Invalid model identifier | Run opencode models to list available models |
| Context too short | Auto-compact triggered | Task is self-contained; continue monitoring |
| Permission denied | File access issues | OpenCode runs with user permissions; check file ownership |
| Timeout | Long-running task | Increase WaitMsBeforeAsync or send to background |
- GitHub Copilot models: Require active Copilot subscription
- Anthropic models: Best for complex reasoning and code generation
- Gemini models: Strong at multi-file understanding
- OpenAI models: Effective for research and documentation
# Check OpenCode configuration
cat ~/.opencode.json
# List available models
opencode models
# List configured agents
opencode agent list
# Check authentication status
opencode auth status<custom_agents> For recurring specialized tasks, create custom OpenCode agents:
opencode agent createThis launches an interactive wizard to define:
- Agent name and description
- Custom system prompt
- Tool permissions
- Default model
Then invoke with:
opencode run -a my-custom-agent "Task description"- Code Reviewer: Specialized prompts for security and performance review
- Documentation Writer: Focused on JSDoc/TSDoc generation
- Test Generator: Configured for your testing framework </custom_agents>
# Basic execution
opencode run "Your task description"
# With specific model
opencode run -m github-copilot/claude-sonnet-4 "Task"
# With custom agent
opencode run -a custom-agent "Task"
# Check available models
opencode models
# Check available agents
opencode agent list