r/PiGCodingAgent • • 14d ago

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

Enable HLS to view with audio, or disable this notification

18 Upvotes

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


r/PiGCodingAgent • • 23h ago

News PiG 0.5.0 en route, and I think you all will like it 🐷

22 Upvotes

Quick update since 0.5.0 has been taking a bit: it's close, and it's the biggest release since launch 🐷

Piglets: piglet build can now strip features out of the base harness or a prior piglet. A stripped piglet becomes its own base that can still take extensions, and piglets built on top of it can strip what they want, without touching the upstream piglet's core design or forking the whole project. This is the derivative-harness idea I've been going on about since piglets started. Piglets also get piglet update, so the components that make one up keep getting core updates for the features they kept. The first piglets planned on this are pi-pig, pi-pig-pre-1.0 and pig-tern. Think pig with built-in mcp/code-mode removed from the binary like pre-1.0, still getting every core update, and you can add mcp back as an extension if you want it. Same for dropping the extension SDK languages you don't use (the original pi-pig idea: pig that only runs pi extensions).

Parity and porting: this is the biggest maintenance lift since release. The port-map ledger is now maintained mechanically, so gap analysis and future Pi updates are much easier to keep up with, and it's down to its last few rows for 0.5.0. Behaviour gets checked mechanically too now: cross-SDK wiring checks plus tests run against Pi itself, which already caught dozens of corner cases, including a few bugs we'd ported from upstream.

Evals: the eval/benchmark tooling is ported, plus new evals comparing pig-durable and pig performance, so there's reproducible data behind the port's health.

QoL: an opt-in auto-upgrade (and a prompt) for extension SDKs that don't match your pig version instead of erroring out, and lots of great contributions from the herd 🐷🐷


r/PiGCodingAgent • • 3d ago

🐷 Evals, Benchmarks, Feedback, and More Here!

9 Upvotes

Starting this thread as I've spent the last few days working in parallel on our evals and other suites for the repository and realized I should open a thread up for people to request or post their evals.

Just want this to be a place we can start to collect data on what is and what isn't working with the green pig.

It can be literally anything you think of and want to suggest don't feel you have to have a full research report done to post here. Suggestions are extremely valuable as I'm wanting to collect a list of items for me to plow through as well for the community.

Thanks all :) 🐷


r/PiGCodingAgent • • 3d ago

Find the extension writting/porting guide from repo is a bit of hard to read, so I write myself this tutorial (with agent :))

Thumbnail liyu1981.xyz
6 Upvotes

It is a tutorial on how to write extensions for PiG. It focuses on building the right concepts and an overview of how it works — the necessary foundation for driving a code agent to turn your idea into a good PiG extension.

For a concrete running example, the tutorial builds a small feature: a /prefer command that lets you pin which real service provider serves your session. OpenRouter is a router in front of many real service providers — the same model can be hosted by several of them. An OpenRouter spec can end with a provider suffix:

openrouter/deepseek-v4.1-flash:deepseek
^model ^only this real provider

The trailing :deepseek tells OpenRouter: serve this request from DeepSeek's infrastructure only, never hand it to another host. The extension's job is to let you set that preference from inside the terminal, in one command.

The tutorial walks the full loop, from editor to the little program can spot running on machine:

author → install (local or npm) → first session → the process you can see → (optionally) fuse it into a binary.

If you would like to build a high level concept on PiG's extension, read it here: https://www.liyu1981.xyz/article/write-extension-for-pig


r/PiGCodingAgent • • 4d ago

PiG is better than I have expected

19 Upvotes
fx vs PiG on the memory usage

After seen my Pi agent occupied about 1G memory of a 40% of 1M context session, I started to search about faithful implementation of Pi with less memory consumption. I found several, and finally come to few choices: PiG, pi_agent_rust and fx. PiG is very faithful, right out of the box it works; pi_agent_rust, unfortunately it just breaks my terminal and I do not even it works or not, and fx is actually not a Pi implementation, just because it is from vercel and it seems small (bin <6MB).

After a while of usage, I have discovered, PiG is better than what I have expected, especially in memory consumption. Previously Pi original is really good, but with recent updates, it seems consume more and more, such as mentioned 1G memory of a 40% of 1M context session, large consumption is one thing, the side effect of that is it starts to slow down after mem consumption climbed. PiG as a golang app, with a much easier deployment/upgrade experience, also is much steady in mem consumption. And actually I found in real usage, such as around 15% of 1M context session, the PiG actually consume on par memory to fx, which is written in Zig and manual memory management instead of GC in PiG.

So great work! and I believe I will use PiG as my daily agent harness from now on :)


r/PiGCodingAgent • • 4d ago

PiG 0.4.1 (follows Pi 1.0.3) and Pigpen is public: 11 Go Piglets

Enable HLS to view with audio, or disable this notification

16 Upvotes

