FOR PI USERS

A faithful Go port of Pi.

PiG ships as one Go binary and uses Pi’s extensions, skills and session format. Pi is the reference implementation, and PiG is not an official Pi project. Run PIG_USE_PI_DIRS=1 pig to work from your existing ~/.pi setup.

curl -fsSL https://pi-in-go.dev/install.sh | sh
pig 0.7.0
▄▄▄▄ ▄▄▄▄ v0.7.0+1.5.0 ▄▀▀▀▀▄▄▀▀▀▀▄ escape interrupt · ctrl+c/ctrl+d clear/exit · / ▀▀▀▀▀▀▀▀▀▀▀▀▀▀ commands · ! bash · ctrl+o more ▀▀▀▀▀▀▀▀▀▀▀▀▀▀ Press ctrl+o to show full startup help and loaded ▀▀▀▀▀▀▀▀▀▀▀▀▀▀ resources. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀ PiG can explain its own features and look up its docs. Ask it how to use or extend PiG. ──────────────────────────────────────────────────────────────────────── ──────────────────────────────────────────────────────────────────────── ~/project 0.0%/200k (auto) fake-model
Fig. 01A captured pig 0.7.0 session against a scripted model.
  • Memory · resume a 365 MiB session82.2 MiBPi 1.6.0: 634.3 MiB · 7.7x lower
  • Startup · to the first prompt34 msPi 1.6.0: 419.5 ms · repeat start
  • Binary · linux/amd6463.0 MBOne file. 0.8.0 release asset.

Memory and startup: PiG 0.8.0 and Pi 1.6.0 on Intel Xeon Platinum 8468, Linux 7.0, 4 pinned cores per program. Binary size: the 0.8.0 release assets. How we measured

01WATCH IT RUN

Short recordings, one point each.

Each clip is a real run of pig 0.7.0 in a terminal, with captions. Model replies are scripted; the tool calls, files and commands are real.

All demos

02CATALOG

Piglets, extensions, skills and more.

One catalog of what is published on npm for PiG and Pi: filter by type, search, sort by downloads. Every entry has its install command, its manifest and a security note. Community listings are not reviewed by PiG.

Open the catalog Piglets only

7,257 listings from npm16 piglets4,338 extensions433 skills63 prompts122 themes253 providers2,511 packagesSynced 2026-11-30

03PI-COMPATIBLE

Bring your ~/.pi.

PiG reads Pi’s session format and runs Pi’s extensions and skills. By default it keeps its own state under ~/.pig, so the two can run side by side. One variable points PiG at Pi’s directories.

Configuration Every difference from Pi, listed

~/.pi
$ ls ~/.pi/agent auth.json extensions sessions settings.json skills $ PIG_USE_PI_DIRS=1 pig pig reads ~/.pi/agent: your sessions, skills, extensions and settings /resume lists the sessions Pi wrote $ pig # without it, PiG keeps its own state ~/.pig/agent: separate from Pi, so the two run side by side
Fig. 02PIG_USE_PI_DIRS=1 selects Pi’s agent directory (divergence D2). Illustration.
04FOOTPRINT

Pi 1.6.0 behavior, with lower measured memory and startup.

Bare Pi against bare PiG: no extension, no Piglet, the same harness, the median of 15 runs. The page lists the host, the builds and the session files.

Resume a 365 MiB session

Pi 1.6.0634.3 MiB
PiG 0.8.082.2 MiB

Peak memory. 7.7x lower.

Open a 427 MiB session, /fork

Pi 1.6.01155.7 MiB
PiG 0.8.0147.5 MiB

Peak memory. 7.8x lower.

Start to the first prompt

Pi 1.6.0420 ms
PiG 0.8.034 ms

Repeat start. First start: Pi 420 ms, PiG 39.9 ms.

One file, per target

linux/amd6463.0 MB
linux/arm6458.5 MB
darwin/arm6460.2 MB
windows/amd6464.7 MB

The pig executable in each release archive.

