opencode-worktree: Zero-Friction Git Worktrees for AI-Driven Development

This repository profile is provided by osrepos.com, an open source repository discovery platform.

opencode-worktree: Zero-Friction Git Worktrees for AI-Driven Development

Summary

opencode-worktree is an OpenCode plugin designed to streamline git worktree management. It automates the creation and deletion of isolated development environments, complete with terminal spawning and file synchronization. This tool is ideal for AI-driven workflows, offering a zero-friction experience for developers who prioritize automation and efficiency.

Repository Information

Analyzed by OSRepos on September 6, 2026

Topics

Click on any tag to explore related repositories

Use at your own risk

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.

Introduction

opencode-worktree is an innovative OpenCode plugin that revolutionizes how developers interact with git worktrees. It provides a zero-friction solution for creating isolated development environments, automatically spawning dedicated terminals with OpenCode running inside. This eliminates manual setup, context switching, and cleanup, making it perfect for modern, AI-driven development workflows.

Why Use It & Benefits

Traditional git worktree management, whether manual or via OpenCode Desktop's UI, often introduces friction. Manual worktrees require multiple steps: creating the worktree, opening a terminal, navigating, and then starting OpenCode. While OpenCode Desktop offers a visual approach, it can limit automation.

opencode-worktree addresses these challenges by providing a seamless, automated workflow:

  • Zero-Friction Isolation: When an AI agent calls worktree_create, a new terminal automatically spawns with OpenCode pre-loaded, and files are synchronized. For worktree_delete, changes are committed, and the worktree is cleaned up automatically.
  • AI-Driven Development: It's specifically designed to integrate with AI agents, allowing them to effortlessly create and manage isolated development sessions.
  • Automated Lifecycle Management: Handles the entire worktree lifecycle, from creation to cleanup, reducing developer overhead.
  • Terminal Automation: Automatically detects and integrates with various terminals across macOS, Linux, and Windows, including cmux and tmux for advanced multiplexing.
  • Configurable Synchronization: Allows defining files to copy, directories to symlink, and patterns to exclude, ensuring each worktree has the necessary context.
  • Custom Hooks: Supports postCreate and preDelete hooks for running custom commands, such as pnpm install or docker compose up -d.

This plugin transforms worktrees from a manual tool into an integral part of an automated development workflow, especially when paired with tools like cmux.

Installation

To install opencode-worktree, you'll need OCX installed. If you don't have OCX, follow the instructions on its repository first.

Once OCX is ready, add the plugin using the following command:

ocx add kdco/worktree --from https://registry.kdco.dev

For a more comprehensive experience, consider installing kdco-workspace, which bundles worktrees with background agents, planning tools, and notifications:

ocx add kdco/workspace --from https://registry.kdco.dev

Examples

The plugin introduces two primary tools for managing worktrees:

Creating a Worktree

Use worktree_create to set up a new isolated environment. A new terminal will spawn with OpenCode ready.

worktree_create:
  branch: "feature/dark-mode"
  baseBranch: "main"  # optional, defaults to HEAD

Upon execution, this command:

  1. Creates a git worktree at ~/.local/share/opencode/worktree/<project-id>/feature/dark-mode.
  2. Synchronizes files based on your .opencode/worktree.jsonc configuration.
  3. Runs any defined postCreate hooks (e.g., pnpm install).
  4. Opens a new terminal window with OpenCode running within the worktree.

Deleting a Worktree

Use worktree_delete to remove the current worktree. All changes are automatically committed before removal.

worktree_delete:
  reason: "Feature complete, merging to main"

When called, this command:

  1. Executes any preDelete hooks (e.g., docker compose down).
  2. Commits all pending changes with a snapshot message.
  3. Removes the git worktree with --force.
  4. Cleans up the session state.

Links

Related repositories

Similar repositories that may be relevant next.

Agent Factory: Generate AI Agents with Natural Language Descriptions

Agent Factory: Generate AI Agents with Natural Language Descriptions

September 3, 2026

Agent Factory, developed by Mozilla-AI, is a powerful tool designed to generate AI agents and workflows. It allows users to describe tasks in natural language, which it then transforms into executable Python code for agentic workflows. Leveraging the Model Context Protocol (MCP) and the any-agent library, it simplifies the creation of complex AI solutions.

agentagentic-aicli
gh-aw: Automating GitHub Workflows with AI Agents

gh-aw: Automating GitHub Workflows with AI Agents

August 29, 2026

GitHub Agentic Workflows (gh-aw) is a powerful GitHub CLI extension that enables AI-powered repository automation. It allows developers to define intelligent, agentic workflows using Markdown with YAML frontmatter, which are then compiled into standard GitHub Actions workflows. This tool complements traditional CI/CD by handling tasks requiring reasoning or interpretation, such as issue triage and pull request reviews, leveraging AI engines like GitHub Copilot and Claude Code.

github-actionsaiautomation
AntiVibe: Learn Code with AI-Powered Deep Dives and Architectural Audits

AntiVibe: Learn Code with AI-Powered Deep Dives and Architectural Audits

August 26, 2026

AntiVibe is an innovative code learning and audit framework designed to help developers truly understand code, whether it's AI-generated, new, or legacy. It transforms any codebase into educational deep dives or senior-level architectural audits, moving beyond mere code summaries to explain the 'what,' 'why,' and 'when' of code patterns. This tool addresses the common problem of developers copying AI-generated code without grasping its underlying logic or implications.

aiclaude-codecode-explanation
Autoresearch: Autonomous Iteration for LLM-Powered Code Improvement

Autoresearch: Autonomous Iteration for LLM-Powered Code Improvement

August 24, 2026

Autoresearch is a powerful GitHub repository that transforms large language models like Claude Code, OpenCode, and OpenAI Codex into relentless improvement engines. Inspired by Karpathy's autoresearch, it enables autonomous, goal-directed iteration, following a "Modify, Verify, Keep/Discard, Repeat" loop to achieve compounding gains across various domains. This project offers a structured approach to automate development, security, and operational tasks with AI.

aiautonomous-agentautoresearch

Source repository

Open the original repository on GitHub.

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️