OpenCode Plugin Ecosystem
OpenCode achieves powerful extensibility through its plugin system. This guide covers three core plugins that solve multi-model orchestration, context management, web search, and code editing efficiency challenges.
Core Plugins Overviewβ
| Plugin | Purpose | Source | Key Features |
|---|---|---|---|
@tarquinen/opencode-dcp | Auto-compress redundant context, save tokens | npm | Intelligent context compression |
opencode-websearch-cited | Web search with Google Search API | npm | Real-time information retrieval |
morph-fast-apply | Ultra-fast code editing (10,500+ tokens/s, 98% accuracy) | GitHub | High-speed code application |
1. @tarquinen/opencode-dcpβ
Overviewβ
DCP (Dynamic Context Pruning) is an intelligent context management plugin that optimizes token usage through automatic compression and redundancy elimination.
Core Capabilitiesβ
- Automatic Context Compression: Identifies and compresses repetitive or redundant conversation history
- Smart Key Information Retention: Preserves context critical to current tasks
- Token Optimization: Significantly reduces API call costs
- Transparent Operation: Works automatically in the background without manual intervention
Installationβ
cd ~/.config/opencode
npm install @tarquinen/opencode-dcp@latest
Use Casesβ
- Long Conversations: Auto-compresses when conversation history exceeds thousands of tokens
- Multi-Round Iterations: Saves costs in tasks requiring multiple interactions like code refactoring
- Large Projects: Maintains performance when handling projects with extensive file context
How It Worksβ
Configuration Exampleβ
DCP typically requires no additional configuration and auto-enables after installation. For custom behavior, add to opencode.json:
{
"plugins": {
"@tarquinen/opencode-dcp": {
"enabled": true,
"compressionThreshold": 8000,
"preserveRecentMessages": 10
}
}
}
2. opencode-websearch-citedβ
Overviewβ
Websearch Cited provides real-time web search capabilities for OpenCode, fetching latest information via Google Search API with cited sources.
Core Capabilitiesβ
- Real-Time Information Retrieval: Access to latest web information
- Source Citation: Every information point includes verifiable source links
- Intelligent Summarization: Automatically extracts and summarizes search results
- Multi-Language Support: Supports Chinese, English, and other languages
Installationβ
cd ~/.config/opencode
npm install opencode-websearch-cited@latest
Configuration Requirementsβ
Requires Google Search API credentials:
# Method 1: Environment variables
export GOOGLE_SEARCH_API_KEY="your-api-key"
export GOOGLE_SEARCH_ENGINE_ID="your-engine-id"
# Method 2: Write to .env file
echo "GOOGLE_SEARCH_API_KEY=your-api-key" >> ~/.config/opencode/.env
echo "GOOGLE_SEARCH_ENGINE_ID=your-engine-id" >> ~/.config/opencode/.env
Use Casesβ
Scenario 1: Technical Queriesβ
User: Search for React 19 latest features
Agent: [Calling websearch-cited]
Based on search results, React 19 introduces:
1. **React Compiler**: Automatic component performance optimization [Source: react.dev]
2. **Actions**: Simplified form handling and data submission [Source: github.com/facebook/react]
3. **Document Metadata**: Native support for <title> and <meta> tags [Source: react.dev/blog]
Scenario 2: Market Researchβ
User: Find 2025 AI coding tools market trends
Agent: [Calling websearch-cited]
Current AI coding tools market shows:
- GitHub Copilot leads market share [Source: stackoverflow.com/survey]
- Cursor and Windsurf growing rapidly [Source: techcrunch.com]
- Enterprise adoption up 40% [Source: gartner.com]
Workflowβ
Best Practicesβ
- Clear Search Intent: Use specific keywords rather than vague descriptions
- Verify Sources: Check authority of cited links
- Consider Timeliness: For rapidly changing tech, prioritize recent results
- Combine Knowledge: Merge search results with local knowledge for comprehensive answers
3. morph-fast-applyβ
Overviewβ
Morph Fast Apply is a revolutionary code editing plugin achieving ultra-fast code application through Morph LLM's dedicated API, reaching 10,500+ tokens/s with 98% accuracy.
Core Capabilitiesβ
- Ultra-Fast Editing: 10-50x faster than traditional methods
- High Accuracy: 98% code application success rate
- Intelligent Diff: Precisely identifies code segments needing modification
- Batch Operations: Supports simultaneous multi-file editing
- Conflict Detection: Automatically detects and alerts potential code conflicts
Technical Advantagesβ
| Feature | Traditional Editing | Morph Fast Apply |
|---|---|---|
| Speed | 200-500 tokens/s | 10,500+ tokens/s |
| Accuracy | 85-90% | 98% |
| Multi-File Support | Limited | Native |
| Conflict Detection | Manual | Automatic |
| Large File Handling | Difficult | Optimized |
Installationβ
# Clone plugin repository
mkdir -p ~/.config/opencode/plugins
git clone https://github.com/JRedeker/opencode-morph-fast-apply ~/.config/opencode/plugins/morph-fast-apply
# Install dependencies
cd ~/.config/opencode/plugins/morph-fast-apply
npm install
Configure API Keyβ
Visit Morph Dashboard to obtain API Key:
# Method 1: Environment variable (recommended)
# macOS/Linux
echo 'export MORPH_API_KEY="your-morph-api-key"' >> ~/.bashrc # or ~/.zshrc
source ~/.bashrc
# Windows PowerShell (Administrator)
[System.Environment]::SetEnvironmentVariable("MORPH_API_KEY", "your-key", "User")
# Method 2: Write to .env file
echo "MORPH_API_KEY=your-morph-api-key-here" >> ~/.config/opencode/.env
Use Casesβ
Scenario 1: Large-Scale Refactoringβ
User: Refactor all class components to function components in the project
Agent: [Using morph-fast-apply]
β Analyzed 45 component files
β Identified 23 class components
β Batch converting...
β Complete! Average 0.3 seconds per file
Scenario 2: API Upgradeβ
User: Upgrade all React Router v5 code to v6 syntax
Agent: [Using morph-fast-apply]
β Detected 18 route files
β Convert <Switch> to <Routes>
β Update <Route> component syntax
β Change useHistory to useNavigate
β All files updated, no conflicts
Scenario 3: Code Style Unificationβ
User: Unify import statement order across project (React -> Third-party -> Local)
Agent: [Using morph-fast-apply]
β Scanned 127 files
β Reordered imports in 89 files
β Preserved all functionality
β Completed in 8 seconds
How It Worksβ
Performance Comparisonβ
Real test data (based on 50-file refactoring task):
Traditional Method:
- Total time: ~5 minutes
- Success rate: 87%
- Manual fixes needed: 6 files
Morph Fast Apply:
- Total time: ~15 seconds
- Success rate: 98%
- Manual fixes needed: 1 file
Best Practicesβ
- Test Small First: Test on small scope before large-scale application
- Use Version Control: Ensure all changes are under Git management for easy rollback
- Batch Processing: For huge projects (1000+ files), process in batches
- Verify Build: Run tests and build immediately after applying changes
- Review Diff: Manually review diffs for critical code modifications
Plugin Synergyβ
These three plugins work together seamlessly to form powerful workflows:
Typical Workflow Exampleβ
Real-World Case: Tech Stack Upgradeβ
User: Help me upgrade project from Vue 2 to Vue 3, referencing latest best practices
Step 1: [websearch-cited search]
β Get Vue 3 migration guide and best practices
Step 2: [DCP compression]
β Compress search results, retain key migration steps
Step 3: [morph-fast-apply execution]
β Batch update component syntax
β Convert to Composition API
β Update dependency configs
Result: Complete tech stack upgrade in < 2 minutes
Plugin Comparison & Selectionβ
Feature Matrixβ
| Use Case | Recommended Plugin | Reason |
|---|---|---|
| Long conversation optimization | DCP | Auto-manages context, reduces costs |
| Need latest information | websearch-cited | Real-time web search |
| Large-scale code changes | morph-fast-apply | Fast with high accuracy |
| Technical research | websearch-cited | Authoritative sources |
| Code refactoring | morph-fast-apply | Strong batch processing |
| Token cost control | DCP | Intelligent redundancy compression |
Cost-Benefit Analysisβ
Scenario: Handle refactoring task with 100 files
Without Plugins:
- Time cost: ~2 hours
- Token cost: ~500K tokens ($10)
- Manual fixes: ~30 minutes
With Plugin Combo:
- Time cost: ~5 minutes
- Token cost: ~50K tokens ($1)
- Manual fixes: ~5 minutes
Savings: 95% time + 90% cost
Complete Installation & Configuration Guideβ
One-Click Install Scriptβ
#!/bin/bash
# install-opencode-plugins.sh
echo "π Starting OpenCode core plugins installation..."
# Enter config directory
cd ~/.config/opencode || exit
# Install npm plugins
echo "π¦ Installing npm plugins..."
npm install @tarquinen/opencode-dcp@latest \
opencode-websearch-cited@latest
# Install morph-fast-apply
echo "π¦ Installing morph-fast-apply..."
mkdir -p plugins
git clone https://github.com/JRedeker/opencode-morph-fast-apply plugins/morph-fast-apply
cd plugins/morph-fast-apply
npm install
echo "β
All plugins installed!"
echo "β οΈ Please configure these environment variables:"
echo " - MORPH_API_KEY (required)"
echo " - GOOGLE_SEARCH_API_KEY (optional)"
echo " - GOOGLE_SEARCH_ENGINE_ID (optional)"
Verify Installationβ
# Check plugin loading status
opencode debug config | grep -A 5 "plugins"
# Test DCP
opencode run "Long conversation test" --verbose
# Test websearch-cited
opencode run "Search latest AI news" --model=google/gemini-2.5-flash
# Test morph-fast-apply
opencode run "Create a simple React component" --model=duojie/claude-sonnet-4-5
FAQβ
Q1: Will DCP lose important context?β
A: No. DCP uses intelligent algorithms to identify key information, only compressing truly redundant content. If concerned, adjust the preserveRecentMessages parameter.
Q2: Does websearch-cited require payment?β
A: Google Search API has free quota (100 queries/day), payment required beyond that. Usually sufficient for personal use.
Q3: What's the API cost for morph-fast-apply?β
A: Morph API charges by token, but due to extreme speed, actual cost is typically lower than using general LLM multi-turn conversations.
Q4: Which models do these plugins support?β
A:
- DCP and websearch-cited: Support all OpenCode-compatible models
- morph-fast-apply: Uses dedicated Morph API, independent of main model
Q5: Can I install only some plugins?β
A: Yes. These three plugins are completely independent and can be selectively installed based on needs.
Advanced Tipsβ
Tip 1: Customize DCP Compression Strategyβ
{
"plugins": {
"@tarquinen/opencode-dcp": {
"compressionThreshold": 6000,
"preserveRecentMessages": 15,
"aggressiveMode": false,
"preserveCodeBlocks": true
}
}
}
Tip 2: Configure Websearch Preferencesβ
{
"plugins": {
"opencode-websearch-cited": {
"maxResults": 10,
"language": "en-US",
"safeSearch": "moderate",
"dateRestrict": "m1" // Only search last month
}
}
}
Tip 3: Optimize morph-fast-apply Performanceβ
{
"plugins": {
"morph-fast-apply": {
"maxConcurrentFiles": 10,
"timeout": 30000,
"retryOnFailure": true,
"validateSyntax": true
}
}
}
Summaryβ
These three core plugins represent the powerful extensibility of the OpenCode ecosystem:
- @tarquinen/opencode-dcp: Makes long conversations more economical and efficient
- opencode-websearch-cited: Connects to real-time internet knowledge
- morph-fast-apply: Elevates code editing speed to new heights
By properly combining these plugins, you can build extremely efficient AI-assisted development workflows, dramatically reducing time and cost investment while maintaining high-quality output.