Method, hosts and every figure buffon: longer runs (PiG 0.5.0, 2026-10-19)

05A MINUTE WITH PIG

One binary for the whole workflow.

Each step is a real command. The output is what pig 0.7.0 printed against a scripted model, trimmed. Pick a step, or let them play.

pig · ask
▄▄▄▄ ▄▄▄▄ v0.7.0+1.5.0 ▄▀▀▀▀▄▄▀▀▀▀▄ escape interrupt · ctrl+c/ctrl+d clear/exit · / ▀▀▀▀▀▀▀▀▀▀▀▀▀▀ commands · ! bash · ctrl+o more ▀▀▀▀▀▀▀▀▀▀▀▀▀▀ Press ctrl+o to show full startup help and loaded ▀▀▀▀▀▀▀▀▀▀▀▀▀▀ resources. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀ PiG can explain its own features and look up its docs. Ask it how to use or extend PiG. ──────────────────────────────────────────────────────────────────────── ──────────────────────────────────────────────────────────────────────── ~/project 0.0%/200k (auto) fake-model
Fig. 03A captured pig 0.7.0 session against a scripted model.
$ pig
06PIGLETS

YAML in, one signed binary out.

A Piglet is a named agent setup: the tools, skills, extensions and prompts it keeps. PiG builds one into a single executable and signs it with your key. To accept only signed binaries, run pig piglet trust add and then pig piglet trust require on.

Piglet binaries What a Piglet is Browse Piglets Build a Piglet in your browser

reviewer.yaml
name: reviewer
description: "Reviews a change and lists risks."

systemPrompt:
  text: "You review changes. List the risks first, then the questions."

tools: [read, grep, find, ls]
pig piglet
$ pig piglet validate ./reviewer.yaml OK: reviewer (./reviewer.yaml): 0 extension(s), 0 skill(s) (exit 0) $ pig piglet keygen ./reviewer-signing.key Piglet signing key ed25519:26d5451cfbafbfa6b9c6421d928bcd26 private: ./reviewer-signing.key (keep it secret; sign with pig piglet build <name> --format binary --sign-key ./reviewer-signing.key) public: ./reviewer-signing.key.pub (publish it; users trust it with pig piglet trust add) (exit 0) $ pig piglet build ./reviewer.yaml --format binary --out ./pig-reviewer --sign-key ./reviewer-signing.key Resolving manifest (0s) — ./reviewer.yaml Resolving extensions (0s) — reviewer Packing resources (0s) — Inlining prompts and skills Selecting builder (0s) — auto Fetching PiG source (0s) — github.com/MichaelKinsy/PiG@v0.7.0 fetching PiG v0.7.0 source (cached after first build) Locking build inputs (18s) — Hashing source, extensions, and toolchain identities Packing build inputs (18s) — Embedding cells, resources, and component records Compiling and linking Go binary (18s) — reviewer → ./pig-reviewer Signing binary (53s) — ./pig-reviewer Checksumming and verifying binary (53s) — ./pig-reviewer Writing binary and records (53s) — Publishing verified artifact to the managed store Built ./pig-reviewer (69223759 bytes) in 53s (exit 0) $ wc -c < pig-reviewer 69223759 $ pig piglet verify ./pig-reviewer --source ./reviewer.yaml Piglet Binary: ./pig-reviewer Signature: signed by ed25519:26d5451cfbafbfa6b9c6421d928bcd26 (not in your Piglet trust store: this proves it is unchanged since that key signed it, not who holds the key) Provenance: matches ./reviewer.yaml Signed manifest: Piglet: reviewer target: linux/amd64 Pig: 0.7.0 Piglet definition: sha256:737240d908a08bcf79a04863d87495332808bed67933f7a3b0b54fb1d6bb0bf2 resolution record: sha256:d5c41afdbac87dd6a19b7f3ea1820eec01a9750df829a34ad5ba1ca403435db1 component plan: sha256:ac46fd24bd501fa7297f0a2945bcc7f5d655b9bcf8bfbf16718a9d25c0c2c018 executable: sha256:8b64dc53df31e05d60afcdfd0fab11b993057326eb15b4a2b4c1592abf2626cb (69222560 bytes) (exit 0) $ ./pig-reviewer --version 0.7.0+1.5.0 (exit 0) $ ./pig-reviewer -p 'Say hello' Hello! This reply comes from a local fake model. (exit 0)
Fig. 04The manifest, built into one signed binary. Real output of pig 0.7.0; the seconds are the real build times, and the replay runs faster. (exit N) lines come from the capture script.
07EXTENSIONS

