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
Catty CLI
Catty CLI
The command-line tool you install via npm. It handles:
- User authentication
- Creating and managing sessions
- Uploading your workspace
- WebSocket connection for terminal streaming
- Real-time sync-back of file changes
- Encrypted secrets management
Catty API
Catty API
The hosted API server. It handles:
- User authentication and session management
- Provisioning cloud machines
- Presigned URLs for workspace downloads
- Billing and quota management
Session Machine
Session Machine
The runtime environment for each session. It handles:
- Receiving workspace uploads
- Running Claude Code in a PTY
- WebSocket relay for terminal I/O
- File watching for sync-back
- Periodic workspace saves to cloud storage
Cloud Storage
Cloud Storage
Secure storage for workspace persistence:
- Receives workspace snapshots every 30 seconds
- Enables downloads via presigned URLs
- Survives session termination
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 |
