New
Apps 6,419Makers 6,403This week 7
Promote your app−30%
Wrapped Pi screenshot 1
3views in
the last 30 days

Wrapped Pi

Container environment for development with pi coding agent

Built with Claude Code

by swarmbit · Unclaimed · from PTPortugal · added Nov 3, 2026
no ratings0 comments

wpi

Run Pi Coding Agent in Docker with a safety extension and default settings baked into the image.

Why

Running pi in Docker ensures every team member uses the same environment — same pi version, same safety gates.

wpi makes this simple:

  • CWD-respect mounts: uses docker run directly, so $(pwd) is always mounted at the same absolute path inside the container
  • Identity mirroring: the container user and home directory match the host — paths are the same inside and outside the container
  • One install: install once globally, then run wpi from any directory
  • Baked-in defaults: safety extension, github theme, and sensible settings — no setup required
  • Port forwarding: expose container ports for web dev with -p

Install

wpi is installed from source.

Do not run npm install -g wpi. The wpi name on the npm registry belongs to an unrelated package; this project is not published there.

git clone https://github.com/swarmbit/wrapped-pi.git
cd wrapped-pi

# Required dependencies:
#   - Node.js >= 22  (runtime + TypeScript compilation)
#   - Docker         (build and run containers)
#   - npm            (package manager)

npm install        # install TypeScript, vitest, and runtime deps
npm run build      # compile TypeScript → dist/

# Run directly (during development):
node dist/cli.js

# Or install globally from the local checkout:
npm install -g .
wpi build          # optional: the first `wpi` run builds the image anyway

# Alternatively, use the quick-install script:
./install.sh       # build, uninstall old, install globally, build image

Usage

# From any project directory:
cd my-project
wpi                    # interactive session
wpi -- -p "Summarize"  # print mode
wpi -- -r              # resume session

# With port forwarding for web dev:
wpi -p 3000              # expose port 3000
wpi -p 3000 -p 6006    # expose multiple ports
wpi -p 8080:3000        # host 8080 → container 3000

# Management:
wpi build              # build/rebuild the image
wpi shell              # open a shell in a new container
wpi shell <id>         # exec into an existing container
wpi clean              # remove images left over from other configs/versions
wpi dry-run            # print config and docker commands (debugging)

How it works

┌──────────────────────────────────────────────────────────┐
│                    Docker Container                       │
│                                                          │
│  ┌─────────────────────────────────────────┐             │
│  │  /opt/pi-package/                       │  ◄── Baked  │
│  │    ├── package.json                      │      into   │
│  │    ├── extensions/                       │      image  │
│  │    │   ├── confirm-dangerous/           │             │
│  │    │   ├── secret-redaction/            │             │
│  │    │   ├── worktree/                    │             │
│  │    │   ├── tps/                         │             │
│  │    │   └── web/                         │             │
│  │    └── themes/                          │             │
│  │        └── github.json                  │             │
│  └─────────────────────────────────────────┘             │
│         │                                                  │
│         │ pi install /opt/pi-package                      │
│         │ (registers extensions, themes in settings)      │
│         ▼                                                  │
│  ┌─────────────────────────────────────────┐             │
│  │  <host-home>/.pi/       ◄── Host mount (path mirrored) │
│  │  (e.g. /Users/<user>/.pi on macOS)                    │
│  │    └── agent/                                         │
│  │        ├── settings.json   (shared w/ native pi)      │
│  │        ├── auth.json       (shared w/ native pi)      │
│  │        ├── sessions/       (shared w/ native pi)      │
│  │        ├── extensions/                                │
│  │        ├── npm/                                       │
│  │        └── skills/                                    │
│  └─────────────────────────────────────────┘             │
│                                                          │
│  ┌─────────────────────────────────────────┐             │
│  │  <project path>                ◄── CWD mount         │
│  │    (same absolute path as on the host)  │             │
│  └─────────────────────────────────────────┘             │
└──────────────────────────────────────────────────────────┘
  • Baked into the image: pi binary (pinned version), default pi package (safety extension, github theme), default settings
  • Installed on startup: pi install /opt/pi-package registers the built-in package — extensions and themes are discovered by pi automatically
  • Additional packages: use pi install inside the container to add packages at runtime
  • Mounted from host (persists across runs): ~/.pi (settings, auth, sessions, extensions) — mounted at <host-home>/.pi so the path is identical inside and outside the container
  • Mounted from CWD (your project): mounts $(pwd) at the same absolute path (e.g., /Users/alice/dev/myproject), so file paths in tool output match the host
  • Identity mirroring: the container creates a user and home directory that match the host (username, UID/GID, and home path), so all paths are consistent between host and container
  • Port forwarding (optional): -p flags expose container ports on localhost

