r/PiCodingAgent • u/Educational-Yak8793 • Sep 26 '26
Resource Meet PiG: The Pi coding harness that is yours but in Go
Reposted from r/PiGCodingAgent, figured if any sub should see this project it's here. I've been building this out at work for work for quite some time and am excited to open and start a community around the project. I truly appreciate any criticisms, suggestions, and especially contributions, thank you to anyone who does check it out I hope you like it as much as I have been :)
---
PiG is a direct port of the amazing Pi agent harness as one Go binary for macOS, Linux and Windows (Windows in preview). Node.js only comes in if you run TypeScript extensions. Pi's extensions run unchanged; write new ones in Go, Rust or Python and /reload them live. It is a direct port of Pi's its agent loop, terminal UI, sessions, providers, and extension system, shipped as one static Go binary with no libc dependency.
Some Go-specific bits that might interest this sub:
- Extensions in Go can be fused into a single binary and talk to the host over in-memory pipes instead of sockets; other languages run as supervised subprocesses over local sockets.
- The TUI renders differentially; width handling was ported from Pi's own algorithm and checked with a differential test against Pi's code over ~1.5M cases: tui/widthx/pi_width_diff_test.go.
- Behavior is checked against Pi in real terminals (tmux-driven scenarios that compare screens).
go installgithub.com/MichaelKinsy/PiG/cmd/pig@latestworks; so do a curl installer andnpm i -gu/pi-in-go/pig(it installs the prebuilt native binary for your platform).
Measured startup is about 21 ms vs about 300 ms median, and about a quarter of the peak memory (method in the blog).
Disclosure: agents wrote much of the port. Tests, side-by-side comparisons against Pi, and a person reading the diff decide what ships.
Repo: https://github.com/MichaelKinsy/PiG
Blog: https://developer.hpe.com/blog/meet-pig-pi-in-go-a-port-that-plans-on-keeping-up/
Upstream Pi: https://github.com/earendil-works/pi
Happy to answer questions about the port, the extension host, or keeping up with upstream. Feedback on this is appreciated and contributions are welcome.
Thank you to r/HPE for covering writing the blog and contributing PiG to Open Source and special thank you to the Pi team of course at https://earendil.com
View all comments
Show parent comment
3
u/Educational-Yak8793 Sep 26 '26
Yeah that's the main benefit, for me it was just a way to have a single command that is a base agent harness setup that can be more organized to stop clutter from auto discovery or having long pi commands/makefiles or whatever to manage it. Then you can still override whatever from the cli as well so it to me is a base of a different 'harness' especially with how much your extensions/config/interface change things.
The term derivative-harness is kinda a stretch, but the reason it makes sense to me is that since piglets act as a base harness configuration you can also build new piglets on top of prior piglets. Piglets can be in a few formats that go from less to more portable, it can be from host discovery (automating the cli command and settings effectively), from an image (for automating container runtime command or devcontainers on startup), and finally a binary (which only supports go right now but I want to support others). The idea then especially for binaries is you could start to have piglets built on top of each other so you could essentially build apps off of others and support an easier way customizing but still sharing harness functionality. There's still work to do on it but I think the idea is interesting, the first usage I did with it is I created a 'general' piglet that took all the things I used to have as divergences when the project was internal into a separate binary I could still build off of and make porting the core of Pi to PiG easier. Then it's really easy to make a custom agent application and just ship it off to someone as a binary