|
| 1 | +--- |
| 2 | +name: brev-cli |
| 3 | +description: Manage GPU cloud instances with the Brev CLI. Use when users want to create GPU instances, search for GPUs, SSH into instances, open editors, copy files, port forward, manage organizations, or work with cloud compute. Trigger keywords - brev, gpu, instance, create instance, ssh, vram, A100, H100, cloud gpu, remote machine. |
| 4 | +allowed-tools: Bash, Read, AskUserQuestion |
| 5 | +argument-hint: [create|search|shell|exec|open|ls|delete] [instance-name] |
| 6 | +--- |
| 7 | +<!-- |
| 8 | +Token Budget: |
| 9 | +- Level 1 (YAML): ~100 tokens |
| 10 | +- Level 2 (This file): ~1900 tokens (target <2000) |
| 11 | +- Level 3 (prompts/, reference/): Loaded on demand |
| 12 | +--> |
| 13 | + |
| 14 | +# Brev CLI |
| 15 | + |
| 16 | +Manage GPU cloud instances from the command line. Create, search, connect, and manage remote GPU machines. |
| 17 | + |
| 18 | +## When to Use |
| 19 | + |
| 20 | +Use this skill when users want to: |
| 21 | +- Create GPU instances (with smart defaults or specific types) |
| 22 | +- Search for available GPU types (A100, H100, L40S, etc.) |
| 23 | +- SSH into instances or run commands remotely |
| 24 | +- Open editors (VS Code, Cursor, Windsurf) on remote instances |
| 25 | +- Copy files to/from instances |
| 26 | +- Port forward from remote to local |
| 27 | +- Manage organizations and instances |
| 28 | + |
| 29 | +**Trigger Keywords:** brev, gpu, instance, create instance, ssh, vram, A100, H100, cloud gpu, remote machine, shell |
| 30 | + |
| 31 | +## Quick Start |
| 32 | + |
| 33 | +```bash |
| 34 | +# Search for GPUs (sorted by price) |
| 35 | +brev search |
| 36 | + |
| 37 | +# Create an instance with smart defaults |
| 38 | +brev create my-instance |
| 39 | + |
| 40 | +# Create with specific GPU |
| 41 | +brev create my-instance --type g5.xlarge |
| 42 | + |
| 43 | +# List your instances |
| 44 | +brev ls |
| 45 | + |
| 46 | +# SSH into an instance (interactive) |
| 47 | +brev shell my-instance |
| 48 | + |
| 49 | +# Run a command on an instance (non-interactive) |
| 50 | +brev exec my-instance "nvidia-smi" |
| 51 | + |
| 52 | +# Open in VS Code/Cursor |
| 53 | +brev open my-instance code |
| 54 | +brev open my-instance cursor |
| 55 | +``` |
| 56 | + |
| 57 | +## Core Commands |
| 58 | + |
| 59 | +### Search GPUs |
| 60 | +```bash |
| 61 | +# All available GPUs |
| 62 | +brev search |
| 63 | + |
| 64 | +# Filter by GPU name |
| 65 | +brev search --gpu-name A100 |
| 66 | +brev search --gpu-name H100 |
| 67 | + |
| 68 | +# Filter by VRAM, sort by price |
| 69 | +brev search --min-vram 40 --sort price |
| 70 | + |
| 71 | +# Filter by boot time |
| 72 | +brev search --max-boot-time 5 --sort price |
| 73 | + |
| 74 | +# Filter by instance features |
| 75 | +brev search --stoppable --min-total-vram 40 --sort price |
| 76 | +``` |
| 77 | + |
| 78 | +### Create Instances |
| 79 | +```bash |
| 80 | +# Smart defaults (cheapest matching GPU) |
| 81 | +brev create my-instance |
| 82 | + |
| 83 | +# Specific type |
| 84 | +brev create my-instance --type g5.xlarge |
| 85 | + |
| 86 | +# Multiple types (fallback chain) |
| 87 | +brev create my-instance --type g5.xlarge,g5.2xlarge |
| 88 | + |
| 89 | +# Pipe from search |
| 90 | +brev search --gpu-name A100 | brev create my-instance |
| 91 | + |
| 92 | +# Use search filters directly on create |
| 93 | +brev create my-instance --gpu-name A100 --min-vram 40 |
| 94 | + |
| 95 | +# Multiple instances |
| 96 | +brev create my-cluster --count 3 |
| 97 | + |
| 98 | +# With startup script |
| 99 | +brev create my-instance --startup-script @setup.sh |
| 100 | +brev create my-instance --startup-script 'pip install torch' |
| 101 | + |
| 102 | +# Dry run (preview matching types without creating) |
| 103 | +brev create my-instance --dry-run |
| 104 | +``` |
| 105 | + |
| 106 | +### Instance Access |
| 107 | +```bash |
| 108 | +# SSH into instance (interactive shell) |
| 109 | +brev shell my-instance |
| 110 | + |
| 111 | +# Run command on instance (non-interactive) |
| 112 | +brev exec my-instance "nvidia-smi" |
| 113 | +brev exec my-instance "python train.py" |
| 114 | + |
| 115 | +# Run a local script on the instance (@ prefix reads local file) |
| 116 | +brev exec my-instance @setup.sh |
| 117 | +brev exec my-instance @/path/to/script.sh |
| 118 | + |
| 119 | +# Run on multiple instances |
| 120 | +brev exec instance1 instance2 instance3 "nvidia-smi" |
| 121 | + |
| 122 | +# Open in editor |
| 123 | +brev open my-instance # default editor |
| 124 | +brev open my-instance code # VS Code |
| 125 | +brev open my-instance cursor # Cursor |
| 126 | +brev open my-instance windsurf # Windsurf |
| 127 | +brev open my-instance terminal # Terminal window |
| 128 | +brev open my-instance tmux # Terminal + tmux |
| 129 | + |
| 130 | +# Copy files |
| 131 | +brev copy ./local-file my-instance:/remote/path/ |
| 132 | +brev copy my-instance:/remote/file ./local-path/ |
| 133 | + |
| 134 | +# Port forward |
| 135 | +brev port-forward my-instance -p 8080:8080 |
| 136 | +``` |
| 137 | + |
| 138 | +### Instance Management |
| 139 | +```bash |
| 140 | +# List instances |
| 141 | +brev ls |
| 142 | +brev ls --json |
| 143 | + |
| 144 | +# Delete instance |
| 145 | +brev delete my-instance |
| 146 | + |
| 147 | +# Stop/start (if supported) |
| 148 | +brev stop my-instance |
| 149 | +brev start my-instance |
| 150 | + |
| 151 | +# Reset (recover from errors) |
| 152 | +brev reset my-instance |
| 153 | +``` |
| 154 | + |
| 155 | +### Pipeable Workflows |
| 156 | +```bash |
| 157 | +# Stop all running instances |
| 158 | +brev ls | awk '/RUNNING/ {print $1}' | brev stop |
| 159 | + |
| 160 | +# Delete all stopped instances |
| 161 | +brev ls | awk '/STOPPED/ {print $1}' | brev delete |
| 162 | + |
| 163 | +# Start all stopped instances |
| 164 | +brev ls | awk '/STOPPED/ {print $1}' | brev start |
| 165 | + |
| 166 | +# Stop instances matching pattern |
| 167 | +brev ls | grep "test-" | awk '{print $1}' | brev stop |
| 168 | + |
| 169 | +# Run command on all running instances |
| 170 | +brev ls | awk '/RUNNING/ {print $1}' | brev exec "nvidia-smi" |
| 171 | + |
| 172 | +# Create and run setup |
| 173 | +brev search --gpu-name A100 | brev create my-box | brev exec @setup.sh |
| 174 | + |
| 175 | +# Create and open in one command |
| 176 | +brev search --gpu-name A100 | brev create my-box | brev open cursor |
| 177 | +``` |
| 178 | + |
| 179 | +### Organizations |
| 180 | +```bash |
| 181 | +# List orgs |
| 182 | +brev org ls |
| 183 | + |
| 184 | +# Set active org |
| 185 | +brev org set my-org |
| 186 | +brev set my-org # alias |
| 187 | + |
| 188 | +# Generate invite link |
| 189 | +brev invite |
| 190 | +``` |
| 191 | + |
| 192 | +## Common Workflows |
| 193 | + |
| 194 | +1. **Quick GPU Session** ([prompts/quick-session.md](prompts/quick-session.md)) |
| 195 | + - Search → Create → Open editor |
| 196 | + |
| 197 | +2. **ML Training Setup** ([prompts/ml-training.md](prompts/ml-training.md)) |
| 198 | + - Find high-VRAM GPU → Create with startup script → Copy data → Run training |
| 199 | + |
| 200 | +3. **Instance Cleanup** ([prompts/cleanup.md](prompts/cleanup.md)) |
| 201 | + - List instances → Identify unused → Delete |
| 202 | + |
| 203 | +## Safety Rules - CRITICAL |
| 204 | + |
| 205 | +**NEVER do these without explicit user confirmation:** |
| 206 | +- Delete instances (`brev delete`) |
| 207 | +- Stop running instances (`brev stop`) |
| 208 | +- Create multiple instances (`--count > 1`) |
| 209 | +- Create expensive instances (H100, multi-GPU) |
| 210 | + |
| 211 | +**ALWAYS do these:** |
| 212 | +- Show instance cost/type before creating |
| 213 | +- Confirm instance name before deletion |
| 214 | +- Check `brev ls` before assuming instance exists |
| 215 | + |
| 216 | +## Troubleshooting |
| 217 | + |
| 218 | +**"Instance not found":** |
| 219 | +- Run `brev ls` to see available instances |
| 220 | +- Check if you're in the correct org: `brev org ls` |
| 221 | + |
| 222 | +**"Failed to create instance":** |
| 223 | +- Try a different instance type: `brev search --sort price` |
| 224 | +- Check quota/credits with org admin |
| 225 | + |
| 226 | +**SSH connection fails:** |
| 227 | +- Run `brev refresh` to update SSH config |
| 228 | +- Ensure instance is running: `brev ls` |
| 229 | + |
| 230 | +**Editor won't open:** |
| 231 | +- Verify editor is in PATH: `which code` / `which cursor` |
| 232 | +- Set default: `brev open --set-default code` |
| 233 | + |
| 234 | +## References |
| 235 | + |
| 236 | +- **[reference/commands.md](reference/commands.md)** - Full command reference |
| 237 | +- **[reference/search-filters.md](reference/search-filters.md)** - GPU search options |
| 238 | +- **[prompts/](prompts/)** - Workflow guides |
| 239 | +- **[examples/](examples/)** - Common patterns |
0 commit comments