OpenCode plugin providing autonomous development agents for continuous codebase improvement.
This plugin follows the OpenCode plugin API and installs three agents that work together to create an infinite autonomous development loop:
| Agent | Purpose |
|---|---|
opencoder |
Main orchestrator - runs the continuous Plan-Build-Commit loop |
opencoder-planner |
Creates development plans with 3-7 prioritized tasks |
opencoder-builder |
Executes tasks with precision, runs tests, and verifies changes |
Add the plugin to your opencode.json config:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-plugin-opencoder"]
}Or install manually:
bun add opencode-plugin-opencoderOn install, the agents are automatically copied to ~/.config/opencode/agents/.
Start the autonomous development loop:
opencode @opencoderThe agent will:
- Analyze your codebase and create a plan with 3-7 tasks
- Execute each task, writing code and running tests
- Commit changes after each task with conventional commit messages
- Push all commits after the plan is complete
- Repeat forever
┌─────────────────────────────────────────────────────────────┐
│ INFINITE LOOP │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ PLANNER │───>│ BUILDER │───>│ COMMIT │ │
│ │ (3-7 tasks) │ │ (per task) │ │ & PUSH │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ ^ │ │
│ └───────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
The planner analyzes your codebase and creates a prioritized list of tasks:
- Critical bugs - Errors, crashes, security issues
- Missing tests - Untested code paths
- Code quality - Linting errors, type issues
- Documentation gaps - Missing or outdated docs
- Performance issues - Slow operations
- Feature gaps - TODO comments, incomplete implementations
- Refactoring - Duplicated code, complex functions
The builder executes each task:
- Understands the task requirements
- Makes code changes following project style
- Runs tests and linter
- Reports completion with a summary
The main orchestrator:
- Invokes the planner to create a plan
- For each task, invokes the builder
- Commits changes after each task (conventional commits)
- Pushes all commits after the plan completes
- Starts the next cycle immediately
The agents use free models by default:
| Agent | Model |
|---|---|
opencoder |
opencode/glm-4.7-free |
opencoder-planner |
opencode/glm-4.7-free |
opencoder-builder |
opencode/minimax-m2.1-free |
You can customize models by editing the agent files in ~/.config/opencode/agents/.
The agents automatically:
- Commit after each task with conventional commit messages (
fix:,feat:,test:, etc.) - Sign commits with
--signofffor DCO compliance - Push after each cycle to keep your remote up to date
If the postinstall script doesn't run automatically:
node node_modules/opencode-plugin-opencoder/postinstall.mjsOr copy the agents manually:
cp node_modules/opencode-plugin-opencoder/agents/*.md ~/.config/opencode/agents/This plugin exports:
// Main plugin function (OpenCode plugin API)
import { OpenCoderPlugin } from "opencode-plugin-opencoder"
// or
import OpenCoderPlugin from "opencode-plugin-opencoder"
// Metadata exports (for introspection)
import { name, version, description, agents } from "opencode-plugin-opencoder"The plugin currently provides a minimal hooks structure that can be extended in the future. Agent registration is handled via the postinstall script since the OpenCode plugin API does not yet support dynamic agent registration.
Enable debug logging to see plugin activity:
OPENCODER_DEBUG=1 opencode @opencoderWhen enabled, the plugin logs:
| Event | Information Logged |
|---|---|
event |
Event type, property keys |
tool.execute.before |
Tool name, session ID, call ID, argument keys |
tool.execute.after |
Tool name, session ID, call ID, title, output length |
Log output format:
[2025-01-18T12:00:00.000Z] [opencoder] Event received {
"directory": "/path/to/project",
"type": "session.created",
"properties": ["sessionID", "model"]
}
If you encounter errors during installation, here are common error codes and their solutions:
| Error Code | Message | Solution |
|---|---|---|
EACCES |
Permission denied | Check write permissions for ~/.config/opencode/agents/. Run chmod -R u+w ~/.config/opencode/ or use sudo if needed. |
EPERM |
Operation not permitted | The file may be locked or in use. Close any editors or applications using the agent files and try again. |
ENOSPC |
Disk full | Free up disk space and retry the installation. |
EROFS |
Read-only file system | The target directory is on a read-only filesystem. Remount with write permissions or choose a different config location. |
EAGAIN |
Resource temporarily unavailable | A transient error. The installer retries automatically, but if it persists, wait a moment and try again. |
EBUSY |
File is busy or locked | Another process is using the file. Close any applications that might have the agent files open. |
ENOENT |
Source file not found | The agent source files are missing from the package. Try reinstalling with bun add opencode-plugin-opencoder. |
EEXIST |
Target already exists | An agent file already exists. The installer should handle this, but you can manually remove files in ~/.config/opencode/agents/ if needed. |
EMFILE / ENFILE |
Too many open files | System file descriptor limit reached. Close some applications or increase your system's ulimit. |
EISDIR |
Expected file but found directory | A directory exists where an agent file should be. Remove the conflicting directory from ~/.config/opencode/agents/. |
If automatic installation fails, you can manually copy the agents:
# Create the agents directory
mkdir -p ~/.config/opencode/agents
# Copy agents from the installed package
cp node_modules/opencode-plugin-opencoder/agents/*.md ~/.config/opencode/agents/Check that agents were installed correctly:
ls -la ~/.config/opencode/agents/
# Should show: opencoder.md, opencoder-planner.md, opencoder-builder.md# Install dependencies
bun install
# Run type checker
bun run typecheck
# Run tests
bun test
# Run linter
bun run lint
# Fix lint issues
bun run lint:fixMIT License - See LICENSE file.