Overview
ThedevCommand field in uzi.yaml defines the command Uzi executes to start a development server for each agent. This command runs in a dedicated tmux window called uzi-dev within each agent’s session.
The $PORT Placeholder
Uzi replaces$PORT in your dev command with an available port from the configured portRange.
uzi.yaml
- Finds an available port (e.g., 3005) from the range
- Replaces
$PORTwith the actual port number - Executes:
npm run dev -- --port 3005
The
$PORT replacement happens once per agent session. Each agent gets a unique port from the configured range.Why Include Installation Steps
Each agent runs in an isolated Git worktree with its own copy of the codebase. Dependencies are not shared between agents.Good Examples
Bad Examples
Command Execution Flow
When you runuzi prompt --agents claude:2 "Add login page":
- Uzi loads configuration from
uzi.yaml(pkg/config/config.go:22) - Creates Git worktree for the agent in
~/.local/share/uzi/worktrees/ - Creates tmux session with two windows:
agent- where the AI agent runsuzi-dev- where the dev server runs
- Finds available port from the
portRange(cmd/prompt/prompt.go:271) - Replaces $PORT in devCommand with the actual port (cmd/prompt/prompt.go:278)
- Executes dev command in the
uzi-devwindow (cmd/prompt/prompt.go:289)
Framework-Specific Examples
Best Practices
1. Always Include Dependencies
2. Use && for Sequential Commands
Chain commands with&& to ensure each step succeeds before continuing:
3. Navigate to Subdirectories if Needed
4. Bind to All Interfaces for Remote Access
What Happens Without devCommand
IfdevCommand is not configured (or portRange is missing), Uzi:
- Creates the Git worktree normally
- Creates the tmux session with only the
agentwindow - Skips dev server startup
- Proceeds with sending the prompt to the agent
- Projects that don’t need a dev server
- Backend services that don’t have a web interface
- CLI tools or libraries
Troubleshooting
Dev Server Fails to Start
-
Check the
uzi-devtmux window for error messages: - Verify installation commands are included in devCommand
-
Test the command manually in a fresh worktree:
Port Already in Use
If all ports in the range are taken, Uzi logs an error and skips that agent. See Port Management for details.Related
- uzi.yaml Configuration - Full configuration reference
- Port Management - How ports are allocated