@generativereality/cctabs 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@generativereality/cctabs",
3
+ "version": "0.1.0",
4
+ "description": "Claude Code tab manager. Terminal tabs as the UI, no tmux.",
5
+ "type": "module",
6
+ "bin": {
7
+ "cctabs": "dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ ".claude-plugin",
12
+ "skills"
13
+ ],
14
+ "scripts": {
15
+ "dev": "bun run ./src/index.ts",
16
+ "build": "tsdown",
17
+ "typecheck": "tsc --noEmit",
18
+ "lint": "eslint src/",
19
+ "check": "bun run typecheck && bun run build",
20
+ "release": "bumpp && npm publish",
21
+ "sync-plugin": "bash scripts/sync-plugin.sh",
22
+ "prepack": "bash scripts/sync-plugin.sh --check && bun run build"
23
+ },
24
+ "keywords": [
25
+ "claude-code",
26
+ "ai-agents",
27
+ "session-manager",
28
+ "wave-terminal",
29
+ "cctabs",
30
+ "agentherder"
31
+ ],
32
+ "author": "motin",
33
+ "license": "MIT",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/generativereality/cctabs.git"
37
+ },
38
+ "homepage": "https://cctabs.com",
39
+ "engines": {
40
+ "node": ">=20.19.4"
41
+ },
42
+ "publishConfig": {
43
+ "registry": "https://registry.npmjs.org",
44
+ "access": "public"
45
+ },
46
+ "dependencies": {
47
+ "@clack/prompts": "^0.9.1",
48
+ "consola": "^3.4.0",
49
+ "gunshi": "^0.23.0",
50
+ "update-notifier": "^7.3.1"
51
+ },
52
+ "devDependencies": {
53
+ "@types/node": "^22.0.0",
54
+ "@types/update-notifier": "^6.0.8",
55
+ "bumpp": "^9.11.1",
56
+ "tsdown": "^0.12.0",
57
+ "typescript": "^5.8.0"
58
+ }
59
+ }
@@ -0,0 +1,202 @@
1
+ ---
2
+ name: herd
3
+ description: Manage Claude Code sessions across terminal tabs (NOT browser tabs) — list running sessions, open new ones, fork, close, inspect output, and send input. Use this when working with multiple parallel Claude Code sessions in terminal tabs.
4
+ ---
5
+
6
+ You are managing Claude Code sessions using the `cctabs` CLI.
7
+
8
+ **Important:** "tabs" here means **terminal tabs** (e.g. Wave Terminal tabs), NOT browser tabs. Each terminal tab runs its own Claude Code session. This skill is for managing those terminal-based Claude Code sessions — not for browser automation.
9
+
10
+ ## First: Ensure cctabs is available
11
+
12
+ ```bash
13
+ which cctabs || ls "$(npm prefix -g)/bin/cctabs" 2>/dev/null
14
+ ```
15
+
16
+ If found, use whichever path works. If `cctabs` is on PATH, use it directly. Otherwise use the full path from `npm prefix -g`.
17
+
18
+ If not found, ask the user: "cctabs isn't installed yet — want me to install it globally with npm?" If they agree, run:
19
+
20
+ ```bash
21
+ npm install -g @generativereality/cctabs
22
+ ```
23
+
24
+ Do not modify PATH or npm configuration beyond this.
25
+
26
+ ---
27
+
28
+ Each Claude Code session runs in its own **terminal tab**. `cctabs` lets you — and other Claude Code sessions — introspect and orchestrate the full session fleet.
29
+
30
+ ## Quick Reference
31
+
32
+ ```bash
33
+ cctabs sessions # list all tabs with session status
34
+ cctabs list # list all workspaces, tabs, and blocks
35
+ cctabs new <name> [dir] [-w workspace] [-p "prompt"] [-f file] # new tab + claude
36
+ cctabs resume <name> [dir] # resume last session (reuses tab or creates one)
37
+ cctabs fork <tab-name> [-n new-name] # fork session into new tab (--resume <id> --fork-session)
38
+ cctabs close <name-or-id> # close a tab
39
+ cctabs rename <name-or-id> <new-name> # rename a tab
40
+ cctabs scrollback <tab-or-block> [n] # read terminal output (default: 50 lines)
41
+ cctabs send <tab-or-block> [text] # send input — arg, --file, or stdin pipe
42
+ cctabs config # show config and path
43
+ ```
44
+
45
+ ## Workflow: Checking What's Running
46
+
47
+ Before starting new sessions, always check what's already active:
48
+
49
+ ```bash
50
+ cctabs sessions
51
+ ```
52
+
53
+ Output example:
54
+ ```
55
+ Sessions
56
+ ==================================================
57
+
58
+ Workspace: work (current)
59
+
60
+ [a1b2c3d4] "auth" ◄ ~/Dev/myapp
61
+ ● active
62
+ [e5f6a7b8] "api" ~/Dev/myapp
63
+ ○ idle
64
+ [c9d0e1f2] "infra" ~/Dev/myapp
65
+ terminal
66
+ last: $ git status
67
+ ```
68
+
69
+ ## Workflow: Opening a Session Batch
70
+
71
+ ```bash
72
+ cctabs new auth ~/Dev/myapp
73
+ cctabs new api ~/Dev/myapp
74
+ cctabs new infra ~/Dev/myapp
75
+ ```
76
+
77
+ Each tab is automatically named and the claude session name is synced to the tab title.
78
+
79
+ ## Workflow: Resuming a Session
80
+
81
+ `cctabs resume` finds the latest session ID for the directory and runs `claude --resume <id>`.
82
+ If the named tab still exists, it reuses it. If not, it creates a new tab.
83
+
84
+ ```bash
85
+ cctabs resume auth ~/Dev/myapp # reuses "auth" tab if it exists, otherwise creates one
86
+ cctabs resume api ~/Dev/myapp
87
+ ```
88
+
89
+ **Use `cctabs resume` instead of `cctabs new` when you want to continue a previous conversation.**
90
+ `cctabs new` always starts a fresh Claude session. `cctabs resume` picks up where the last session left off.
91
+
92
+ ## Workflow: Forking a Session
93
+
94
+ Use `fork` when you want to explore an alternative approach without disrupting the original.
95
+ `cctabs fork` finds the latest session ID for the source tab and opens a new tab with
96
+ `claude --resume <id> --fork-session`. The source tab is not modified.
97
+
98
+ ```bash
99
+ cctabs fork auth # creates "auth-fork" tab
100
+ cctabs fork auth -n "auth-v2" # creates "auth-v2" tab
101
+ ```
102
+
103
+ The forked session shares full conversation history up to the fork point, then diverges independently.
104
+
105
+ ## Workflow: Spawning a Parallel Agent
106
+
107
+ As a Claude Code session, you can spawn a sibling session to work on a parallel task:
108
+
109
+ **Preferred: pass the initial task directly to `cctabs new`** using `--prompt` or `--file`. This polls internally until Claude's `❯` prompt appears before sending — no race condition:
110
+
111
+ ```bash
112
+ cctabs new payments ~/Dev/myapp --prompt "implement the billing endpoint"
113
+ cctabs new payments ~/Dev/myapp --file /tmp/task.txt
114
+ ```
115
+
116
+ If you need to send a task after the fact, poll first:
117
+
118
+ ```bash
119
+ cctabs new payments ~/Dev/myapp
120
+ # Poll until ❯ appears (typically 10-15s with MCP servers)
121
+ cctabs scrollback payments 5 # repeat until you see ❯
122
+ cctabs send payments --file /tmp/task.txt
123
+ cctabs send payments "yes\n" # quick replies
124
+ ```
125
+
126
+ **Do NOT call `cctabs send` immediately after `cctabs new`** — Claude is still starting up and the text will land as raw shell commands.
127
+
128
+ ## Workflow: Monitoring Another Session
129
+
130
+ ```bash
131
+ cctabs scrollback auth # last 50 lines
132
+ cctabs scrollback auth 200 # last 200 lines
133
+ ```
134
+
135
+ ## Workflow: Sending Input to a Session
136
+
137
+ ```bash
138
+ cctabs send auth "yes\n" # approve a tool call
139
+ cctabs send auth "\n" # press enter (confirm a prompt)
140
+ cctabs send auth "/clear\n" # send a slash command
141
+ cctabs send auth --file ~/prompts/task.txt # send a full prompt from file
142
+ echo "do the thing" | cctabs send auth # pipe via stdin
143
+ ```
144
+
145
+ ## Workflow: Worktrees
146
+
147
+ **Always point tabs at the repo root — never at a manually-created worktree directory.** Claude Code manages worktrees itself via `claude --worktree <name>`, which creates `.claude/worktrees/<name>/` inside the repo and handles branch creation and cleanup automatically.
148
+
149
+ ### New isolated session (new branch, Claude manages everything)
150
+
151
+ ```bash
152
+ cctabs new feature-name ~/Dev/myapp --worktree
153
+ # Equivalent to: cd ~/Dev/myapp && claude --worktree "feature-name" --name "feature-name"
154
+ # Claude creates: ~/Dev/myapp/.claude/worktrees/feature-name/
155
+ # Claude creates branch: worktree-feature-name
156
+ ```
157
+
158
+ ### Existing branch — ask Claude to enter the worktree mid-session
159
+
160
+ ```bash
161
+ cctabs new hiring ~/Dev/myapp # open tab at repo root
162
+ cctabs send hiring "Enter a worktree for branch z.old/new-hire-ad and ..."
163
+ # Claude will use EnterWorktree tool to set up isolation
164
+ ```
165
+
166
+ ### Do NOT manage git worktrees manually
167
+
168
+ ```bash
169
+ # ❌ WRONG — do not create worktree dirs yourself and pass them to cctabs new
170
+ git worktree add ~/Dev/myapp-feature branch
171
+ cctabs new feature ~/Dev/myapp-feature
172
+
173
+ # ✅ RIGHT — always use repo root; let Claude Code manage the worktree
174
+ cctabs new feature ~/Dev/myapp --worktree
175
+ ```
176
+
177
+ **Why:** Manually created worktree dirs placed outside the repo confuse Claude Code's session tracking, project memory lookup (`.claude/` is in the main repo), and CLAUDE.md resolution. Claude Code's built-in worktree support keeps everything co-located under `.claude/worktrees/` and handles cleanup on session exit.
178
+
179
+ ## Workflow: Cleanup
180
+
181
+ ```bash
182
+ cctabs sessions # find idle/terminal tabs
183
+ cctabs close old-feature # close by name (prefix match)
184
+ cctabs close e5f6a7b8 # close by block ID prefix
185
+ ```
186
+
187
+ ## Tab Naming Conventions
188
+
189
+ Name tabs after the **project or task**:
190
+ - `auth` — authentication work
191
+ - `api` — API service
192
+ - `infra` — infrastructure
193
+ - `pr-1234` — specific PR work
194
+ - `auth-v2` — forked attempt
195
+
196
+ ## Notes
197
+
198
+ - Tab names are matched by exact name or prefix (case-insensitive)
199
+ - Block IDs can be abbreviated to the first 8 characters
200
+ - `cctabs new` and `cctabs resume` automatically pass `--name <tab-name>` to claude, syncing the session display name with the tab title
201
+ - Configured `claude.flags` in `~/.config/cctabs/config.toml` are applied to every session
202
+ - `cctabs send` resolves tab names to their terminal block automatically