Running more than one coding agent at a time is the quickest way to get more done with Claude Code and Codex. It is also the quickest way to make a mess: two agents editing the same file, or a session that sat waiting for your approval for twenty minutes while you looked at another window.
Three things make it work: a separate copy of the code for each agent, a separate terminal for each, and a signal when one needs you. Here is how to set each one up with Terminal and Git, and then how Lattice does it for you.
Before you start
- Claude Code, Codex or both, installed and signed in. Check by running
claude --versionorcodex --version. - Your project in a Git repository, with your current work committed. Each agent starts from your latest commit, so anything uncommitted stays behind.
1. Give each agent its own copy of the code
Two agents in the same folder will overwrite each other's changes. A Git worktree is a second folder that shares the same repository but has its own branch and its own files, so each agent works in isolation and nothing is copied or cloned.
From your project folder, make one worktree per task:
git worktree add -b agent/fix-login ../myapp-agents/fix-login
git worktree add -b agent/search ../myapp-agents/searchEach line creates a new branch (agent/fix-login) and a folder beside your project where that branch is checked out. Name them after the task so you can tell them apart later.
Install dependencies in each worktree. Folders like node_modules aren't shared, so run npm install (or your project's equivalent) in each one before an agent tries to build or test. If agents start dev servers, give each a different port.
2. Start one agent per worktree
Open a terminal tab for each worktree and start an agent inside it:
cd ../myapp-agents/fix-login && claude
cd ../myapp-agents/search && codexGive each a task that touches different parts of the code. “Fix the login redirect” and “add search to the docs page” run well side by side; two agents both refactoring the same module will produce branches that conflict when you merge. Two to four agents at once is plenty for most people: beyond that, reviewing their work becomes the bottleneck.
3. Get a notification when an agent needs you
Agents stop to ask for permission, ask a question or finish, and none of that is visible from another window. Both tools can run a command at those moments, and macOS can turn it into a notification.
Claude Code: add a Notification hook to ~/.claude/settings.json. It runs when Claude Code needs your permission or has been waiting for your input. Add the same block under Stop if you also want to know when it finishes.
{
"hooks": {
"Notification": [
{
"hooks": [
{
"type": "command",
"command": "osascript -e 'display notification \"Claude Code needs you\" with title \"Claude Code\"'"
}
]
}
]
}
}Codex: add a notify line near the top of ~/.codex/config.toml. Codex runs it each time it finishes a turn.
notify = ["osascript", "-e", "display notification \"Codex finished\" with title \"Codex\""]The first notification may ask for permission: allow notifications for Script Editor in System Settings → Notifications.
4. Review and merge the work
When an agent is done, look at everything it changed, then bring it into your main branch:
git diff main...agent/fix-login
git merge agent/fix-loginThen remove the worktree and its branch:
git worktree remove ../myapp-agents/fix-login
git branch -d agent/fix-logingit worktree list shows every worktree you still have, if you lose track.
The same thing in Lattice
Lattice is a Mac workspace that puts terminals, coding agents, a browser and your project files in one window. Its Agents tool does all of the above in a few clicks:
- Open Agents from the command bar (⌘ K) and click New agent.
- Click Choose… and pick your project folder.
- Pick Claude Code or Codex, tick Own worktree, type a task name such as fix login, and click Start.
Lattice creates myapp-agents/fix-login on the branch lattice/fix-login and starts the agent there, in its own window. Repeat for each task. Then:
- Every agent's status in one list. The Agents tool shows which sessions are working, which are waiting and what each is doing, such as “Editing store.ts”.
- Alerts only when you're needed. An approval or a question badges the Dock icon and, if Lattice isn't in front, sends a notification. Lattice adds its hooks to that session only, so your own settings files stay as they are.
- Everything for the task beside it. Open the worktree's files, a terminal for
npm installand a browser on its dev server next to the agent, on a desktop of their own. - Agents on a server. Choose a saved SSH server under Run on, and the agent starts there, inside tmux when the server has it, so it keeps running if your Mac sleeps.
Lattice runs the Claude Code and Codex you already have installed, with your own sign-ins and plans. It adds no AI service of its own.