Skip to main content
BuildAI reviewed Aug 28, 2026

Postgres Adopt

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.

v1.0.31 install

Unsigned, install at your own risk

Unverified

This skill has no cryptographic signature attached. We can't verify the contents match what the publisher intended.

Install this skill

No account required. Pick your tool, or use the command that detects it for you.

Run in your terminal. It detects your AI tool.

npx @skills-hub-ai/cli install gbrain-postgres-adopt
Or get the file:
Browse all CLI commands →
Manual setup by platform

Claude Code

~/.claude/skills/gbrain-postgres-adopt/SKILL.md

Setup guide →
0Save

Instructions

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

gbrain engine status --json

Branch on the output:

  • effective_engine: "postgres" and (optionally) --probe says ok →
    report healthy, done.
  • effective_engine: "postgres" but the probe fails → this is an ACCESS
    problem, not an adoption problem: route to db-repair.
  • config_file_engine differs from effective_engine → an env URL is
    overriding the config file; tell the operator which one wins — the signal
    is db_url_source (env:GBRAIN_DATABASE_URL / env:DATABASE_URL means
    env wins; env.note additionally fires when both env URLs are set or the
    cwd-.env shadow guard excluded one).
  • thin_client: true → the brain lives on a remote server; engine choices
    belong to that host. Stop.
  • effective_engine: null (no brain) → Step 2.
  • effective_engine: "pglite" with data → Step 3.
  • The output has a graduation block whose state is not none (in progress,
    interrupted, graduated or split) → Step 4.

Step 2 — Fresh install, Postgres-first

gbrain init --prefer-postgres

The ladder tries, in order: an env URL → Supabase Management-API discovery
(SUPABASE_ACCESS_TOKEN, plus SUPABASE_PROJECT_REF on multi-project
accounts and SUPABASE_DB_PASSWORD for the connection string) → a local
Postgres (only when PGHOST/PGPORT/PGUSER/PGPASSWORD are set or
--local-postgres is passed) → docker → PGLite. Each unusable rung prints a
one-line note and falls through; nothing is silent.

  • Ask the operator BEFORE adding --allow-docker (it creates and owns a
    gbrain-postgres container that survives reboots) or --allow-create-db
    (it runs CREATE DATABASE on their local server).
  • --json reports {engine, ladder_rung, url_source} — relay which rung won.
  • If the ladder lands on PGLite, that is a fine outcome: say so, and note the
    upgrade path below is available whenever they want it.

Step 3 — Existing PGLite brain: plan, ask, run

Full reference: Move a PGLite brain to Postgres.

  1. Target URL. Ask the user to put the connection string in an
    environment variable without pasting it into the conversation
    (read -rs GBRAIN_TARGET_URL && export GBRAIN_TARGET_URL). On Supabase use
    the transaction pooler; on an IPv4-only host also set
    GBRAIN_DIRECT_DATABASE_URL to the session pooler.
  2. Plan. This changes nothing and exits 3 with the
    confirmation_required document:
    gbrain migrate --to postgres --url-env GBRAIN_TARGET_URL --json
    
    Relay user_message, what moves, what stays on this computer, blockers
    and the estimate. Stop and wait for the user. A blocker with its own
    fix gets cleared first (ask when it says ask_user).
  3. Run, after the user agrees. Use fix.command from the document:
    gbrain migrate --to postgres --url-env GBRAIN_TARGET_URL --yes --expect <plan_hash>
    
    preview_changed means the plan changed: go back to step 2. For thousands
    of pages run it in the background and poll gbrain migrate --status --json.
  4. Report. Relay the target doctor verdict from the run's output, that
    existing tokens, OAuth clients and local writers stay valid, the
    gbrain mcp expose follow-up for other machines, and, if a serve handed
    the brain over, that the user restarts the MCP client.
  • A gbrain serve holding the brain hands it over on its own; never ask the
    user to stop it first. graduation_source_writer_held names the process to
    stop when one does not.
  • The old data dir is kept as <path>.graduated-<run_id> (doctor's
    pglite_leftovers reports it). Deleting it is the user's call.
  • gbrain doctor's pglite_scale check warns at 1000+ pages and points at
    the plan command — that warning is this skill's cue.

