Automation daemon for OpenCode - polls for work and spawns sessions.
Note: This is a community project and is not built by or affiliated with the OpenCode team.
- Polling automation - Automatically start sessions from GitHub issues, Linear tickets, etc.
- Readiness evaluation - Check labels, dependencies, and priority before starting work
- Template-based prompts - Customize prompts with placeholders for issue data
- Built-in presets - Common patterns like "my GitHub issues" work out of the box
npm install -g opencode-pilot-
Create config - Copy examples/config.yaml to
~/.config/opencode/pilot/config.yamland customize -
Create templates - Add prompt templates to
~/.config/opencode/pilot/templates/ -
Enable the plugin - Add to your
opencode.json:{ "plugin": ["opencode-pilot"] }The daemon will auto-start when OpenCode launches.
Or start manually:
opencode-pilot start
See examples/config.yaml for a complete example with all options.
server_port- Preferred OpenCode server port (e.g.,4096). When multiple OpenCode instances are running, pilot attaches sessions to this port.startup_delay- Milliseconds to wait before first poll (default:10000). Allows OpenCode server time to fully initialize after restart.repos_dir- Directory containing git repos (e.g.,~/code). Pilot auto-discovers repos by scanning git remotes (bothoriginandupstreamfor fork support).defaults- Default values applied to all sourcessources- What to poll (presets, shorthand, or full config)tools- Field mappings to normalize different MCP APIsrepos- Explicit repository paths (overrides auto-discovery fromrepos_dir)
Three ways to configure sources, from simplest to most flexible:
- Presets - Built-in definitions for common patterns (
github/my-issues,github/review-requests, etc.) - GitHub shorthand - Simple
github: "query"syntax for custom GitHub searches - Full syntax - Complete control with
tool,args, anditemfor any MCP source
github/my-issues- Issues assigned to megithub/review-requests- PRs needing my reviewgithub/my-prs-attention- My PRs needing attention (conflicts OR human feedback)linear/my-issues- Linear tickets (requiresteamId,assigneeId)
Session names for my-prs-attention indicate the condition: "Conflicts: {title}", "Feedback: {title}", or "Conflicts+Feedback: {title}".
Create prompt templates as markdown files in ~/.config/opencode/pilot/templates/. Templates support placeholders like {title}, {body}, {number}, {html_url}, etc.
By default, pilot reuses existing sessions and sandboxes to avoid duplicates:
- Session reuse: If a non-archived session already exists for the target directory, pilot appends to it instead of creating a new session. Archived sessions are never reused.
- Sandbox reuse: When
worktree: "new"with aworktree_name, pilot first checks if a sandbox with that name already exists and reuses it.
defaults:
# Disable session reuse (always create new sessions)
reuse_active_session: false
# Disable sandbox reuse (always create new worktrees)
prefer_existing_sandbox: falseWhen multiple sessions exist for the same directory, pilot prefers idle sessions over busy ones, then selects the most recently updated.
Run sessions in isolated git worktrees instead of the main project directory. This uses OpenCode's built-in worktree management API to create and manage worktrees.
sources:
- preset: github/my-issues
# Create a fresh worktree for each session (or reuse if name matches)
worktree: "new"
worktree_name: "issue-{number}" # Optional: name template
- preset: linear/my-issues
# Use an existing worktree by name
worktree: "my-feature-branch"Options:
worktree: "new"- Create a new worktree via OpenCode's API (or reuse existing if name matches)worktree: "name"- Look up existing worktree by name from project sandboxesworktree_name- Template for naming new worktrees (only withworktree: "new")prefer_existing_sandbox: false- Disable sandbox reuse for this source
opencode-pilot start # Start the service (foreground)
opencode-pilot status # Check status
opencode-pilot config # Validate and show config
opencode-pilot clear # Show state summary
opencode-pilot clear --all # Clear all processed state
opencode-pilot clear --expired # Clear expired entries (uses configured TTL)
opencode-pilot clear --source X # Clear entries for source X
opencode-pilot clear --item ID # Clear specific item
opencode-pilot test-source NAME # Test a source
opencode-pilot test-mapping MCP # Test field mappings- Poll sources - Periodically fetch items from configured MCP tools (GitHub, Linear, etc.)
- Evaluate readiness - Check labels, dependencies, and calculate priority
- Spawn sessions - Start
opencode runwith the appropriate prompt template - Track state - Remember which items have been processed
- opencode-devcontainers - Run multiple devcontainer instances for OpenCode
MIT