Integration

OpenCode Orchestration with Stoneforge

Orchestrate OpenCode AI coding agents with Stoneforge. Automated dispatch, context management, and merge coordination.

How Stoneforge orchestrates OpenCode

OpenCode is an open-source AI coding agent built in Go. As a powerful OpenCode AI tool, it runs in your terminal as a TUI and is also available as a desktop app and IDE extension. OpenCode includes primary agents (Build and Plan), subagents (General and Explore), and multi-agent team coordination via message passing.

Stoneforge coordinates multiple OpenCode AI coding agent instances working on separate tasks at the same time, handling dispatch, merging, and failure recovery.

Parallel development with OpenCode AI

OpenCode supports multi-session work and agent teams out of the box. Stoneforge adds orchestrated task dispatch, assigning instances to tasks from a backlog and managing their full lifecycle:

# Create tasks for OpenCode agents
sf plan create --title "Frontend Refresh"

sf task create --title "Redesign login page" --plan "Frontend Refresh"
sf task create --title "Add dark mode support" --plan "Frontend Refresh"
sf task create --title "Implement search component" --plan "Frontend Refresh"

# Start orchestration
sf serve

Each OpenCode instance works in its own git worktree. One handles the login page redesign while another adds dark mode, without stepping on each other’s changes.

Coordinated output

Running multiple coding agents in parallel creates merge challenges. Stoneforge helps manage this:

  • Tasks with dependencies are sequenced so they run in the right order
  • Each agent works in an isolated worktree, preventing interference
  • A steward agent tests and validates completed work before merging
  • Merge conflicts are detected early and resolved automatically when possible

Task lifecycle management

Stoneforge manages the full lifecycle for each OpenCode instance:

  1. The agent receives a task with context, acceptance criteria, and its own branch
  2. It works in isolation, committing and pushing regularly
  3. If context fills up or the agent gets stuck, a clean handoff passes work to a fresh session
  4. When the agent finishes, a steward takes over for review
  5. Changes are tested and merged into the main branch

Getting started

# Install Stoneforge
npm install -g @stoneforge/cli

# Initialize in your project
sf init

# Configure for OpenCode in .stoneforge/config.yaml
# Start orchestrating
sf serve

Stoneforge auto-detects your project structure and sets reasonable defaults. You can customize agent count, model, and merge policies in the config file.

Learn more

Configuration

.stoneforge/config.yaml
# .stoneforge/config.yaml
orchestrator:
  agent: opencode
  maxConcurrent: 4
  worktreeIsolation: true

agents:
  worker:
    provider: opencode
    model: default
  steward:
    provider: opencode
    autoMerge: true

OpenCode alone vs. with Stoneforge

OpenCode alone With Stoneforge
Multi-session support within a single project Orchestrated dispatch from a task backlog with lifecycle management
Manual project navigation and context Automatic task dispatch with full project context
Multi-agent teams with subagent delegation Role-based orchestration (director, worker, steward) across independent tasks
Manual git workflow Isolated worktrees with automated branching and merging
Within-session error recovery and context compaction Cross-session handoff when context fills up or sessions fail unrecoverably

Integration documentation

Start orchestrating OpenCode

Set up Stoneforge in under 30 seconds and run multiple OpenCode agents in parallel.