Step 4 — A move already underway

gbrain migrate --status --json

It is read-only and names the next command for the state. Exit 75 or a
run in progress → wait and poll. Interrupted → gbrain migrate --resume
(or gbrain migrate --rollback-to-source if the user wants to stay on
PGLite). Every refusal names its fix; the recovery table is in the guide.
A rollback that lists data loss runs only with the user's
--rollback-to-source --yes --expect <hash>.

The tradeoff (say it when recommending)

Postgres wins on concurrency, multi-machine access, and scale. PGLite keeps
the per-turn bootstrap hook lane (hook injection is PGLite-only today —
docs/guides/bootstrap.md); on Postgres, ambient context rides
MCP-every-session and the pull protocol instead. Recommend Postgres when the
operator has concurrent agents, multiple machines, or a 1000+ page brain;
otherwise PGLite is genuinely fine.

When it fails

Follow the agent operator protocol for any gbrain error code, exit code, [AGENT] block or notice block. Specific to this skill:

  • effective_engine: "postgres" but the probe fails: this is an access problem; run gbrain engine status --probe, then the db-repair skill.
  • Provisioning steps (Docker, installing Postgres) and the move itself need the user's explicit agreement; the docker rung needs --allow-docker, the move needs --yes --expect <plan_hash> after the user saw the plan.
  • gbrain config set engine … is refused by design: switch engines through the migrate path, never by editing config.

Anti-Patterns

  • NEVER gbrain config set engine ... — it is refused by design; an engine
    flip without a data migration splits the brain across two stores.
  • NEVER pick Postgres over a healthy PGLite brain without the migrate path.
  • NEVER add --yes before the user has seen the plan, and never use
    --force unless the plan listed what it wipes and the user agreed.
  • NEVER put the database URL or password in a command line; use
    --url-env GBRAIN_TARGET_URL.
  • NEVER run the docker rung without the operator's explicit yes.
  • NEVER paste or echo SUPABASE_ACCESS_TOKEN / passwords into output.

Output Format

Detection reports in one line; changes report in 2-4:

Engine: <pglite|postgres> (source: <db_url_source>)   [probe: ok, 42ms]
Action: <none | init rung that won | migrate --to postgres result>
Next:   <upgrade note, or "healthy — nothing to do">

Quote gbrain engine status output as-is (it is already redacted); name the
winning ladder rung when an install ran; after a migration, include the
target's gbrain doctor verdict.

This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

Browse all →
briefingCompile daily briefing with meeting context, active deals, and citation tracking0 installsbrain-opsBrain knowledge base operations. The core read/write cycle: brain-first lookup, read-enrich-write loop, source attribution, ambient enrichment, back-linking. Read this before any brain interaction.0 installscontext-auditToken-hygiene audit of the always-loaded context stack — CLAUDE.md, AGENTS.md, auto-memory MEMORY.md, and the bootstrap-rendered identity files (SOUL.md, USER.md, ACCESS_POLICY.md, HEARTBEAT.md) or their harness equivalents. Finds redundancy, contradictions, stale content, compression candidates, and skill-extraction candidates; produces a ranked action list sorted by token savings with a risk class per finding. REPORT-ONLY: this skill never edits any audited file. Recommendations for bootstrap-rendered files target the interview answer bank / templates, never the rendered output. Judging routes through `gbrain eval cross-modal` (single cheap model by default; full multi-model panel is explicit opt-in).0 installscompany-brainifyExtract a sanitized shared team/company brain from a personal brain. Strips internal ratings, compensation, performance assessments, retention and political dynamics from pages, takes, and facts across the full scan scope (people, companies, meetings, dailies, cross-references — not just people/), verifies with grep + retrieval passes, and purges sensitive git history behind the data-loss-gate confirmation card. Also runs as a report-only re-audit on an existing shared brain.0 installsask-userReusable pattern for presenting the user with explicit choices and gating execution until they respond. Used by other skills when a decision point requires human input before proceeding. Platform-agnostic — works on Telegram (inline buttons), Discord, CLI, or any agent with a message tool.0 installsenrichEnrich brain pages with tiered enrichment protocol. Creates and updates person/company pages with compiled truth, timeline, and cross-links. Use when a new entity is mentioned or an existing page needs updating.0 installs

