A Piglet is a named PiG configuration: a YAML file that sets a system prompt, a ceiling on tools, and which extensions and skills to use. You can run it by name, and you can build it into one signed binary.
Prerequisites: pig 0.7.0 or later. Building a binary also needs network access the first time, to fetch PiG's source for the build, and a Go toolchain (pig setup go installs one).
Step 1: write the file
Save this as 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]tools is a ceiling: the active tools start from PiG's defaults and the Piglet removes everything outside its list. A systemPrompt replaces PiG's prompt; leave it out to keep PiG's. The reference shows exactly what the model receives in each case.
Step 2: validate and run it
pig piglet validate ./reviewer.yaml
pig piglet add ./reviewer.yaml
pig --piglet reviewervalidate prints OK: reviewer (./reviewer.yaml): 0 extension(s), 0 skill(s). add copies the file into ~/.pig/piglets/, so later edits to your working copy do not change the registered one until you add it again. pig piglet list shows what is registered.
Step 3: add extensions and skills (optional)
A Piglet selects extensions and skills by origin and tries the origins in order:
name: researcher
tools: [read]
extensions:
- name: search
origins: [local:./extensions/search]
tools: [web_search]
skills:
- name: source-review
origins: [local:./skills/source-review]To start from a published one instead, pig piglet add npm:@pi-in-go/pigpen-piglet-pig-extension-porter adds a Piglet from npm; see Port a Pi extension.
Step 4: build one signed binary
pig piglet keygen ./reviewer-signing.key
pig piglet build ./reviewer.yaml --format binary --out ./pig-reviewer --sign-key ./reviewer-signing.key
pig piglet verify ./pig-reviewer --source ./reviewer.yaml
./pig-reviewer --version
./pig-reviewer -p "Say hello"Output from the run of these commands (pig 0.7.0, Linux amd64, scripted model):
$ pig piglet validate ./reviewer.yaml
OK: reviewer (./reviewer.yaml): 0 extension(s), 0 skill(s)
$ pig piglet build ./reviewer.yaml --format binary --out ./pig-reviewer --sign-key ./reviewer-signing.key
Fetching PiG source (0s) — github.com/MichaelKinsy/PiG@v0.7.0
Compiling and linking Go binary (18s) — reviewer → ./pig-reviewer
Signing binary (53s) — ./pig-reviewer
Built ./pig-reviewer (69223759 bytes) in 53sThe build took 53 s in that run on a shared 192-core host with a warm Go cache; the binary was 69,223,759 bytes. Your time will differ.
Step 5: verify
pig piglet verify checks the signature and, with --source, that the binary's recorded digests match your YAML, without running it. The signature proves the binary is unchanged since that key signed it; it does not say who holds the key until you add the public key with pig piglet trust add. Then run the binary: ./pig-reviewer -p "Say hello" prints the model's reply.
Next
- Publish:
pig piglet publish(GitHub Releases, signed) or--to npm; others install withpig piglet pullorpig piglet add npm:<name>. See Piglet binaries. - Browse what others have published in the catalog.