Parallel Works

pw code

pw code

AI coding agent

Synopsis

Start an AI coding agent that can read, write, and edit files in your workspace. The agent uses tool-calling to execute tasks autonomously.

If no model is specified, you'll be prompted to choose one. Run 'pw ai models ls' to list the model IDs available to you.

Sessions are saved locally under ~/.local/state/pw/code-sessions and can be resumed with --resume. Settings such as trusted workspaces live in ~/.config/pw/code.json.

pw code [model] [flags]

Examples

  pw code
  
  # Start with a specific model (see 'pw ai models ls')
  pw code Jake.Thayne:openai/gpt-5.2
  
  # One-shot prompt
  pw code -p "find all TODO comments" Jake.Thayne:openai/gpt-5.2
  
  # JSON output for automation
  pw code -p "list Go files" -o json Jake.Thayne:openai/gpt-5.2
  
  # Resume a local session
  pw code -r latest Jake.Thayne:openai/gpt-5.2
  
  # Read-only mode
  pw code --permission-mode read-only Jake.Thayne:openai/gpt-5.2
  
  # Use an org provider with a budget allocation
  pw code --allocation PW-QA-TEST org:openai/gpt-5.2

Options

      --add-dir strings          Directories outside the workspace the agent may read without prompting (repeatable)
      --agent string             Run a custom agent definition as the main session (a name from .agents/agents)
      --agents string            Ad-hoc agent definitions as JSON keyed by name, merged over the definition files
      --allocation string        Budget allocation name (required for org provider models)
      --allowedTools strings     Tools pre-approved without prompting, e.g. ReadFile, 'Bash(git status:*)', or 'ReadFile(/data/**)' to allow reads outside the workspace
      --effort string            Reasoning effort: default, none, minimal, low, medium, high, xhigh, or max (support varies by model)
  -h, --help                     help for code
  -m, --model string             Model ID, e.g. Jake.Thayne:openai/gpt-5.2 or org:openai/gpt-5.2 (run 'pw ai models ls' to list)
      --no-tools                 Disable tool calling (chat-only mode)
  -o, --output string            Output format: text, json (default "text")
      --permission-mode string   Permission mode: read-only, accept-edits, bypass-permissions, plan
  -p, --prompt string            One-shot prompt (non-interactive)
  -r, --resume string[="pick"]   Resume a local session: pass a session ID or 'latest', or use --resume alone to pick from a list
  -w, --workspace string         Workspace root directory (default: current directory)

Options inherited from parent commands

      --context string         The context to use. Overrides PW_CONTEXT environment variable and current context from config.
      --platform-host string   The Parallel Works ACTIVATE platform host to use. Overrides PW_PLATFORM_HOST environment variable and the current context's server.
  -v, --verbose                Enable verbose logging

SEE ALSO

  • pw - The Parallel Works ACTIVATE CLI
  • pw code mcp - Manage MCP servers for pw code