This file provides instructions for AI coding agents working in this repository.
This is an OpenCode plugin that provides autonomous development agents. The plugin follows the OpenCode plugin API and installs three agents that work together to create an infinite Plan-Build-Commit loop.
- Type: OpenCode Plugin
- Runtime: Bun
- Language: TypeScript
opencode-plugin-opencoder/
├── agents/ # Agent markdown files
│ ├── opencoder.md # Main orchestrator agent
│ ├── opencoder-planner.md # Planning subagent
│ └── opencoder-builder.md # Building subagent
├── src/
│ ├── index.ts # Main entry: exports plugin + re-exports metadata
│ ├── plugin.ts # Plugin function (OpenCode plugin API)
│ ├── metadata.ts # Metadata exports (name, version, agents)
│ ├── paths.mjs # Path utilities for install/uninstall scripts
│ └── paths.d.mts # Type declarations for paths.mjs
├── tests/
│ ├── index.test.ts # Tests for main exports
│ ├── plugin.test.ts # Tests for plugin function
│ ├── agents.test.ts # Tests for agent files
│ ├── install.test.ts # Tests for install/uninstall scripts
│ └── paths.test.ts # Tests for path utilities
├── postinstall.mjs # Copies agents to ~/.config/opencode/agents/
├── preuninstall.mjs # Removes agents on uninstall
├── package.json # npm package configuration
├── biome.json # Linter configuration
└── tsconfig.json # TypeScript configuration
The plugin follows the OpenCode plugin structure:
// Plugin function (default + named export)
export { OpenCoderPlugin } from "./plugin"
export { OpenCoderPlugin as default } from "./plugin"
// Metadata re-exports (backwards compatibility)
export { name, version, description, agents } from "./metadata"import type { Plugin } from "@opencode-ai/plugin"
export const OpenCoderPlugin: Plugin = async (ctx) => {
// Returns hooks object (minimal for now)
return {}
}Contains package metadata exports for introspection and backwards compatibility.
# Install dependencies
bun install
# Run tests
bun test
# Run type checker
bun run typecheck
# Run linter
bun run lint
# Fix lint issues
bun run lint:fix
# Format code
bun run format
# Test postinstall script
node postinstall.mjsThe core functionality is in the agent markdown files under agents/:
The primary agent that:
- Invokes
@opencoder-plannerto create development plans - Invokes
@opencoder-builderfor each task - Commits changes after each task
- Pushes after all tasks complete
- Repeats indefinitely
Analyzes codebases and produces 3-7 prioritized tasks based on:
- Critical bugs
- Missing tests
- Code quality issues
- Documentation gaps
- Performance issues
- Feature gaps
- Refactoring opportunities
Executes individual tasks:
- Understands the task
- Makes code changes
- Runs tests and linter
- Reports completion
When editing agent files:
- Be specific - Clear instructions produce better results
- Use examples - Show the expected format/output
- Define boundaries - What should and shouldn't be done
- Test changes - Run
opencode @opencoderto verify behavior
import { existsSync } from "node:fs" // Node.js builtins with node: prefix| Element | Convention | Example |
|---|---|---|
| Files | kebab-case | postinstall.mjs |
| Constants | camelCase | agents |
| Exports | camelCase | name, version |
- Use conventional commits:
feat:,fix:,docs:,chore: - Sign commits with
-sflag - Keep commits atomic
- Update version in
package.json - Update
CHANGELOG.md - Create git tag:
git tag v0.1.0 - Push tag:
git push --tags - CI will publish to npm automatically