Bring your Pi setup

Use your existing ~/.pi directory, settings, sessions and packages from PiG with PIG_USE_PI_DIRS=1.

Guides / Coming from Pi

Tested · 2026-11-07

Recording: watch the pi-setup demo

If you already use Pi, you can point PiG at the same directories. PiG does not copy or merge anything: with one environment variable it reads and writes Pi's agent directory.

Step 1: prerequisites

  • pig 0.7.0 or later (pig --version prints 0.7.0+1.5.0 for the 0.7.0 release).
  • An existing Pi agent directory: ~/.pi/agent by default, or the directory named by PI_CODING_AGENT_DIR.
  • Stop any Pi or older PiG process that has a session open before you share its files. Do not edit one session from two processes at once.

Step 2: opt in

Set PIG_USE_PI_DIRS=1 on the command that starts PiG:

PIG_USE_PI_DIRS=1 pig

Only the exact value 1 enables sharing. PiG then uses Pi's agent directory and the project .pi resources. It selects the directory before it reads settings, so the opt-in cannot live inside a settings file. Project trust still applies.

To make it permanent, set it where you set your other environment, or use an alias for the one command:

alias pig='PIG_USE_PI_DIRS=1 pig'

Step 3: know what is shared

  • Shared mode uses PI_CODING_AGENT_DIR (or ~/.pi/agent) and PI_CODING_AGENT_SESSION_DIR. It ignores the PiG-specific PIG_CODING_AGENT_* overrides. --session-dir still wins.
  • PIG_HOME still selects PiG-owned state: SDK caches, documentation and user Piglets.
  • PiG's configuration page states that settings, authentication and session formats are compatible with Pi's, that writes to auth, settings, trust and the model-catalog cache use Pi's lock-directory protocol, and that settings writes keep unknown keys. PiG does not write models.json.
  • Use Pi-compatible Packages and resources in the shared settings.

Unset the variable to return to separate PiG directories. The shared files stay where they are. The full rules are in Configuration.

Step 4: verify

Run one prompt and look at the Pi directory:

PIG_USE_PI_DIRS=1 pig -p "Say hello"
ls "${PI_CODING_AGENT_DIR:-$HOME/.pi/agent}/sessions"

A new session file appears under Pi's sessions directory, and PiG's own state directory (PIG_HOME) stays empty of sessions. The screenshot below is this check with a scripted model.

  • Upstream Pi, the reference implementation.
  • Editor adapters that look in Pi's directory (pi-acp, Powerline) need the same variable; see Configuration.
Terminal: PIG_USE_PI_DIRS=1 pig reading a Pi agent directory
pig 0.7.0 reading a Pi-style agent directory with PIG_USE_PI_DIRS=1.

Test record

Tested 2026-11-07 with pig 0.7.0 on Linux amd64, using a local scripted model so no key is needed. Where a step needs a real model or a published artifact that we did not use, the guide says so.