AIFeed

Peer (to peer) Programming

Original text(via Lobsters)

Peer Programming

December 02, 2026

Shapr and I only actually started using e2e-encrypted peer-to-peer terminal sharing when it became convenient enough.

We had the tools for quite a while: the “Dilation” concept of Magic Wormhole, and the terminal sharing of “tty-share” can be set up with Fowl on the CLI with only a few commands.

However, even for seasoned terminal aficianados this was apparently “too hard” because we kept leaning on screen-sharing or (un-encrypted) tty-share -public instead of doing this (tiny amount of) work each time. It was only with the launch of Shell With Me that we routinely used our own software.

Make It Convenient

Shae coined the term “peer programming” to refer to what we were reaching toward. (It might be better to say “peer-to-peer programming” out loud though, to avoid confusion with plain “pair programming”)

The current state is that terminal sharing is convenient: it’s shwim for one side (which generates a magic code) and shwim <the magic code> for the other side. Copy-pasting this code into chat applications (e.g. Signal or Zulip) or speaking it aloud in a video-chat is straightforward.

However, we’d like a lot more out of “peer programming” than just a terminal. Let us explore those other ideas.

What Even Is Fowl?

Very briefly, fowl lets us leverage Magic Wormhole to teleport local-only streams from one machine to another (more).

With client-type and server-type software on either end this can get a bit confusing. The CLI uses --client on the side that will run the client-type software. It should be no surprise that --service is used on the side that will run the server-type software.

Ideally, the chosen ports are not fixed but are random (i.e. let the OS choose) which avoids conflicts. Fowl does this by default (tying things together with the service name) and also allows explicit ports to be chosen. (Things like Web stuff often need the ports to match).

In the Python API, the service-side is the “Coop” (like a Chicken Coop) and the client-side “Roosts”. See for example shwim guest code vs. shwim host code for setting up for tty-share.

Further Ideas:

For this “peer programming” concept we’d ultimately like to have far less Python code than even ShWiM has. Ideally there would be some short amount of config and wrapper code for the client and service sides.

The config here is enough to tell Fowl what sorts of channels to set up. The wrapper code might just be a template for the command to run (filled in via named ports)? Something like ShWiM then drives this, doing the UX for whatever plugins the user asked for etc. It’s easy to imagine TUI or GUI versions .. the more the merrier, really.

Exploring futher, here are some plugin ideas we’ve got.

Idea: Listen to Me

It would be great to ditch any audio / video “chat services” altogether. The bare minimum for that would be to stream audio in both directions.

GStreamer seems to be the most promising idea here. It has tcpserversink and tcpclientsrc. You can easily play from a terminal with gst-launch-1.0.

Goal: enough gstreamer incantations to work via Fowl. To work over Fowl we need a “service” side listening on localhost and a “client” side connecting to that service.

So once we have it working on one computer, there’s a simple Fowl incantation / setup to get it to work over Wormhole.

The closest meejah has gotten at such a setup are these two pipelines:


        gst-launch-1.0 alsasrc card-name="USB Audio" ! audioconvert  ! vorbisenc ! webmmux ! tcpserversink host=localhost port=1234
gst-launch-1.0 tcpclientsrc host=localhost port=1234 ! queue ! matroskademux !  vorbisdec !  autoaudiosink
      

Next Steps: make this work reliably over fowl.

Idea: Git With Me

It is often convenient to share a one-off Git repository while pair-programming. This would replace e.g. “create repo at some service” like CodeBerg with quick opt-in Git sharing. That is, quick and ephemeral sharing with only your peer.

Status: a fairly usable proof-of-concept exists as Git With Me <https://git.sr.ht/~meejah/git-withme>_.

Next steps: make this a “plugin” or otherwise unify with ShWiM or similar. That is, use git-with-me and ShWiM as the first two items in the “peer programming” UI.

Explore what people actually want here. TeamType (mentioned further below) makes an attempt to answer this question. So does the existing “git-withme” tool.

There are many trade-offs here, between surprising behavior, convenience, privacy, etc. The least surprising probably centers around using “git push” as a signal to share with the peer. However, the most convenient might automagically share all Git objects, branches, etc.

What is important to you? How would you like to collborate on Git repositories?

Idea: Surf With Me

Shae and I often exchange Web pages we’re reading or have found while pair programming. It would be great to streamline this part, so that we can both look at the same Web site on our own device.

Privacy note: we want opt-in points for sharing particular pages, not a complete sync of the browser or similar.

Meejah has written a Proof-of-Concept Firefox plugin that provides a button. This button sends the current URL via a WebSocket connection to a local daemon. This daemon is listening for this Firefox WebSocket connection and can print out the URL sent.

Rejected: we tried monitoring the Firefox directories for changes to e.g. detect “new bookmark” as a signal to send the page to the client; this is unreliable and error-prone (the on-disc database updates aren’t timely, it’s not set up to be a shared DB, …).

Next steps: polish the plugin PoC; cross-connect the peers (i.e. I can send you URLs and you can send me URLs)

Idea: Emacs With Me

Shae and I both use Emacs.

With “ShWiM” there’s actually a workable way to “both edit a document” at the same time: Shae uses emacsclient inside a ShWiM session on my machine, while I use the graphical Emacs it is connected to.

Then, we can both see live updates and real-time editing because we’re literally in the same Emacs buffer. Still, this isn’t quite ideal: If Shae copies some text, and I paste immediately after, I don’t get what I expect. Also we all have our own customizations which can provide surprises.

There have been a lot of experiments in this vein, some even culminating in enclosure by Google (e.g. Google Docs which came originally from Writely which IIRC came from Etherpad). There’s also CryptPad for in-browser editing of documents.

Plenty of papers have been written and software developed around “CRDTs” (Conflict-Free Replicated Datatypes) in this area too. That’s what is “under the hood” of the aforementioned SaaS / browser software.

The nice people at TeamType are also exploring a pair-programming solution (and they even use Magic Wormhole to initiate connections which ultimately use Iroh for real-time communication).

Next steps: can we use one of the already existing tools “inside” a Peer Programming tool? The most promising looks to be TeamType, as it has Vim and Emacs plugins and has worked about peer communication already.

There’s also crdt.el to look at. This should be a straightforward “networking setup” piece (i.e. make it go over Fowl) to enable and try.

Idea: Listen With Me

Encode and broadcast the audio you’re currently listening to (different from “mic -> speakers” and “speakers <- mic” that is the Audio Channel idea above). Obviously, could use very similar gst-launch-1.0 setup to above.

Idea: Look at Me

An extension to the realtime chat (but p2p, e2ee etc) above to add WebCam video as well.

Conclusion?

Software needs to be convenient. Even if it’s “for experts” and uses the terminal; us so-called “experts” are simply humans.

We humans have lots of ways of collaborating. There is not going to be one “right” answer that works for everyone. (The great variety of communication and collaboration tools is ample evidence this is true).

It would be nice to explore some more of this space. I personally am interested in the following niches:

  • terminal-first;
  • peer-to-peer (ideally end-to-end encrypted too);
  • human-centric networking;
  • and limited exposure of data to (corporate) services

As may be too obvious to state, I also like the properties of Magic Wormhole here.

Please discuss on this Mastodon thread.

The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.

Published by Lobsters
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