# pw code

> Source: https://parallelworks.com/docs/cli/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.

```
pw code [model] [flags]
```

### Examples

```
  # Pick a model interactively
  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
  
  # Continue a server-side conversation
  pw code -c <conversation-id> Jake.Thayne:openai/gpt-5.2
  
  # Resume a local session
  pw code --resume 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

```
      --allocation string         Budget allocation name (required for org provider models)
      --allowedTools strings      Tools pre-approved without prompting, e.g. ReadFile or 'Bash(git status:*)'
  -c, --continue string           Continue a server-side conversation by ID
  -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)
      --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. Will override any other platform host settings.
  -v, --verbose                Enable verbose logging
```

### SEE ALSO

* [pw](/docs/cli/pw)	 - The Parallel Works ACTIVATE CLI