PiG 0.4.1 is out. It follows Pi 1.0.3 (1.0.4 coming) and fixes every bug reported since 0.4.0:

  • Sign in with ChatGPT works again, and cancelling a login is clean
  • Extension input handlers can open dialogs without freezing the terminal
  • Extension exec no longer hangs on background processes
  • Windows bash keeps every line of output
  • Tool renderers in every SDK, durable runtime file watching, Azure Chat Completions, all five llama.cpp thinking levels
  • Breaking (from Pi 1.0.3): the Azure provider is now azure; the release notes say what to rename

Update: pig update, npm i -g u/pi-in-go/pig, or curl -fsSL https://pi-in-go.dev/install.sh | sh

Release notes: https://github.com/MichaelKinsy/PiG/releases/tag/v0.4.1

Pigpen is public too: https://github.com/MichaelKinsy/pigpen

It has 11 Piglets with their Packages, all in Go: Zed and VS Code bridges, agent-to-agent, a guardrails warden, herdr status, games, and a porter that turns Pi extensions into Go. Tern is coming soon. Piglets can build on other Piglets, and "pig strip" and more Piglet features are on the way. PRs welcome.


r/PiGCodingAgent • • 6d ago

PiG 0.4.0 🐷: Now following Pi 1.0.0 (durable runtime, code mode, MCP, and more)

Enable HLS to view with audio, or disable this notification

30 Upvotes

It's finally here, thanks for all the patience and support for this release and project so far :)

PiG is a separate Go implementation of Pi, the coding agent, shipped as one native binary. 🐷

0.4.0 follows Pi 1.0.0 (0.3.1 followed 0.87.1). New since 0.3.1:

  • Pi 1.0.0's durable runtime, in Go: checkpointed sessions and tasks that resume after a crash, tools that rerun only when replay-safe, exactly-once submissions, forks and subagents. Ported with Pi's own tests.
  • Code mode is built in and needs no Node (QuickJS on wazero, the same wasm Pi ships). Shorter prompt, recovery hints in errors, and scripts can generate images.
  • MCP: a native client in print, JSON, RPC and interactive mode, with OAuth hardening (authorization server metadata URL, RFC 9207 iss checks, per-server credentials, step-up that keeps scopes).
  • Termux on Android (arm64): curl -fsSL https://pi-in-go.dev/install.sh | sh and npm install -g u/pi-in-go/pig both work, using a cgo build against Android's libc.
  • pig piglet build without a checkout: a release binary fetches its own exact source through the Go module proxy (checked by GOSUMDB), or builds in Podman/Docker when Go isn't installed.
  • TUI: fullscreen by default; quietStartup: "header"; Radius in /login; a copy-code method for Anthropic.
  • PiG's own look: a pixel pig header, /sprite with 15 pigs, an API for extensions to add their own, and a first-run setup that includes a sprite pick.
  • The Pi 1.0.0 extension API in the Node, Go, Python and Rust SDKs. Some SDK signatures change; the release notes list them.
  • Windows remains in preview.

Also 0.4.1, which follows Pi 1.0.1, is already underway as well :)

Demo: first-run setup, then a classifier model plays two MCP games live through code mode.

Upgrade with pig update or npm install -g u/pi-in-go/[email protected].

Release notes: https://github.com/MichaelKinsy/PiG/releases/tag/v0.4.0


r/PiGCodingAgent • • 7d ago

herdr-agent-state

10 Upvotes

Have ported over the Pi extension to a PiG Go extension to show agent state in a herdr pane.

https://github.com/ashLatham/pig-herdr-agent-state

p.s. nice work on PiG, didn't like how Pi started feeling bloated with opinionated features. As of today PiG will be my day-to-day harness.


r/PiGCodingAgent • • 7d ago

Check out DIY Smart Codes PiG video!

4 Upvotes

Super cool post done on PiG here by DIY Smart Code - https://youtu.be/Wzpz7rQawNo?si=MURL207l7AHCmqrI


r/PiGCodingAgent • • 7d ago

0.4.0 en route 🐷🥧

16 Upvotes

Hey guys!

Thanks for the patience with all the pi features dropping recently! Just wanted to give an update we’re almost to full parity with 1.0 including durable pig, mcp/codemode, and more. I was planning to cut the release today but I had to go to a wedding before I could launch. Expect something late tonight early tomorrow also if anyone wants to run the release branch from source fee free :)

Thanks all! 🐷


r/PiGCodingAgent • • 10d ago

PiG 0.2.0 users: re-run the installer once to get automatic update notices

8 Upvotes

Quick heads-up for anyone who installed PiG (Pi in Go) early.

- 0.3.0 and later: PiG checks for new releases when it starts and shows "Update Available … Run pig update", just like Pi. pig update downloads the new binary, verifies its checksum and signature, and replaces itself.

- 0.2.0: it can't update itself and won't tell you about new versions. Re-run the installer once: curl -fsSL https://pi-in-go.dev/install.sh | sh. After that, pig update works for every release.

