iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🐈

Improving Vibe Coding Efficiency by Switching Between Claude Code and Gemini CLI with ccmanager

に公開

TL;DR

  • Using ccmanager, you can run Claude Code and Gemini CLI in parallel by specifying them for each worktree.
  • The status hook feature allows you to execute specific commands when Claude Code/Gemini CLI enters Idle / Waiting / Busy states.
    • This feature lets you set up immediate notifications for task completion, which is something many people currently try to handle through clever prompt engineering.
    • Since you can execute arbitrary commands, you can do anything from Slack notifications to much more.
  • There have been other improvements that make ccmanager even more convenient.

Introduction

Gemini CLI was recently released. While it doesn't currently seem to be a complete game-changer that will replace Claude Code, it's expected that the "best" tools will continue to change rapidly over time and depending on the use case.
Have you ever wanted to easily manage different AI agents for each task, perhaps to experiment or switch tools based on the specific requirements of a job?

In the latest version of ccmanager, you can now flexibly use Claude Code and Gemini CLI for each Git worktree. Furthermore, new features have been added to significantly improve development efficiency, such as the ability to detect AI state changes and execute arbitrary commands, diff visualization, and shortcut keys.

Essentially, this article introduces additional useful features added to ccmanager since the previous introductory article linked below.

https://zenn.dev/kbwok/articles/33fad69555d005

Installation and Usage

# Install
npm install -g ccmanager

# Start
ccmanager

# Start in project root
cd my-project
ccmanager

Key New Features

Preset Feature: Select Claude Code or Gemini CLI for Each Worktree

The most significant addition is the preset function, which allows you to choose between Claude Code and Gemini CLI when starting a session.

Below is a demonstration of configuring the necessary settings and selecting Claude Code or Gemini CLI to start a session.

Preset Configuration

You can define presets either through the ccmanager CLI as shown in the GIF above or in ~/.config/ccmanager/config.json:

{
  "commandPresets": [
    {
      "id": "claude-resume",
      "name": "Claude Code (Resume)",
      "command": "claude",
      "args": ["--resume"],
      "fallbackArgs": [],  // Fallback if --resume fails
      "detectionStrategy": "claude"
    },
    {
      "id": "gemini-default",
      "name": "Gemini CLI",
      "command": "gemini",
      "args": [],
      "detectionStrategy": "gemini"
    }
  ],
  "selectPresetOnStart": true
}

For detailed configuration, please refer to the following:

https://github.com/kbwo/ccmanager/blob/main/docs/gemini-support.md

Fallback Feature

When you want to carry over a previous session in Claude Code, you can resume it by running claude --resume or claude --continue.
However, have you ever accidentally run claude --resume in a worktree where you are starting a session for the first time, only to be met with No conversations found to resume? In those moments, you probably wish it would just start a new session automatically.

A useful aspect of the preset feature for such cases is command fallback.

By setting args to ["--resume"] and fallbackArgs to [] as shown in the preset configuration above, you can enable the following workflow:

  • If a previous session exists → Continue with --resume
  • If no previous session exists → Start fresh with claude (no arguments)

This makes session management much more seamless.

Status Hook Feature - Instantly Catch Agent State Changes

Status Hook is a personally incredibly useful feature that allows you to execute arbitrary commands when the status of Claude Code or Gemini CLI changes.

ccmanager detects what state the session is in based on the following categories:

  • idle: Doing nothing
  • busy: Processing
  • waiting_input: Waiting for user input (Yes/No, etc.)

With Status Hook, you can execute any command when the status changes to a specific state.

While many people seem to notify themselves of state changes by crafting specific prompts, Status Hook allows for AI-independent state detection, making notifications more reliable than prompt-based instructions.

Furthermore, because you can execute arbitrary commands, it's highly extensible—allowing for any kind of customization beyond just notifications.

For actual configuration methods, please refer to the documentation.

https://github.com/kbwo/ccmanager#status-change-hooks

https://github.com/kbwo/ccmanager/blob/main/docs/status-hooks.md

Other Improvements

Here are some other useful features added since the previous article.

Visualizing Worktree Diffs

The Git status of each worktree can now be seen at a glance.

Note: To fully utilize this feature, you need to enable Git's extensions.worktreeConfig. We recommend running the following:

git config extensions.worktreeConfig true
# Or enable it globally
git config --global extensions.worktreeConfig true

Number Key Shortcuts (0-9)

The first 10 worktrees are assigned shortcuts 0–9, allowing for instant selection:

0 ❯ feature/payment
1 ❯ fix/validation
2 ❯ docs/api-update
...
9 ❯ test/integration

You can switch instantly just by pressing a number key, without needing to navigate using the arrow keys.

Automatic Worktree Directory Generation

Previously, you had to specify the branch name and directory path separately, but pattern-based automatic generation is now possible.

Planned Future Features

The following features are planned for future updates:

  • Support for Codex CLI, aider, and opencode
    • I haven't implemented these yet as I don't use them much personally, but after the Gemini update, I've redesigned the system to make it easier to add these, so I plan to support them as soon as possible.
  • Integrated worktree/session management for multiple projects across repositories
  • Merging PRs from contributors
    • Several useful PRs have been submitted, so I intend to merge and release them sequentially if there are no issues.

Summary

The new features in ccmanager have enhanced its utility in the following ways:

  • Use multiple AI tools in the right place at the right time
  • Never miss task completion with Status Hook
  • Quickly grasp the status of each worktree with diff display
  • High-speed switching via shortcuts
  • Reduce tedious input with automatic path generation

Combining these features makes parallel development using Claude Code / Gemini CLI even more efficient.

Please give ccmanager a try! Bug reports, feature requests, and of course, contributions are all welcome.

Gratifyingly, several of the features introduced here are thanks to contributions from the community. I hope more people will use it and lend their strength so we can continue to improve it together.

Discussion