# Forge CLI

Forge CLI is an AI-powered tool that automatically optimizes GPU kernels. It uses swarm AI agents to generate optimized CUDA or Triton code that outperforms PyTorch and `torch.compile()`.

## Quick Start

### Install

```bash
# npm
npm install -g @rightnow/forge-cli

# macOS / Linux
curl -fsSL https://releases.rightnowai.co/forge/install.sh | bash

# Windows PowerShell
irm https://releases.rightnowai.co/forge/install.ps1 | iex
```

### Sign In

```bash
forge login
```

### Optimize

```bash
forge
```

Launches the interactive wizard to optimize HuggingFace models, KernelBench tasks, or custom PyTorch files.

**Typical results:** 1.5x - 5x speedup over baseline PyTorch.

## Input Types

### HuggingFace Models

```bash
forge optimize --huggingface meta-llama/Llama-3-8B
```

### KernelBench

```bash
forge browse
```

### Custom PyTorch

```bash
forge optimize --file model.py
```

## Output Formats & Modes

### Formats

|     |     |
| --- | --- |
| Triton | Python GPU kernels, easy integration |
| CUDA | Native C++, maximum performance |

### Modes

|     |     |
| --- | --- |
| --turbo | Fast (~2 min) |
| (default) | Balanced |
| --quality | Maximum optimization |

## Key Commands

| Command | Description |
| --- | --- |
| forge | Interactive wizard |
| forge login | Sign in |
| forge credits | Check balance |
| forge browse | Browse KernelBench tasks |
| forge optimize | Start optimization |
| forge session list | View past sessions |
| forge health | Check backend status |

## System Requirements

|     |     |
| --- | --- |
| OS | Windows 10+, macOS 10.15+, Linux (glibc 2.17+) |
| Arch | x64 or ARM64 |
| Node.js | 18+ (only for npm install) |

## Verify & Update

### Verify

```bash
forge --version
forge health
```

### Update

```bash
npm update -g @rightnow/forge-cli
```

Or re-run the curl/PowerShell installer.

## Troubleshooting

### "command not found"

Add to PATH:

```bash
echo 'export PATH="$PATH:$HOME/.forge/bin"' >> ~/.bashrc && source ~/.bashrc
```

Windows: Restart terminal or add `%USERPROFILE%\.forge\bin` to PATH.

### macOS Gatekeeper

```bash
xattr -d com.apple.quarantine ~/.forge/bin/forge
```

### Permission denied

```bash
chmod +x ~/.forge/bin/forge
```

## Credits

|     |     |
| --- | --- |
| KernelBench / Custom code | 1 credit |
| HuggingFace (single layer) | 1 credit |
| HuggingFace (multi-layer) | 2 credits |

## Next Steps

[**Commands Reference** \
Complete command documentation.](/content/docs/forge/commands/index.html) [**Optimization Guide** \
Tips for best results.](/content/docs/forge/optimization/index.html)