Five languages, one extension API.

Write an extension in Go, Rust, Python or Common Lisp, or run Pi’s TypeScript extensions through Node.js. All five use the same extension API, with the gaps listed in the SDK surface table.

go · run against pig 0.7.0
package shout
import (
	"strings"
	sdk "github.com/MichaelKinsy/PiG/extensions/sdk"
)
func Extension() *sdk.Extension {
	e := sdk.New("shout")
	e.Tool("shout", "Upper-case text", sdk.Schema{"type": "object", "properties": map[string]any{"text": map[string]any{"type": "string"}}},
		func(ctx sdk.Context, p map[string]any) (any, error) { return strings.ToUpper(p["text"].(string)), nil })
	return e
}
[ SHOW OUTPUT ][ HIDE OUTPUT ]
$ pig install ./shout --validate-only --json
{
  "valid": true,
  "name": "shout",
  "source": "/tmp/ext-go/shout",
  "hash": "914aa12b2f5843752b6a661d0b8294271223ed44e1b1e9e0531e38b7a8a2e442",
  "tools": [
    "shout"
  ],
  "toolDetails": [
    {
      "name": "shout",
      "description": "Upper-case text"
    }
  ],
  "registered": true,
  "definition": {
    "form": "factory",
    "language": "go",
    "root": "/tmp/ext-go/shout",
    "package": "example.com/shout",
    "factory": "Extension",
    "packable": true,
    "runtime": "subprocess",
    "sdk": "github.com/MichaelKinsy/PiG/extensions/sdk",
    "isolation": "shared-ok"
  },
  "autoDiscovered": true
}
(exit 0, 1.9 s, first build)
$ pig -e ./shout --mode json -p 'Please shout hello'   # tool_execution events only (filtered)
{"type":"tool_execution_start","toolName":"shout","args":{"text":"hello from pig"}}
{"type":"tool_execution_end","toolName":"shout","result":{"content":[{"type":"text","text":"HELLO FROM PIG"}]},"isError":false}
(exit 0, 0.1 s)
$ pig -e ./shout -p 'Please shout hello'
The tool returned: HELLO FROM PIG

Real output of pig 0.7.0. Lines such as (exit 0) and the # notes on a command are added by the capture script. Where output is cut, a line says so.

Also needed, not shown: go.mod.

Fig. 05The same tool, shout, in each language. Each was loaded by pig 0.7.0 and called once.
08EMBED ANYWHERE

Put PiG inside your own tool.

A Go SDK, JSON over stdin and stdout, one-shot runs for CI, and a Piglet as one executable. Pick one and copy it.

go · inside main() · run against pig 0.7.0
// needs: context, fmt, log, github.com/MichaelKinsy/PiG/coding
services, err := coding.CreateAgentSessionServices(coding.CreateAgentSessionServicesOptions{CWD: ".", AgentDir: coding.DefaultAgentDir()})
must(err)
rt, err := coding.NewRuntime(coding.RuntimeOptions{Services: services})
must(err)
model, err := coding.BuildModel("fake/fake-model", services)
must(err)
session, err := rt.New(coding.SessionStartOptions{Model: model})
must(err)
_, err = session.Send(context.Background(), "Say hello")
must(err)
fmt.Println(*session.LastAssistantText())
[ SHOW OUTPUT ][ HIDE OUTPUT ]
$ go mod tidy
go: downloading golang.org/x/sync v0.24.0
go: downloading cloud.google.com/go/compute v1.24.0
go: downloading github.com/lucasb-eyer/go-colorful v1.4.0
go: downloading github.com/clipperhouse/displaywidth v0.11.0
go: downloading github.com/google/go-cmp v0.7.0
$ go vet ./...
vet exit 0
$ go build -o sdkdemo .
build exit 0
$ ./sdkdemo
Hello! This reply comes from a local fake model.
run exit 0

