How It Works
Catty connects your local terminal to Claude Code running in isolated cloud machines. Here's how all the pieces fit together.
Architecture
The catty CLI on your machine communicates with the Catty API to provision isolated session machines in the cloud. Each session machine runs Claude Code in a PTY. Your terminal connects directly to Claude Code via WebSocket, streaming input and output in real-time. File changes sync back to your local directory, and workspaces are periodically saved to cloud storage for persistence.
Components
Data Flow
Session Creation
catty newcalls the API- API provisions a cloud machine
- Machine starts and reports ready
- CLI zips your workspace (respecting
.gitignore) - Workspace uploads to session machine
- WebSocket connection established
- Claude Code spawns in a PTY
- Terminal I/O streams bidirectionally
File Sync-Back
- Claude modifies a file in
/workspace - File watcher detects the change
- Change sent over WebSocket as JSON message
- CLI validates path (security check)
- File written to your local directory
Cloud Persistence
- Session saves workspace every 30 seconds
- Tarball uploaded to cloud storage
- When you run
catty download:- API generates presigned URL
- CLI downloads directly from cloud storage
- Extracts to your local directory
Security
| Aspect | Implementation |
|---|---|
| Authentication | OAuth via browser, tokens stored locally |
| Secrets | AES-256-GCM encrypted, machine-bound |
| Transport | HTTPS for API, WSS for WebSocket |
| Isolation | Each session runs in its own machine |
| File access | Sessions can only access /workspace |