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.the pig executablepig verifyREADME.md
Stock PiGProduct-neutral pig binary with no Piglet selected.the pig executablepig 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.inside the pig executable/model, pig --list-modelsmodels.md
ProviderTurns a Transcript into one Event Stream for one API.inside the pig executablepig --list-modelsproviders.md
ModeInteractive TUI, print, JSON event stream, or RPC over stdin/stdout.pig flags: -p, --mode json, --mode rpcpig --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.~/.pig/agent/extensions, .pig/ in a projectpig install --validate-only <dir>extensions.md
Extension SDKOne extension contract per language: Go, Rust, Python, TypeScript declarations.scaffolded per language by pig extension initpig extension initextension-api.md
Extension realizationHow an extension runs: isolated process, packed runtime cell, or fused into a Piglet Binary (Go only).inside the pig executablepig status --jsonruntime-cells.md
Extension HostLoads, isolates, reloads, and shuts down extension realizations over one wire contract.inside the pig executable/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.an installed Pigletpig piglet listbuilt-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 and compiles out the built-ins its strip lists name.pig piglet build --format binarypig verifypiglets.md
BuilderProduces Piglet Binaries: native (needs Go and PiG source) or container (needs Docker or Podman).pig piglet buildpig setuppiglets.md
SlotA part of PiG that a Piglet can change: keep PiG's own part, replace it with a fused member (today the frontend), or strip it.slots: and strip: in the Piglet filepig piglet show <name>piglet-strip.md
Strip listDisables built-in tools, commands, extensions, APIs, or features by stable ID; tools: is a ceiling, strip removes.strip: in the Piglet filepig piglet schema, pig piglet show <name>piglet-strip.md
Overlay PigletA Piglet chosen at launch on a Piglet Binary that is not built with build.closed; it can undo runtime strips but not compiled-out ones.--piglet, PIG_PIGLET_PATH, PIG_PIGLET_NAME/pigletpiglets.md
DivergenceA numbered, approved, user-visible difference from pinned Pi.divergences.md in this bundlepig 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
PigletdeclaresStrip listtools is a ceiling; strip removes built-ins
Strip listdisablesSlotby stable ID, in runtime or binary
PigletreplacesSlotslots.frontend
Overlay Pigletis aPigletrefused only by a Binary built with build.closed
Overlay Pigletapplies toPiglet Binaryat launch
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