Skip to main content

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​

PluginPurposeSourceKey Features
@tarquinen/opencode-dcpAuto-compress redundant context, save tokensnpmIntelligent context compression
opencode-websearch-citedWeb search with Google Search APInpmReal-time information retrieval
morph-fast-applyUltra-fast code editing (10,500+ tokens/s, 98% accuracy)GitHubHigh-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​

  1. Clear Search Intent: Use specific keywords rather than vague descriptions
  2. Verify Sources: Check authority of cited links
  3. Consider Timeliness: For rapidly changing tech, prioritize recent results
  4. 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​

FeatureTraditional EditingMorph Fast Apply
Speed200-500 tokens/s10,500+ tokens/s
Accuracy85-90%98%
Multi-File SupportLimitedNative
Conflict DetectionManualAutomatic
Large File HandlingDifficultOptimized

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​

  1. Test Small First: Test on small scope before large-scale application
  2. Use Version Control: Ensure all changes are under Git management for easy rollback
  3. Batch Processing: For huge projects (1000+ files), process in batches
  4. Verify Build: Run tests and build immediately after applying changes
  5. 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 CaseRecommended PluginReason
Long conversation optimizationDCPAuto-manages context, reduces costs
Need latest informationwebsearch-citedReal-time web search
Large-scale code changesmorph-fast-applyFast with high accuracy
Technical researchwebsearch-citedAuthoritative sources
Code refactoringmorph-fast-applyStrong batch processing
Token cost controlDCPIntelligent 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.