PiG Documentation

Guides and references for configuring, using, and extending PiG.

Knowledge graph

PiG is built from a small set of entities. This page lists each entity, where it lives, the command that inspects it, and how the entities relate. The same graph is published as JSON-LD at pig-knowledge-graph.jsonld and as Mermaid source in docs/knowledge-graph/pig.mmd, and it ships inside every pig binary as knowledge-graph.md in the local docs (pig docs show knowledge-graph).

Entity relationship diagram of PiG

Entity
What it is
Where it lives
Inspect with
Read
PiUpstream TypeScript coding agent; the behavior oracle.https://github.com/earendil-works/pipig versiondivergences.md
PiGThe Go implementation; executable pig.coding/pigversion/pigversion.go pins Pipig verifyREADME.md
Stock PiGProduct-neutral pig binary with no Piglet selected.cmd/pigpig versionbuilt-in-extensions.md
SessionAppend-only JSONL tree of entries for one conversation.~/.pig/agent/sessions/tree, /sessionsessions.md
Model RuntimeSession-owned model lookup, auth, completion, and streaming used by every mode.coding//model, pig --list-modelsmodels.md
ProviderTurns a Transcript into one Event Stream for one API.ai/pig --list-modelsproviders.md
ModeInteractive TUI, print, JSON event stream, or RPC over stdin/stdout.cmd/pigpig --mode rpccommands.md
ResourceOne capability: extension, skill, prompt, hook, MCP definition, theme, or environment.~/.pig/agent, .pig/ in a projectpig status --jsonconcepts.md
ExtensionCode Resource in Go, Rust, Python, or Node/TypeScript that registers tools, commands, events, and UI.extensions/sdk*, ~/.pig/agent/extensionspig install --validate-only <dir>extensions.md
Extension SDKOne extension contract per language: Go, Rust, Python, TypeScript declarations.extensions/sdk, sdk-rs, sdk-py, sdk-tspig extension initextension-api.md
Extension realizationHow an extension runs: isolated process, packed runtime cell, or fused into a Piglet Binary (Go only).coding/extension/hostpig status --jsonruntime-cells.md
Extension HostLoads, isolates, reloads, and shuts down extension realizations over one wire contract.coding/extension/host/subprocess/reloadruntime-cells.md
PackageVersioned collection of Resources from npm, git, or a local path; never owns a Piglet.~/.pig/agent/npm, ~/.pig/agent/gitpig listpackages.md
PigletOne named agent: selects and scopes Resources and sets defaults.*.yaml Piglet filepig piglet validate <file>piglets.md
PiG StandardThe optional curated Piglet: login identity, PiG Runner, Angry Pigs.piglets/standard/pig-standard.yamlpig piglet validate piglets/standard/pig-standard.yamlbuilt-in-extensions.md
Piglet releasePins the exact Resource closure and component plan of a Piglet.release.version and managed recordspig piglet show --record <path>piglets.md
Piglet BinaryTarget-native pig executable for one Piglet release; verifies its closure at startup.pig piglet build --format binarypig verifypiglets.md
BuilderProduces Piglet Binaries: native (needs Go and PiG source) or container (needs Docker or Podman).coding/pigletbuildpig setuppiglets.md
Pig PorterParity workbench Piglet Resource; proposes ports, never accepts its own work.piglets/portermake porter-check (source checkout)divergences.md
DivergenceA numbered, approved, user-visible difference from pinned Pi.DIVERGENCES.mdpig docs show divergencesdivergences.md
From
Relation
To
Note
PiGimplementsPiexact pinned release
Stock PiGbuildsPiGone binary per target
SessionownsModel Runtimeone per Session
Model Runtimestreams throughProviderone Provider per request
ModedrivesSessionTUI, print, JSON, RPC share one Session path
PackagedistributesResourceone to many
Extensionis aResource
Extensionwritten withExtension SDKone language per extension
Extensionrealized asExtension realizationisolated, packed, or fused
Extension HosthostsExtension realizationsame contract in every realization
PigletselectsResourceand scopes discovery
PiG Standardis aPigletexplicit, never active in Stock
Piglet releasepinsPigletexact closure
Piglet BinaryrealizesPiglet releaseper target
BuilderproducesPiglet Binaryno silent fallback between builders
Pig Porteris aResourceselected by the Porter Piglet
Divergencedocuments difference fromPinumbered D<N>

The graph source is docs/knowledge-graph/pig.graph.json. Run automation/gen/gen-knowledge-graph.py after editing it.

PiG project documentation · MIT License