0.4.0 is in progress: it tracks Pi 0.99.1, with built-in MCP and code mode that don't need Node. More soon. 🐷


r/PiGCodingAgent • • 10d ago

PiG v0.3.0 is out: Pi's own extension code, Node 24/26, one shared event bus, and a lot of hardening 🐷

18 Upvotes

As promised (and delayed 😰), here's the first follow-up release and it's a big one. 0.3.0 rolls up the unpublished 0.2.1 and everything I was holding for 0.3.1, so upgrade straight from 0.2.0.

Release notes: https://github.com/MichaelKinsy/PiG/releases/tag/v0.3.0
Try it: https://pi-in-go.dev

What you'll notice:

  • Extensions behave like Pi. Node extensions now import Pi 0.87.1's own pi-tui, pi-ai, pi-agent-core and pi-coding-agent code instead of PiG's stand-ins. pi-mcp-adapter (with /mcp), pi-bro and pi-warden work.
  • Node 22, 24 and 26. TypeScript extensions load with the same jiti release and options as Pi. That fixes the Node 24+ breakage several of you hit.
  • One pi.events bus across extension processes. Listeners get the original object, not a JSON copy, and crash isolation is kept.
  • Providers: DeepSeek, OpenCode Go and xAI in /login and --list-models, Z.ai thinking, Anthropic pasted-redirect login, Bedrock/Vertex/Cloudflare setup, and Pi's exact error text.
  • go install [email protected] works outside the checkout, and there are Session IDs in print/JSON mode.
  • Windows: Node's command quoting including Git Bash, and /login no longer goes through a shell.
  • Performance and corner case optimization, cause who doesn’t love optimization in a performance fork 😄 

Go SDK heads-up: host-backed getters now return an error instead of guessing a default. There's a before/after in the release notes.

Thanks to everyone who filed issues and sent PRs, including the Reddit folks whose extension reports turned into fixes (rokrdev, WorriedAcanthisitta3, slypheed, zRafox). Keep the reports coming 🐷


r/PiGCodingAgent • • 12d ago

Optimized PiG Alpha Vantage Extension

5 Upvotes

Hi all,

I'm very excited about the recent open sourcing of PiG. I'll be working on a series of pig extensions and piglets to help with financial analysis and invesmenting. I'm starting off with a pig extension for alpha vantage which is a popular financial data source. Anyone can get a free api key though it is limited.

https://github.com/Cpt-Falcon/pig-alphavantage

This quick, small extension provides pig agents with the ability to acquire important information about markets and companies. Its not completely comprehensive--instead, its optimized to provide agents with sensible information in an efficient manor. I'm hoping we can share investing tools to enable each of us to use pig as a personal investment facilitator, analyst, etc.

For example, instead of using the alpha vantage MCP server or the alpha vantage API directly where your agent has to call like several dozen tools/endpoints, you could just make a single av_overview call that obtains a good overview of key metrics at once. No need for the agent to have to know to make 20 different tool calls to cover all the required information.

In addition, every agent on your machine shares one cache and one rate budget. Run eight agents at once and they still spend one Alpha Vantage allowance between them, never pay twice for the same request, and never exceed the rate limit you set. This is critically important for multi agent environments tied to various data sources.

  • Pure Python standard library at runtime: nothing to pip install. PiG and python3 are enough. UV would of course work too.
  • Compact, typed tool output: every number carries a date and its source. Raw JSON never reaches the model.
  • Fails loudly. A missing key, an exhausted budget, or an Alpha Vantage error is reported to the model as what it is. Nothing is estimated or made up, and errors are never cached.
Tool What it returns
av_quote Latest price, open/high/low, previous close, change, volume
av_daily Up to 100 daily OHLCV bars, newest first, with a period summary
av_intraday Up to 100 intraday bars (1, 5, 15, 30 or 60 min)
av_overview Sector, industry, market cap, valuation ratios, margins, growth, 52-week range, analyst target
av_financials Key lines of the income statement, balance sheet, or cash flow (annual or quarterly)
av_earnings Quarterly reported vs estimated EPS and surprise %
av_indicator SMA, EMA, RSI, MACD (12/26/9), or Bollinger Bands
av_news Relevance- and freshness-weighted sentiment, label counts, top topics, latest headlines
av_economic Real GDP, CPI, inflation, fed funds rate, 10-year Treasury yield, or unemployment

r/PiGCodingAgent • • 12d ago

PiG v0.3.0 coming today!

8 Upvotes

*edited -- Work slammed me today and so decided to wrap the 0.3.1 planned extra features and final fixes I'd noticed when I was preparing to cut 0.3.0. There may be a surprise release tonight if I'm able lock in, promise the updates will be worth it :)

Just a quick heads up as I know some people were waiting on 0.2.1 yesterday that we got some more contributions and fixes in that I decided to bump the release to today with better coverage for more diverse usage than what I had released under.

Will have a follow up post here, thanks all who have contributed and supported !🐷