---
name: pangea
description: Deploy, inspect, and operate Dockerfile HTTP apps, background workers, Shared AI (LLM & Speech), GitHub Actions CI, PR previews, and ephemeral gVisor sandboxes on Pangea via pangea mcp and the pangea CLI. Use whenever the user wants to host an app on Pangea, configure Pangea features, or ask what Pangea supports.
---

# Pangea Agent Skill

Follow these instructions when helping a user set up, deploy, debug, or ask questions about **Pangea** (`https://pangea.host`).

## 1. Safety & Trust Guardrails (Always Enforce)

- **Never read, print, paste, or commit secrets:**
  - Never read `.token` connection files (`$HOME/Downloads/pangea-cli-tok_*.token` or `$HOME/.config/pangea/*.token`) into chat transcripts, tool outputs, logs, or source code. Pass only the file path to `pangea login --token-file ...`.
  - Never upload `.env` files, private keys, or credentials in build contexts or `Dockerfile` `ARG`s; use `pangea_set_secrets` / `pangea secrets set` (with `--env-file` or `--stdin-json`).
- **Never invent URLs or claim unverified success:**
  - Only report a live app URL after `pangea view` (or `pangea_get_project`) confirms `actions.open=true`, `live.status=available`, and `publication.open_url`, and you have actually probed that HTTPS URL (`200`/expected status).
- **Never disable TLS verification for Shared AI:**
  - Always verify HTTPS against the injected `PANGEA_AI_CA_PEM` CA bundle. Never pass `verify=False` or `rejectUnauthorized: false`.
- **Never duplicate projects on transient errors:**
  - Keep existing `pangea.yaml` and `prj_...` IDs. On interrupted deploys, repeat `pangea deploy . --resume` with unchanged source; never mint a second app to work around `PROJECT_PROVISIONING` or transient errors.

## 2. First-Time Setup & 90-Day Credential Flow

If `pangea` is not installed or not authenticated yet:

1. **Account & Plan:** The user signs in at `https://pangea.host/account` (Google or GitHub) and picks a plan at `https://pangea.host/billing` (cardless Free Sandbox via a 30+ day GitHub account, `$0` Stripe card check, or `Mini $9+`).
2. **Download Connection File:** The user downloads their 90-day connection file from `https://pangea.host/console/connect` (`$HOME/Downloads/pangea-cli-tok_<hex32>.token`).
3. **Install Verified CLI (Python 3.10+):**
   - Auto-detect Python `>= 3.10` (`python3.13`, `python3.12`, `python3.11`, `python3.10`, or `python3` checked `>= (3, 10)`).
   - Download the pinned wheel + `SHA256SUMS` from `https://pangea.host/downloads/cli/...` (redirects disabled), verify SHA-256 and byte count, install into `"$HOME/.local/share/pangea/cli-<version>"`, and create a stable symlink:
     ```bash
     mkdir -p "$HOME/.local/bin" && ln -sf "$HOME/.local/share/pangea/cli-<version>/bin/pangea" "$HOME/.local/bin/pangea"
     export PATH="$HOME/.local/bin:$PATH"
     ```
4. **Log into Default Profile (`~/.config/pangea/client.json`):**
   - Run locally without tracing (`chmod 700 "$HOME/.config/pangea"`, `install -m 600 ...`):
     ```bash
     pangea login --endpoint 'https://pangea.host/api/agent' --token-file "$HOME/.config/pangea/<filename>"
     pangea whoami
     pangea projects
     ```
   - This saves to `~/.config/pangea/client.json` automatically (valid for 90 days), so new terminals, chat sessions, and `pangea mcp` stay connected without setting `PANGEA_CLIENT_CONFIG`.
5. **Permanently Register `pangea mcp`:**
   - When your client supports MCP, add `"pangea"` to its MCP config using the **resolved absolute binary path** (e.g. `/Users/<user>/.local/bin/pangea` with `args: ["mcp"]`) so GUI clients without `~/.local/bin` on `PATH` launch it reliably.

## 3. Conversational Self-Discovery

Whenever the user asks what Pangea supports, what plans/limits apply, or how to configure a feature:

- Call **`pangea_guide`** (MCP tool) or read **`pangea://guide/<topic>`** (MCP resource).
- From the shell, run **`pangea guide`** (works offline too).
- Or consult `https://pangea.host/llms.txt` and `https://pangea.host/llms-full.txt`.

## 4. Standard App Deployment Workflow

1. **Inspect repo & preflight:**
   - Check `Dockerfile`, bind address (`0.0.0.0`), port (`1024..65535`, default `8080`), health path (`/healthz`), non-root `UID 1000`, read-only rootfs (write temp files to `/tmp`, durable data to `/data`), and `.dockerignore`.
   - Run `pangea_check_directory` (or `pangea doctor`).
2. **Create or link project:**
   - Check `pangea_whoami` and `pangea_list_projects` first.
   - If `pangea.yaml` exists, keep its `project` ID; link with `pangea link` if needed.
   - Otherwise create via `pangea_create_project` or `pangea init --template dockerfile-http-v1 --name <slug> --directory . --http-port <port> --health-path <path> --persistent-data|--no-persistent-data`.
3. **Secrets & Shared AI (if needed):**
   - Set runtime secrets with `pangea_set_secrets` / `pangea secrets set`.
   - Enable Shared AI with `pangea_enable_ai` / `pangea ai enable --apply`. Wire `PANGEA_LLM_BASE_URL`, `PANGEA_LLM_API_KEY`, `PANGEA_LLM_MODEL` (`gemma` default, `qwen`, `default`), `PANGEA_SPEECH_BASE_URL`, `PANGEA_SPEECH_API_KEY`, and verify TLS with `PANGEA_AI_CA_PEM`. Handle `429` / `503` gracefully without failing `/healthz`.
4. **Deploy & Verify:**
   - Run `pangea_deploy_directory` or `pangea deploy . --resume --wait 300`.
   - Check `pangea view --directory .` (or `pangea_get_project`). Once `actions.open=true` and `live.status=available`, probe the `publication.open_url` (`https://<app>.pangea.host`) with HTTPS and report the verified URL + console link.

## 5. Additional Platform Features

- **Workers & Autoscaling (`Mini+`):** `pangea_set_processes` (up to 12 processes x 32 replicas) and `pangea_set_autoscaling` (1–64 replicas, 20–90% CPU) on stateless rolling HTTP apps.
- **Compute & `/tmp` Scratch:** `pangea_set_resources` (`cpu_m`, `memory_mib`, `scratch_mib`, `runtime_class`).
- **Aliases & Custom Domains:** `pangea_set_alias` (`<slug>.pangea.host`) and `pangea_domain_add` / `verify` (Mini+, up to 5/project).
- **CI & PR Previews:** Zero-secret Pod-native GitHub Actions (`PANGEA_CI_TOKEN_FILE`) and `pangea preview up/down` / `pangea_preview_up/down` (card-verified Free Sandbox or Mini+).
- **Ephemeral gVisor Sessions:** `pangea_set_session_pool` (WarmPool ~0.1s checkout, `exec_mode: "builtin"`, `egress_proxies`), `pangea_create_session`, `pangea_pause_session` / `resume`, `pangea_create_session_token` (`pga_ses_...`), and `session_only: true` projects.
- **Edge Access & Analytics:** `pangea_access_set` / `pangea_access_token_create` / `pangea_access_default_set`, and `pangea_enable_analytics` / `pangea_get_analytics_stats` (cookieless Umami, 90-day retention).
- **Backups & Export:** `pangea_export_data` (`pangea export`), `pangea_backup_project`, `pangea restore`.