More from gbrain

View source →
skillpack-checkRun `gbrain skillpack-check` to produce an agent-readable JSON health report for the gbrain install. Wraps `gbrain doctor` + `gbrain apply-migrations --list` so a host agent (your OpenClaw's morning-briefing, any OpenClaw cron) can see at a glance whether the skillpack needs attention. Use when the user asks "is gbrain healthy?", when a cron fires a morning check, or proactively when something seems off (jobs not running, brain not updating, autopilot silent).2 installsskill-autobenchAuthor an eval for an existing skill from its REAL usage history, not its spec. Mine invocations from the brain's conversation archive (conversations/) and per-harness session transcripts — a user correction after an invocation is the gold signal — then synthesize an eval_contract plus 4-8 replayable cases with honesty labels (SPEC-DERIVED vs HISTORY-IMPLIED) and stage the result at skills/<name>/eval/autobench-<date>.md as PENDING-HUMAN-APPROVAL. Never rewrites SKILL.md. Ships two guard companions: panel integrity (multi-model judging must prove each provider actually responded) and the fail-improve taxonomy (logged LLM-fallback cases convert to deterministic code over time).2 installsskill-optimizerSelf-evolving skill optimization via SkillOpt-paper-grounded text-space optimizer.2 installscorrection-pipelineWhen the user corrects a factual error, root-cause it immediately. Don't just note the correction — trace the error to its source, fix the source, and prevent recurrence. Every factual error is either a data error (bad brain page, bad memory file, bad rendered SOUL/USER identity, bad facts row) or a hallucination (LLM confabulated from partial signals).2 installsarticle-enrichmentTransform raw article text dumps in the brain into structured pages with executive summary, verbatim quotes, key insights, why-it-matters, and cross-references. Replaces walls-of-text with quotable, actionable brain pages.1 installsdaily-task-managerTask lifecycle management with stable task IDs. Add, complete, defer, remove, and review tasks with deterministic action routing and fail-closed ambiguity handling. Maintains a running task list as a brain page.1 installs

More Build skills

Browse category →
senior-frontendBuild and review React, Next.js, TypeScript or Tailwind frontends: components, scaffolding, performance and bundle size. Use whenever the user wants a new component or app, a page feels slow, the bundle is too big, or asks for a frontend code review.642 installsui-design-systemUse when building a design system: tokens, component docs, responsive scales or developer handoff. Generates tokens with design_token_generator.py.546 installsfrontend-designGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.353 installssenior-backendBuild and fix backend services: REST or GraphQL APIs, auth, microservices, PostgreSQL queries, migrations and load tests. Use whenever the user's API is slow or broken, needs login or auth added, a schema change, or a new endpoint or service scaffolded.252 installsself-improving-agentCurate what the agent has learned into durable project knowledge. Reviews Claude Code auto-memory (MEMORY.md and its topic files) for learnings worth keeping, promotes proven ones into CLAUDE.md or .claude/rules/, records a correction as a lesson that persists across sessions, prunes stale or duplicate entries, and turns a recurring fix into a reusable skill. Use whenever the user asks what you have learned or saved about the project, which memories should become permanent rules, to remember a lesson or stop repeating a mistake, or to clean up, audit or check memory health.179 installsusing-superpowersUse when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions146 installs

Frequently asked questions about postgres-adopt

What does the postgres-adopt skill do?

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. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the postgres-adopt skill?

Run `npx @skills-hub-ai/cli install gbrain-postgres-adopt` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/gbrain-postgres-adopt/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does postgres-adopt work with?

postgres-adopt runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the postgres-adopt skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use postgres-adopt after installing it?

In Claude Code, type `/gbrain-postgres-adopt` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the postgres-adopt skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.