PiG Documentation

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

Environment variables

PiG reads these variables at startup. Each one has a setting or a default that covers the normal case, so set a variable only when you need to change PiG from outside its configuration: in a container, in CI, or while debugging.

Variables named PI_* are read for compatibility with upstream Pi. PiG reads both spellings where both exist.

Location

Variable
Effect
PIG_HOMEConfiguration root. Default ~/.pig
PIG_CODING_AGENT_DIRAgent directory alone. Default $PIG_HOME/agent

PIG_HOME moves settings, keybindings, sessions, trust decisions and installed packages together. Use it to run two configurations side by side.

Network

Variable
Effect
PIG_OFFLINE, PI_OFFLINEDo not check for package updates. Accepts 1, true or yes
PIG_UPDATE_URLRelease manifest used by pig update
PIG_UPDATE_TRUST_ROOTPublic key that signs the release manifest
PI_OAUTH_CALLBACK_HOSTHost the OAuth callback listens on
PI_SHARE_GATEWAY_URLArtifact upload endpoint used only when you run /share. Default https://pi-in-go.dev/v1/artifacts?visibility=unlisted&title=PiG+session
PI_TELEMETRYOverride the enableInstallTelemetry setting: 1, true or yes enables it, anything else disables it. Gates the install/update ping and the OpenRouter/NVIDIA/Cloudflare attribution headers. The ping is not active yet: PiG has no endpoint to send it to.

Set PIG_OFFLINE in CI. Without it, every run checks for updates and fails slowly when the network is blocked.

Diagnostics

Variable
Effect
PIG_DEBUGWrite a debug log
PIG_DEBUG_KEYSLog every key as PiG decodes it
PIG_DEBUG_TOOLSLog tool calls and their results
PIG_RENDER_DEBUGWrite render diagnostics
PIG_DEBUG_REDRAWLog why the screen was fully repainted
PIG_STARTUP_TRACETime each startup step

Use PIG_DEBUG_KEYS when a keybinding does not respond: it shows whether the key reached PiG at all. See terminal setup.

Use PIG_DEBUG_REDRAW when the view jumps while output arrives. A full repaint clears the terminal's scrollback, which moves the reader, and every cause emits the same bytes. The log names the cause, in $PIG_HOME/agent/pig-debug.log.

Any non-empty value turns these on.

Display

Variable
Effect
PI_HARDWARE_CURSORShow the terminal's own cursor
PI_CLEAR_ON_SHRINKRepaint when content shrinks

Both have settings that do the same thing. See settings.

Extensions and piglets

Variable
Effect
PIG_PIGLET_NAMEPiglet to run
PIG_PIGLET_PATHDirectories searched for piglets
PIG_SDK_GO_ROOTGo SDK used when building an extension
PIG_SDK_PY_ROOTPython SDK used when building an extension
PIG_SDK_RS_ROOTRust SDK used when building an extension
PIG_CELL_BUILD_TIMEOUTTime an extension build may take

The PIG_SDK_* variables point a build at an SDK checkout instead of the staged copy. Use them while developing the SDK itself. See extensions.

Process markers

Pig sets two markers that every child process inherits, as Pi does:

Variable
Effect
AI_AGENT=piGeneric marker that lets tooling identify the launching agent
PI_CODING_AGENT=trueLets a child process detect that it runs inside the coding agent
Adapted from upstream Pi documentation · Upstream documentation ↗ · MIT License