Each invocation creates a fresh container. Multiple instances can run simultaneously (no --name collision).

Configuration

wpi reads config from two files (both in YAML format) and CLI flags. All settings are optional — zero config works out of the box.

Config files

File Purpose Committed?
.pi/wpi.yml Project-level defaults (team-shared) Yes
~/.pi/wpi.yml Personal overrides (all projects) No

Precedence

Which file wins depends on what the setting is for.

Personal runtime settings — your choice wins:

Setting Order (highest first)
docker.ports CLI flags (-p, --port) > user config > project config
docker.env User keys override project keys with the same name; the rest are merged
docker.mounts, docker.volumes Merged; a user entry replaces a project entry with the same container path

Settings that define the shared environment — the project's choice wins:

Setting Order (highest first)
pi.version Project config > user config > version bundled with wpi
docker.extension Project config > user config (one block is used, they are not concatenated)
docker.memory, docker.memorySwap Project config > user config
git.user.name, git.user.email Project config > user config > host git config

Full config reference

Here is every supported key in a wpi.yml file:

# ── Pi settings ────────────────────────────────────────────
pi:
  version: 1.0.0    # pin to a specific pi version (default: baked-in)

# ── Docker settings ────────────────────────────────────────
docker:
  # Expose container ports on localhost so you can access web
  # apps running inside the container from your browser.
  # Formats: simple port, host:container, or range.
  ports:
    - 3000            # localhost:3000 → container:3000
    - 8080:80         # localhost:8080 → container:80
    - 9000-9010       # port range — expands to 11 entries

  # Mount arbitrary host paths into the container.
  # Format: HOST_PATH:CONTAINER_PATH[:MODE]
  # Supported placeholders: ~ or ${home} (host home dir), ${workspaceDir} (project dir)
  # User mounts override project mounts on matching container paths.
  mounts:
    - /var/run/docker.sock:/var/run/docker.sock  # Docker-out-of-Docker
    - ~/.ssh:~/.ssh:ro                           # SSH keys (read-only)

  # Named Docker volumes that persist across all wpi containers.
  # Useful for caching build artifacts (Maven, Gradle, npm, etc.).
  # Format: VOLUME_NAME:CONTAINER_PATH[:MODE]
  # Supported placeholders: ~ or ${home} (host home dir), ${workspaceDir} (project dir)
  volumes:
    - wpi-m2:${home}/.m2
    - wpi-gradle:${home}/.gradle
    - wpi-claude:${home}/.claude                 # Claude Code login and state (pair with CLAUDE_CONFIG_DIR)

  # Limit container memory (docker run --memory / --memory-swap).
  memory: 4g
  memorySwap: 4g

  # Environment variables injected into the container at runtime.
  env:
    CUSTOM_VAR: some-value
    NODE_ENV: development
    # Keeps ~/.claude.json inside the wpi-claude volume so the login survives restarts.
    # ${home} and ${workspaceDir} are expanded in env values.
    CLAUDE_CONFIG_DIR: ${home}/.claude

  # Extra Dockerfile instructions appended at image build time.
  # Use this to install system packages or tools. Changing it
  # produces a new image, built automatically on the next run.
  extension: |
    RUN apt-get update && apt-get install -y python3 pip
    ENV PYTHONUNBUFFERED=1
    # Claude Code: see example/wpi.yml for the full install block

# ── Git settings ───────────────────────────────────────────
# Set the Git author identity for commits made inside the container.
# If not set, wpi infers them from the host git config.
git:
  user:
    name: John Doe
    email: john@example.com

Images

