r/PiGCodingAgent • • Sep 25 '26

Meet PiG: The Pi coding harness that is yours but in Go

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 -g u/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

20 Upvotes

13 comments sorted by

3

u/FastHotEmu Sep 26 '26

Fantastic. Thanks for this! Go is so much better than TS/JS.

1

u/Educational-Yak8793 Sep 26 '26

Of course and thank you for checking out the project! Feel free to contribute if you find anything or let me know if you have any issues, I really want to make sure to give the community a high quality version of one of the best harnesses out there :)

1

u/Necessary-Musician10 Sep 26 '26

Agreed. Just don't scratch the paint or it could

Rust.

2

u/Educational-Yak8793 Sep 26 '26

Haha, good thing we can leave extensions for that - https://pi-in-go.dev/docs/latest/extensions/#sdks 😄

2

u/FastHotEmu Sep 26 '26

Swift is what Rust wants to be when it grows up :)

0

u/Educational-Yak8793 Sep 26 '26

Now I'm wondering if we need to add a swift entry to the sdks 🤔

2

u/DanielSReichenbach Oct 01 '26

Just finished testing this, and I do have to say: nicely done. Rendering in terminal size changes not flickering alone is so pleasant.

If I have a bug that originates in pi itself and has been ported to pig, I assumed I report it to pi, and it gets ported to pig?

1

u/Educational-Yak8793 Oct 01 '26

Thanks for trying and testing I appreciate it the kind feedback too :)

I try to port all changes as they land in main on upstream so there may be some delay. If you file to pig I’ll make sure to triage and integrate directly if appropriate as I do accept bug fix divergences which often get resolved anyways in further ports.

2

u/DanielSReichenbach Oct 02 '26

Then I would try the route to file it to pi first. I found a very specific bug in the llama.cpp provider related to thinking levels that seems to be ported 1:1 in pig. Basically renders any levels other than null or medium defunct with llama.cpp

2

u/Educational-Yak8793 Oct 02 '26

I'll check if I can fix this in the 0.4.0 release today, thanks Daniel!

1

u/zRafox Sep 26 '26

I installed them, but the OpenCode Go provider (/login) isn't set by default.

0

u/Educational-Yak8793 Sep 26 '26

Thanks, that's a bug in PiG: after /login, Pi automatically switches to the provider's default model, and PiG doesn't yet. It's fixed for the next update. Until then, run /model and pick opencode-go / kimi-k2.6 (or any OpenCode Go model); PiG remembers it as your default. You can also set it in ~/.pig/agent/settings.json: "defaultProvider": "opencode-go", "defaultModel": "kimi-k2.6".

1

u/alexzzzz Sep 28 '26

I have an old Pentium E5400 machine with limited RAM that can't run neither Opencode nor Omp. Pi runs there but it's pretty slow and heavy because of node.js. PIG is a miracle there!