opencode-enhancer-plugin
v1.5.0
Published
Universal Technical Architect & Prompt Enhancer with Todo Enforcer and Strategos Planning Mode
Maintainers
Readme
🚀 OpenCode Enhancer Plugin
Universal Technical Architect & Prompt Enhancer - Transform vague ideas into precise, context-aware engineering specifications.
✨ What is Enhancer?
The Enhancer is a third primary agent mode for OpenCode that sits alongside Plan and Build. It acts as your technical architect, analyzing your codebase and generating detailed, actionable prompts that you can execute in Build mode.
🎯 Key Features
- 🔍 Intelligent Context Analysis - Automatically explores your project structure, tech stack, and relevant files
- 🧠 Intent Classification - Categorizes requests as FIX, FEAT, REFACTOR, TEST, or EXPLAIN
- 🔒 Todo Enforcer System - Tracks TODOs and prevents stopping until all tasks are completed (for ultraplan and strategos agents)
- 🎯 Strategos Mode - Strategic planning with interview mode for complex tasks
- 📚 Context7 Integration - Conditionally includes
use context7when documentation-heavy frameworks are detected - 🎨 Style-Aware - Mimics your project's coding style and patterns
- ⚡ One-Click Workflow - Generates copy-pasteable prompts ready for Build mode
🚀 Quick Start
Installation
From npm (Recommended)
Add to your OpenCode config (~/.config/opencode/opencode.json):
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
"opencode-enhancer-plugin@latest"
]
}Restart OpenCode and press Tab to cycle through modes:
Plan → Build → Enhancer → PlanFrom Source (Development)
Clone this repository:
git clone https://github.com/MaansenV/opencode-enhancer-plugin.git cd opencode-enhancer-pluginInstall dependencies and build:
npm install npm run buildAdd to your OpenCode config using the local path:
{ "plugin": [ "file:///path/to/opencode-enhancer-plugin/dist/index.js" ] }
Version Management
- Latest version:
"opencode-enhancer-plugin@latest" - Current version:
"[email protected]" - Specific version:
"[email protected]" - Update: OpenCode auto-updates plugins on startup, or run
opencode --update-plugins
Uninstall
Remove from your opencode.json:
{
"plugin": []
}📖 How It Works
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ User │────▶│ Enhancer │────▶│ Build │
│ Request │ │ Agent │ │ Mode │
└─────────────┘ └──────────────┘ └─────────────┘
│
▼
┌──────────────┐
│ Explore- │
│ Context │
│ (Subagent) │
└──────────────┘Workflow
- Select Enhancer Mode (Tab to cycle)
- Describe your goal - "Fix the login bug" or "Add user authentication"
- Enhancer analyzes - Calls explore-context to map your codebase
- Receive enhanced prompt - Structured markdown with context, instructions, and technical requirements
- Copy & Execute - Switch to Build mode and run the generated prompt
📝 Changelog
v1.5.0 - Specialized Subagents
- 📚 Librarian - Documentation and research specialist with Context7 and Code Search
- 🔮 Oracle - Debugging and code architecture specialist
- 🏗️ Architect - Dependencies and system design specialist
- ✅ Reviewer - Plan validation specialist
- 🎤 Interviewer - Requirements clarification specialist
- Optimized 4+1 subagent structure (4 specialists + 1 interviewer)
- Simplified, focused prompts for better performance
v1.4.0 - Todo Enforcer & Strategos Mode
- 🔒 Todo Enforcer System - Tracks TODOs and prevents stopping until all tasks are completed (for ultraplan and strategos agents)
- 🎯 Strategos Mode - New primary agent with strategic planning and interview mode for complex multi-phase tasks
- strategos-interviewer subagent for stakeholder requirement gathering
- Enhanced hooks for session management and TODO tracking
- Auto-activation of strategos mode on keyword detection
v1.2.0 - New Agents & Model Configuration
- ultraplan & ask primary agents
- review-plan subagent for critical analysis
- Enhanced model configuration with environment variables
v1.0.0 - Initial Release
- enhancer primary agent
- explore-context subagent for project analysis
- Intent classification and Context7 integration
- Style-aware prompt generation
🎨 Example Output
# Task: Fix Authentication Token Validation
## Context
Detected **React + TypeScript + Express** project. Authentication logic located in `src/auth/middleware.ts` and `src/utils/token.ts`.
## Instructions
use context7
1. Modify `src/auth/middleware.ts`:
- Locate function `validateToken` (line 45)
- Add null check for `req.headers.authorization`
- Implement JWT verification using existing `verify()` pattern
2. Update `src/utils/token.ts`:
- Add error handling for expired tokens
- Return structured error object instead of throwing
3. Testing:
- Run `npm test` to verify auth flow
- Check edge cases: missing token, expired token, malformed token
## Technical Requirements
- **Style**: Follow existing async/await patterns
- **Error Handling**: Use `try/catch` with custom AuthError class
- **TypeScript**: Maintain strict typing, add interfaces for token payload🛠️ Architecture
Components
Primary Agents (User-Facing)
Activated via Tab key in OpenCode:
| Agent | Color | Steps | Description | |-------|-------|-------|-------------| | enhancer | Purple (#9C27B0) | 15 | Universal Technical Architect - analyzes intent and generates executable prompts | | ultraplan | Orange (#FF5722) | 20 | Iterative Planner with Todo Enforcement - creates plans through parallel subagent analysis and review loops | | ask | Blue (#2196F3) | 15 | Research Assistant - answers codebase questions via multi-source context gathering | | strategos | Deep Orange (#BF360C) | 30 | Strategic Planner with Interview Mode - handles complex multi-phase tasks with strategic planning and stakeholder interviews |
Subagents (Background Workers)
Called automatically by primary agents via task tool:
| Subagent | Called By | Description | |----------|-----------|-------------| | librarian | All primary agents | Documentation and codebase research specialist (Context7 + codesearch) | | oracle | All primary agents | Debugging and code architecture specialist | | architect | ultraplan, strategos, ask | Dependencies and system design specialist | | reviewer | ultraplan, strategos | Plan validation and critical analysis specialist | | interviewer | strategos only | Requirements clarification and stakeholder interview specialist |
Supported Tech Stacks
- Web: React, Vue, Angular, Svelte, Next.js, Nuxt, Vite
- Backend: Express, Django, Flask, FastAPI, Rails, Laravel, Spring
- Game Engines: Unity, Godot, Unreal Engine
- Data/ML: TensorFlow, PyTorch, NumPy, Pandas
- Infrastructure: Docker, Kubernetes, Terraform
- And more...
⚙️ Configuration
Agent Configuration
The plugin automatically registers agents via the config hook with configurable models:
// Enhancer (Primary Agent) - Model configurable via opencode.json or env vars
{
mode: "primary",
model: "opencode/kimi-k2.5-free", // Default, can be overridden
description: "Universal Technical Architect & Prompt Enhancer",
color: "#9C27B0",
steps: 15,
tools: { task: true, read: true }
}
// Explore-Context (Subagent) - Model configurable via opencode.json or env vars
{
mode: "subagent",
hidden: true,
model: "opencode/kimi-k2.5-free", // Default, can be overridden
tools: { list: true, read: true, grep: true, bash: true }
}Model Configuration
You can configure custom models for Enhancer agents. This is useful for:
- Using more powerful models for complex planning tasks
- Saving costs by using simpler models for subagents
- Testing specific models for certain task types
Configuration Methods (Priority: Highest → Lowest)
1. OpenCode Agent Config (Recommended)
Configure models directly in your opencode.json:
{
"agent": {
"strategos": {
"model": "anthropic/claude-sonnet-4-5"
},
"oracle": {
"model": "anthropic/claude-sonnet-4-5"
},
"librarian": {
"model": "opencode/kimi-k2.5-free"
}
}
}2. Environment Variables
Use environment variables for CI/CD or temporary changes:
# All Subagents
export ENHANCER_MODEL_SUBAGENT="opencode/kimi-k2.5-free"
# All Primary Agents
export ENHANCER_MODEL_PRIMARY="anthropic/claude-sonnet-4-5"
# Specific Agent (highest priority among env vars)
export ENHANCER_MODEL_STRATEGOS="anthropic/claude-opus-4"
export ENHANCER_MODEL_ORACLE="anthropic/claude-sonnet-4-5"Model Recommendations by Agent Type
Primary Agents (Use stronger models for complex reasoning):
| Agent | Recommended | Minimum | Purpose | |-------|-----------|---------|---------| | strategos | anthropic/claude-sonnet-4-5 | opencode/kimi-k2.5-free | Strategic planning with interview mode | | ultraplan | anthropic/claude-sonnet-4-5 | opencode/kimi-k2.5-free | Planning with todo enforcement | | enhancer | opencode/kimi-k2.5-free | opencode/kimi-k2.5-free | Prompt enhancement & analysis | | ask | opencode/kimi-k2.5-free | opencode/kimi-k2.5-free | Q&A and research |
Subagents (Lightweight models sufficient for information gathering):
| Subagent | Recommended | Minimum | Purpose | |----------|-------------|---------|---------| | librarian | opencode/kimi-k2.5-free | opencode/kimi-k2.5-free | Documentation & research (Context7 + codesearch) | | oracle | anthropic/claude-sonnet-4-5 | opencode/kimi-k2.5-free | Debugging & code architecture | | architect | opencode/kimi-k2.5-free | opencode/kimi-k2.5-free | Dependencies & system design | | reviewer | opencode/kimi-k2.5-free | opencode/kimi-k2.5-free | Plan validation | | interviewer | anthropic/claude-sonnet-4-5 | opencode/kimi-k2.5-free | Requirements clarification |
Validation
The plugin validates configured models against known providers:
opencode/*anthropic/*openai/*google/*mistral/*cohere/*ollama/*
Invalid models automatically fall back to the default (opencode/kimi-k2.5-free).
🎨 Ready-to-Use Templates
Siehe MODEL-TEMPLATES.md für vorgefertigte Konfigurationen:
- 🚀 Performance First - Beste Ergebnisse mit Claude
- 💰 Budget First - Kosten sparen mit Kimi
- ⚡ Hybrid - Intelligente Aufteilung nach Aufgabe
- 🔧 Custom Models - OpenAI, Google, etc.
Quick-Start:
# Hybrid Template (empfohlen für den Anfang)
curl -s https://raw.githubusercontent.com/MaansenV/opencode-enhancer-plugin/main/MODEL-TEMPLATES.md | grep -A 50 "Template 3: Hybrid"Context7 Integration
The plugin automatically detects libraries that benefit from Context7:
// Libraries triggering "use context7"
["react", "django", "unity", "tensorflow", "docker", ...]🔧 Development
Project Structure
opencode-enhancer-plugin/
├── src/
│ └── index.ts # Source TypeScript
├── dist/ # Compiled output (published to npm)
│ ├── index.js
│ └── index.d.ts
├── package.json # Package metadata
├── tsconfig.json # TypeScript config
└── README.md # This fileHooks
config- Registers agents on startuptool.execute.before- Logs subagent callsmessage.updated- Appends Build mode hintmessage.completed- Extracts and stores TODOsstop.requested- Prevents stop when TODOs are opensession.start- Manages todo store lifecyclesession.end- Manages todo store lifecycleuser.prompt.submitted- Auto-activates strategos mode on keywords
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Ideas for Contributions
- Add more tech stack detectors
- Improve Context7 heuristics
- Add support for additional intent types
- Enhance prompt templates
📄 License
MIT License - see LICENSE file for details.
🙏 Acknowledgments
- Built for OpenCode
- Inspired by the need for better context-aware AI assistance
- Thanks to the OpenCode community for feedback and ideas
Made with ❤️ for the OpenCode community
