colabbd/docs/notes.txt
2026-01-27 16:02:36 -05:00

125 lines
3.6 KiB
Text

CLI Collaborative Editing Research
===================================
The problem: Zed/VSCode have great collab features. What about terminal folks
who want to use vim/emacs/whatever but still pair/mob program in real-time?
HOW THE BIG PLAYERS DO IT
-------------------------
See detailed breakdowns:
- vscode-liveshare.txt (host-guest model, SSH relay, no CRDT)
- zed-collab.txt (true CRDT, anchors, tombstones, SumTree)
Quick comparison:
VSCode Live Share:
- Host-guest model (not true P2P)
- All content stays on host machine
- SSH tunnel (P2P or via Microsoft relay)
- No conflict resolution needed - only one source of truth
- Simpler but dependent on host connection
Zed:
- True CRDT - every replica is equal
- Anchors instead of offsets (insertion_id + offset)
- Tombstone deletions with version vectors
- Lamport timestamps for ordering concurrent edits
- Per-user undo via undo map
- SumTree (copy-on-write B+ tree) everywhere
Key insight:
VSCode = "remote desktop for code"
Zed = "Google Docs for code"
For CLI collab, the Zed approach is more interesting because it's
truly decentralized and doesn't require a persistent host.
NEOVIM-SPECIFIC
---------------
instant.nvim
https://github.com/jbyuki/instant.nvim
- Pure Lua, no dependencies, CRDT-based
- Run a server, others connect, real-time sync
- Virtual cursors show where others are editing
- Can share single buffer or entire session
- Built-in localhost server, default port 8080
- Commands: :InstantStartSingle, :InstantJoinSingle, :InstantStartSession
- Separate undo/redo per user
- This is probably the closest to Zed collab for terminal users
live-share.nvim
https://github.com/azratul/live-share.nvim
https://dev.to/azratul/live-sharenvim-real-time-collaboration-for-neovim-1kn2
- Builds on instant.nvim with nicer UX
- Still actively developed
TERMINAL SHARING (any editor)
-----------------------------
Upterm
https://github.com/owenthereal/upterm
https://upterm.dev
- Modern tmate alternative, written in Go
- NOT a tmux fork so you keep your tmux config
- GitHub/GitLab/SourceHut/Codeberg auth
- Community server: uptermd.upterm.dev
- Supports scp/sftp file transfer
- WebSocket fallback when SSH blocked
- Can integrate with GitHub Actions for SSH debugging
tmate
https://tmate.io
- Fork of tmux 2.x, shares terminal sessions
- Simple but stuck on old tmux, config conflicts
bottlerocketlabs/pair
https://github.com/bottlerocketlabs/pair
- Wrapper around tmux for quick pairing
- Good for vim/emacs users
CRDT LIBRARIES (build your own)
-------------------------------
Cola (Rust)
https://github.com/nomad/cola
- Text CRDT for real-time collaborative editing
- Peer-to-peer, no central server required
- Could theoretically power an editor-agnostic collab layer
- See: cola.txt in this dir for deep dive
Automerge
https://automerge.org
- More general CRDT library
- Has bindings for many languages
THE MISSING PIECE
-----------------
Nobody has built the "any editor" dream yet. Would need:
1. Shared CRDT document layer (cola/automerge)
2. LSP forwarding to share language intelligence
3. Thin clients for each editor connecting to shared state
This could be a fun project to explore.
QUICK START
-----------
To try instant.nvim:
1. Install the plugin
2. One person runs :InstantStartServer 0.0.0.0 8080
3. Same person runs :InstantStartSession [ip] 8080
4. Others run :InstantJoinSession [ip] 8080
To try Upterm:
1. brew install owenthereal/upterm/upterm (or build from source)
2. upterm host -- tmux new -s shared
3. Share the SSH connection string with your pair