Skip to content

Instantly share code, notes, and snippets.

@damoahdominic
Created January 19, 2026 16:52
Show Gist options
  • Select an option

  • Save damoahdominic/655ff6353fe66bf6064f66348a46c9ee to your computer and use it in GitHub Desktop.

Select an option

Save damoahdominic/655ff6353fe66bf6064f66348a46c9ee to your computer and use it in GitHub Desktop.
tmux-multi-code-worktrees-skill
name description homepage metadata
code-multi-run-tmux
Run Codex multiple times on the same repo for different features using git worktrees (safe parallelism).
clawdbot
emoji requires
🧩
bins
git

code-multi-run-tmux

Run Codex multiple times on the same repo safely by using Git worktrees.

The core idea: each Codex run gets its own working directory (so there is no last-write-wins overwrite), while sharing the same .git object database.

Why worktrees

Multiple Codex processes editing the same checkout can overwrite each other’s changes. Worktrees avoid that by isolating each run in its own folder.

Workflow (worktree-only)

1) Start from your main repo checkout

Pick a “base” checkout you consider the canonical one:

cd /path/to/repo

git status

2) Create one worktree per feature run

Create a new branch and a new worktree folder in one step:

# Creates branch feat/foo and checks it out in ../repo__feat-foo
# (choose any path you like)
git worktree add -b feat/foo ../repo__feat-foo main

Repeat for another parallel run:

git worktree add -b feat/bar ../repo__feat-bar main

3) Run Codex inside the worktree

Run Codex from inside the worktree directory so it only edits that feature’s files:

cd ../repo__feat-foo
# run your codex command here

4) Review/test/commit per worktree

cd ../repo__feat-foo

git diff
# run tests for the repo

git add -A
git commit -m "feat: foo"

5) Clean up worktrees when done

When you’re finished with a feature branch (merged or abandoned):

# from anywhere inside the original repo
git worktree remove ../repo__feat-foo

# optionally delete the branch too
git branch -D feat/foo

6) List what’s currently checked out

git worktree list

Tips

  • Avoid having two worktrees modify the same lockfile (package-lock.json, pnpm-lock.yaml) at the same time.
  • If you want two competing approaches, create two worktrees:
    • feat/foo-a
    • feat/foo-b

Prompt template

Repo: <worktree path>
Feature: <name>

Goal:
- ...

Constraints:
- Touch only: ...

Acceptance criteria:
- ...

Now implement.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment