Skip to content

AI agents

Copy page

workrex is designed with AI agent workflows in mind. Run multiple agents in parallel, each in their own isolated environment.

Workrex uses .workrex.yaml, ~/.config/workrex/config.yaml, and WORKREX_* environment variables. See Configuration.

When you provide a prompt via --prompt, --prompt-file, or --prompt-editor, workrex automatically injects the prompt into panes running the configured agent command (e.g., claude, codex, opencode, gemini, agy, kiro-cli, vibe, pi, omp, grok, muse, or whatever you’ve set via the agent config or --agent flag) without requiring any .workrex.yaml changes:

  • Panes with a command matching the configured agent are automatically started with the given prompt.
  • You can keep your .workrex.yaml pane configuration simple (e.g., panes: [{ command: "<agent>" }]) and let workrex handle prompt injection at runtime.

This means you can launch AI agents with task-specific prompts without modifying your project configuration for each task.

Terminal window
# Create a worktree with an inline prompt
workrex add feature/auth -p "Implement user authentication with OAuth"
# Create a worktree with a prompt from a file
workrex add feature/refactor --prompt-file task-description.md
# Open your editor to write a prompt interactively
workrex add feature/new-api --prompt-editor
# Override the default agent for a specific worktree
workrex add feature/caching -a gemini -p "Add caching layer for API responses"
# Use -A to generate branch name from the prompt automatically
workrex add -A -p "Fix race condition in payment handler"
# Use -A alone to open editor for prompt, then generate branch name from it
workrex add -A

If your editor has a built-in agent (e.g., neovim with an agent plugin), you can use --prompt-file-only to write the prompt to .workrex/PROMPT-<branch>.md without requiring an agent pane:

Terminal window
workrex add feature/task -P task.md --prompt-file-only

Your editor can then detect the prompt file on startup and pass it to its embedded agent. Set prompt_file_only: true in .workrex.yaml to make this the default.

Define short names for agent profiles in your global config. This is useful when you have multiple accounts, custom wrapper scripts, extra arguments, or environment variable overrides:

~/.config/workrex/config.yaml
agents:
cc-work: "claude"
cc-personal:
type: claude
command: claude
env:
CLAUDE_CONFIG_DIR: ~/.claude-personal
cod-mini:
type: codex
command: codex
args:
- exec
- -m
- gpt-5.1-codex-mini
pi-luna-max:
type: pi
command: pi
args:
- --model
- openai-codex/gpt-5.6-luna
- --thinking
- max

Use named agents anywhere you’d use an agent name:

Terminal window
# CLI
workrex add oauth -a pi-luna-max -p "Implement history/2026-08-29-oauth-plan.md"
# In .workrex.yaml
agent: pi-luna-max

workrex resolves the name to a structured command before launching panes. The agent profile controls prompt injection format, continue/resume flags, skip-permissions flags, and sandbox behavior. Set type when the command is a wrapper or when you omit command and want the built-in executable for that agent type:

agents:
cc-smart:
type: claude
command: /path/to/smart-picker
args:
- -p
env:
ANTHROPIC_BASE_URL: http://localhost:18765
ANTHROPIC_AUTH_TOKEN:
from_env: ANTHROPIC_AUTH_TOKEN

For example, this profile runs Claude Code through claude-code-proxy with Cursor’s composer-2.5-fast model:

agents:
claude-composer-fast:
type: claude
command: /Users/raine/.local/bin/claude
args:
- --dangerously-skip-permissions
env:
ANTHROPIC_BASE_URL: http://localhost:18765
ANTHROPIC_AUTH_TOKEN: anything
ANTHROPIC_MODEL: composer-2.5-fast
ANTHROPIC_SMALL_FAST_MODEL: composer-2.5-fast
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1"
CLAUDE_CODE_DISABLE_AUTO_MEMORY: "1"
CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK: "1"
CLAUDE_CODE_EFFORT_LEVEL: max
CLAUDE_CODE_ENABLE_TELEMETRY: "0"

Structured profiles support these fields:

  • type: Built-in agent behavior to use (claude, gemini, codex, etc.)
  • command: Executable or command string to launch. Defaults to type or profile name
  • args: Literal arguments appended after the command, before injected prompts
  • env: Environment variables set for the agent process. Values can be literal strings or { from_env: NAME } to read the value from the launch environment

String entries still work for simple aliases, but structured profiles avoid quoting long commands by hand.

workrex automatically recognizes built-in agent commands (claude, gemini, agy, codex, opencode, kiro-cli, vibe, pi, omp, grok, muse) in pane commands. This means prompt injection works without the <agent> placeholder or a matching agent config:

panes:
- command: "claude --dangerously-skip-permissions"
focus: true
- command: "codex --yolo"
split: vertical

Each agent receives the prompt using its native format (e.g., Claude uses --, Gemini and Antigravity use -i). Auto-detection matches the executable name regardless of flags or path. Just provide a prompt via -p, -P, or -e.

Antigravity CLI support covers command detection, prompt injection, and status tracking through lifecycle hooks installed by workrex setup.

See pane configuration for details.

Use named layouts to define reusable pane arrangements with different agent combinations:

layouts:
design:
panes:
- command: claude
focus: true
- command: codex
split: vertical
solo:
panes:
- command: claude
Terminal window
# Two agents side by side
workrex add my-feature -l design -p "Implement the new search API"
# Single agent
workrex add quick-fix -l solo -p "Fix the login bug"

When a layout is selected with -l, its panes replace the top-level panes. All other config (hooks, files, etc.) comes from the top-level as usual.

workrex can generate multiple worktrees from a single add command, which is ideal for running parallel experiments or delegating tasks to multiple AI agents.

Terminal window
# Create one worktree for claude and one for gemini with a focused prompt
workrex add my-feature -a claude -a gemini -p "Implement the new search API integration"
# Generates worktrees: my-feature-claude, my-feature-gemini
# Create 2 instances of the default agent
workrex add my-feature -n 2 -p "Implement task #{{ num }} in TASKS.md"
# Generates worktrees: my-feature-1, my-feature-2

See the add command reference for all parallel workflow options.