ccmanager 使用备忘

基于 ccmanager 官方 README 整理一篇多 Agent 会话管理与 Git worktree 协作备忘

ccmanager 使用备忘

ccmanager 是一个 AI Agent Session Manager,核心目标是把 Claude CodeCodex CLIGemini CLICursor Agent 这类终端 Agent 会话统一管理,适合“多 Agent 会话 + 多分支并行开发”的场景,可以做到在多个分支Agent会话之间快速切换。

1. 安装和启动

通过npm进行安装:

1
2
3
4
5
# 全局安装
npm install -g ccmanager

# 直接运行
ccmanager

1.1 配置

README 里默认快捷键有两个(快捷键可以在 CLI/config.json修改):

  • Ctrl+E:从活跃会话返回菜单,可以在Configure Shortcuts里修改
  • Escape:取消或返回

通过CLI界面配置codex的启动: 选择Configure Command Presets -> Select preset before session start: ❌ Disabled 设置为Enabled 随后 Add New Preset -> 选择Codex,然后设置命令为codex,参数为-a on-request -> Set as Default设置成默认启动项。

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
➜ ✗ ccmanager     
CCManager - Claude Code Worktree Manager v4.1.15

Select a worktree to start or resume a Claude Code session:

  0 ❯ master (main)  +26            3w ago
  ────────────── Other ──────────────
  N ⊕ New Worktree
  M ⇄ Merge Worktree
  D ✕ Delete Worktree
  P ⌨ Project Configuration
❯ C ⌨ Global Configuration # 选择全局配置
  Q ⏻ Exit

➜ ✗ 
Select a configuration option:

  S ⌨  Configure Shortcuts # 这里可以配置快捷键 ctrl+e 会被vscode 吞掉 需要自己设置
  H 🔧  Configure Status Hooks
  T 🔨  Configure Worktree Hooks
  W 📁  Configure Worktree Settings
❯ C 🚀  Configure Command Presets # 选择配置命令
  M 🔀  Configure Merge/Rebase
  O 🧪  Other & Experimental
  B ← Back to Main Menu

➜ ✗ 
Configure command presets for running code sessions

  Main (default)
      Command: claude
      Detection: Claude
  ─────────────────────────
  Select preset before session start: ❌ Disabled
  ─────────────────────────
❯ Add New Preset # 选择添加新的命令预设
  ← Cancel

Press ↑↓ to navigate, Enter to select, Esc to exit

➜ ✗ 
Choose the state detection strategy for this preset:

The command will be auto-set based on the strategy (can be changed later)

  Claude
  Gemini
❯ Codex # 选择codex
  Cursor Agent
  GitHub Copilot CLI
  Cline
  OpenCode
  Kimi

Press Enter to select, Esc to cancel

➜ ✗ 
Enter command (default set by strategy, can be modified):

Auto-filled from your strategy selection. You can change this if needed.

codex # 这里会默认填充codex enter确认

Press Enter to continue, Esc to cancel

➜ ✗
Enter command arguments (space-separated):

-a on-request # 这里可以配置启动参数 如果不配置可以不适用 -a on-request是模型自动判断执行命令是否需要权限

Press Enter to continue, Esc to cancel

➜ ✗ # 后面的fallback可以默认设空 present name根据需要写 写完后如下继续选择
Configure command presets for running code sessions

  Main (default)
      Command: claude
      Detection: Claude
❯ Codex
      Command: codex
      Args: -a on-request
      Detection: Codex
  ─────────────────────────
  Select preset before session start: ❌ Disabled  # 把这里设置成enabled
  ─────────────────────────
  Add New Preset
  ← Cancel

➜ ✗ # 把codex设置为默认启动项
  Name: Codex
  Command: codex
  Arguments: -a on-request
  Fallback Arguments: (none)
  Detection Strategy: Codex
  ─────────────────────────
❯ Set as Default
  Delete Preset
  ─────────────────────────
  ← Back to List

Press ↑↓ to navigate, Enter to edit/select, Esc to go back

1.2 使用

适合同一个项目的多个分支的同步开发,通过New Worktree新建一个工作树,Merge Worktree可以把当前工作树的修改合并到另一个工作树,Delete Worktree可以删除一个工作树。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
➜ ✗ ccmanager     
CCManager - Claude Code Worktree Manager v4.1.15

Select a worktree to start or resume a Claude Code session:

  0 ❯ master (main)  +26            3w ago
  ────────────── Other ──────────────
❯ N ⊕ New Worktree # 选择新建一个工作树
  M ⇄ Merge Worktree
  D ✕ Delete Worktree
  P ⌨ Project Configuration
  C ⌨ Global Configuration 
  Q ⏻ Exit

参考链接

Licensed under CC BY-NC-SA 4.0
最后更新于 2026-05-14