Each image is tagged pi-agent:<pi version>-<fingerprint>. The fingerprint covers everything that goes into the build: the Dockerfile (including docker.extension), the entrypoint, and the bundled extensions and settings. So:

  • Changing docker.extension, changing pi.version, or updating wpi gives a tag that does not exist yet, and the next wpi run builds it. No manual rebuild is needed.
  • Projects with different docker.extension blocks get separate images instead of overwriting each other.
  • wpi build still forces a rebuild of the current image, for example to pick up newer base image or OS packages.
  • Superseded images are not deleted automatically. wpi clean removes every pi-agent image except the one the current configuration uses; an image another project still needs is rebuilt on that project's next run, and one a running container uses is left alone.

Images of earlier configurations are not removed automatically. List them with docker images pi-agent and delete the ones you no longer need with docker rmi <tag>.

Settings reference

Key Type Default Description
pi.version string (baked-in) Pin to a specific pi version. Overrides the version bundled with this wpi release.
docker.ports list [] Container ports to expose on 127.0.0.1. Accepts simple ports (3000), host:container mappings (8080:80), and ranges (9000-9010).
docker.mounts list [] Custom host-to-container volume mounts. Each entry is HOST:CONTAINER[:MODE] (e.g., /var/run/docker.sock:/var/run/docker.sock or ~/.ssh:~/.ssh:ro). Placeholders: ~ or ${home} (host home dir), ${workspaceDir} (project dir). User mounts override project mounts on matching container paths.
docker.volumes list [] Named Docker volumes created and mounted into the container. Each entry is VOLUME_NAME:CONTAINER_PATH[:MODE]. Placeholders: ~ or ${home} (host home dir), ${workspaceDir} (project dir). Volumes persist across runs — useful for caches like .m2, .gradle, or node_modules.
docker.memory string — Maximum memory for the container (docker run --memory). Example: 4g.
docker.memorySwap string — Memory+swap limit for the container (docker run --memory-swap). Example: 4g.
docker.env map {} Key-value pairs injected as environment variables. ${home} and ${workspaceDir} are expanded in values. Values are handed to Docker through a private temporary env file rather than the command line, so they do not appear in process listings. User config overrides project config per-key.
docker.extension string — Extra Dockerfile content appended at image build time. Use it to install system packages or set image-level ENV vars. Each distinct block gets its own image, built on the next run.
git.user.name string (host git config) Git author name for commits inside the container. Falls back to git config user.name from the host.
git.user.email string (host git config) Git author email for commits inside the container. Falls back to git config user.email from the host.

CLI flags

Flag Description
-p, --port PORT Publish a container port on localhost (repeatable). Formats: 3000 or 8080:3000. Port ranges are not supported via CLI — use the config file.
--debug, -d Enable debug logging. Prints resolved config, docker commands, and container output to stderr. docker.env values are masked.

Commands

Command Description
(default) Run pi interactively in a new container
build Build or rebuild the Docker image for the current configuration. Optional: a missing image is built on first use.
shell Open a bash shell in a new container (useful for debugging or running arbitrary commands)
shell <id> Exec into an existing running container by ID or name.
clean Remove pi-agent images other than the one the current configuration uses.
dry-run Print the resolved config and the docker commands that would run, without executing anything. Useful for debugging config resolution. docker.env keys are listed with their values masked.

Port details

All ports bind to 127.0.0.1 (localhost only) for security. Ranges (9000-9010) are supported in config files but not via CLI flags. If a host port is already in use, wpi will report the conflict and exit.

Example: full project config

# .pi/wpi.yml — committed to git, shared by the team
docker:
  ports:
    - 3000            # Next.js dev server
    - 6006            # Storybook
    - 8080:80         # Reverse proxy

  mounts:
    - /var/run/docker.sock:/var/run/docker.sock

  env:
    NODE_ENV: development
    # Keeps ~/.claude.json inside the wpi-claude volume so the login survives restarts.
    # ${home} and ${workspaceDir} are expanded in env values.
    CLAUDE_CONFIG_DIR: ${home}/.claude
    CUSTOM_API_URL: https://api.example.com

  extension: |
    RUN apt-get update && apt-get install -y python3

git:
  user:
    name: Team Bot
    email: bot@example.com

The first wpi run after adding or changing docker.extension builds the matching image.

Example: personal override

