Phew Install

Run AI coding agents in parallel in VS Code

Updated · 2 min read

One agent at a time is slow when the work splits well. Phew runs agents in parallel on three levels: chats side by side, agents on their own branches, and subagents that research for an agent. Here is when to use which.

Three ways to work in parallel

WayFilesBest for
Parallel chatsThe same folderSeparate tasks in different parts of the code
Worktree agentsTheir own branch and folderBigger changes that must not meet
SubagentsRead onlyResearch for one task: find, map, collect

Parallel chats

Open a second chat in an editor tab with ⧉ or Ctrl+Alt+Shift+P (Cmd+Alt+Shift+P on macOS). Each chat has its own model, its own terminals, and its own history. If two chats try to change the same file, Phew stops the second one and says why.

The terminals of a chat: an idle terminal, a dev server, and an ssh session that waits for a password
Each chat has its own terminals, so agents never type into each other's shells.

Agents in Git worktrees

Run Phew: New Agent in Worktree. Describe the task, choose the model of the agent, and name the branch. The agent works in a separate folder on its own branch, so your files do not change. When it is done, compare, merge, or remove the branch from the chat.

Subagents

An agent can give research tasks to subagents with the delegate tool: for example, one finds every caller of a function while another maps how a feature works. Up to three run at once by default (phew.subagents.maxParallel). Each one only reads: it cannot change files, run commands, or ask you. Its card in the chat shows the model, the current step, and the report.

Ask for it in plain words: “Use subagents to find where network errors are handled and how the tests are set up, then plan the fix.”

Terminals you can follow

Each chat has its own terminals, and agents never type into each other's shells. An agent names each terminal it opens, such as “dev server” or “tests”, and closes the ones it no longer needs; a chat keeps at most six by default (phew.commands.maxTerminals). The Terminals button under the input shows what runs where, with the ports of servers: click one to open it in the browser. All agents shows the terminals of every chat at once.

When a server of one agent holds port 3000, another agent that tries the same port learns which terminal of which chat has it, instead of guessing.

Different models for different agents

  • Choose a strong model for the chat that writes the code, and a fast one for subagents with phew.subagents.model.
  • An agent may also name one of your models for a subagent.
  • Two keys of one provider work side by side, each in its own chat.

Know what each agent is doing

The list of chats shows the state of each one: Needs input, Model quiet when a model has sent nothing for a minute, On and the name of a fallback model, Failed, and Done. When a chat that you do not look at fails or waits for you, VS Code shows a notification with the reason.