Real output. The go mod tidy download lines are trimmed to the last five.

must(err) is a five-line helper that calls log.Fatal. The model here is a local fake; point BuildModel at a provider you use.

Fig. 06Each snippet was run against pig 0.7.0. The output is under the snippet.
09OUTSIDE THE TERMINAL

Works with the tools you already use.

PiG runs Pi extensions unchanged and speaks ACP, the Agent Client Protocol editors and terminals use to drive an agent, through pig-acp. Pick a tool below to open its setup page and test record.

24 tools ran on PiG 0.8.0, 0 more ran on 0.7.x, and 15 additional ACP clients are listed from their own documentation.

[ ONE-TIME SETUP: INSTALL PIG-ACP ][ HIDE ONE-TIME SETUP ]
  1. Install PiG 0.8.0 or later. pig version prints PiG’s version; pig --version prints the Pi version it follows. The editor needs the absolute path of pig as /path/to/pig.

    pig version
  2. Download pig-acp from the same PiG release on GitHub (github.com/MichaelKinsy/PiG/releases): pig-acp-0.9.0-<os>-<arch>.tar.gz on macOS and Linux (amd64, arm64) or pig-acp-0.9.0-windows-<arch>.zip on Windows. Unpack pig-acp into a folder on your PATH and check it.

    pig-acp --version
  3. If pig has no model or key yet, sign in once in a terminal. Without it, the editor gets the ACP error "authentication required".

    pig-acp --pig /path/to/pig --terminal-login
  4. The editor then runs this command and speaks ACP over stdin and stdout. pig-acp starts pig --mode rpc for each session.

    pig-acp --pig /path/to/pig

Every tool on one pageMore ACP clients (from their docs)

10PRIMITIVES, NOT FEATURES

What we didn’t build.

Stock PiG provides generic extension and Piglet contracts instead of dictating each product workflow. Put application behavior in a Resource and select it through a Piglet. MCP and code mode are built in, as they are in Pi.

  • No built-in sub-agent product

    Compose a reviewed extension or separate agent application through a Piglet.

    Derivative harnesses
  • No permission product policy

    Use an operating-system boundary or select a policy extension that fits your environment.

    Containerization
  • No built-in plan workflow

    Use files, skills, or an extension selected by your agent application.

    Extensions
  • No built-in to-do workflow

    Use a project file or select a focused extension.

    Extensions
  • No product-specific background shell

    Use an explicit terminal or extension policy with owned lifecycle.

    tmux
Doom running inside pig through the unchanged pi-doom extension, above the pig footer
Fig. 07pi-doom, an extension written for Pi, running in pig without changes.
11THE HERD

Built with Pi people.

Start with observed Pi behavior. Report a reproducible difference, keep the attribution, and support compatibility claims with parity evidence.

  • Pigpen

    The community index of Piglets and Pi extensions ported to Go.

    Browse Piglets
  • Contribute

    Report a difference from Pi, send a fix, or port an extension. Every commit needs a DCO sign-off and a verified signature.

    How to contribute
  • Demos

    Short recordings of PiG running, with captions.

    Watch the demos
  • Guides

    Port a Pi extension, bring your Pi setup, build a Piglet, embed PiG, and set it up in each tool.

    Read the guides
  • Docs

    References, from first run to the SDK.

    Read the docs

The herd: PiG’s built-in sprites. Pick yours with /sprite.

PiG is not an official Pi project. Pi is the reference implementation, from Earendil Works; see the Pi documentation. Created by Michael Kinsy. Originally developed at Hewlett Packard Enterprise. Source: MichaelKinsy/PiG.