r/PiCodingAgent • • 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 install github.com/MichaelKinsy/PiG/cmd/pig@latest works; so do a curl installer and npm 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

256 Upvotes

122 comments sorted by

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

1

u/saltyourhash Sep 26 '26

I love this idea. So you can have a binary-wide base harness, then have a more specialized harness on top, then have a split derivation that has 1 different experimental workflows and a/b test or something. That feels like a great way to have the model use evidence backed session data to improve the harness.

1

u/Educational-Yak8793 Sep 26 '26

Exactly :) we're at a point where we need to build for dependable extendability I feel like. This has been something I am hoping we can do something cool with

1

u/saltyourhash Sep 26 '26

Yeah, it'd make rapid iteration on harnesses a lot faster.

1

u/Educational-Yak8793 Sep 26 '26

Yep, and being able to incrementally build out applications. Then, since Pi/PiG are already so extensible, it lets you start with a base application that can grow into an isolated, shippable product. Especially when you want non-technical people to be able to get up and go with an agent app you made for them, with zero setup beyond running it (onboarding credentials aside).

1

u/saltyourhash Sep 26 '26 • Bravo

You know, another though I just had was for DevSecOps, they can bake in the approved extensions and deploy a binary...

1

u/Educational-Yak8793 Sep 26 '26

I actually took (still need to improve parts) of this exact idea from a good (purposely divergent) port of pi at pi-go.sh

I had already started with doing piglet base verification (just the binary, image, or script/yaml artifacts) but I think we can have a lot of levels of defense with how composable the architecture is.

1

u/Impossible_Hour5036 Sep 27 '26

I have a question about this idea of the model using session data to improve the harness. Is the idea that the model will be able to understand the solution to the problems by looking at the symptoms? I haven't found this to be the case. Even the best models seem to be pretty bad at understanding and manipulating feedback loops in general. They have a hard time with subtlety and 'doing nothing' about something as an intentional action, so you end up with these wild oscillations between extremes and overly prescriptive 'hide bound' guidance that doesn't really work that well. I tend to make changes to my workflows intentionally so letting agents just start making changes based on whatever data they think is relevant seems...not risky exactly, because you can remove it, but not productive either.

My second question would be this: if they're already able to autonomously build software within a harness, what are they improving on? Would that just be doing it with fewer tokens? I personally can already get them to build whatever I want reliably and with minimal intervention, except the points at which there are decisions to be made.

What do people need out of a harness exactly? Maybe I just don't understand the use cases, since the existing harnesses are already capable of completely automating the full software engineering process with a few skills and a work tracking system (that doesn't really belong in the harness imo).

1

u/saltyourhash Sep 27 '26

Well, I wouldn't say this is some sort of recursive selfimprovement of the harness so much as letting you analyze the issues you have in previous sessions to improve your lower level harness's prompt to avoid those issues, like when to lean on certain skills, for example. It's more of a loose idea I just thought aboutthan concrete evidence it'd work, it's possible in other tools, just having a base harness below your trial harness let's you isolate some of the divergence, perhaps. It's something I find intetsitng to explore, at least.

2

u/Impossible_Hour5036 Sep 29 '26

Oh yea I gotcha. Yea just improving your skills / workflow. I don't really consider that part of the harness I guess. And yea I am not trying to say "x won't work" or "doing y is wrong" or anything like that, I really just genuinely have had these questions and it seemed like you were actively doing this stuff so I decided to ask. I might ask another question if you don't mind.

1

u/saltyourhash Sep 29 '26

I don't get an awful lot of time to tweak stuff, honestly.I just run it and go. I have been doing more experimentation lately.