/gbrain:postgres-adopt runs instead · from gbrain
Detects the active gbrain engine (PGLite vs Postgres), provisions Postgres via Supabase/local/Docker, and migrates PGLite brains to Postgres with full history.
This skill never runs in Claude Code
It ships in gbrain at plugin/, but /gbrain:postgres-adopt (a command, or a skill Claude Code finds first) has the same name: typing it, or Claude choosing it, runs that one instead.
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.
This skill guarantees:
gbrain engine status --json
answers with the database down (that is the point of the command).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.GBRAIN_TARGET_URL and every command uses --url-env GBRAIN_TARGET_URL.--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.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.graduation block whose state is not none (in progress,
interrupted, graduated or split) → Step 4.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.
--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.Full reference: Move a PGLite brain to Postgres.
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.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).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.gbrain mcp expose follow-up for other machines, and, if a serve handed
the brain over, that the user restarts the MCP client.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.<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 at any page
count once the chunk vector index nears what PGLite can build (counted in
embedded chunks, about 200k at 1,024 dimensions; past it the index cannot be
built and vector search falls back to slower exact scans; see the
ceiling).
Either warning points at the plan command and is this skill's cue.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>.
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, a 1000+ page brain, or a
chunk vector index near PGLite's ceiling;
otherwise PGLite is genuinely fine.
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.--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.gbrain config set engine ... — it is refused by design; an engine
flip without a data migration splits the brain across two stores.--yes before the user has seen the plan, and never use
--force unless the plan listed what it wipes and the user agreed.--url-env GBRAIN_TARGET_URL.SUPABASE_ACCESS_TOKEN / passwords into output.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.
What SKILL.md sets; muted values are Claude Code's defaults
Use when the user asks: "which gbrain engine", "pglite or postgres", "gbrain engine status", "upgrade to postgres", "switch gbrain to postgres".
Three short reads, in order
148 skills in this plugin
/academic-verifyVerify a research claim or academic citation by tracing it through publication → methodology → raw data → independent replication. Routes through perplexity-research for the actual web lookup, then formats results as a citation-checked brain page. Use when a book/article/conversation cites a study and you want to confirm the claim is real, replicated, and accurately characterized./archive-crawlerUniversal archivist for personal file archives (Dropbox/B2/Gmail-takeout/local-mount/hard-drive-dump). Filters for high-value content (the user's own writing, ideas, relationships) and surfaces it interactively. REFUSES TO RUN without an explicit gbrain.yml `archive-crawler.scan_paths:` allow-list./article-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./ask-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.
/blog-ingestFeed and whole-publication ingestion: turn an entire blog, newsletter, or
RSS/Atom archive into brain source pages. Covers feed discovery, pagination
walking, normalization to a common article shape, canonical-URL dedup,
idempotent re-runs, 429 pacing, and empty-husk repair. This is the
PUBLICATION-scope skill — a single article URL routes to idea-ingest
instead. Per-article enrichment hands off to the brain-ingest-gate skill;
public posts only (gated content is skipped, never worked around).
/book-mirrorTake any book (EPUB/PDF), produce a personalized chapter-by-chapter analysis. Each chapter is summarized with brief quotes (The Chapter) and mirrored back to the reader's actual life (The Mirror) using brain context. The mirror observes and resonates — a friend pointing out parallels, NOT a consultant rearranging the reader's life, NOT a therapist assigning homework. The reader decides what to do about it. Layout is a top-aligned HTML table or stacked sections, never a bare markdown pipe table (pipe tables center-misalign uneven columns). Output is a single brain page at media/books/<slug>-personalized.md plus an optional PDF via brain-pdf.npx claudepluginhub garrytan/gbrain --plugin gbrainOther plugins' skills for the same job