Implementation Plan - Vast.ai SSH Tunnel
Primary Objective
Replace the complex MCP/Cloudflare auto-deploy system with simple SSH tunnel for remote GPU access.
Current Status
- β Requirements documented
- β Design documented
- β Tasks broken down
- β Bugs documented
- β³ Ready to implement
Implementation Order
PHASE 1: Fix Critical Bugs (1-2 hours)
These bugs block testing and need to be fixed first:
Fix
deliberatefloat parsing bug- Location: agent_compiler.py council deliberation code generation
- Issue: Float values being concatenated without separators
- Impact: Blocks council deliberation feature
Implement
tocommand- Location: agent_compiler.py command parser
- Issue: Command documented but not implemented
- Impact: Can't test individual council members
PHASE 2: SSH Infrastructure (2-3 hours)
Core remote execution system:
- Add paramiko to requirements.txt
- Create RemoteGPUExecutor class (new file: remote_gpu.py)
- SSH connection management
- Remote Python REPL
- Code execution and output capture
- Test SSH connection with real Vast.ai instance
PHASE 3: Simplify vast rent (3-4 hours)
CRITICAL: This is quine code - must be extremely careful
Remove complexity from vast rent:
- Delete agent upload code
- Delete MCP server setup
- Delete Cloudflare tunnel code
- Keep only: rent instance + SSH setup
Add SSH tunnel setup:
- Wait for "running" status
- Get SSH details
- Create RemoteGPUExecutor
- Store in TUI state
Test: Rent GPU, verify SSH connection works
PHASE 4: Remote Model Loading (2-3 hours)
Modify plug command:
- Check if remote executor exists
- If yes: load on remote GPU
- If no: load locally
Implement remote loading:
- Generate model loading code
- Execute via SSH
- Verify success
Test: Plug BGE-small on remote GPU
PHASE 5: Remote Inference (2-3 hours)
Modify infer/embed commands:
- Check if model is remote
- Execute remotely if yes
- Return results to local TUI
Test: Run embeddings on remote GPU
PHASE 6: Polish & Documentation (1-2 hours)
- Add status display: Show local vs remote GPU
- Add vast stop command: Destroy instance, close SSH
- Update documentation: relay_center.cmd, FelixBag guides
Total Estimated Time: 11-17 hours
Risk Mitigation
Quine Structure Risk
- Risk: Breaking quine structure when editing agent_compiler.py
- Mitigation:
- Make small, incremental changes
- Test after each change
- Keep old code commented out initially
- Verify quine hash after compilation
SSH Compatibility Risk
- Risk: paramiko might not work on Windows
- Mitigation:
- Test early (Phase 2)
- Have fallback plan (use subprocess + ssh.exe)
Remote Execution Risk
- Risk: Code serialization/deserialization might fail
- Mitigation:
- Start with simple examples
- Test incrementally
- Add robust error handling
Success Criteria
- β
User can rent GPU with
vast rent 1 - β SSH connection establishes automatically
- β
User can
plugmodel on remote GPU - β
User can run
embedusing remote GPU - β Results return to local TUI correctly
- β Quine structure preserved (hash matches)
- β Works on Windows
Next Steps
- Start with Phase 1: Fix critical bugs
- Test fixes with Beholder Council
- Move to Phase 2: SSH infrastructure
- Continue through phases sequentially
Notes
- Primary focus: SSH tunnel implementation
- Secondary: Fix bugs that block testing
- Tertiary: Polish and additional features
- Always test after each change
- Document any new bugs discovered