# ~/.pi/wpi.yml — not committed, personal overrides
docker:
  ports:
    - 3000

  env:
    CUSTOM_VAR: personal-value

Multiple instances

Each wpi invocation creates a new ephemeral container (docker run --rm). Containers don't interfere with each other. The pi config directory (~/.pi) is shared on the host, so settings and auth persist across runs.

If you need to run two agents on the same project simultaneously, that's a workflow concern (like two editors on the same files), not a container concern.

Where config lives

Host path Container path Contents
$(pwd) $(pwd) Your project (CWD mount, same absolute path)
~/.pi <host-home>/.pi Full pi config (mounted at the same path as host)
~/.pi/agent/settings.json <host-home>/.pi/agent/settings.json Model, thinking level, preferences
~/.pi/agent/auth.json <host-home>/.pi/agent/auth.json OAuth tokens
~/.pi/agent/sessions/ <host-home>/.pi/agent/sessions/ Conversation history
~/.pi/agent/extensions/ <host-home>/.pi/agent/extensions/ User extensions
~/.pi/agent/npm/ <host-home>/.pi/agent/npm/ Installed package data
~/.pi/wpi.yml (not mounted) User-level wpi config

Note: <host-home> is the host user's home directory (e.g. /Users/<user> on macOS, /home/<user> on Linux). The container creates a user with the same username, UID/GID, and home path, so all paths are identical inside and outside the container. If the entrypoint cannot assign the host UID/GID it prints a wpi: warning: line at startup.

If you use pi both natively and in the container, they share the same config.

Bundled Extensions

The default package includes several extensions:

  • confirm-dangerous — Allows simple standalone rm commands scoped to the workspace or /tmp without confirmation; prompts for other destructive commands (sudo, force push, forced/recursive removals elsewhere, etc.) and for writes or edits outside the workspace, /tmp, and ~/.pi. Paths are judged where they really land: ~, .., and symlinks are resolved first
  • secret-redaction — Automatically replaces detected credentials with reversible placeholders in model-visible content
  • dynamic-system-prompts — Select Markdown instructions from .pi/system-prompts/ to append to the session system prompt (/system-prompts; see extension README)
  • subagent — Delegates work to isolated agents with live parallel/nested progress and reported cost (see package/extensions/subagent/PLAN.md for interactive controls)
  • multiagent — Persistent background agents with separate live Pi conversation views, steering, follow-ups, and individual stop controls (/multiagents; see package/extensions/multiagent/README.md)
  • worktree — Git worktree management with per-worktree sessions (/worktree:create, /worktree:open, etc.)
  • orchestrator — Experimental named virtual sessions, editor-based task routing, and aggregate usage (/orchestrator; see extension README and local Laya Compose example)
  • tps — Displays tokens-per-second metrics after each agent run
  • web — Firecrawl-based web browsing and scraping tools (web_fetch, web_search, web_screenshot)

Secret redaction

Enabled automatically with the bundled package; no configuration or proxy is needed. After installing an updated wpi, start a new container; the image is rebuilt on that run.

The extension learns credential values from environment variables, Pi auth.json and models.json, wpi configuration, and .env/.env.* and .npmrc files in the current directory. Files accessed through read, edit, or write are also scanned. Source scanning skips symlinks, non-regular files, and files larger than 1 MiB; it never executes credential commands or sources shell files. Request and tool-result text is inspected for credential field names, authorization headers, URL passwords, private keys, and common provider-token formats. Short/common values are masked only in credential contexts to avoid corrupting ordinary code.

Source code assigns expressions to names like password and token far more often than literals, so the unquoted right-hand side of an assignment found in free text is judged by its shape:

Right-hand side Example Treatment
Unmistakably code generatePassword(), await, null, string Left as is
Shaped like an identifier accessToken, req.headers.authorization, hunter Masked where it is assigned, not searched for elsewhere
Anything else Summer2024x, a-hyphenated-value, sk-... Masked everywhere

Quoted strings, structured credential fields, environment variables, and values in .env/`

Description taken from the repository README.

Ratings

–
0 ratings
5 0
4 0
3 0
2 0
1 0

Rate this app

Sign in to rate

Comments 0

Sign in to comment

No comments yet.

Related apps

#dev-tools · #containers · #ai-agents