# Postgres Adopt

Detect which gbrain engine is in use (PGLite vs Postgres), prefer Postgres for...

- Repository: https://github.com/garrytan/gbrain (31427 stars)
- Category: AI and agents
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add garrytan/gbrain --skill postgres-adopt -g -a claude-code -y`
Codex: `npx skills add garrytan/gbrain --skill postgres-adopt -g -a codex -y`
Cursor: `npx skills add garrytan/gbrain --skill postgres-adopt -g -a cursor -y`
Gemini CLI: `npx skills add garrytan/gbrain --skill postgres-adopt -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add garrytan/gbrain`

## Description

Detect which gbrain engine is in use (PGLite vs Postgres), prefer Postgres for agent-harness installs, install/provision Postgres (Supabase discovery via SUPABASE_ACCESS_TOKEN, local Postgres, opt-in Docker), and move an existing PGLite brain to Postgres with its history (plan, ask, run). Detection is one engine-free command; the install ladder is one flag.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Postgres Adopt

> The engine is the brain's foundation: PGLite is the zero-config floor,
> Postgres is where concurrency, multi-machine access, and 1000+ pages live.
> This skill answers "which one am I on?", prefers Postgres when the
> operator wants it, and moves data safely, never by flipping config.

## Contract

This skill guarantees:
- Detection is engine-free and read-only: `gbrain engine status --json`
  answers with the database down (that is the point of the command).
- Engine changes NEVER happen by editing config. A PGLite brain moves with
  `gbrain migrate --to postgres` (alias `--to supabase`), which graduates it:
  plan first (exit 3), run only with the user's `--yes --expect <plan_hash>`,
  verify every table, then flip routing. This skill wraps it; it never
  reimplements it.
- The target URL never appears in a command, transcript or output: it lives
  in `GBRAIN_TARGET_URL` and every command uses `--url-env GBRAIN_TARGET_URL`.
- Provisioning consent is explicit: the docker rung needs `--allow-docker`,
  creating a database on a local server needs `--allow-create-db`. Headless
  mutation of infrastructure the operator didn't opt into never happens.

## Step 1, Detect

```bash
gbrain engine status --json
```

The rest: https://github.com/garrytan/gbrain/blob/HEAD/plugin-variants/gbrain-coding/skills/postgres-adopt/SKILL.md
